Class: Heroploy::CheckTaskLib
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Heroploy::CheckTaskLib
- Includes:
- Commands::Checks, Commands::Git, Commands::Heroku, Rake::DSL
- Defined in:
- lib/heroploy/tasks/check_task_lib.rb
Instance Attribute Summary collapse
-
#defined_tasks ⇒ Object
Returns the value of attribute defined_tasks.
-
#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_all_check ⇒ Object
- #define_branch_check ⇒ Object
- #define_pushed_check ⇒ Object
- #define_remote_check ⇒ Object
- #define_staged_check ⇒ Object
-
#initialize(deploy_config, env_config) ⇒ CheckTaskLib
constructor
A new instance of CheckTaskLib.
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) ⇒ CheckTaskLib
Returns a new instance of CheckTaskLib.
21 22 23 24 25 26 |
# File 'lib/heroploy/tasks/check_task_lib.rb', line 21 def initialize(deploy_config, env_config) @deploy_config = deploy_config @env_config = env_config @defined_tasks = [] define end |
Instance Attribute Details
#defined_tasks ⇒ Object
Returns the value of attribute defined_tasks.
19 20 21 |
# File 'lib/heroploy/tasks/check_task_lib.rb', line 19 def defined_tasks @defined_tasks end |
#deploy_config ⇒ Object
Returns the value of attribute deploy_config.
17 18 19 |
# File 'lib/heroploy/tasks/check_task_lib.rb', line 17 def deploy_config @deploy_config end |
#env_config ⇒ Object
Returns the value of attribute env_config.
18 19 20 |
# File 'lib/heroploy/tasks/check_task_lib.rb', line 18 def env_config @env_config end |
Instance Method Details
#define ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/heroploy/tasks/check_task_lib.rb', line 28 def define define_remote_check define_pushed_check define_branch_check define_staged_check define_all_check end |
#define_all_check ⇒ Object
78 79 80 81 |
# File 'lib/heroploy/tasks/check_task_lib.rb', line 78 def define_all_check desc "do all the checks for #{env_config.name}" task :all => @defined_tasks end |
#define_branch_check ⇒ Object
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/heroploy/tasks/check_task_lib.rb', line 56 def define_branch_check if env_config.checks.branch then desc "check we can deploy to #{env_config.name} from the current branch" task :branch do valid_branch = env_config.checks.branch check_branch(current_branch, valid_branch, env_config.name) end @defined_tasks << :branch end end |
#define_pushed_check ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'lib/heroploy/tasks/check_task_lib.rb', line 46 def define_pushed_check if env_config.checks.pushed then desc "check changes have been pushed to origin" task :pushed do check_pushed(current_branch) end @defined_tasks << :pushed end end |
#define_remote_check ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/heroploy/tasks/check_task_lib.rb', line 36 def define_remote_check desc "check remote exists for #{env_config.name}" task :remote do remote = env_config.remote check_remote(remote) end @defined_tasks << :remote end |
#define_staged_check ⇒ Object
67 68 69 70 71 72 73 74 75 76 |
# File 'lib/heroploy/tasks/check_task_lib.rb', line 67 def define_staged_check if env_config.checks.staged then desc "check the changes have already been staged" task :staged do staging_env_config = deploy_config[env_config.checks.staged] check_staged(staging_env_config.remote, current_branch, staging_env_config.name) end @defined_tasks << :staged end end |