Class: Kumade::Deployer
- Inherits:
-
Object
- Object
- Kumade::Deployer
- Defined in:
- lib/kumade/deployer.rb
Instance Attribute Summary collapse
-
#git ⇒ Object
readonly
Returns the value of attribute git.
-
#heroku ⇒ Object
readonly
Returns the value of attribute heroku.
-
#packager ⇒ Object
readonly
Returns the value of attribute packager.
Instance Method Summary collapse
- #deploy ⇒ Object
- #ensure_clean_git ⇒ Object
- #ensure_heroku_remote_exists ⇒ Object
-
#initialize ⇒ Deployer
constructor
A new instance of Deployer.
- #package_assets ⇒ Object
- #post_deploy ⇒ Object
- #pre_deploy ⇒ Object
- #sync_origin ⇒ Object
Constructor Details
Instance Attribute Details
#git ⇒ Object (readonly)
Returns the value of attribute git.
6 7 8 |
# File 'lib/kumade/deployer.rb', line 6 def git @git end |
#heroku ⇒ Object (readonly)
Returns the value of attribute heroku.
6 7 8 |
# File 'lib/kumade/deployer.rb', line 6 def heroku @heroku end |
#packager ⇒ Object (readonly)
Returns the value of attribute packager.
6 7 8 |
# File 'lib/kumade/deployer.rb', line 6 def packager @packager end |
Instance Method Details
#deploy ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/kumade/deployer.rb', line 15 def deploy begin ensure_heroku_remote_exists pre_deploy heroku.sync heroku.migrate_database heroku.restart_app rescue => Kumade.configuration.outputter.error("#{.class}: #{.}") ensure post_deploy end end |
#ensure_clean_git ⇒ Object
48 49 50 |
# File 'lib/kumade/deployer.rb', line 48 def ensure_clean_git git.ensure_clean_git end |
#ensure_heroku_remote_exists ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/kumade/deployer.rb', line 52 def ensure_heroku_remote_exists if git.remote_exists?(Kumade.configuration.environment) if git.heroku_remote? Kumade.configuration.outputter.success("#{Kumade.configuration.environment} is a Heroku remote") else Kumade.configuration.outputter.error(%{Cannot deploy: "#{Kumade.configuration.environment}" remote does not point to Heroku}) end else Kumade.configuration.outputter.error(%{Cannot deploy: "#{Kumade.configuration.environment}" remote does not exist}) end end |
#package_assets ⇒ Object
36 37 38 |
# File 'lib/kumade/deployer.rb', line 36 def package_assets @packager.run end |
#post_deploy ⇒ Object
44 45 46 |
# File 'lib/kumade/deployer.rb', line 44 def post_deploy heroku.delete_deploy_branch end |
#pre_deploy ⇒ Object
29 30 31 32 33 34 |
# File 'lib/kumade/deployer.rb', line 29 def pre_deploy ensure_clean_git run_predeploy_task package_assets sync_origin end |
#sync_origin ⇒ Object
40 41 42 |
# File 'lib/kumade/deployer.rb', line 40 def sync_origin git.push(@branch) end |