Class: Instapusher2::Commands

Inherits:
Object
  • Object
show all
Defined in:
lib/instapusher2/commands.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(init_options = {}) ⇒ Commands

Returns a new instance of Commands.



10
11
12
13
14
15
16
17
18
# File 'lib/instapusher2/commands.rb', line 10

def initialize init_options = {}
  @debug = init_options[:debug]
  @quick = init_options[:quick]
  @local = init_options[:local]

  git          = Git.new
  @branch_name  = init_options[:project_name] || ENV['INSTAPUSHER_BRANCH'] || git.current_branch
  @project_name = init_options[:branch_name] || ENV['INSTAPUSHER_PROJECT'] || git.project_name
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



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

def api_key
  @api_key
end

#branch_nameObject (readonly)

Returns the value of attribute branch_name.



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

def branch_name
  @branch_name
end

#debugObject (readonly)

Returns the value of attribute debug.



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

def debug
  @debug
end

#project_nameObject (readonly)

Returns the value of attribute project_name.



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

def project_name
  @project_name
end

Instance Method Details

#deployObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/instapusher2/commands.rb', line 20

def deploy
  verify_api_key
  #SpecialInstructionForProduction.new.run if production?

  job_submission = JobSubmission.new(debug, options)
  job_submission.submit_the_job

  if job_submission.success?
    job_submission.feedback_to_user
    TagTheRelease.new(branch_name, debug).tagit if production?
  else
    puts job_submission.error_message
  end
end