Class: Teststrap::Teststrap

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/teststrap.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cookbook_nameObject

Returns the value of attribute cookbook_name.



8
9
10
# File 'lib/teststrap.rb', line 8

def cookbook_name
  @cookbook_name
end

Instance Method Details

#generate_testsObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/teststrap.rb', line 13

def generate_tests
  @cookbook_name = current_directory_name
  puts 'generating testfiles::'
  copy_file '.gitignore'
  copy_file '.rubocop.yml'
  copy_file 'Berksfile'
  copy_file 'chefignore'
  copy_file 'Gemfile'
  copy_file 'LICENSE'
  copy_file 'rubocop-disabled.yml'
  copy_file 'Strainerfile'
  copy_file 'Thorfile'
  template 'spec/default_spec.rb'
  template 'spec/chefspec_helper.rb'
  template 'test/integration/default/serverspec/localhost/default_spec.rb',
           "test/integration/#{@cookbook_name}/serverspec/localhost/default_spec.rb"
  template 'test/integration/default/serverspec/spec_helper.rb',
           "test/integration/#{@cookbook_name}/serverspec/spec_helper.rb"
  template '.kitchen.yml'
  template 'metadata.rb'
  template 'README.md'
end