Class: Push2heroku::Base
- Inherits:
-
Object
- Object
- Push2heroku::Base
- Defined in:
- lib/push2heroku/base.rb
Instance Attribute Summary collapse
-
#branch_name ⇒ Object
Returns the value of attribute branch_name.
-
#callbacks ⇒ Object
readonly
Returns the value of attribute callbacks.
-
#commands ⇒ Object
Returns the value of attribute commands.
-
#current_user ⇒ Object
Returns the value of attribute current_user.
-
#heroku_app_name ⇒ Object
Returns the value of attribute heroku_app_name.
-
#named_branches ⇒ Object
Returns the value of attribute named_branches.
-
#project_name ⇒ Object
readonly
Returns the value of attribute project_name.
-
#settings ⇒ Object
Returns the value of attribute settings.
Instance Method Summary collapse
-
#initialize(callbacks) ⇒ Base
constructor
A new instance of Base.
- #push ⇒ Object
Constructor Details
#initialize(callbacks) ⇒ Base
Returns a new instance of Base.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/push2heroku/base.rb', line 7 def initialize(callbacks) @project_name = File.basename(Dir.getwd) @callbacks = callbacks git = Git.new @branch_name = git.current_branch @current_user = git.current_user @named_branches = ConfigLoader.new('push2heroku.yml').named_branches @heroku_app_name = "#{url_prefix}-#{url_suffix}".downcase.chomp('-')[0..29] #heroku only allows upto 30 characters in name ENV['BRANCH_NAME'] = branch_name ENV['HEROKU_APP_NAME'] = heroku_app_name @settings = ConfigLoader.new('push2heroku.yml').settings(branch_name) @commands = [] end |
Instance Attribute Details
#branch_name ⇒ Object
Returns the value of attribute branch_name.
4 5 6 |
# File 'lib/push2heroku/base.rb', line 4 def branch_name @branch_name end |
#callbacks ⇒ Object (readonly)
Returns the value of attribute callbacks.
5 6 7 |
# File 'lib/push2heroku/base.rb', line 5 def callbacks @callbacks end |
#commands ⇒ Object
Returns the value of attribute commands.
4 5 6 |
# File 'lib/push2heroku/base.rb', line 4 def commands @commands end |
#current_user ⇒ Object
Returns the value of attribute current_user.
4 5 6 |
# File 'lib/push2heroku/base.rb', line 4 def current_user @current_user end |
#heroku_app_name ⇒ Object
Returns the value of attribute heroku_app_name.
4 5 6 |
# File 'lib/push2heroku/base.rb', line 4 def heroku_app_name @heroku_app_name end |
#named_branches ⇒ Object
Returns the value of attribute named_branches.
4 5 6 |
# File 'lib/push2heroku/base.rb', line 4 def named_branches @named_branches end |
#project_name ⇒ Object (readonly)
Returns the value of attribute project_name.
5 6 7 |
# File 'lib/push2heroku/base.rb', line 5 def project_name @project_name end |
#settings ⇒ Object
Returns the value of attribute settings.
4 5 6 |
# File 'lib/push2heroku/base.rb', line 4 def settings @settings end |
Instance Method Details
#push ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/push2heroku/base.rb', line 26 def push build_commands feedback_to_user commands.each do |cmd| begin puts "Going to execute: #{cmd}" sh cmd rescue Exception => e puts "command that failed was: #{cmd}" puts e end end end |