class Soloist::CLI

Attributes

soloist_config[W]

Public Instance Methods

chef() click to toggle source
# File lib/soloist/cli.rb, line 15
def chef
  install_cookbooks if cheffile_exists?
  soloist_config.run_chef
end
config() click to toggle source
# File lib/soloist/cli.rb, line 29
def config
  Kernel.ap(soloist_config.as_node_json)
end
install_cookbooks() click to toggle source
# File lib/soloist/cli.rb, line 34
def install_cookbooks
  Dir.chdir(File.dirname(rc_path)) do
    Librarian::Chef::Cli.with_environment do
      Librarian::Chef::Cli.new.install
    end
  end
end
run_recipe(*recipes) click to toggle source
# File lib/soloist/cli.rb, line 23
def run_recipe(*recipes)
  soloist_config.royal_crown.recipes = recipes
  chef
end
soloist_config() click to toggle source
# File lib/soloist/cli.rb, line 42
def soloist_config
  @soloist_config ||= if options[:remote]
    Soloist::RemoteConfig.from_file(rc_path, remote)
  else
    Soloist::Config.from_file(rc_path)
  end.tap do |config|
    config.merge!(rc_local) if rc_local_path
  end
end

Private Instance Methods

cheffile_exists?() click to toggle source
# File lib/soloist/cli.rb, line 66
def cheffile_exists?
  File.exists?(File.expand_path("../Cheffile", rc_path))
end
rc_local() click to toggle source
# File lib/soloist/cli.rb, line 54
def rc_local
  Soloist::Config.from_file(rc_local_path)
end
rc_local_path() click to toggle source
# File lib/soloist/cli.rb, line 74
def rc_local_path
  @rc_local_path ||= Soloist::Spotlight.find("soloistrc_local", ".soloistrc_local")
end
rc_path() click to toggle source
# File lib/soloist/cli.rb, line 70
def rc_path
  @rc_path ||= Soloist::Spotlight.find!("soloistrc", ".soloistrc")
end
remote() click to toggle source
# File lib/soloist/cli.rb, line 58
def remote
  @remote ||= if options[:identity]
    Soloist::Remote.from_uri(options[:remote], options[:identity])
  else
    Soloist::Remote.from_uri(options[:remote])
  end
end