deploy-context 2.2.0.3.gec16643.4.g20d2d42.4.g17e8559.12.g831d0a8.4.gbb2ab14.12.g0bc028d → 2.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/bin/deploy-context +3 -1
- data/libraries/context-manager.rb +103 -6
- data/libraries/deploy-context/cookbook-studio.rb +43 -0
- data/libraries/deploy-context/cucumber-studio.rb +9 -0
- data/libraries/deploy-context/default-studio.rb +58 -0
- data/libraries/deploy-context/deploy/context.rb +0 -70
- data/libraries/deploy-context/deploy/cookbook.rb +20 -4
- data/libraries/deploy-context/deploy/cucumber.rb +7 -3
- data/libraries/deploy-context/deploy/deployer.rb +20 -38
- data/libraries/deploy-context/deploy/git.rb +16 -14
- data/libraries/deploy-context/deploy/habitat.rb +112 -0
- data/libraries/deploy-context/deploy/ruby.rb +34 -9
- data/libraries/deploy-context/habitat-studio.rb +38 -0
- data/libraries/deploy-context/helpers/command.rb +7 -4
- data/libraries/deploy-context/helpers/rake_tasks.rb +143 -39
- data/libraries/deploy-context/ruby-studio.rb +24 -0
- data/libraries/deploy-context/steps/deploy.rb +53 -0
- data/libraries/deploy-context/studio/base.rb +155 -0
- data/libraries/deploy-context/studio/default.rb +65 -0
- data/libraries/deploy-context/studio/deployer.rb +20 -0
- data/libraries/deploy-context.rb +9 -13
- data.tar.gz.sig +0 -0
- metadata +184 -29
- metadata.gz.sig +0 -0
- data/.gitignore +0 -25
- data/.kitchen/logs/kitchen.log +0 -149
- data/CHANGELOG.md +0 -10
- data/Gemfile +0 -3
- data/Policyfile.rb +0 -16
- data/Rakefile +0 -3
- data/VERSION +0 -1
- data/chefignore +0 -115
- data/compliance/README.md +0 -25
- data/config/cucumber.yml +0 -5
- data/deploy-context.gemspec +0 -69
- data/features/code_update.feature +0 -13
- data/features/step_definitions/deploy-context.rb +0 -2
- data/features/support/env.rb +0 -6
- data/features/update_deployer.feature +0 -10
- data/features/updated_git.feature +0 -10
- data/kitchen.yml +0 -31
- data/libraries/deploy-context/deploy.rb +0 -36
- data/libraries/deploy-context/helpers/binary.rb +0 -7
- data/libraries/deploy-context/step_definitions/deploy-context.rb +0 -39
- data/metadata.rb +0 -23
- data/recipes/default.rb +0 -8
- data/test/integration/default/default_test.rb +0 -16
@@ -18,7 +18,7 @@ module Context
|
|
18
18
|
def ruby_release(context)
|
19
19
|
context.git_build(context)
|
20
20
|
# gem ["push #{context.context_name}-#{GVB.version}.gem"]
|
21
|
-
# context.patch_bump if gem_installed?(context)
|
21
|
+
# context.patch_bump if gem_installed?(context, context.context_name)
|
22
22
|
context.rake context, ['release']
|
23
23
|
# context.commit
|
24
24
|
end
|
@@ -47,23 +47,48 @@ module Context
|
|
47
47
|
# sleep(60)
|
48
48
|
end
|
49
49
|
|
50
|
-
def gem_installed?(context)
|
51
|
-
|
52
|
-
|
53
|
-
|
50
|
+
def gem_installed?(context, gemname, compare_version = nil)
|
51
|
+
begin
|
52
|
+
installed_version = Gem::Specification.find_by_name(gemname)
|
53
|
+
rescue Gem::MissingSpecError => e
|
54
|
+
context.error_log(context, "The gem '#{gemname}' is missing")
|
55
|
+
# sleep(5)
|
56
|
+
installed_version = nil
|
57
|
+
rescue Exception => e
|
58
|
+
context.error_log(context, "The gem '#{gemname}' got issue with #{e}")
|
59
|
+
sleep(5)
|
60
|
+
installed_version = nil
|
61
|
+
end
|
62
|
+
# context.log("Compare #{context.context_name} installed_version #{installed_version} with #{context.version} in folder #{context.context_folder}")
|
63
|
+
installed = if compare_version.nil? || installed_version.nil?
|
64
|
+
not installed_version.nil?
|
65
|
+
else
|
66
|
+
installed_version.version == context.version
|
67
|
+
end
|
54
68
|
puts "installed = #{installed}"
|
55
69
|
installed
|
56
70
|
end
|
57
71
|
|
72
|
+
def load_dependency(context, gemname, require_file)
|
73
|
+
context.gem(context, ['install', gemname]) unless context.gem_installed?(context, gemname)
|
74
|
+
context.log("Loading file #{require_file} for gem #{gemname}")
|
75
|
+
sleep 3
|
76
|
+
require require_file
|
77
|
+
end
|
78
|
+
|
79
|
+
def load_all_dependencies(context)
|
80
|
+
context.load_dependencies
|
81
|
+
end
|
82
|
+
|
58
83
|
def ruby_cycle(context)
|
59
84
|
context.log "\n\nBuilding Ruby application for #{context.context_name}"
|
60
85
|
if context.new_update_available?
|
61
86
|
context.log "\n\nNew update available for #{context.context_name}\nCleaning the building space"
|
62
87
|
context.clean
|
63
|
-
if git_dirty_state?(context)
|
64
|
-
|
65
|
-
|
66
|
-
end
|
88
|
+
# if git_dirty_state?(context)
|
89
|
+
# context.patch_bump
|
90
|
+
# context.commit
|
91
|
+
# end
|
67
92
|
context.log "\n\nBuilding project #{context.context_name} now ..."
|
68
93
|
context.build
|
69
94
|
# context.commit
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require_relative 'cookbook-studio'
|
2
|
+
|
3
|
+
module Context
|
4
|
+
class HabitatStudio < CookbookStudio
|
5
|
+
def initialize(organisation_name, context_name, deploycontext_folder)
|
6
|
+
super(organisation_name, context_name, deploycontext_folder)
|
7
|
+
end
|
8
|
+
|
9
|
+
# 4
|
10
|
+
def do_clean
|
11
|
+
super
|
12
|
+
delete_file_only_if_exist(get_context_file(self, 'respond.txt'))
|
13
|
+
true
|
14
|
+
end
|
15
|
+
|
16
|
+
# 9
|
17
|
+
def do_install
|
18
|
+
super
|
19
|
+
Dir.chdir context_folder
|
20
|
+
start_habitat_job(self)
|
21
|
+
true
|
22
|
+
end
|
23
|
+
|
24
|
+
# 11
|
25
|
+
def do_end
|
26
|
+
super
|
27
|
+
promote_habitat(self)
|
28
|
+
end
|
29
|
+
|
30
|
+
def do_build_in_habitat
|
31
|
+
build_habitat(self)
|
32
|
+
end
|
33
|
+
|
34
|
+
def do_promote
|
35
|
+
promote_habitat(self)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -21,18 +21,17 @@ module Context
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def temp_dir
|
24
|
-
|
25
|
-
@temp_dir
|
24
|
+
File.join(context_folder, 'results')
|
26
25
|
end
|
27
26
|
|
28
|
-
def
|
27
|
+
def get_shell_data(command_line)
|
29
28
|
debug_log "Get data from command #{command_line.join(' ')}"
|
30
29
|
`#{command_line.join(' ')}`
|
31
30
|
end
|
32
31
|
|
33
32
|
def execute_command(command)
|
34
33
|
command_status = system(command.join(' '))
|
35
|
-
|
34
|
+
log "executed command #{command.join(' ')}"
|
36
35
|
command_status
|
37
36
|
end
|
38
37
|
|
@@ -50,5 +49,9 @@ module Context
|
|
50
49
|
::File.write(file, content)
|
51
50
|
system("chmod 644 #{file}") unless Gem.win_platform?
|
52
51
|
end
|
52
|
+
|
53
|
+
def delete_file_only_if_exist(file)
|
54
|
+
FileUtils.rm file if File.exist? file
|
55
|
+
end
|
53
56
|
end
|
54
57
|
end
|
@@ -1,54 +1,158 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module Context
|
2
|
+
module RakeTasks
|
3
|
+
def load_public_dependencies
|
4
|
+
require 'rubygems'
|
5
|
+
require 'bundler'
|
6
|
+
# require 'bundler/setup'
|
7
|
+
# require 'bundler/installer'
|
8
|
+
|
9
|
+
require 'rdoc/task'
|
10
|
+
|
11
|
+
require 'git-version-bump/rake-tasks'
|
12
|
+
|
13
|
+
require 'cucumber'
|
14
|
+
require 'cucumber/rake/task'
|
3
15
|
|
4
|
-
|
16
|
+
require_relative '../../deploy-context'
|
17
|
+
end
|
5
18
|
|
6
|
-
|
19
|
+
def define_deploy_context_tasks
|
20
|
+
load_public_dependencies
|
21
|
+
Bundler::GemHelper.install_tasks
|
7
22
|
|
8
|
-
Rake::RDocTask.new do |rd|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
end
|
23
|
+
Rake::RDocTask.new do |rd|
|
24
|
+
rd.main = "README.md"
|
25
|
+
rd.title = 'deploy-context'
|
26
|
+
rd.rdoc_files.include("README.md", "lib/**/*.rb")
|
27
|
+
end
|
13
28
|
|
14
|
-
|
29
|
+
namespace :deploycontext do
|
30
|
+
task :default => "deploycontext:test" do
|
31
|
+
Context::DeployContext.deployer.cycle
|
32
|
+
end
|
15
33
|
|
16
|
-
|
17
|
-
|
18
|
-
|
34
|
+
task :bump => "deploycontext:commit" do
|
35
|
+
Context::DeployContext.deployer.bump
|
36
|
+
end
|
19
37
|
|
20
|
-
|
38
|
+
task :test => "deploycontext:help" do
|
39
|
+
Context::DeployContext.deployer.test
|
40
|
+
end
|
21
41
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
42
|
+
task :release => "deploycontext:commit" do
|
43
|
+
Context::DeployContext.deployer.release
|
44
|
+
end
|
26
45
|
|
27
|
-
|
28
|
-
|
29
|
-
|
46
|
+
task :commit => "deploycontext:default" do
|
47
|
+
Context::DeployContext.deployer.commit
|
48
|
+
end
|
30
49
|
|
31
|
-
|
32
|
-
|
33
|
-
|
50
|
+
task :push => "deploycontext:commit" do
|
51
|
+
Context::DeployContext.deployer.push
|
52
|
+
end
|
34
53
|
|
35
|
-
|
36
|
-
|
37
|
-
|
54
|
+
task :help do
|
55
|
+
Context::DeployContext.deployer.help
|
56
|
+
end
|
38
57
|
|
39
|
-
|
40
|
-
|
41
|
-
|
58
|
+
namespace :studio do
|
59
|
+
task :promote => "deploycontext:studio:release" do
|
60
|
+
Context::DeployContext.deployer.do_promote
|
61
|
+
end
|
42
62
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
63
|
+
task :build => "deploycontext:studio:habitat" do
|
64
|
+
Context::DeployContext.deployer.do_build
|
65
|
+
end
|
66
|
+
|
67
|
+
task :install => "deploycontext:studio:build" do
|
68
|
+
Context::DeployContext.deployer.do_install
|
69
|
+
end
|
70
|
+
|
71
|
+
task :release => "deploycontext:studio:install" do
|
72
|
+
Context::DeployContext.deployer.do_release
|
73
|
+
end
|
74
|
+
|
75
|
+
task :habitat do
|
76
|
+
Context::DeployContext.deployer.do_build_in_habitat
|
77
|
+
end
|
78
|
+
|
79
|
+
task :kitchen do
|
80
|
+
Context::DeployContext.deployer.test_with_kitchen
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
namespace :plan do
|
85
|
+
task :do_mix_cookbook do
|
86
|
+
Context::DeployContext.deployer.do_mix_cookbook
|
87
|
+
end
|
88
|
+
|
89
|
+
task :do_begin do
|
90
|
+
Context::DeployContext.deployer.do_begin
|
91
|
+
end
|
92
|
+
|
93
|
+
task :do_download do
|
94
|
+
Context::DeployContext.deployer.do_download
|
95
|
+
end
|
96
|
+
|
97
|
+
task :do_verify do
|
98
|
+
Context::DeployContext.deployer.do_verify
|
99
|
+
end
|
100
|
+
|
101
|
+
task :do_clean do
|
102
|
+
Context::DeployContext.deployer.do_clean
|
103
|
+
end
|
104
|
+
|
105
|
+
task :do_unpack do
|
106
|
+
Context::DeployContext.deployer.do_unpack
|
107
|
+
end
|
108
|
+
|
109
|
+
task :do_prepare do
|
110
|
+
Context::DeployContext.deployer.do_prepare
|
111
|
+
end
|
112
|
+
|
113
|
+
task :do_build do
|
114
|
+
Context::DeployContext.deployer.do_build
|
115
|
+
end
|
116
|
+
|
117
|
+
task :do_check do
|
118
|
+
Context::DeployContext.deployer.do_check
|
119
|
+
end
|
120
|
+
|
121
|
+
task :do_install do
|
122
|
+
Context::DeployContext.deployer.do_install
|
123
|
+
end
|
124
|
+
|
125
|
+
task :do_strip do
|
126
|
+
Context::DeployContext.deployer.do_strip
|
127
|
+
end
|
128
|
+
|
129
|
+
task :do_end do
|
130
|
+
Context::DeployContext.deployer.do_end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
namespace :deployer do
|
135
|
+
task :cookbook do
|
136
|
+
Context::DeployContext.deployer.cookbook_test(Context::DeployContext.deployer)
|
137
|
+
end
|
138
|
+
|
139
|
+
task :cucumber do
|
140
|
+
Context::DeployContext.deployer.cucumber_test(Context::DeployContext.deployer)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
namespace :features do
|
145
|
+
Cucumber::Rake::Task.new(:strict) do |t|
|
146
|
+
t.cucumber_opts = "--format pretty" # Any valid command line option can go here.
|
147
|
+
t.profile = "strict"
|
148
|
+
end
|
149
|
+
|
150
|
+
Cucumber::Rake::Task.new(:html_report) do |t|
|
151
|
+
t.cucumber_opts = "--format pretty" # Any valid command line option can go here.
|
152
|
+
t.profile = "html_report"
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
52
156
|
end
|
53
157
|
end
|
54
158
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative 'default-studio'
|
2
|
+
|
3
|
+
module Context
|
4
|
+
class RubyStudio < DefaultStudio
|
5
|
+
def initialize(organisation_name, context_name, deploycontext_folder)
|
6
|
+
super(organisation_name, context_name, deploycontext_folder)
|
7
|
+
end
|
8
|
+
|
9
|
+
# 2
|
10
|
+
def do_download
|
11
|
+
super
|
12
|
+
do_clean
|
13
|
+
system('bundle install')
|
14
|
+
true
|
15
|
+
end
|
16
|
+
|
17
|
+
# 4
|
18
|
+
def do_clean
|
19
|
+
super
|
20
|
+
delete_file_only_if_exist(get_context_file(self, 'Gemfile.lock'))
|
21
|
+
true
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
|
2
|
+
module Context
|
3
|
+
module Steps
|
4
|
+
module Deploy
|
5
|
+
def define_steps
|
6
|
+
# Étantdonnéque('le projet {word} à une dernière version de disponible dans git') do |project_name|
|
7
|
+
# context_exec [project_name, 'cycle']
|
8
|
+
|
9
|
+
# if project_name == deployer.context_name
|
10
|
+
# Dir.chdir deployer.context_folder
|
11
|
+
# else
|
12
|
+
# Dir.chdir File.join(deployer.contexts_container(deployer), project_name)
|
13
|
+
# end
|
14
|
+
# end
|
15
|
+
|
16
|
+
Alors('démarrer un simple cycle de {word}') do |project_name|
|
17
|
+
pending
|
18
|
+
context_exec [project_name, 'cycle'] || abort("#{project_name} ERROR: Issue with life cycle")
|
19
|
+
end
|
20
|
+
|
21
|
+
Alors('déployer le projet {word}') do |project_name|
|
22
|
+
pending
|
23
|
+
context_exec [project_name, 'release'] || abort("#{project_name} ERROR: Issue with deploy steps")
|
24
|
+
end
|
25
|
+
|
26
|
+
Alors('tester le projet {word}') do |project_name|
|
27
|
+
pending
|
28
|
+
context_exec [project_name, 'test'] || abort("#{project_name} ERROR: Issue with testing steps")
|
29
|
+
end
|
30
|
+
|
31
|
+
Étantdonnéque('le projet {word} à du code à updater') do |project_name|
|
32
|
+
pending
|
33
|
+
context_exec [project_name, 'check_code_to_update'] || abort("#{project_name} ERROR: Issue to check updated code")
|
34
|
+
end
|
35
|
+
|
36
|
+
Alors('bumper la version du patch de {word}') do |project_name|
|
37
|
+
pending
|
38
|
+
# context_exec [project_name, 'bump'] || abort("#{project_name} ERROR: Issue with bumping version")
|
39
|
+
end
|
40
|
+
|
41
|
+
Étantdonnéque('le projet {word} à la bonne version d\'installer') do |project_name|
|
42
|
+
pending
|
43
|
+
context_exec [project_name, 'check_installed_version'] || abort("#{project_name} ERROR: Issue to check installed version")
|
44
|
+
end
|
45
|
+
|
46
|
+
Étantdonnéque('le projet {word} à une nouvelle version de disponible') do |project_name|
|
47
|
+
pending
|
48
|
+
context_exec [project_name, 'check_new_version'] || abort("#{project_name} ERROR: Issue to check newer version available")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,155 @@
|
|
1
|
+
module Context
|
2
|
+
module Studio
|
3
|
+
module Base
|
4
|
+
def help
|
5
|
+
show_help(self)
|
6
|
+
end
|
7
|
+
|
8
|
+
def test
|
9
|
+
log "\nExecute tests\n"
|
10
|
+
log "\n\nTest result: #{test_context_successful?}\n"
|
11
|
+
end
|
12
|
+
|
13
|
+
def version
|
14
|
+
# do_prepare unless defined?(GitVersionBump)
|
15
|
+
# log "Getting version info for #{context_folder} and version should be #{GitVersionBump.version(true)}"
|
16
|
+
if defined?(GitVersionBump)
|
17
|
+
Gem::Version.new(GitVersionBump.version(true))
|
18
|
+
else
|
19
|
+
cookbook_version
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_context_successful?
|
24
|
+
log "Check if #{context_name} is install #{version}"
|
25
|
+
|
26
|
+
if cookbook_test_successful?(self) && cucumber_test_successful?(self) && gem_installed?(self, context_name, version)
|
27
|
+
log "Test context #{context_name} was successfully perform on version #{version}"
|
28
|
+
true
|
29
|
+
else
|
30
|
+
log "Test context #{context_name} has failed to perform #{version}"
|
31
|
+
false
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# def cycle
|
36
|
+
# ruby_cycle(self)
|
37
|
+
# end
|
38
|
+
|
39
|
+
# def build
|
40
|
+
# ruby_build(self)
|
41
|
+
# cookbook_build(self)
|
42
|
+
# build_habitat(self)
|
43
|
+
# end
|
44
|
+
|
45
|
+
# def commit
|
46
|
+
# cookbook_install(self)
|
47
|
+
# git_commit(self)
|
48
|
+
# end
|
49
|
+
|
50
|
+
# def push
|
51
|
+
# commit
|
52
|
+
# git_release(self)
|
53
|
+
# end
|
54
|
+
|
55
|
+
# def release
|
56
|
+
# log "\n\nRelease #{context_name} at version #{version}"
|
57
|
+
# cookbook_push(self)
|
58
|
+
# ruby_release(self)
|
59
|
+
# git_release(self)
|
60
|
+
# start_habitat_job(self)
|
61
|
+
# end
|
62
|
+
|
63
|
+
# def install
|
64
|
+
# ruby_install(self)
|
65
|
+
# end
|
66
|
+
|
67
|
+
# def clean
|
68
|
+
# clean_folder(self, 'contexts')
|
69
|
+
# ruby_clean(self)
|
70
|
+
# cookbook_clean(self)
|
71
|
+
# end
|
72
|
+
|
73
|
+
# def patch_bump
|
74
|
+
# GitVersionBump.tag_version("#{GitVersionBump.major_version(true)}.#{GitVersionBump.minor_version(true)}.#{GitVersionBump.patch_version(true) + 1}")
|
75
|
+
# show_new_version('Patch')
|
76
|
+
# end
|
77
|
+
|
78
|
+
# def minor_bump
|
79
|
+
# GitVersionBump.tag_version("#{GitVersionBump.major_version(true)}.#{GitVersionBump.minor_version(true) + 1}.0")
|
80
|
+
# show_new_version('Minor')
|
81
|
+
# end
|
82
|
+
|
83
|
+
# def major_bump
|
84
|
+
# GitVersionBump.tag_version("#{GitVersionBump.major_version(true) + 1}.0.0")
|
85
|
+
# show_new_version('Major')
|
86
|
+
# end
|
87
|
+
|
88
|
+
# def wait_until_release_available
|
89
|
+
# wait_until_release_available unless is_present_publicly?
|
90
|
+
# end
|
91
|
+
|
92
|
+
def load_dependencies
|
93
|
+
require 'simplecov_setup'
|
94
|
+
require 'git-version-bump'
|
95
|
+
require 'cucumber'
|
96
|
+
require 'cucumber/cli/main'
|
97
|
+
require 'cucumber/rspec/disable_option_parser'
|
98
|
+
end
|
99
|
+
|
100
|
+
# def test
|
101
|
+
# log "\nExecute tests\n"
|
102
|
+
# log "\n\nTest result: #{test_context_successful?}\n"
|
103
|
+
# end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
|
109
|
+
# case action
|
110
|
+
# when 'cycle'
|
111
|
+
# context.log "\nExecute only the cycle once\n"
|
112
|
+
# context.cycle
|
113
|
+
# true
|
114
|
+
# when 'agent'
|
115
|
+
# context.log "\nAlways in execution\n"
|
116
|
+
# while true do
|
117
|
+
# context.cycle
|
118
|
+
# end
|
119
|
+
# true
|
120
|
+
# when 'commit'
|
121
|
+
# context.log "\nBump minor version\n"
|
122
|
+
# context.commit
|
123
|
+
# true
|
124
|
+
# when 'push'
|
125
|
+
# context.log "\nBump minor version\n"
|
126
|
+
# context.push
|
127
|
+
# true
|
128
|
+
# when 'bump'
|
129
|
+
# context.log "\nBump minor version\n"
|
130
|
+
# context.patch_bump
|
131
|
+
# true
|
132
|
+
# when 'release'
|
133
|
+
# context.log "\nBump major version\n"
|
134
|
+
# context.minor_bump
|
135
|
+
# true
|
136
|
+
# when 'upgrade'
|
137
|
+
# context.log "\nBump major version\n"
|
138
|
+
# context.major_bump
|
139
|
+
# true
|
140
|
+
# when 'test'
|
141
|
+
# context.log "\nExecute tests\n"
|
142
|
+
# context.test_context_successful?
|
143
|
+
# when 'reset'
|
144
|
+
# context.log "\nReset versionning\n"
|
145
|
+
# system('rake')
|
146
|
+
# # context.cucumber_test(deployer)
|
147
|
+
# true
|
148
|
+
# when 'help'
|
149
|
+
# context.show_help(context)
|
150
|
+
# true
|
151
|
+
# else
|
152
|
+
# context.error_log context.context_name, "Unknown setting #{action}"
|
153
|
+
# show_help(context)
|
154
|
+
# false
|
155
|
+
# end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
|
3
|
+
module Context
|
4
|
+
module Studio
|
5
|
+
module Default
|
6
|
+
def actions_permitted
|
7
|
+
%w(
|
8
|
+
do_begin
|
9
|
+
do_download
|
10
|
+
do_verify
|
11
|
+
do_clean
|
12
|
+
do_unpack
|
13
|
+
do_prepare
|
14
|
+
do_build
|
15
|
+
do_check
|
16
|
+
do_install
|
17
|
+
do_strip
|
18
|
+
do_end
|
19
|
+
help
|
20
|
+
do_build_in_habitat
|
21
|
+
do_promote
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
def do_mix_cookbook
|
26
|
+
mix_run_list(self, context_name)
|
27
|
+
end
|
28
|
+
|
29
|
+
# 4
|
30
|
+
def do_clean
|
31
|
+
delete_file_only_if_exist(get_context_file(self, 'respond.txt'))
|
32
|
+
true
|
33
|
+
end
|
34
|
+
|
35
|
+
# 6
|
36
|
+
def do_prepare
|
37
|
+
# load_dependencies
|
38
|
+
git_build(self)
|
39
|
+
end
|
40
|
+
|
41
|
+
# 7
|
42
|
+
def do_build
|
43
|
+
git_commit(self)
|
44
|
+
end
|
45
|
+
|
46
|
+
# 8
|
47
|
+
def do_check
|
48
|
+
end
|
49
|
+
|
50
|
+
# 9
|
51
|
+
def do_install
|
52
|
+
ruby_release(self)
|
53
|
+
true
|
54
|
+
end
|
55
|
+
|
56
|
+
# 10
|
57
|
+
# def do_strip
|
58
|
+
# end
|
59
|
+
|
60
|
+
# 11
|
61
|
+
def do_end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Context
|
2
|
+
module Studio
|
3
|
+
module Deployer
|
4
|
+
def self.set(deployer_class)
|
5
|
+
@deployer = deployer_class if @deployer.nil?
|
6
|
+
@deployer
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.method_missing(method_name, *argv, &block)
|
10
|
+
puts "Searching method #{method_name} in context #{@deployer}"
|
11
|
+
is_deploy_context_respond_to_action = @deployer.respond_to?(method_name) && @deployer.actions_permitted?(method_name.to_s)
|
12
|
+
if is_deploy_context_respond_to_action
|
13
|
+
@deployer.execute_action(@deployer, method_name)
|
14
|
+
else
|
15
|
+
puts "\n\nUnavailable action '#{method_name}' for context #{@deployer.context_name} as #{@deployer.respond_to?(method_name)} and #{@deployer.actions_permitted?(method_name)} for #{@deployer.class}\n"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/libraries/deploy-context.rb
CHANGED
@@ -1,21 +1,17 @@
|
|
1
|
-
require_relative '
|
2
|
-
require_relative 'deploy-context/deploy/ruby'
|
3
|
-
require_relative 'deploy-context/deploy/cucumber'
|
4
|
-
require_relative 'deploy-context/deploy/cookbook'
|
1
|
+
require_relative 'context-manager'
|
5
2
|
|
6
3
|
module Context
|
7
|
-
class DeployContext <
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
def self.deployer
|
13
|
-
@deployer = Context::DeployContext.new(Dir.pwd) if @deployer.nil?
|
14
|
-
@deployer
|
4
|
+
class DeployContext < Manager
|
5
|
+
def self.deployer(origin_folder = ENV.key?('DEPLOYCONTEXTFOLDER') ? ENV['DEPLOYCONTEXTFOLDER'] : Dir.pwd)
|
6
|
+
Studio::Deployer.set(DeployContext.new(origin_folder))
|
7
|
+
Studio::Deployer
|
15
8
|
end
|
16
9
|
|
17
10
|
def initialize(deploycontext_folder)
|
18
|
-
super('deploy-context', deploycontext_folder)
|
11
|
+
super('jimbodragon', 'deploy-context', deploycontext_folder)
|
12
|
+
@rubystudio = RubyStudio.new(organisation_name, context_name, deploycontext_folder)
|
13
|
+
|
14
|
+
abort("No context_name :(") if context_name.nil? || context_name.empty?
|
19
15
|
end
|
20
16
|
end
|
21
17
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|