Class: Kitchenplan::Cli
- Inherits:
-
Thor
- Object
- Thor
- Kitchenplan::Cli
- Includes:
- Thor::Actions
- Defined in:
- lib/kitchenplan/cli.rb
Instance Method Summary collapse
Instance Method Details
#provision(targetdir = '/opt') ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/kitchenplan/cli.rb', line 56 def provision(targetdir='/opt') logo pid = Process.fork do dorun "while true; do sudo -n true; sleep 60; kill -0 \"$$\" || exit; done 2>/dev/null" end Process.detach pid prepare_folders(targetdir) install_bundler(targetdir) recipes = parse_config(targetdir) fetch_cookbooks(targetdir, [:debug]) unless ['no-fetch'] run_chef(targetdir, ([:recipes] ? [:recipes] : recipes), [:solorb], [:debug]) cleanup(targetdir, [:debug]) Process.kill(9, pid) print_notice('Installation complete!') end |
#setup(targetdir = '/opt') ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/kitchenplan/cli.rb', line 17 def setup(targetdir='/opt') gitrepo = [:gitrepo] logo install_clt unless File.exist? "/Library/Developer/CommandLineTools/usr/bin/clang" if gitrepo || File.exists?("#{targetdir}/kitchenplan") fetch(gitrepo, targetdir) else has_config = yes?('Do you have a config repository? [y,n]', :green) if has_config gitrepo = ask('Please enter the clone URL of your git config repository:', :green) fetch(gitrepo, targetdir) else create(targetdir) end end unless File.exists?("#{targetdir}/kitchenplan/config/people/#{ENV['USER']}.yml") user_create = [:config] user_create = yes?("config/people/#{ENV['USER']}.yml does not exist. Do you wish to create it? [y,n]", :green) if user_create.nil? if user_create create_user(targetdir) end end end |