Class: Sambot::Commands::CookbookCmd

Inherits:
BaseCommand show all
Defined in:
lib/sambot/commands/cookbook_cmd.rb

Instance Method Summary collapse

Methods inherited from Thor

command_help

Instance Method Details

#buildObject



18
19
20
# File 'lib/sambot/commands/cookbook_cmd.rb', line 18

def build
  execute { Chef::Cookbook.build(config) }
end

#cleanObject



13
14
15
# File 'lib/sambot/commands/cookbook_cmd.rb', line 13

def clean
  execute { Chef::Cookbook.clean() }
end

#generateObject



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/sambot/commands/cookbook_cmd.rb', line 23

def generate
  execute do
    config = {
      name: ask(' What is the name of this cookbook?'),
      type: ask(' What type of cookbook will this be?', :limited_to => ['wrapper', 'role']),
      platforms: ask(' What operating system will this cookbook run on?', :limited_to => ['windows', 'centos', 'both']),
      description: ask(' What does this cookbook do?')
    }
    config[:identifier] = ask(' What will be the unique machiner identifier for this role cookbook?') if config[:type] == 'role'
    config[:platforms] = config[:platforms] == 'both' ? ['centos', 'windows'] : [config[:platforms]]
    Chef::Cookbook.generate(config)
  end
end

#versionObject



38
39
40
# File 'lib/sambot/commands/cookbook_cmd.rb', line 38

def version
  execute { puts "##teamcity[buildNumber '#{config['version'].to_s}']" }
end