Class: Heroploy::Tasks::CheckTaskLib
Instance Attribute Summary collapse
Instance Method Summary
collapse
#check_branch, #check_config, #check_pushed, #check_remote, #check_staged, #check_travis
#heroku_config_set, #heroku_exec, #heroku_migrate, #heroku_run
#current_branch, #git_clone, #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.
20
21
22
23
24
25
|
# File 'lib/heroploy/tasks/check_task_lib.rb', line 20
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.
18
19
20
|
# File 'lib/heroploy/tasks/check_task_lib.rb', line 18
def defined_tasks
@defined_tasks
end
|
#deploy_config ⇒ Object
Returns the value of attribute deploy_config.
16
17
18
|
# File 'lib/heroploy/tasks/check_task_lib.rb', line 16
def deploy_config
@deploy_config
end
|
#env_config ⇒ Object
Returns the value of attribute env_config.
17
18
19
|
# File 'lib/heroploy/tasks/check_task_lib.rb', line 17
def env_config
@env_config
end
|
Instance Method Details
#define ⇒ Object
27
28
29
30
31
32
33
34
35
|
# File 'lib/heroploy/tasks/check_task_lib.rb', line 27
def define
define_remote_check
define_pushed_check
define_branch_check
define_staged_check
define_config_check
define_travis_check
define_all_check
end
|
#define_all_check ⇒ Object
97
98
99
100
|
# File 'lib/heroploy/tasks/check_task_lib.rb', line 97
def define_all_check
desc "do all the checks for #{env_config.name}"
task :all => @defined_tasks
end
|
#define_branch_check ⇒ Object
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/heroploy/tasks/check_task_lib.rb', line 57
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_config_check ⇒ Object
79
80
81
82
83
84
85
|
# File 'lib/heroploy/tasks/check_task_lib.rb', line 79
def define_config_check
desc "check all required config variables are defined"
task :config => :load_remote_configs do
check_config(deploy_config.shared_env, env_config)
end
@defined_tasks << :config
end
|
#define_pushed_check ⇒ Object
47
48
49
50
51
52
53
54
55
|
# File 'lib/heroploy/tasks/check_task_lib.rb', line 47
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
37
38
39
40
41
42
43
44
45
|
# File 'lib/heroploy/tasks/check_task_lib.rb', line 37
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
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/heroploy/tasks/check_task_lib.rb', line 68
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
|
#define_travis_check ⇒ Object
87
88
89
90
91
92
93
94
95
|
# File 'lib/heroploy/tasks/check_task_lib.rb', line 87
def define_travis_check
if env_config.checks.travis then
desc "check the travis build for the current branch"
task :travis do
check_travis(current_branch, deploy_config.travis_repo)
end
@defined_tasks << :travis
end
end
|