deploy-context 2.1.31.1.g6ccfd57 → 2.1.32.15.g7b29619
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/Rakefile +1 -15
- data/bin/deploy-context +1 -1
- data/lib/deploy-context/deploy/cucumber.rb +7 -5
- data/lib/deploy-context/deploy/deployer.rb +87 -0
- data/lib/deploy-context/deploy/git.rb +43 -41
- data/lib/deploy-context/deploy/ruby.rb +65 -58
- data/lib/deploy-context/deploy.rb +17 -4
- data/lib/deploy-context/helpers/command.rb +51 -0
- data/lib/deploy-context/helpers/rake.rb +15 -0
- data/lib/deploy-context.rb +2 -4
- data.tar.gz.sig +0 -0
- metadata +6 -4
- metadata.gz.sig +0 -0
- data/lib/deploy-context/context/deploy.rb +0 -85
- /data/lib/deploy-context/{context → helpers}/binary.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d27bbe5efafcb1a1684532ee7c1fbe7e57cf9084de387dbf0410f8a722b053a6
|
4
|
+
data.tar.gz: f87858265a221249dc821dc3e82bc32ebfc13130bbfd6ddb921e431602660b0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51c5f18a1584b97cf3fe4c923629b6a57f306bc81d5fb4e10d6d376f052f8013ac1a25a7aafa42e58a14b20d7dc2160a069a1de3f9730f4c3ac02470e69513b2
|
7
|
+
data.tar.gz: 6d0203968751a87a77f42a46b0db253a801b55958e99cf34bcd956158e272d11f05058d479a59b829d812f8b436c45c94487f606de2e97bc623c6bc52e66d15f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/Rakefile
CHANGED
@@ -13,18 +13,4 @@ end
|
|
13
13
|
|
14
14
|
require 'git-version-bump/rake-tasks'
|
15
15
|
|
16
|
-
require_relative 'lib/deploy-context'
|
17
|
-
|
18
|
-
deployer = Context::DeployContext.deployer
|
19
|
-
|
20
|
-
task :default do
|
21
|
-
deployer.execute_action(deployer, 'once')
|
22
|
-
end
|
23
|
-
|
24
|
-
task :bump do
|
25
|
-
deployer.execute_action(deployer, 'bump')
|
26
|
-
end
|
27
|
-
|
28
|
-
task :test do
|
29
|
-
deployer.execute_action(deployer, 'test')
|
30
|
-
end
|
16
|
+
require_relative 'lib/deploy-context/helpers/rake'
|
data/bin/deploy-context
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require 'deploy-context/
|
2
|
+
require 'deploy-context/helpers/binary'
|
@@ -1,9 +1,11 @@
|
|
1
1
|
module Context
|
2
|
-
module
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
module DeployHelpers
|
3
|
+
module CucumberHelper
|
4
|
+
def cucumber_test(context)
|
5
|
+
context.git_build(context)
|
6
|
+
context.log "Working in folder #{Dir.pwd}\nAnd context #{context.context_name} is created in folder #{context.context_folder} at version #{context.version}"
|
7
|
+
context.cucumber(context)
|
8
|
+
end
|
7
9
|
end
|
8
10
|
end
|
9
11
|
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
module Context
|
2
|
+
module DeployHelpers
|
3
|
+
module DeployerHelper
|
4
|
+
def get_context_folder(context, folder)
|
5
|
+
File.join(context.context_folder, folder)
|
6
|
+
end
|
7
|
+
|
8
|
+
def build_folder(context)
|
9
|
+
context.get_context_folder(context, 'build')
|
10
|
+
end
|
11
|
+
|
12
|
+
def contexts_container(context)
|
13
|
+
context.get_context_folder(context, 'contexts')
|
14
|
+
end
|
15
|
+
|
16
|
+
def chef_exec(context, commands)
|
17
|
+
context.execute_command(%w(chef exec) + commands)
|
18
|
+
end
|
19
|
+
|
20
|
+
def git(context, commands)
|
21
|
+
context.chef_exec(context,['git'] + commands)
|
22
|
+
end
|
23
|
+
|
24
|
+
def gem(context, commands)
|
25
|
+
context.chef_exec(context,['gem'] + commands)
|
26
|
+
end
|
27
|
+
|
28
|
+
def rake(context, commands)
|
29
|
+
context.chef_exec(context,['rake'] + commands)
|
30
|
+
end
|
31
|
+
|
32
|
+
def cucumber(context, commands = [])
|
33
|
+
context.chef_exec(context,['cucumber'] + commands)
|
34
|
+
end
|
35
|
+
|
36
|
+
def execute_action(context, action)
|
37
|
+
state_action = if action.nil?
|
38
|
+
context.cycle
|
39
|
+
false
|
40
|
+
else
|
41
|
+
case action
|
42
|
+
when 'once'
|
43
|
+
context.log "\nExecute only once\n"
|
44
|
+
context.cycle
|
45
|
+
true
|
46
|
+
when 'always'
|
47
|
+
context.log "\nAlways in execution\n"
|
48
|
+
while true do
|
49
|
+
context.cycle
|
50
|
+
end
|
51
|
+
true
|
52
|
+
when 'bump'
|
53
|
+
context.log "\nBump minor version\n"
|
54
|
+
context.patch_bump
|
55
|
+
true
|
56
|
+
when 'release'
|
57
|
+
context.log "\nBump major version\n"
|
58
|
+
context.minor_bump
|
59
|
+
true
|
60
|
+
when 'upgrade'
|
61
|
+
context.log "\nBump major version\n"
|
62
|
+
context.major_bump
|
63
|
+
true
|
64
|
+
when 'test'
|
65
|
+
context.log "\nExecute tests\n"
|
66
|
+
context.cucumber_test(context)
|
67
|
+
true
|
68
|
+
when 'reset'
|
69
|
+
context.log "\nReset versionning\n"
|
70
|
+
system('rake')
|
71
|
+
# context.cucumber_test(deployer)
|
72
|
+
true
|
73
|
+
else
|
74
|
+
context.log "Unknown setting #{action}"
|
75
|
+
false
|
76
|
+
end
|
77
|
+
end
|
78
|
+
context.commit
|
79
|
+
if state_action
|
80
|
+
context.log "Action #{action} executed correctly in context #{context}"
|
81
|
+
else
|
82
|
+
context.abort("Failed to execute action #{action} in context #{context}")
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -1,53 +1,55 @@
|
|
1
1
|
module Context
|
2
|
-
module
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
module DeployHelpers
|
3
|
+
module GitHelper
|
4
|
+
def git_build(context)
|
5
|
+
if context.present_localy?
|
6
|
+
Dir.chdir(context.context_folder)
|
7
|
+
context.git_pull(context)
|
8
|
+
else
|
9
|
+
local_dir = File.join(Dir.pwd, context.context_name)
|
10
|
+
context.git ["clone git@github.com:JimboDragonGit/#{context.context_name}.git"] unless ::Dir.exist?(local_dir)
|
11
|
+
context.move_folder(local_dir)
|
12
|
+
end
|
11
13
|
end
|
12
|
-
end
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
def git_pull(context)
|
16
|
+
context.git_build(context) unless context.actual_working_directory?
|
17
|
+
context.git context, ['pull']
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
def git_commit(context)
|
21
|
+
context.git_build(context)
|
22
|
+
context.git context, ['add .']
|
23
|
+
context.git context, ["commit -m 'Create #{context.context_name} automatic commit'"]
|
24
|
+
end
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
def git_release(context)
|
27
|
+
context.git_build(context)
|
28
|
+
context.git context, ['push', '--follow-tags']
|
29
|
+
end
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
def git_bump(context, level)
|
32
|
+
context.git_build(context)
|
33
|
+
context.git context, ['version-bump', level]
|
34
|
+
context.git_commit(context)
|
35
|
+
end
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
def patch_reset(context)
|
38
|
+
context.git_build(context)
|
39
|
+
context.git_bump(context, 'minor')
|
40
|
+
end
|
40
41
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
def git_update_available?(context)
|
43
|
+
context.git_build(context)
|
44
|
+
# context.git ['log', "v#{context.version}"]
|
45
|
+
context.git context, ['ls-remote origin', "v#{context.version}"]
|
46
|
+
end
|
46
47
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
def git_dirty_state?(context)
|
49
|
+
context.git_build(context)
|
50
|
+
# context.git ['log', "v#{context.version}"]
|
51
|
+
context.get_data(["git status --porcelain"]).split('\n').count > 0
|
52
|
+
end
|
51
53
|
end
|
52
54
|
end
|
53
55
|
end
|
@@ -1,74 +1,81 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
|
3
3
|
module Context
|
4
|
-
module
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
module DeployHelpers
|
5
|
+
module RubyHelper
|
6
|
+
def ruby_build(context)
|
7
|
+
git_build(context)
|
8
|
+
context.log "Working in folder #{Dir.pwd}\nAnd context #{context.context_name} is created"
|
9
|
+
check_folder get_context_folder(context, 'build')
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
def ruby_release(context)
|
13
|
+
context.git_build(context)
|
14
|
+
# gem ["push #{context.context_name}-#{GVB.version}.gem"]
|
15
|
+
# context.patch_bump if gem_installed?(context)
|
16
|
+
context.rake context, ['release']
|
17
|
+
# context.commit
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
def ruby_install(context)
|
21
|
+
context.gem context, ['install', context.context_name]
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
def clean_folder(context, folder)
|
25
|
+
clean_folder = get_context_folder(context, folder)
|
26
|
+
puts "Clean folder #{clean_folder}"
|
27
|
+
FileUtils.remove_dir(clean_folder) if Dir.exist?(clean_folder)
|
28
|
+
end
|
28
29
|
|
29
|
-
|
30
|
-
|
31
|
-
|
30
|
+
def ruby_clean(context)
|
31
|
+
clean_folder(context, 'pkg')
|
32
|
+
end
|
32
33
|
|
33
|
-
|
34
|
-
|
35
|
-
|
34
|
+
def ruby_remove_gem(context)
|
35
|
+
clean_folder(context, 'pkg')
|
36
|
+
end
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
def ruby_check_if_available_public(context)
|
39
|
+
puts "Waiting a minute before installing #{context.context_name} in folder #{context.context_folder}"
|
40
|
+
`chef gem list #{context.context_name}`
|
41
|
+
# sleep(60)
|
42
|
+
end
|
42
43
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
44
|
+
def gem_installed?(context)
|
45
|
+
installed_version = Gem::Specification.find_by_name(context.context_name).version
|
46
|
+
puts "Compare #{context.context_name} installed_version #{installed_version} with #{context.version} in folder #{context.context_folder}"
|
47
|
+
installed = installed_version == context.version
|
48
|
+
puts "installed = #{installed}"
|
49
|
+
installed
|
50
|
+
end
|
50
51
|
|
51
|
-
|
52
|
-
|
53
|
-
context.
|
54
|
-
|
55
|
-
context.
|
56
|
-
context
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
#
|
52
|
+
def ruby_cycle(context)
|
53
|
+
context.log "\n\nBuilding Ruby application for #{context.context_name}"
|
54
|
+
if context.new_update_available?
|
55
|
+
context.log "\n\nNew update available for #{context.context_name}\nCleaning the building space"
|
56
|
+
context.clean
|
57
|
+
if git_dirty_state?(context)
|
58
|
+
context.patch_bump
|
59
|
+
context.commit
|
60
|
+
end
|
61
|
+
context.log "\n\nBuilding project #{context.context_name} now ..."
|
62
|
+
context.build
|
63
|
+
# context.commit
|
64
|
+
context.log "\n\nReleasing project #{context.context_name}"
|
65
|
+
context.release
|
66
|
+
context.wait_until_release_available
|
67
|
+
context.log "\n\nInstalling project #{context.context_name}"
|
68
|
+
context.install
|
69
|
+
if context.test_context_successful?
|
70
|
+
context.log "newer version installed successfully for #{context.context_name} on version #{context.version}"
|
71
|
+
# context.patch_bump
|
72
|
+
# patch_reset(context)
|
73
|
+
else
|
74
|
+
context.log "newer version not installed for #{context.context_name} on version #{context.version}"
|
75
|
+
end
|
67
76
|
else
|
68
|
-
|
77
|
+
context.log "No update available"
|
69
78
|
end
|
70
|
-
else
|
71
|
-
puts "No update available"
|
72
79
|
end
|
73
80
|
end
|
74
81
|
end
|
@@ -1,8 +1,13 @@
|
|
1
|
-
require_relative '
|
1
|
+
require_relative 'helpers/command'
|
2
|
+
require_relative 'deploy/deployer'
|
3
|
+
require_relative 'deploy/git'
|
4
|
+
|
2
5
|
|
3
6
|
module Context
|
4
7
|
class Deploy
|
5
|
-
include
|
8
|
+
include CommandHelper
|
9
|
+
include DeployHelpers::DeployerHelper
|
10
|
+
include DeployHelpers::GitHelper
|
6
11
|
|
7
12
|
attr_reader :context_name
|
8
13
|
attr_reader :context_folder
|
@@ -30,7 +35,7 @@ module Context
|
|
30
35
|
|
31
36
|
def version
|
32
37
|
git_build(self)
|
33
|
-
|
38
|
+
log "Getting version info for #{context_folder} and version should be #{GitVersionBump.version(true)}"
|
34
39
|
Gem::Version.new(GitVersionBump.version(true))
|
35
40
|
end
|
36
41
|
|
@@ -39,7 +44,7 @@ module Context
|
|
39
44
|
end
|
40
45
|
|
41
46
|
def test_context_successful?
|
42
|
-
|
47
|
+
log "Check if #{context_name} is install #{version}"
|
43
48
|
if gem_installed?(self)
|
44
49
|
puts "Test context #{context_name} was successfully install on version #{version}"
|
45
50
|
true
|
@@ -58,6 +63,7 @@ module Context
|
|
58
63
|
end
|
59
64
|
|
60
65
|
def release
|
66
|
+
debug_log "Release #{context_name} at version #{version}"
|
61
67
|
ruby_release(self)
|
62
68
|
git_release(self)
|
63
69
|
end
|
@@ -71,16 +77,23 @@ module Context
|
|
71
77
|
ruby_clean(self)
|
72
78
|
end
|
73
79
|
|
80
|
+
def show_new_version(level)
|
81
|
+
log "#{level} bump #{context_name} at newer version #{version}"
|
82
|
+
end
|
83
|
+
|
74
84
|
def patch_bump
|
75
85
|
GitVersionBump.tag_version("#{GitVersionBump.major_version(true)}.#{GitVersionBump.minor_version(true)}.#{GitVersionBump.patch_version(true) + 1}")
|
86
|
+
show_new_version('Patch')
|
76
87
|
end
|
77
88
|
|
78
89
|
def minor_bump
|
79
90
|
GitVersionBump.tag_version("#{GitVersionBump.major_version(true)}.#{GitVersionBump.minor_version(true) + 1}.0")
|
91
|
+
show_new_version('Minor')
|
80
92
|
end
|
81
93
|
|
82
94
|
def major_bump
|
83
95
|
GitVersionBump.tag_version("#{GitVersionBump.major_version(true) + 1}.0.0")
|
96
|
+
show_new_version('Major')
|
84
97
|
end
|
85
98
|
|
86
99
|
def wait_until_release_available
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Context
|
2
|
+
module CommandHelper
|
3
|
+
def debug?
|
4
|
+
ENV.key?('CONTEXTDEBUG') && ! ENV['CONTEXTDEBUG'].nil? && ENV['CONTEXTDEBUG']
|
5
|
+
true
|
6
|
+
end
|
7
|
+
|
8
|
+
def log(message)
|
9
|
+
puts message
|
10
|
+
end
|
11
|
+
|
12
|
+
def debug_log(message)
|
13
|
+
log message if debug?
|
14
|
+
end
|
15
|
+
|
16
|
+
def is_admin?
|
17
|
+
Process::Sys.getuid != 0
|
18
|
+
end
|
19
|
+
|
20
|
+
def temp_dir
|
21
|
+
@temp_dir = Dir.tmpdir() if @temp_dir.nil?
|
22
|
+
@temp_dir
|
23
|
+
end
|
24
|
+
|
25
|
+
def get_data(command_line)
|
26
|
+
debug_log "Get data from command #{command_line.join(' ')}"
|
27
|
+
`#{command_line.join(' ')}`
|
28
|
+
end
|
29
|
+
|
30
|
+
def execute_command(command)
|
31
|
+
command_status = system(command.join(' '))
|
32
|
+
debug_log "executed command #{command.join(' ')}"
|
33
|
+
command_status
|
34
|
+
end
|
35
|
+
|
36
|
+
def sudo_command(command)
|
37
|
+
if ! Gem.win_platform? && Process::Sys.getuid != 0
|
38
|
+
['sudo'] + command
|
39
|
+
else
|
40
|
+
command
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def write_in_system_file(file, content)
|
45
|
+
debug_log "write_in_system_file #{[file, content]}"
|
46
|
+
system("touch #{file}")
|
47
|
+
::File.write(file, content)
|
48
|
+
system("chmod 644 #{file}") unless Gem.win_platform?
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require_relative '../../deploy-context'
|
2
|
+
|
3
|
+
deployer = Context::DeployContext.deployer
|
4
|
+
|
5
|
+
task :default => "test" do
|
6
|
+
deployer.execute_action(deployer, 'once')
|
7
|
+
end
|
8
|
+
|
9
|
+
task :bump do
|
10
|
+
deployer.execute_action(deployer, 'bump')
|
11
|
+
end
|
12
|
+
|
13
|
+
task :test do
|
14
|
+
deployer.execute_action(deployer, 'test')
|
15
|
+
end
|
data/lib/deploy-context.rb
CHANGED
@@ -3,15 +3,13 @@ require 'fileutils'
|
|
3
3
|
require 'git-version-bump'
|
4
4
|
|
5
5
|
require_relative 'deploy-context/deploy'
|
6
|
-
require_relative 'deploy-context/deploy/git'
|
7
6
|
require_relative 'deploy-context/deploy/ruby'
|
8
7
|
require_relative 'deploy-context/deploy/cucumber'
|
9
8
|
|
10
9
|
module Context
|
11
10
|
class DeployContext < Deploy
|
12
|
-
include
|
13
|
-
include
|
14
|
-
include CucumberDeployerHelper
|
11
|
+
include DeployHelpers::RubyHelper
|
12
|
+
include DeployHelpers::CucumberHelper
|
15
13
|
|
16
14
|
def self.deployer
|
17
15
|
@deployer = Context::DeployContext.new(Dir.pwd) if @deployer.nil?
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deploy-context
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.32.15.g7b29619
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jimmy Provencher
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
+V3ectLBpuoKM8f/ZFMnUPA0mAv5e7J6u9IBwyNj/cy+wLOAbpPdmhoKZXCpQcno
|
36
36
|
ysBBJbi//0tgFWwC4vOaDMch
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2023-10-
|
38
|
+
date: 2023-10-04 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: chef
|
@@ -106,12 +106,14 @@ files:
|
|
106
106
|
- features/update_deployer.feature
|
107
107
|
- features/updated_git.feature
|
108
108
|
- lib/deploy-context.rb
|
109
|
-
- lib/deploy-context/context/binary.rb
|
110
|
-
- lib/deploy-context/context/deploy.rb
|
111
109
|
- lib/deploy-context/deploy.rb
|
112
110
|
- lib/deploy-context/deploy/cucumber.rb
|
111
|
+
- lib/deploy-context/deploy/deployer.rb
|
113
112
|
- lib/deploy-context/deploy/git.rb
|
114
113
|
- lib/deploy-context/deploy/ruby.rb
|
114
|
+
- lib/deploy-context/helpers/binary.rb
|
115
|
+
- lib/deploy-context/helpers/command.rb
|
116
|
+
- lib/deploy-context/helpers/rake.rb
|
115
117
|
homepage: https://github.com/JimboDragonGit/deploy-context
|
116
118
|
licenses:
|
117
119
|
- MIT
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,85 +0,0 @@
|
|
1
|
-
module Context
|
2
|
-
module DeployHelper
|
3
|
-
def get_context_folder(context, folder)
|
4
|
-
File.join(context.context_folder, folder)
|
5
|
-
end
|
6
|
-
|
7
|
-
def build_folder(context)
|
8
|
-
get_context_folder(context, 'build')
|
9
|
-
end
|
10
|
-
|
11
|
-
def contexts_container(context)
|
12
|
-
get_context_folder(context, 'contexts')
|
13
|
-
end
|
14
|
-
|
15
|
-
def chef_exec(commands)
|
16
|
-
system("chef exec #{commands.join(' ')}")
|
17
|
-
end
|
18
|
-
|
19
|
-
def git(commands)
|
20
|
-
chef_exec(['git'] + commands)
|
21
|
-
end
|
22
|
-
|
23
|
-
def gem(commands)
|
24
|
-
chef_exec(['gem'] + commands)
|
25
|
-
end
|
26
|
-
|
27
|
-
def rake(commands)
|
28
|
-
chef_exec(['rake'] + commands)
|
29
|
-
end
|
30
|
-
|
31
|
-
def cucumber(commands = [])
|
32
|
-
chef_exec(['cucumber'] + commands)
|
33
|
-
end
|
34
|
-
|
35
|
-
def execute_action(context, action)
|
36
|
-
state_action = if action.nil?
|
37
|
-
context.cycle
|
38
|
-
false
|
39
|
-
else
|
40
|
-
case action
|
41
|
-
when 'once'
|
42
|
-
puts "\nExecute only once\n"
|
43
|
-
context.cycle
|
44
|
-
true
|
45
|
-
when 'always'
|
46
|
-
puts "\nAlways in execution\n"
|
47
|
-
while true do
|
48
|
-
context.cycle
|
49
|
-
end
|
50
|
-
true
|
51
|
-
when 'bump'
|
52
|
-
puts "\nBump minor version\n"
|
53
|
-
context.patch_bump
|
54
|
-
true
|
55
|
-
when 'release'
|
56
|
-
puts "\nBump major version\n"
|
57
|
-
context.minor_bump
|
58
|
-
true
|
59
|
-
when 'upgrade'
|
60
|
-
puts "\nBump major version\n"
|
61
|
-
context.major_bump
|
62
|
-
true
|
63
|
-
when 'test'
|
64
|
-
puts "\nExecute tests\n"
|
65
|
-
context.cucumber_test(context)
|
66
|
-
true
|
67
|
-
when 'reset'
|
68
|
-
puts "\nReset versionning\n"
|
69
|
-
system('rake')
|
70
|
-
# context.cucumber_test(deployer)
|
71
|
-
true
|
72
|
-
else
|
73
|
-
puts "Unknown setting #{action}"
|
74
|
-
false
|
75
|
-
end
|
76
|
-
end
|
77
|
-
context.commit
|
78
|
-
if state_action
|
79
|
-
puts "Action #{action} executed correctly in context #{context}"
|
80
|
-
else
|
81
|
-
abort("Failed to execute action #{action} in context #{context}")
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
File without changes
|