Class: Itamae::CLI
- Inherits:
-
Thor
- Object
- Thor
- Itamae::CLI
- Defined in:
- lib/itamae/cli.rb
Constant Summary collapse
- GENERATE_TARGETS =
%w[cookbook role].freeze
Class Method Summary collapse
Instance Method Summary collapse
- #destroy(target, name) ⇒ Object
- #docker(*recipe_files) ⇒ Object
- #generate(target, name) ⇒ Object
- #init(name) ⇒ Object
-
#initialize ⇒ CLI
constructor
A new instance of CLI.
- #jail(*recipe_files) ⇒ Object
- #local(*recipe_files) ⇒ Object
- #ssh(*recipe_files) ⇒ Object
- #version ⇒ Object
Constructor Details
Class Method Details
.define_exec_options ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/itamae/cli.rb', line 15 def self. option :recipe_graph, type: :string, desc: "[EXPERIMENTAL] Write recipe dependency graph in DOT", banner: "PATH" option :node_json, type: :string, aliases: ['-j'] option :node_yaml, type: :string, aliases: ['-y'] option :dry_run, type: :boolean, aliases: ['-n'] option :shell, type: :string, default: "/bin/sh" option :login_shell, type: :boolean, default: false option :ohai, type: :boolean, default: false, desc: "This option is DEPRECATED and will be unavailable." option :profile, type: :string, desc: "[EXPERIMENTAL] Save profiling data", banner: "PATH" option :detailed_exitcode, type: :boolean, default: false, desc: "exit code 0 - The run succeeded with no changes or failures, exit code 1 - The run failed, exit code 2 - The run succeeded, and some resources were changed" option :log_level, type: :string, aliases: ['-l'], default: 'info' option :color, type: :boolean, default: true option :config, type: :string, aliases: ['-c'] end |
Instance Method Details
#destroy(target, name) ⇒ Object
111 112 113 114 115 116 117 |
# File 'lib/itamae/cli.rb', line 111 def destroy(target, name) validate_generate_target!('destroy', target) generator = Generators.find(target).new generator.destination_root = File.join("#{target}s", name) generator.remove_files end |
#docker(*recipe_files) ⇒ Object
68 69 70 71 72 73 74 |
# File 'lib/itamae/cli.rb', line 68 def docker(*recipe_files) if recipe_files.empty? raise "Please specify recipe files." end run(recipe_files, :docker, ) end |
#generate(target, name) ⇒ Object
101 102 103 104 105 106 107 |
# File 'lib/itamae/cli.rb', line 101 def generate(target, name) validate_generate_target!('generate', target) generator = Generators.find(target).new generator.destination_root = File.join("#{target}s", name) generator.copy_files end |
#init(name) ⇒ Object
93 94 95 96 97 |
# File 'lib/itamae/cli.rb', line 93 def init(name) generator = Generators::Project.new generator.destination_root = name generator.invoke_all end |
#jail(*recipe_files) ⇒ Object
79 80 81 82 83 84 85 |
# File 'lib/itamae/cli.rb', line 79 def jail(*recipe_files) if recipe_files.empty? raise "Please specify recipe files." end run(recipe_files, :jexec, ) end |
#local(*recipe_files) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/itamae/cli.rb', line 32 def local(*recipe_files) if recipe_files.empty? raise "Please specify recipe files." end run(recipe_files, :local, ) end |
#ssh(*recipe_files) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/itamae/cli.rb', line 50 def ssh(*recipe_files) if recipe_files.empty? raise "Please specify recipe files." end unless [:host] || [:vagrant] raise "Please set '-h <hostname>' or '--vagrant'" end run(recipe_files, :ssh, ) end |