sambot 0.1.41 → 0.1.42

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba731bab2513c08744cb5d8486759a60d6ae1683
4
- data.tar.gz: 9eeb26209320e7ba4eb913ccf15a77ef0a40e080
3
+ metadata.gz: 4c70a73f177268cdb467c2199937845ca0260738
4
+ data.tar.gz: a279ca714365f1b6c7537612914b6bd3548bdab2
5
5
  SHA512:
6
- metadata.gz: 6e29ede2e9909138c15ed2e5f88105dd8474494a06575b9f92cc980165d6689322589b6c8183adeb7728e7e4272cf96329b1942fcbe1b9e4b1f1fa2e9f153fea
7
- data.tar.gz: 03245d418abcbabbd024ef675e5991e577911c1c74669b2717087b0654321f83dc127004f83726b3daed14cd0672f415d0821ee77c8cf189c8159b61b1cf8b4b
6
+ metadata.gz: 00f754648cef2655993c2744b689153aa84e77e387e3910822451c82c711ff1be64d46007d6356ab520451a4c787b96ade84798dcd65fcea2dc592b5c14cfced
7
+ data.tar.gz: e0ba908cbba185fca5f3d6bc186a7581f7ca9f56ac3e1e8269f36fff8ee37a56f15ac902d663f6661bafd8a4e6d49854f3c442d2a83254d962f1ff36c78d4d22
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.2.6
1
+ 2.4.0
@@ -35,7 +35,7 @@ module Sambot
35
35
  LONGDESC
36
36
  def build
37
37
  ensure_latest
38
- modified_files = Sambot::Domain::Cookbooks::AssistantChef.new.build_cookbook(ESSENTIAL_FILES, GENERATED_FILES)
38
+ modified_files = Domain::Cookbooks::AssistantChef.new.build_cookbook(ESSENTIAL_FILES, GENERATED_FILES)
39
39
  modified_files.each {|file| debug("./#{file} has been added to the cookbook.")}
40
40
  info('The cookbook has been successfully built.')
41
41
  rescue Domain::Common::ApplicationException => e
@@ -47,15 +47,13 @@ module Sambot
47
47
  `sambot cookbook generate` will create a new cookbook. This can be either a
48
48
  wrapper cookbook or an instance role cookbook.
49
49
  LONGDESC
50
- option :name
51
- option :platform, :desc => 'Can be either "windows" or "linux"'
52
- option :type, :desc => 'Can be either "wrapper" or "role"'
53
50
  def generate()
54
51
  ensure_latest
55
52
  name = ask(' What is the name of this cookbook?')
53
+ description = ask(' What does this cookbook do?')
56
54
  platform = ask(' What operating system will this cookbook run on?', :limited_to => ['windows', 'linux'])
57
55
  type = ask(' What type of cookbook will this be?', :limited_to => ['wrapper', 'role'])
58
- Sambot::Domain::Cookbooks::AssistantChef.new.generate_cookbook(name, options[:platform], options[:type], ESSENTIAL_FILES, GENERATED_FILES)
56
+ Sambot::Domain::Cookbooks::AssistantChef.new.generate_cookbook(name, platform, type, description, ESSENTIAL_FILES, GENERATED_FILES)
59
57
  info('The cookbook has been successfully generated.')
60
58
  rescue Domain::Common::ApplicationException => e
61
59
  error(e.message)
@@ -2,7 +2,7 @@ module Sambot
2
2
  module Domain
3
3
  module Common
4
4
  module UI
5
-
5
+
6
6
  def debug(msg)
7
7
  say("debug: #{msg}", :yellow)
8
8
  end
@@ -1,4 +1,5 @@
1
1
  require 'yaml'
2
+ require 'git'
2
3
 
3
4
  module Sambot
4
5
  module Domain
@@ -27,24 +28,34 @@ module Sambot
27
28
  end
28
29
 
29
30
  def generate_cookbook(name, platform, type, description, essential_files, generated_files)
30
- FileUtils.mkdir(name)
31
- FileUtils.mkdir(File.join(name, 'test'))
32
- FileUtils.mkdir(File.join(name, 'spec'))
33
- FileUtils.mkdir(File.join(name, 'recipes'))
31
+ Git.init(name)
34
32
  Dir.chdir(name) do
35
- write_config(description, platform, type)
33
+ FileUtils.mkdir('test')
34
+ FileUtils.mkdir('spec')
35
+ FileUtils.mkdir('recipes')
36
+ FileUtils.touch('README.md')
37
+ write_config(name, description, platform, type)
36
38
  build_cookbook(essential_files, generated_files)
37
39
  end
38
40
  end
39
41
 
40
42
  private
41
43
 
42
- def write_config(description, platform, type)
44
+ def write_config(name, description, platform, type)
43
45
  contents = {
44
- :version => '0.0.1',
45
- :platform => platform,
46
- :suites => nil,
47
- :description => nil
46
+ 'name' => name,
47
+ 'version' => '0.0.1',
48
+ 'platform' => platform,
49
+ 'suites' => [{
50
+ 'name' => 'default',
51
+ 'run_list' => [
52
+ "recipe[#{name}]"
53
+ ],
54
+ 'verifier' => {
55
+ 'inspec_tests' => ['./test']
56
+ }
57
+ }],
58
+ 'description' => description,
48
59
  }.to_yaml
49
60
  File.write('.config.yml', contents)
50
61
  end
@@ -81,7 +92,7 @@ module Sambot
81
92
  end
82
93
 
83
94
  def build_metadata(config)
84
- result = Metadata.new.generate(config['name'], config['platform'], config['version'], config['description'])
95
+ result = Metadata.new.generate(config['name'], config['platform'], config['version'], config['description'], config['dependencies'])
85
96
  File.write('metadata.rb', result)
86
97
  @modified_files << 'metadata.rb'
87
98
  end
@@ -5,12 +5,13 @@ module Sambot
5
5
  module Cookbooks
6
6
  class Metadata
7
7
 
8
- def generate(name, platform, version, description)
8
+ def generate(name, platform, version, description, dependencies = nil)
9
9
  context = {
10
10
  'cookbook_name' => name,
11
- 'cookbook_platfrom' => platform,
11
+ 'cookbook_platform' => platform,
12
12
  'cookbook_version' => version,
13
- 'cookbook_description' => description
13
+ 'cookbook_description' => description,
14
+ 'cookbook_dependencies' => dependencies
14
15
  }
15
16
  generate_metadata(context)
16
17
  end
@@ -8,3 +8,9 @@ version '<%= @cookbook_version %>'
8
8
  chef_version '>=12'
9
9
  issues_url 'https://github.exacttarget.com/ads-cookbooks/<%= @cookbook_name %>/issues'
10
10
  source_url 'https://github.exacttarget.com/ads-cookbooks/<%= @cookbook_name %>'
11
+ supports '<%= @cookbook_platform %>'
12
+ <% if @cookbook_dependencies %>
13
+ <% @cookbook_dependencies.each do |dependency| %>
14
+ depends '<%= dependency %>'
15
+ <% end %>
16
+ <% end %>
@@ -1,3 +1,3 @@
1
1
  module Sambot
2
- VERSION = '0.1.41'.freeze
2
+ VERSION = '0.1.42'.freeze
3
3
  end
data/sambot.gemspec CHANGED
@@ -19,6 +19,8 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = 'sambot'
20
20
  spec.require_paths = ['lib']
21
21
 
22
+ spec.add_dependency 'git'
23
+ spec.add_dependency 'chef', '~> 12.18'
22
24
  spec.add_dependency 'thor', '~> 0.19'
23
25
  spec.add_dependency 'erubis', '~> 2.7', '>= 2.7.0'
24
26
  spec.add_dependency 'gems', '~> 1.0', '>= 1.0.0'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sambot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.41
4
+ version: 0.1.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - Olivier Kouame
@@ -10,6 +10,34 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2017-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: git
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: chef
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '12.18'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '12.18'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: thor
15
43
  requirement: !ruby/object:Gem::Requirement
@@ -210,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
238
  version: '0'
211
239
  requirements: []
212
240
  rubyforge_project:
213
- rubygems_version: 2.4.5.2
241
+ rubygems_version: 2.6.8
214
242
  signing_key:
215
243
  specification_version: 4
216
244
  summary: Tooling for a DevOps workflow