Class: Gemstreamer::Publisher
- Inherits:
-
Object
- Object
- Gemstreamer::Publisher
- Defined in:
- lib/publisher.rb
Instance Method Summary collapse
- #build_hash(gems) ⇒ Object
-
#initialize(host, user, app, api_key = nil) ⇒ Publisher
constructor
A new instance of Publisher.
- #publish_dependencies(gems) ⇒ Object
Constructor Details
#initialize(host, user, app, api_key = nil) ⇒ Publisher
Returns a new instance of Publisher.
4 5 6 7 8 9 |
# File 'lib/publisher.rb', line 4 def initialize(host,user,app,api_key=nil) @host = host @user = user @app = app @api_key = api_key end |
Instance Method Details
#build_hash(gems) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/publisher.rb', line 12 def build_hash(gems) dep_hash = {} gems.each do |g| #it works but its ugly! dep_hash[g.name] = g.version_requirements.requirements.last.last.version end dep_hash end |
#publish_dependencies(gems) ⇒ Object
21 22 23 24 25 |
# File 'lib/publisher.rb', line 21 def publish_dependencies(gems) dep_hash = build_hash(gems) #todo apikey / authorisation RestClient.post "#{@host}/users/#{@user}/applications/#{@app}/deps", {"dependencies" => dep_hash } end |