deploy-context 2.13.10 → 2.13.17

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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +4 -0
  3. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/context-knife-context.rb +26 -0
  4. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/context-manager.rb +100 -0
  5. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/cookbook-studio.rb +72 -0
  6. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/cucumber-studio.rb +45 -0
  7. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/cucumber-suite.rb +179 -0
  8. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/default-studio.rb +174 -0
  9. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/deploy/chef.rb +57 -0
  10. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/deploy/context.rb +42 -0
  11. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/deploy/cookbook.rb +121 -0
  12. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/deploy/cucumber.rb +42 -0
  13. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/deploy/deployer.rb +83 -0
  14. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/deploy/git.rb +62 -0
  15. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/deploy/habitat.rb +112 -0
  16. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/deploy/ruby.rb +138 -0
  17. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/deploy/vagrant.rb +7 -0
  18. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/habitat-studio.rb +50 -0
  19. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/helpers/command.rb +91 -0
  20. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/helpers/gemspec.rb +91 -0
  21. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/helpers/rake_tasks.rb +150 -0
  22. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/knife/default_knife_context.rb +35 -0
  23. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/knife/dummy_knife.rb +43 -0
  24. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/ruby-studio.rb +56 -0
  25. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/steps/deploy.rb +61 -0
  26. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/studio/base.rb +167 -0
  27. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/studio/default.rb +38 -0
  28. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context/studio/deployer.rb +24 -0
  29. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-context.rb +65 -0
  30. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-definitions/deploy-context-cucumber.rb +18 -0
  31. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-definitions/deploy-context-git.rb +47 -0
  32. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-definitions/deploy-context-habitat.rb +82 -0
  33. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-definitions/deploy-context-kitchen.rb +67 -0
  34. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-definitions/deploy-context-knife.rb +45 -0
  35. data/home/jimboadmin/deploy-context/habitat/plan.sh/x86_64-linux/lib/deploy-definitions/deploy-context-rake.rb +12 -0
  36. data.tar.gz.sig +0 -0
  37. metadata +64 -6
  38. metadata.gz.sig +0 -0
@@ -0,0 +1,91 @@
1
+ module Context
2
+ module CommandHelper
3
+ def debug?
4
+ ENV.key?('CONTEXTDEBUG') && ! ENV['CONTEXTDEBUG'].nil? && ENV['CONTEXTDEBUG']
5
+ end
6
+
7
+ def context_log(message)
8
+ return log message if respond_to? :log
9
+ puts message
10
+ end
11
+
12
+ def debug_context_log(name, message)
13
+ return debug_log message if respond_to? :debug_log
14
+ debug_message = "\n\n#{name} DEBUG: #{message}\n\n"
15
+ context_log debug_message if debug?
16
+ end
17
+
18
+ def warning_context_log(name, message)
19
+ return warning_log message if respond_to? :warning_log
20
+ warning_message = "\n\n#{name} WARNING: #{message}\n\n"
21
+ context_log warning_message
22
+ end
23
+
24
+ def error_context_log(name, message)
25
+ return error_log message if respond_to? :error_log
26
+ error_message = "\n\n#{name} ERROR: #{message}\n\n"
27
+ context_log error_message
28
+ context_log caller
29
+ abort(error_message)
30
+ exit 1
31
+ end
32
+
33
+ def is_admin?
34
+ Process::Sys.getuid != 0
35
+ end
36
+
37
+ def temp_dir
38
+ File.join(context_folder, 'results')
39
+ end
40
+
41
+ def get_shell_data(command_line)
42
+ debug_context_log 'Get data from command', command_line
43
+ `#{command_line.join(' ')}`
44
+ end
45
+
46
+ def execute_command(command, command_type = :system)
47
+ command_state = case command_type
48
+ when :system
49
+ system(command.join(' '))
50
+ when :run_as_admin
51
+ execute_command(sudo_command(command), command_type)
52
+ when :get_data
53
+ debug_context_log "get data command = #{command} on type #{command_type}"
54
+ get_shell_data(command)
55
+ when :fork
56
+ fork(command.join(' '))
57
+ else
58
+ error_context_log(context_name, "Unknown command type #{command_type}")
59
+ end
60
+ debug_context_log 'Execute Command', "\n\nexecuted command #{command.join(' ')}"
61
+ command_state
62
+ end
63
+
64
+ def sudo_command(command)
65
+ if ! Gem.win_platform? && Process::Sys.getuid != 0
66
+ ['sudo'] + command
67
+ else
68
+ command
69
+ end
70
+ end
71
+
72
+ def write_in_system_file(file, content)
73
+ debug_context_log "Write in file system", [file, content]
74
+ system("touch #{file}")
75
+ ::File.write(file, content)
76
+ system("chmod 644 #{file}") unless Gem.win_platform?
77
+ end
78
+
79
+ def delete_file_only_if_exist(file)
80
+ FileUtils.rm file if File.exist? file
81
+ end
82
+
83
+ def delete_folder_only_if_exist(folder)
84
+ FileUtils.rm_dir folder if File.exist? folder
85
+ end
86
+
87
+ def is_binary_available?(binary_name)
88
+ execute_command(['which', binary_name])
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,91 @@
1
+
2
+ module Context
3
+ module GemHelpers
4
+ def deploycontext_gem_specification(s, deploycontext_rootfolder, libraries_folder, steps_folder = '')
5
+ s.name = 'deploy-context'
6
+ s.license = 'MIT'
7
+ s.authors = ['Jimmy Provencher']
8
+ s.email = ['jimbo_dragon@hotmail.com']
9
+ s.homepage = 'https://github.com/JimboDragonGit/deploy-context'
10
+ s.summary = 'A auto chef bootstrapper and wrapper cookbook to deploy code and context'
11
+ s.description = 'Using Chef cookbook style and force any script using it to switch to chef even if it is not install. It will install it tho ;)'
12
+
13
+ s.version = File.read(File.join(deploycontext_rootfolder, 'VERSION'))
14
+ s.date = File.read(File.join(deploycontext_rootfolder, 'DATE'))
15
+
16
+ # all_files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
17
+ # s.files = all_files.grep(%r!^(exe|libraries|rubocop)/|^.rubocop.yml$!)
18
+ # code_folder = 'libraries/'
19
+ # s.files = %w(README.md LICENSE bin/selfbootstrap libraries/selfbootstrap.rb ) + Dir.glob('libraries/**/*') # + Dir.glob('{bin,lib,certs,test}/**/*')
20
+ # s.require_paths = [code_folder]
21
+ # s.executables = %w(selfbootstrap)
22
+ # s.bindir = 'exe'
23
+
24
+
25
+ # s.extra_rdoc_files = ["README.md", 'VERSION', 'DATE']
26
+ # s.files = `git ls-files`.split("\n")
27
+ libraries_glob = Dir.glob(File.join(libraries_folder, '**/*'))
28
+ libraries_glob = libraries_glob + Dir.glob(File.join(steps_folder, '*')) unless steps_folder.empty?
29
+ s.files = libraries_glob
30
+ s.executables = [
31
+ 'deploy-context'
32
+ ]
33
+
34
+ s.cert_chain = [File.join(ENV['HOME'], '.gem/gem-public_cert.pem')]
35
+ s.signing_key = File.join(ENV['HOME'], '.gem/gem-private_key.pem') if $PROGRAM_NAME =~ /gem\z/
36
+
37
+ s.metadata = {
38
+ # 'source_code_uri' => '/home/git/selfbootstrap.git/',
39
+ 'bug_tracker_uri' => 'https://github.com/JimboDragonGit/deploy-context/issues',
40
+ 'changelog_uri' => 'https://github.com/JimboDragonGit/deploy-context/releases',
41
+ 'homepage_uri' => s.homepage,
42
+ }
43
+
44
+ s.rdoc_options = ['--charset=UTF-8']
45
+ # s.extra_rdoc_files = %w(README.md LICENSE)
46
+
47
+ # s.required_ruby_version = '>= 2.5.0'
48
+ # s.required_rubygems_version = '>= 2.7.0'
49
+
50
+ # s.add_development_dependency('chef')
51
+ # s.add_development_dependency('test-kitchen')
52
+
53
+ # s.add_runtime_dependency('git')
54
+ # s.add_runtime_dependency('git_cli')
55
+ # s.add_runtime_dependency('chef')
56
+ # s.add_runtime_dependency('test-kitchen')
57
+ # s.add_runtime_dependency('chef-bin')
58
+ # s.add_runtime_dependency('chef-cli')
59
+ # s.add_runtime_dependency('cheffish')
60
+ # s.add_runtime_dependency('knife')
61
+ # s.add_runtime_dependency('knife-ec2')
62
+
63
+ s.add_runtime_dependency('inspec')
64
+ s.add_runtime_dependency('kitchen-vagrant')
65
+ s.add_runtime_dependency('kitchen-dokken')
66
+ s.add_runtime_dependency('kitchen-ec2')
67
+ s.add_runtime_dependency('simplecov')
68
+ s.add_runtime_dependency('cucumber')
69
+ s.add_runtime_dependency('down')
70
+ s.add_runtime_dependency('unix-crypt')
71
+ s.add_runtime_dependency('ruby-shadow')
72
+ s.add_runtime_dependency('securerandom')
73
+ s.add_runtime_dependency('git-version-bump')
74
+
75
+ # s.add_runtime_dependency('colorator', '~> 1.0')
76
+ # s.add_runtime_dependency('em-websocket', '~> 0.5')
77
+ # s.add_runtime_dependency('i18n', '~> 1.0')
78
+ # s.add_runtime_dependency('jekyll-sass-converter', '>= 2.0', '< 4.0')
79
+ # s.add_runtime_dependency('jekyll-watch', '~> 2.0')
80
+ # s.add_runtime_dependency('kramdown', '~> 2.3', '>= 2.3.1')
81
+ # s.add_runtime_dependency('kramdown-parser-gfm', '~> 1.0')
82
+ # s.add_runtime_dependency('liquid', '~> 4.0')
83
+ # s.add_runtime_dependency('mercenary', '>= 0.3.6', '< 0.5')
84
+ # s.add_runtime_dependency('pathutil', '~> 0.9')
85
+ # s.add_runtime_dependency('rouge', '>= 3.0', '< 5.0')
86
+ # s.add_runtime_dependency('safe_yaml', '~> 1.0')
87
+ # s.add_runtime_dependency('terminal-table', '>= 1.8', '< 4.0')
88
+ # s.add_runtime_dependency('webrick', '~> 1.7')
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,150 @@
1
+ module Context
2
+ module RakeTasks
3
+ def define_deploy_context_tasks(deployer)
4
+ deployer.load_public_dependencies
5
+ Bundler::GemHelper.install_tasks
6
+
7
+ Rake::RDocTask.new do |rd|
8
+ rd.main = "README.md"
9
+ rd.title = 'deploy-context'
10
+ rd.rdoc_files.include("README.md", "lib/**/*.rb")
11
+ end
12
+
13
+ namespace :deploycontext do
14
+ task :mix_cookbook => "deploycontext:push_cookbook" do
15
+ deployer.do_mix_cookbook
16
+ end
17
+
18
+ task :push_cookbook => "deploycontext:install" do
19
+ deployer.do_end
20
+ end
21
+
22
+ task :install do
23
+ deployer.do_install
24
+ end
25
+
26
+ # task :bump => "deploycontext:commit" do
27
+ # deployer.bump
28
+ # end
29
+
30
+ # task :test => "deploycontext:help" do
31
+ # deployer.test
32
+ # end
33
+
34
+ # task :release => "deploycontext:commit" do
35
+ # deployer.release
36
+ # end
37
+
38
+ # task :commit => "deploycontext:default" do
39
+ # deployer.commit
40
+ # end
41
+
42
+ # task :push => "deploycontext:commit" do
43
+ # deployer.push
44
+ # end
45
+
46
+ task :help do
47
+ deployer.help
48
+ end
49
+
50
+ namespace :studio do
51
+ task :promote => "deploycontext:studio:release" do
52
+ deployer.do_end
53
+ end
54
+
55
+ task :build => "deploycontext:studio:habitat" do
56
+ deployer.do_build
57
+ end
58
+
59
+ task :install => "deploycontext:studio:build" do
60
+ deployer.do_install
61
+ end
62
+
63
+ task :release => "deploycontext:studio:install" do
64
+ deployer.do_release
65
+ end
66
+
67
+ task :habitat do
68
+ deployer.do_build_in_habitat
69
+ end
70
+
71
+ task :kitchen do
72
+ deployer.test_with_kitchen
73
+ end
74
+ end
75
+
76
+ namespace :plan do
77
+ task :do_mix_cookbook do
78
+ deployer.do_mix_cookbook
79
+ end
80
+
81
+ task :do_begin do
82
+ deployer.do_begin
83
+ end
84
+
85
+ task :do_download do
86
+ deployer.do_download
87
+ end
88
+
89
+ task :do_verify do
90
+ deployer.do_verify
91
+ end
92
+
93
+ task :do_clean do
94
+ deployer.do_clean
95
+ end
96
+
97
+ task :do_unpack do
98
+ deployer.do_unpack
99
+ end
100
+
101
+ task :do_prepare do
102
+ deployer.do_prepare
103
+ end
104
+
105
+ task :do_build do
106
+ deployer.do_build
107
+ end
108
+
109
+ task :do_check do
110
+ deployer.do_check
111
+ end
112
+
113
+ task :do_install do
114
+ deployer.do_install
115
+ end
116
+
117
+ task :do_strip do
118
+ deployer.do_strip
119
+ end
120
+
121
+ task :do_end do
122
+ deployer.do_end
123
+ end
124
+ end
125
+
126
+ namespace :deployer do
127
+ task :cookbook do
128
+ deployer.cookbook_test(deployer)
129
+ end
130
+
131
+ task :cucumber do
132
+ deployer.cucumber_test(deployer)
133
+ end
134
+ end
135
+
136
+ namespace :features do
137
+ Cucumber::Rake::Task.new(:strict) do |t|
138
+ t.cucumber_opts = "--format pretty" # Any valid command line option can go here.
139
+ t.profile = "strict"
140
+ end
141
+
142
+ Cucumber::Rake::Task.new(:html_report) do |t|
143
+ t.cucumber_opts = "--format pretty" # Any valid command line option can go here.
144
+ t.profile = "html_report"
145
+ end
146
+ end
147
+ end
148
+ end
149
+ end
150
+ end
@@ -0,0 +1,35 @@
1
+ require_relative 'dummy_knife.rb'
2
+
3
+ module Context
4
+ module Knife
5
+ class DefaultKnifeContext < Chef::Knife
6
+ include Context::CommandHelper
7
+
8
+ banner "knife default knife context"
9
+
10
+ deps do
11
+ end
12
+
13
+ option :context_name,
14
+ :long => '--context-name VALUE',
15
+ :boolean => false,
16
+ :description => "The name of the context we running on"
17
+
18
+ option :context_folder,
19
+ :long => '--context-path VALUE',
20
+ :description => "Path of the context"
21
+
22
+ option :organisation_name,
23
+ :long => '--organisation-name VALUE',
24
+ :description => "Organisation name of the context"
25
+
26
+ def run
27
+ if config[:context_name]
28
+ context_log "Running on context #{config[:context_name]}, config = #{config.inspect}\n#{name_args}"
29
+ else
30
+ warning_context_log self, "Running on context without name"
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,43 @@
1
+ begin
2
+ require 'chef/knife'
3
+ rescue Exception => e
4
+ puts "Failed to load chef/knife module, loading a dummy module instead"
5
+
6
+ class Chef
7
+ class Knife
8
+ def self.banner(banner_flags)
9
+ end
10
+
11
+ def self.deps
12
+ end
13
+
14
+ def self.option(name,*argv)
15
+ end
16
+ end
17
+ end
18
+ end
19
+
20
+ module Context
21
+ module Knife
22
+ class MannequinKnifeContext < Chef::Knife
23
+ banner "knife mannequin knife context"
24
+
25
+ deps do
26
+ end
27
+
28
+ option :mannequin,
29
+ :description => "Just a dummy example"
30
+
31
+ def run
32
+ # deployer.send(config[:omg])
33
+ if config[:mannequin]
34
+ # Oh yeah, we are pumped.
35
+ puts "Dummy Mannequin ;)"
36
+ else
37
+ # meh
38
+ puts "Where is my Dummy Mannequin!!!!"
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,56 @@
1
+ require_relative 'default-studio'
2
+
3
+ module Context
4
+ class ContextRubyStudio < DefaultStudio
5
+ banner "knife context ruby studio"
6
+
7
+ deps do
8
+ Knife::DefaultKnifeContext.load_deps
9
+ end
10
+
11
+ option :omg,
12
+ :short => '-O',
13
+ :long => '--omg',
14
+ :description => "I'm so excited! 9"
15
+
16
+ def run
17
+ if config[:omg]
18
+ puts "OMG HELLO WORLD!!!9!!99"
19
+ else
20
+ puts "I am just a fucking example. 9"
21
+ end
22
+ end
23
+
24
+ # 2
25
+ def do_download
26
+ super
27
+ system('bundle install')
28
+ true
29
+ end
30
+
31
+ # 2
32
+ # def do_verify
33
+ # super
34
+ # cucumber(self)
35
+ # true
36
+ # end
37
+
38
+ # 4
39
+ def do_clean
40
+ super
41
+ delete_file_only_if_exist(get_context_file(self, 'Gemfile.lock'))
42
+ true
43
+ end
44
+
45
+ # 9
46
+ def do_end
47
+ super
48
+ ruby_release(self)
49
+ true
50
+ end
51
+
52
+ def studio_present?
53
+ execute_command('which ruby') || super
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,61 @@
1
+
2
+ module Context
3
+ module Steps
4
+ module Deploy
5
+ def define_steps(deployer)
6
+ deployer.load_public_dependencies
7
+ # Étantdonnéque('le projet {word} à une dernière version de disponible dans git') do |project_name|
8
+ # context_exec [project_name, 'cycle']
9
+
10
+ # if project_name == deployer.context_name
11
+ # Dir.chdir deployer.context_folder
12
+ # else
13
+ # Dir.chdir File.join(deployer.contexts_container(deployer), project_name)
14
+ # end
15
+ # end
16
+
17
+ Alors('démarrer un simple cycle de {word}') do |project_name|
18
+ pending
19
+ # context_exec [project_name, 'cycle'] || abort("#{project_name} ERROR: Issue with life cycle")
20
+ end
21
+
22
+ Alors('déployer le projet {word}') do |project_name|
23
+ abort("Deployer failed to update") unless deployer.do_begin
24
+ pending
25
+ # context_exec [project_name, 'release'] || abort("#{project_name} ERROR: Issue with deploy steps")
26
+ end
27
+
28
+ Alors('tester le projet {word}') do |project_name|
29
+ pending
30
+ # context_exec [project_name, 'test'] || abort("#{project_name} ERROR: Issue with testing steps")
31
+ end
32
+
33
+ Étantdonnéque('le projet {word} à du code à updater') do |project_name|
34
+ abort("Not on a dirty studio") unless deployer.on_a_dirty_studio?
35
+ # context_exec [project_name, 'check_code_to_update'] || abort("#{project_name} ERROR: Issue to check updated code")
36
+ end
37
+
38
+ Alors('bumper la version du patch de {word}') do |project_name|
39
+ pending
40
+ # context_exec [project_name, 'bump'] || abort("#{project_name} ERROR: Issue with bumping version")
41
+ end
42
+
43
+ Étantdonnéque('le projet {word} à la bonne version d\'installer') do |project_name|
44
+ abort("Not the latest version installed") unless deployer.current_version_installed?
45
+ end
46
+
47
+ Étantdonnéque('le projet {word} à une nouvelle version de disponible') do |project_name|
48
+ abort("Latest version installed") if deployer.current_version_installed?
49
+ end
50
+
51
+ Étantdonnéque('le projet {word} est chargé') do |project_name|
52
+ abort("Latest version installed") if deployer.current_version_installed?
53
+ end
54
+
55
+ Quand('le studio est disponible') do
56
+ abort("Studio not available") unless deployer.studio_available?
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,167 @@
1
+ module Context
2
+ module Studio
3
+ module Base
4
+ def help
5
+ show_help(self)
6
+ end
7
+
8
+ def test
9
+ context_log "\nExecute tests\n"
10
+ context_log "\n\nTest result: #{test_context_successful?}\n"
11
+ end
12
+
13
+ def version
14
+ # do_prepare unless defined?(GitVersionBump)
15
+ # context_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
+ Gem::Version.new(cookbook_version(self))
20
+ end
21
+ end
22
+
23
+ def current_version_installed?
24
+ gem_installed?(self, context_name, version)
25
+ end
26
+
27
+ def test_context_successful?
28
+ context_log "Check if #{context_name} is install #{version}"
29
+
30
+ if cookbook_test_successful?(self) && cucumber_test_successful?(self) && current_version_installed?
31
+ context_log "Test context #{context_name} was successfully perform on version #{version}"
32
+ true
33
+ else
34
+ context_log "Test context #{context_name} has failed to perform #{version}"
35
+ false
36
+ end
37
+ end
38
+
39
+ def on_a_dirty_studio?
40
+ git_dirty_state?(self)
41
+ end
42
+
43
+ def loaded_in_ruby?
44
+ gem_available?(self, context_name, version)
45
+ end
46
+
47
+ # def cycle
48
+ # ruby_cycle(self)
49
+ # end
50
+
51
+ # def build
52
+ # ruby_build(self)
53
+ # cookbook_build(self)
54
+ # build_habitat(self)
55
+ # end
56
+
57
+ # def commit
58
+ # cookbook_install(self)
59
+ # git_commit(self)
60
+ # end
61
+
62
+ # def push
63
+ # commit
64
+ # git_release(self)
65
+ # end
66
+
67
+ # def release
68
+ # context_log "\n\nRelease #{context_name} at version #{version}"
69
+ # cookbook_push(self)
70
+ # ruby_release(self)
71
+ # git_release(self)
72
+ # start_habitat_job(self)
73
+ # end
74
+
75
+ # def install
76
+ # ruby_install(self)
77
+ # end
78
+
79
+ # def clean
80
+ # clean_folder(self, 'contexts')
81
+ # ruby_clean(self)
82
+ # cookbook_clean(self)
83
+ # end
84
+
85
+ # def patch_bump
86
+ # GitVersionBump.tag_version("#{GitVersionBump.major_version(true)}.#{GitVersionBump.minor_version(true)}.#{GitVersionBump.patch_version(true) + 1}")
87
+ # show_new_version('Patch')
88
+ # end
89
+
90
+ # def minor_bump
91
+ # GitVersionBump.tag_version("#{GitVersionBump.major_version(true)}.#{GitVersionBump.minor_version(true) + 1}.0")
92
+ # show_new_version('Minor')
93
+ # end
94
+
95
+ # def major_bump
96
+ # GitVersionBump.tag_version("#{GitVersionBump.major_version(true) + 1}.0.0")
97
+ # show_new_version('Major')
98
+ # end
99
+
100
+ # def wait_until_release_available
101
+ # wait_until_release_available unless is_present_publicly?
102
+ # end
103
+
104
+ def load_dependencies
105
+ require 'simplecov_setup'
106
+ require 'git-version-bump'
107
+ require 'cucumber'
108
+ require 'cucumber/cli/main'
109
+ require 'cucumber/rspec/disable_option_parser'
110
+ end
111
+
112
+ # def test
113
+ # context_log "\nExecute tests\n"
114
+ # context_log "\n\nTest result: #{test_context_successful?}\n"
115
+ # end
116
+ end
117
+ end
118
+ end
119
+
120
+
121
+ # case action
122
+ # when 'cycle'
123
+ # context.log "\nExecute only the cycle once\n"
124
+ # context.cycle
125
+ # true
126
+ # when 'agent'
127
+ # context.log "\nAlways in execution\n"
128
+ # while true do
129
+ # context.cycle
130
+ # end
131
+ # true
132
+ # when 'commit'
133
+ # context.log "\nBump minor version\n"
134
+ # context.commit
135
+ # true
136
+ # when 'push'
137
+ # context.log "\nBump minor version\n"
138
+ # context.push
139
+ # true
140
+ # when 'bump'
141
+ # context.log "\nBump minor version\n"
142
+ # context.patch_bump
143
+ # true
144
+ # when 'release'
145
+ # context.log "\nBump major version\n"
146
+ # context.minor_bump
147
+ # true
148
+ # when 'upgrade'
149
+ # context.log "\nBump major version\n"
150
+ # context.major_bump
151
+ # true
152
+ # when 'test'
153
+ # context.log "\nExecute tests\n"
154
+ # context.test_context_successful?
155
+ # when 'reset'
156
+ # context.log "\nReset versionning\n"
157
+ # system('rake')
158
+ # # context.cucumber_test(deployer)
159
+ # true
160
+ # when 'help'
161
+ # context.show_help(context)
162
+ # true
163
+ # else
164
+ # context.error_context_log context.context_name, "Unknown setting #{action}"
165
+ # show_help(context)
166
+ # false
167
+ # end