Class: Nuker::Commands::Push

Inherits:
Base
  • Object
show all
Defined in:
lib/nuker/commands/push.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#resource, #url

Constructor Details

#initialize(project, dir, options = {}) ⇒ Push

Returns a new instance of Push.



10
11
12
13
# File 'lib/nuker/commands/push.rb', line 10

def initialize(project, dir, options = {})
  @project = project
  @dir = dir
end

Instance Attribute Details

#dirObject

Returns the value of attribute dir.



8
9
10
# File 'lib/nuker/commands/push.rb', line 8

def dir
  @dir
end

#projectObject

Returns the value of attribute project.



8
9
10
# File 'lib/nuker/commands/push.rb', line 8

def project
  @project
end

Instance Method Details

#executeObject



15
16
17
18
19
20
21
22
23
# File 'lib/nuker/commands/push.rb', line 15

def execute
  FileUtils.chdir(dir) do
    content = targz_util.pack(files)
    resource.post_tar_gz("projects/#{project}/pushes", content)
  end
  
rescue RestClient::ResourceNotFound
  raise Nuker::ClientError, "Unknown project \"#{project}\""
end