Class: Heroploy::EnvTaskLib
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Heroploy::EnvTaskLib
- Includes:
- Commands::Checks, Commands::Git, Commands::Heroku, Rake::DSL
- Defined in:
- lib/heroploy/tasks/env_task_lib.rb
Instance Attribute Summary collapse
-
#deploy_config ⇒ Object
Returns the value of attribute deploy_config.
-
#env_config ⇒ Object
Returns the value of attribute env_config.
Instance Method Summary collapse
- #define ⇒ Object
- #define_check_tasks ⇒ Object
- #define_git_tasks ⇒ Object
- #define_heroku_tasks ⇒ Object
-
#initialize(deploy_config, env_config) ⇒ EnvTaskLib
constructor
A new instance of EnvTaskLib.
Methods included from Commands::Checks
#check_branch, #check_pushed, #check_remote, #check_staged
Methods included from Commands::Heroku
#heroku_exec, #heroku_migrate, #heroku_run
Methods included from Commands::Git
#current_branch, #git_fetch, #git_push_tag, #git_push_to_master, #git_remote_behind?, #git_remote_exists?, #git_remote_has_branch?, #git_staged?, #git_tag
Constructor Details
#initialize(deploy_config, env_config) ⇒ EnvTaskLib
Returns a new instance of EnvTaskLib.
21 22 23 24 25 |
# File 'lib/heroploy/tasks/env_task_lib.rb', line 21 def initialize(deploy_config, env_config) @deploy_config = deploy_config @env_config = env_config define end |
Instance Attribute Details
#deploy_config ⇒ Object
Returns the value of attribute deploy_config.
18 19 20 |
# File 'lib/heroploy/tasks/env_task_lib.rb', line 18 def deploy_config @deploy_config end |
#env_config ⇒ Object
Returns the value of attribute env_config.
19 20 21 |
# File 'lib/heroploy/tasks/env_task_lib.rb', line 19 def env_config @env_config end |
Instance Method Details
#define ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/heroploy/tasks/env_task_lib.rb', line 27 def define namespace env_config.name do define_check_tasks define_git_tasks define_heroku_tasks end end |
#define_check_tasks ⇒ Object
35 36 37 38 39 |
# File 'lib/heroploy/tasks/env_task_lib.rb', line 35 def define_check_tasks namespace :check do CheckTaskLib.new(deploy_config, env_config) end end |
#define_git_tasks ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/heroploy/tasks/env_task_lib.rb', line 41 def define_git_tasks desc "push the current branch to master on #{env_config.name}" task :push do git_push_to_master(env_config.remote, current_branch) end desc "tag the deployment to #{env_config.name}" task :tag do if env_config.tag then tag = DateTime.now.strftime(env_config.tag) git_tag(tag, "Deployed #{current_branch} to #{env_config.name}") git_push_tag(tag) end end end |
#define_heroku_tasks ⇒ Object
57 58 59 60 61 62 63 64 65 |
# File 'lib/heroploy/tasks/env_task_lib.rb', line 57 def define_heroku_tasks desc "run database migrations on #{env_config.name}" task :migrate do heroku_migrate(env_config.app) end desc "deploy to #{env_config.name}" task :deploy => ['check:all', :push, :migrate, :tag] end |