Class: Jumpup::Heroku::Integrate
- Inherits:
-
Object
- Object
- Jumpup::Heroku::Integrate
- Defined in:
- lib/jumpup/heroku/integrate.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
Class Method Summary collapse
- .add_remote ⇒ Object
- .check ⇒ Object
- .deploy ⇒ Object
- .deploy_to_production ⇒ Object
- .integrate ⇒ Object
- .lock ⇒ Object
- .unlock ⇒ Object
Instance Method Summary collapse
- #add_remote ⇒ Object
- #branches_that_send_to_heroku ⇒ Object
- #check ⇒ Object
- #deploy ⇒ Object
- #deploy_to_production ⇒ Object
-
#initialize(app) ⇒ Integrate
constructor
A new instance of Integrate.
- #lock ⇒ Object
- #unlock ⇒ Object
- #when_branch_send_to_heroku(message, &block) ⇒ Object
Constructor Details
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
6 7 8 |
# File 'lib/jumpup/heroku/integrate.rb', line 6 def app @app end |
Class Method Details
.add_remote ⇒ Object
24 25 26 27 28 29 |
# File 'lib/jumpup/heroku/integrate.rb', line 24 def self.add_remote = "Adding Heroku git remotes for app #{integrate.app}" integrate.when_branch_send_to_heroku() do integrate.add_remote end end |
.check ⇒ Object
31 32 33 34 35 36 |
# File 'lib/jumpup/heroku/integrate.rb', line 31 def self.check = "Checking if there's already someone integrating to #{integrate.app}" integrate.when_branch_send_to_heroku() do integrate.check end end |
.deploy ⇒ Object
8 9 10 11 12 13 |
# File 'lib/jumpup/heroku/integrate.rb', line 8 def self.deploy = "Starting to deploy on Heroku app #{integrate.app}" integrate.when_branch_send_to_heroku() do integrate.deploy end end |
.deploy_to_production ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/jumpup/heroku/integrate.rb', line 15 def self.deploy_to_production app = Env.all[:production_app] integrate = new(app) = "Starting to deploy to production on Heroku app #{integrate.app}" integrate.when_branch_send_to_heroku() do integrate.deploy_to_production end end |
.integrate ⇒ Object
52 53 54 55 56 |
# File 'lib/jumpup/heroku/integrate.rb', line 52 def self.integrate envs = Env.all app = envs[:app] || envs[:staging_app] new(app) end |
.lock ⇒ Object
38 39 40 41 42 43 |
# File 'lib/jumpup/heroku/integrate.rb', line 38 def self.lock = "Locking Heroku integration on app #{integrate.app}" integrate.when_branch_send_to_heroku() do integrate.lock end end |
.unlock ⇒ Object
45 46 47 48 49 50 |
# File 'lib/jumpup/heroku/integrate.rb', line 45 def self.unlock = "Unlocking Heroku integration on app #{integrate.app}" integrate.when_branch_send_to_heroku() do integrate.unlock end end |
Instance Method Details
#add_remote ⇒ Object
108 109 110 111 |
# File 'lib/jumpup/heroku/integrate.rb', line 108 def add_remote remote = run_with_clean_env("git remote | grep heroku").strip exec_with_clean_env("git remote add heroku [email protected]:#{app}.git") if remote.blank? end |
#branches_that_send_to_heroku ⇒ Object
72 73 74 |
# File 'lib/jumpup/heroku/integrate.rb', line 72 def branches_that_send_to_heroku [Env.all[:deploy_branch], Env.all[:deploy_to_production_branch]] end |
#check ⇒ Object
113 114 115 116 117 |
# File 'lib/jumpup/heroku/integrate.rb', line 113 def check return if can_start_integration?(user) puts "----> Project is already being integrated by '#{}', halting" exit 1 end |
#deploy ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/jumpup/heroku/integrate.rb', line 76 def deploy if run_database_tasks? check_if_migration_is_needed check_if_seed_is_needed end backup push(Env.all[:deploy_branch]) migrate seed restart end |
#deploy_to_production ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/jumpup/heroku/integrate.rb', line 89 def deploy_to_production if run_database_tasks? check_if_migration_is_needed check_if_seed_is_needed end confirm_deploy spec confirm_maintenance maintenance backup tag push(Env.all[:deploy_to_production_branch]) migrate seed close_maintenance restart end |
#lock ⇒ Object
119 120 121 122 123 124 |
# File 'lib/jumpup/heroku/integrate.rb', line 119 def lock return if (user) puts "----> Locking Heroku integration for you (#{user})" exec_with_clean_env("heroku config:set INTEGRATING_BY='#{user}' --app #{app}") end |
#unlock ⇒ Object
126 127 128 |
# File 'lib/jumpup/heroku/integrate.rb', line 126 def unlock exec_with_clean_env("heroku config:unset INTEGRATING_BY --app #{app}") end |
#when_branch_send_to_heroku(message, &block) ⇒ Object
63 64 65 66 67 68 69 70 |
# File 'lib/jumpup/heroku/integrate.rb', line 63 def when_branch_send_to_heroku(, &block) puts "--> #{}" if branches_that_send_to_heroku.include?(actual_branch) block.call else puts "----> Skipping since you are in a feature branch [#{actual_branch}]" end end |