Class: ChefEnv::Tasks
- Inherits:
-
Thor
- Object
- Thor
- ChefEnv::Tasks
- Defined in:
- lib/chefenv.rb
Instance Method Summary collapse
Instance Method Details
#current ⇒ Object
31 32 33 |
# File 'lib/chefenv.rb', line 31 def current() puts current_environment end |
#init ⇒ Object
36 37 38 39 40 41 |
# File 'lib/chefenv.rb', line 36 def init() FileUtils.mkdir_p(chefenv_dir) unless File.directory?(chefenv_dir) FileUtils.mkdir_p(environments_dir) unless File.directory?(environments_dir) FileUtils.safe_unlink(chef_dir) list end |
#list ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/chefenv.rb', line 10 def list current = current_environment available_environments.each do |env| puts "#{(env == current) ? '*' : ' '} #{env}" end if available_environments.empty? puts "No Environments Available" end end |
#use(env = "") ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/chefenv.rb', line 21 def use(env="") if available_environments.include?(env) select_environment(env) else puts "'#{env}' is not a known environment." end list end |