Class: HerokuHelper::Heroku
- Inherits:
-
Object
- Object
- HerokuHelper::Heroku
- Defined in:
- lib/heroku-helper/heroku.rb
Instance Attribute Summary collapse
-
#environment ⇒ Object
Returns the value of attribute environment.
Instance Method Summary collapse
- #add_addons ⇒ Object
- #deploy ⇒ Object
-
#initialize(env) ⇒ Heroku
constructor
A new instance of Heroku.
- #restart ⇒ Object
- #run(command) ⇒ Object
- #set_vars ⇒ Object
- #share ⇒ Object
Constructor Details
#initialize(env) ⇒ Heroku
Returns a new instance of Heroku.
6 7 8 9 10 |
# File 'lib/heroku-helper/heroku.rb', line 6 def initialize(env) @environment = env.intern load_configuration puts "#{application_name} - #{environment}\n" end |
Instance Attribute Details
#environment ⇒ Object
Returns the value of attribute environment.
4 5 6 |
# File 'lib/heroku-helper/heroku.rb', line 4 def environment @environment end |
Instance Method Details
#add_addons ⇒ Object
37 38 39 40 41 |
# File 'lib/heroku-helper/heroku.rb', line 37 def add_addons addons.each do |addon| cmd 'heroku addons:add', addon, '--app', application_name end end |
#deploy ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/heroku-helper/heroku.rb', line 12 def deploy remote = cmd("git remote add git-remote-for-#{application_name} [email protected]:#{application_name}.git 2>&1") if remote !~ /remote git-remote-for-#{application_name} already exists/ cmd("git push git-remote-for-#{application_name} master") else cmd("git push -f git-remote-for-#{application_name}") end end |
#restart ⇒ Object
27 28 29 |
# File 'lib/heroku-helper/heroku.rb', line 27 def restart cmd 'heroku restart', '--app', application_name end |
#run(command) ⇒ Object
43 44 45 46 47 48 |
# File 'lib/heroku-helper/heroku.rb', line 43 def run(command) command = command.intern run_before_hook(command) send(command) run_after_hook(command) end |
#set_vars ⇒ Object
31 32 33 34 35 |
# File 'lib/heroku-helper/heroku.rb', line 31 def set_vars environment_variables.each do |key, value| cmd 'heroku config:add', "#{key}=#{value}", '--app', application_name end end |
#share ⇒ Object
21 22 23 24 25 |
# File 'lib/heroku-helper/heroku.rb', line 21 def share contributors.each do |dev| cmd 'heroku sharing:add', dev, '--app', application_name end end |