test-kitchen-rsync 3.0.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +21 -0
  3. data/LICENSE +15 -0
  4. data/Rakefile +53 -0
  5. data/bin/zl-kitchen +11 -0
  6. data/lib/kitchen/base64_stream.rb +48 -0
  7. data/lib/kitchen/chef_utils_wiring.rb +40 -0
  8. data/lib/kitchen/cli.rb +413 -0
  9. data/lib/kitchen/collection.rb +52 -0
  10. data/lib/kitchen/color.rb +63 -0
  11. data/lib/kitchen/command/action.rb +41 -0
  12. data/lib/kitchen/command/console.rb +54 -0
  13. data/lib/kitchen/command/diagnose.rb +84 -0
  14. data/lib/kitchen/command/doctor.rb +39 -0
  15. data/lib/kitchen/command/exec.rb +37 -0
  16. data/lib/kitchen/command/list.rb +148 -0
  17. data/lib/kitchen/command/login.rb +39 -0
  18. data/lib/kitchen/command/package.rb +32 -0
  19. data/lib/kitchen/command/sink.rb +50 -0
  20. data/lib/kitchen/command/test.rb +47 -0
  21. data/lib/kitchen/command.rb +207 -0
  22. data/lib/kitchen/config.rb +344 -0
  23. data/lib/kitchen/configurable.rb +616 -0
  24. data/lib/kitchen/data_munger.rb +1024 -0
  25. data/lib/kitchen/diagnostic.rb +138 -0
  26. data/lib/kitchen/driver/base.rb +133 -0
  27. data/lib/kitchen/driver/dummy.rb +105 -0
  28. data/lib/kitchen/driver/exec.rb +70 -0
  29. data/lib/kitchen/driver/proxy.rb +70 -0
  30. data/lib/kitchen/driver/ssh_base.rb +351 -0
  31. data/lib/kitchen/driver.rb +40 -0
  32. data/lib/kitchen/errors.rb +243 -0
  33. data/lib/kitchen/generator/init.rb +254 -0
  34. data/lib/kitchen/instance.rb +726 -0
  35. data/lib/kitchen/lazy_hash.rb +148 -0
  36. data/lib/kitchen/lifecycle_hook/base.rb +78 -0
  37. data/lib/kitchen/lifecycle_hook/local.rb +53 -0
  38. data/lib/kitchen/lifecycle_hook/remote.rb +39 -0
  39. data/lib/kitchen/lifecycle_hooks.rb +92 -0
  40. data/lib/kitchen/loader/yaml.rb +377 -0
  41. data/lib/kitchen/logger.rb +422 -0
  42. data/lib/kitchen/logging.rb +52 -0
  43. data/lib/kitchen/login_command.rb +49 -0
  44. data/lib/kitchen/metadata_chopper.rb +49 -0
  45. data/lib/kitchen/platform.rb +64 -0
  46. data/lib/kitchen/plugin.rb +76 -0
  47. data/lib/kitchen/plugin_base.rb +60 -0
  48. data/lib/kitchen/provisioner/base.rb +269 -0
  49. data/lib/kitchen/provisioner/chef/berkshelf.rb +116 -0
  50. data/lib/kitchen/provisioner/chef/common_sandbox.rb +350 -0
  51. data/lib/kitchen/provisioner/chef/policyfile.rb +163 -0
  52. data/lib/kitchen/provisioner/chef_apply.rb +121 -0
  53. data/lib/kitchen/provisioner/chef_base.rb +705 -0
  54. data/lib/kitchen/provisioner/chef_infra.rb +167 -0
  55. data/lib/kitchen/provisioner/chef_solo.rb +82 -0
  56. data/lib/kitchen/provisioner/chef_zero.rb +12 -0
  57. data/lib/kitchen/provisioner/dummy.rb +75 -0
  58. data/lib/kitchen/provisioner/shell.rb +157 -0
  59. data/lib/kitchen/provisioner.rb +42 -0
  60. data/lib/kitchen/rake_tasks.rb +80 -0
  61. data/lib/kitchen/shell_out.rb +90 -0
  62. data/lib/kitchen/ssh.rb +289 -0
  63. data/lib/kitchen/state_file.rb +112 -0
  64. data/lib/kitchen/suite.rb +48 -0
  65. data/lib/kitchen/thor_tasks.rb +63 -0
  66. data/lib/kitchen/transport/base.rb +236 -0
  67. data/lib/kitchen/transport/dummy.rb +78 -0
  68. data/lib/kitchen/transport/exec.rb +145 -0
  69. data/lib/kitchen/transport/ssh.rb +579 -0
  70. data/lib/kitchen/transport/winrm.rb +546 -0
  71. data/lib/kitchen/transport.rb +40 -0
  72. data/lib/kitchen/util.rb +229 -0
  73. data/lib/kitchen/verifier/base.rb +243 -0
  74. data/lib/kitchen/verifier/busser.rb +275 -0
  75. data/lib/kitchen/verifier/dummy.rb +75 -0
  76. data/lib/kitchen/verifier/shell.rb +99 -0
  77. data/lib/kitchen/verifier.rb +39 -0
  78. data/lib/kitchen/version.rb +20 -0
  79. data/lib/kitchen/which.rb +26 -0
  80. data/lib/kitchen.rb +152 -0
  81. data/lib/vendor/hash_recursive_merge.rb +79 -0
  82. data/support/busser_install_command.ps1 +14 -0
  83. data/support/busser_install_command.sh +21 -0
  84. data/support/chef-client-fail-if-update-handler.rb +15 -0
  85. data/support/chef_base_init_command.ps1 +18 -0
  86. data/support/chef_base_init_command.sh +1 -0
  87. data/support/chef_base_install_command.ps1 +85 -0
  88. data/support/chef_base_install_command.sh +229 -0
  89. data/support/download_helpers.sh +109 -0
  90. data/support/dummy-validation.pem +27 -0
  91. data/templates/driver/CHANGELOG.md.erb +3 -0
  92. data/templates/driver/Gemfile.erb +3 -0
  93. data/templates/driver/README.md.erb +64 -0
  94. data/templates/driver/Rakefile.erb +21 -0
  95. data/templates/driver/driver.rb.erb +23 -0
  96. data/templates/driver/gemspec.erb +29 -0
  97. data/templates/driver/gitignore.erb +17 -0
  98. data/templates/driver/license_apachev2.erb +15 -0
  99. data/templates/driver/license_lgplv3.erb +16 -0
  100. data/templates/driver/license_mit.erb +22 -0
  101. data/templates/driver/license_reserved.erb +5 -0
  102. data/templates/driver/tailor.erb +4 -0
  103. data/templates/driver/travis.yml.erb +11 -0
  104. data/templates/driver/version.rb.erb +12 -0
  105. data/templates/init/chefignore.erb +2 -0
  106. data/templates/init/kitchen.yml.erb +18 -0
  107. data/test-kitchen.gemspec +52 -0
  108. metadata +528 -0
@@ -0,0 +1,63 @@
1
+ #
2
+ # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
3
+ #
4
+ # Copyright (C) 2013, Fletcher Nichol
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ module Kitchen
19
+ # Utility methods to help ouput colorized text in a terminal. The
20
+ # implementation is a compressed mashup of code from the Thor and Foreman
21
+ # projects.
22
+ #
23
+ # @author Fletcher Nichol <fnichol@nichol.ca>
24
+ module Color
25
+ ANSI = {
26
+ reset: 0, black: 30, red: 31, green: 32, yellow: 33,
27
+ blue: 34, magenta: 35, cyan: 36, white: 37,
28
+ bright_black: 90, bright_red: 91, bright_green: 92,
29
+ bright_yellow: 93, bright_blue: 94, bright_magenta: 95,
30
+ bright_cyan: 96, bright_white: 97
31
+ }.freeze
32
+
33
+ COLORS = %w{
34
+ cyan yellow green magenta blue bright_cyan bright_yellow
35
+ bright_green bright_magenta bright_blue
36
+ }.freeze
37
+
38
+ # Returns an ansi escaped string representing a color control sequence.
39
+ #
40
+ # @param name [Symbol] a valid color representation, taken from
41
+ # Kitchen::Color::ANSI
42
+ # @return [String] an ansi escaped string if the color is valid and an
43
+ # empty string otherwise
44
+ def self.escape(name)
45
+ return "" if name.nil?
46
+ return "" unless ANSI[name]
47
+
48
+ "\e[#{ANSI[name]}m"
49
+ end
50
+
51
+ # Returns a colorized ansi escaped string with the given color.
52
+ #
53
+ # @param str [String] a string to colorize
54
+ # @param name [Symbol] a valid color representation, taken from
55
+ # Kitchen::Color::ANSI
56
+ # @return [String] an ansi escaped string if the color is valid and an
57
+ # unescaped string otherwise
58
+ def self.colorize(str, name)
59
+ color = escape(name)
60
+ color.empty? ? str : "#{color}#{str}#{escape(:reset)}"
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,41 @@
1
+ #
2
+ # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
3
+ #
4
+ # Copyright (C) 2013, Fletcher Nichol
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ require_relative "../command"
19
+
20
+ require "benchmark" unless defined?(Benchmark)
21
+
22
+ module Kitchen
23
+ module Command
24
+ # Command to run a single action one or more instances.
25
+ #
26
+ # @author Fletcher Nichol <fnichol@nichol.ca>
27
+ class Action < Kitchen::Command::Base
28
+ include RunAction
29
+
30
+ # Invoke the command.
31
+ def call
32
+ banner "Starting Test Kitchen (v#{Kitchen::VERSION})"
33
+ elapsed = Benchmark.measure do
34
+ results = parse_subcommand(args.first)
35
+ run_action(action, results)
36
+ end
37
+ banner "Test Kitchen is finished. #{Util.duration(elapsed.real)}"
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,54 @@
1
+ #
2
+ # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
3
+ #
4
+ # Copyright (C) 2013, Fletcher Nichol
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ require_relative "../command"
19
+
20
+ module Kitchen
21
+ module Command
22
+ # Command to launch a Pry-based Kitchen console..
23
+ #
24
+ # @author Fletcher Nichol <fnichol@nichol.ca>
25
+ class Console < Kitchen::Command::Base
26
+ # Invoke the command.
27
+ def call
28
+ require "pry"
29
+ Pry.start(@config, prompt: [prompt(">"), prompt("*")])
30
+ rescue LoadError
31
+ warn %{Make sure you have the pry gem installed. You can install it with:}
32
+ warn %{`gem install pry` or including 'gem "pry"' in your Gemfile.}
33
+ exit 1
34
+ end
35
+
36
+ private
37
+
38
+ # Construct a custom Pry prompt proc.
39
+ #
40
+ # @param char [String] prompt character
41
+ # @return [proc] a prompt proc
42
+ # @api private
43
+ def prompt(char)
44
+ proc do |target_self, nest_level, pry|
45
+ [
46
+ "[#{pry.input_ring.size}] ",
47
+ "kc(#{Pry.view_clip(target_self.class)})",
48
+ "#{":#{nest_level}" unless nest_level == 0}#{char} ",
49
+ ].join
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,84 @@
1
+ #
2
+ # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
3
+ #
4
+ # Copyright (C) 2013, Fletcher Nichol
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ require_relative "../command"
19
+ require_relative "../diagnostic"
20
+
21
+ autoload :YAML, "yaml"
22
+
23
+ module Kitchen
24
+ module Command
25
+ # Command to log into to instance.
26
+ #
27
+ # @author Fletcher Nichol <fnichol@nichol.ca>
28
+ class Diagnose < Kitchen::Command::Base
29
+ # Invoke the command.
30
+ def call
31
+ instances = record_failure { load_instances }
32
+
33
+ loader = record_failure { load_loader }
34
+
35
+ puts YAML.dump(Kitchen::Diagnostic.new(
36
+ loader: loader, instances: instances, plugins: plugins?
37
+ ).read)
38
+ end
39
+
40
+ private
41
+
42
+ def plugins?
43
+ options[:all] || options[:plugins]
44
+ end
45
+
46
+ # Loads and returns instances if they are requested.
47
+ #
48
+ # @return [Array<Instance>] an array of instances or an empty array
49
+ # @api private
50
+ def load_instances
51
+ if options[:all] || options[:instances]
52
+ parse_subcommand(args.first)
53
+ else
54
+ []
55
+ end
56
+ end
57
+
58
+ # Loads and returns loader configuration if it is requested.
59
+ #
60
+ # @return [Hash,nil] a hash or nil
61
+ # @api private
62
+ def load_loader
63
+ @loader if options[:all] || options[:loader]
64
+ end
65
+
66
+ # Returns a hash with exception detail if an exception is raised in the
67
+ # yielded block.
68
+ #
69
+ # @return [yield,Hash] the result of the yielded block or an error hash
70
+ # @api private
71
+ def record_failure
72
+ yield
73
+ rescue => e
74
+ {
75
+ error: {
76
+ exception: e.inspect,
77
+ message: e.message,
78
+ backtrace: e.backtrace,
79
+ },
80
+ }
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,39 @@
1
+ #
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require_relative "../command"
16
+
17
+ module Kitchen
18
+ module Command
19
+ # Check for common system or configuration problems.
20
+ #
21
+ class Doctor < Kitchen::Command::Base
22
+ # Invoke the command.
23
+ def call
24
+ results = parse_subcommand(args.first)
25
+ if results.empty?
26
+ error("No instances configured, cannot check configuration. Please check your .kitchen.yml and confirm it has platform and suites sections.")
27
+ exit(1)
28
+ end
29
+ # By default only doctor the first instance to avoid output spam.
30
+ results = [results.first] unless options[:all]
31
+ failed = results.any? do |instance|
32
+ debug "Doctor on #{instance.name}."
33
+ instance.doctor_action
34
+ end
35
+ exit(1) if failed
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,37 @@
1
+ #
2
+ # Author:: SAWANOBORI Yukihiko (<sawanoboriyu@higanworks.com>)
3
+ #
4
+ # Copyright (C) 2014, HiganWorks LLC
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ require_relative "../command"
19
+
20
+ module Kitchen
21
+ module Command
22
+ # Execute command on remote instance.
23
+ #
24
+ # @author SAWANOBORI Yukihiko (<sawanoboriyu@higanworks.com>)
25
+ class Exec < Kitchen::Command::Base
26
+ # Invoke the command.
27
+ def call
28
+ results = parse_subcommand(args.first)
29
+
30
+ results.each do |instance|
31
+ banner "Execute command on #{instance.name}."
32
+ instance.remote_exec(options[:command])
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,148 @@
1
+ #
2
+ # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
3
+ #
4
+ # Copyright (C) 2013, Fletcher Nichol
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ require_relative "../command"
19
+ require "json" unless defined?(JSON)
20
+
21
+ module Kitchen
22
+ module Command
23
+ # Command to list one or more instances.
24
+ #
25
+ # @author Fletcher Nichol <fnichol@nichol.ca>
26
+ class List < Kitchen::Command::Base
27
+ # Invoke the command.
28
+ def call
29
+ result = parse_subcommand(args.first)
30
+ if options[:debug]
31
+ die "The --debug flag on the list subcommand is deprecated, " \
32
+ "please use `kitchen diagnose'."
33
+ elsif options[:bare]
34
+ puts Array(result).map(&:name).join("\n")
35
+ elsif options[:json]
36
+ puts JSON.pretty_generate(Array(result).map { |r| to_hash(r) })
37
+ else
38
+ list_table(result)
39
+ end
40
+ end
41
+
42
+ private
43
+
44
+ # Add a trailing ansi color escape code to line up columns of colored
45
+ # output.
46
+ #
47
+ # @param string [String] a string
48
+ # @return [String]
49
+ # @api private
50
+ def color_pad(string)
51
+ string + colorize("", :white)
52
+ end
53
+
54
+ # Generate the display rows for an instance.
55
+ #
56
+ # @param instance [Instance] an instance
57
+ # @return [Array<String>]
58
+ # @api private
59
+ def display_instance(instance)
60
+ [
61
+ color_pad(instance.name),
62
+ color_pad(instance.driver.name),
63
+ color_pad(instance.provisioner.name),
64
+ color_pad(instance.verifier.name),
65
+ color_pad(instance.transport.name),
66
+ format_last_action(instance.last_action),
67
+ format_last_error(instance.last_error),
68
+ ]
69
+ end
70
+
71
+ # Format and color the given last action.
72
+ #
73
+ # @param last_action [String] the last action
74
+ # @return [String] formated last action
75
+ # @api private
76
+ def format_last_action(last_action)
77
+ case last_action
78
+ when "create" then colorize("Created", :cyan)
79
+ when "converge" then colorize("Converged", :magenta)
80
+ when "setup" then colorize("Set Up", :blue)
81
+ when "verify" then colorize("Verified", :yellow)
82
+ when nil then colorize("<Not Created>", :red)
83
+ else colorize("<Unknown>", :white)
84
+ end
85
+ end
86
+
87
+ # Format and color the given last error.
88
+ #
89
+ # @param last_error [String] the last error
90
+ # @return [String] formated last error
91
+ # @api private
92
+ def format_last_error(last_error)
93
+ case last_error
94
+ when nil then colorize("<None>", :white)
95
+ else colorize(last_error, :red)
96
+ end
97
+ end
98
+
99
+ # Constructs a list display table and output it to the screen.
100
+ #
101
+ # @param result [Array<Instance>] an array of instances
102
+ # @api private
103
+ def list_table(result)
104
+ table = [
105
+ [
106
+ colorize("Instance", :green), colorize("Driver", :green),
107
+ colorize("Provisioner", :green), colorize("Verifier", :green),
108
+ colorize("Transport", :green), colorize("Last Action", :green),
109
+ colorize("Last Error", :green)
110
+ ],
111
+ ]
112
+ table += Array(result).map { |i| display_instance(i) }
113
+ print_table(table)
114
+ end
115
+
116
+ # Constructs a hashtable representation of a single instance.
117
+ #
118
+ # @param result [Hash{Symbol => String}] hash of a single instance
119
+ # @api private
120
+ def to_hash(result)
121
+ {
122
+ instance: result.name,
123
+ driver: result.driver.name,
124
+ provisioner: result.provisioner.name,
125
+ verifier: result.verifier.name,
126
+ transport: result.transport.name,
127
+ last_action: result.last_action,
128
+ last_error: result.last_error,
129
+ }
130
+ end
131
+
132
+ # Outputs a formatted display table.
133
+ #
134
+ # @api private
135
+ def print_table(*args)
136
+ shell.print_table(*args)
137
+ end
138
+
139
+ # Colorize a string.
140
+ #
141
+ # @return [String] a colorized string
142
+ # @api private
143
+ def colorize(*args)
144
+ shell.set_color(*args)
145
+ end
146
+ end
147
+ end
148
+ end
@@ -0,0 +1,39 @@
1
+ #
2
+ # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
3
+ #
4
+ # Copyright (C) 2013, Fletcher Nichol
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ require_relative "../command"
19
+
20
+ module Kitchen
21
+ module Command
22
+ # Command to log into to instance.
23
+ #
24
+ # @author Fletcher Nichol <fnichol@nichol.ca>
25
+ class Login < Kitchen::Command::Base
26
+ # Invoke the command.
27
+ def call
28
+ results = parse_subcommand(args.first)
29
+ if results.size > 1
30
+ die "Argument `#{args.first}' returned multiple results:\n" +
31
+ results.map { |i| " * #{i.name}" }.join("\n")
32
+ end
33
+ instance = results.pop
34
+
35
+ instance.login
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,32 @@
1
+ #
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require_relative "../command"
16
+
17
+ module Kitchen
18
+ module Command
19
+ # Execute command on remote instance.
20
+ #
21
+ class Package < Kitchen::Command::Base
22
+ # Invoke the command.
23
+ def call
24
+ results = parse_subcommand(args.first)
25
+ results.each do |instance|
26
+ banner "Package on #{instance.name}."
27
+ instance.package_action
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,50 @@
1
+ #
2
+ # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
3
+ #
4
+ # Copyright (C) 2013, Fletcher Nichol
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ require_relative "../command"
19
+
20
+ module Kitchen
21
+ module Command
22
+ # Command to... include the sink.
23
+ #
24
+ # @author Seth Vargo <sethvargo@gmail.com>
25
+ class Sink < Kitchen::Command::Base
26
+ # Invoke the command.
27
+ def call
28
+ puts [
29
+ "",
30
+ " ___ ",
31
+ " ' _ '. ",
32
+ ' / /` `\\ \\ ',
33
+ " | | [__] ",
34
+ " | | {{ ",
35
+ " | | }} ",
36
+ " _ | | _ {{ ",
37
+ " ___________<_>_| |_<_>}}________ ",
38
+ " .=======^=(___)=^={{====. ",
39
+ ' / .----------------}}---. \\ ',
40
+ ' / / {{ \\ \\ ',
41
+ ' / / }} \\ \\ ',
42
+ " ( '=========================' ) ",
43
+ " '-----------------------------' ",
44
+ " ", # necessary newline
45
+ "",
46
+ ].map(&:rstrip).join("\n")
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,47 @@
1
+ #
2
+ # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
3
+ #
4
+ # Copyright (C) 2013, Fletcher Nichol
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ require_relative "../command"
19
+
20
+ require "benchmark" unless defined?(Benchmark)
21
+
22
+ module Kitchen
23
+ module Command
24
+ # Command to test one or more instances.
25
+ #
26
+ # @author Fletcher Nichol <fnichol@nichol.ca>
27
+ class Test < Kitchen::Command::Base
28
+ include RunAction
29
+
30
+ # Invoke the command.
31
+ def call
32
+ unless %w{passing always never}.include?(options[:destroy])
33
+ raise ArgumentError, "Destroy mode must be passing, always, or never."
34
+ end
35
+
36
+ banner "Starting Test Kitchen (v#{Kitchen::VERSION})"
37
+ elapsed = Benchmark.measure do
38
+ destroy_mode = options[:destroy].to_sym
39
+ results = parse_subcommand(args.join("|"))
40
+
41
+ run_action(:test, results, destroy_mode)
42
+ end
43
+ banner "Test Kitchen is finished. #{Util.duration(elapsed.real)}"
44
+ end
45
+ end
46
+ end
47
+ end