Class: Sambot::Commands::Cookbook

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

Instance Method Summary collapse

Methods inherited from Thor

command_help

Instance Method Details

#buildObject



19
20
21
# File 'lib/sambot/commands/cookbook.rb', line 19

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

#cleanObject



14
15
16
# File 'lib/sambot/commands/cookbook.rb', line 14

def clean
  execute { Chef::Cookbook.clean(GENERATED_FILES - ['.gitignore']) }
end

#generateObject



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

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

#registerObject



41
42
43
# File 'lib/sambot/commands/cookbook.rb', line 41

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

#versionObject



36
37
38
# File 'lib/sambot/commands/cookbook.rb', line 36

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