teststrap 1.1.8 → 1.2.0

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: ddab98fc60db906951e8f6eabf22d9e44cf16b2a
4
- data.tar.gz: 437f94278b9492efc34a1228527cc59482fe9ca2
3
+ metadata.gz: 4111e91c3b159c7785f7a2d8065db40301f37b6f
4
+ data.tar.gz: f8cce3d5304e2baee95ec5fdf51cb27acbe3da09
5
5
  SHA512:
6
- metadata.gz: c0fba0d48817eb00b7e0c120602c3d332ad516ac6a09de99d50fadb10accdfdb4c0db984e2d08610eed3b1bf9989217ae346ae5e6c0ab4da97afc56102da78d3
7
- data.tar.gz: 01d5dd6cd815a983e92c97eda9447a069e4af2a306f85db9e8a69a973502afed49591f066961ad13de7d51d053d88bdbb0445a134b9bf142543073980beba813
6
+ metadata.gz: 3498204ced986179f7b32e7d874daae8601308f434415e0783d5baef420f27a157ca20e8507cf3d2e738622b9d9b9e53f3202b35c7de02de65958b66f0528840
7
+ data.tar.gz: ead1beb34f2a6a6a088e10b6e7a1c3828ada2001f87decd50547b597d22af7096e201452bf1576ed731a98b4a25bda9010e1667cb95159d2756338a2484f1c6c
@@ -3,6 +3,9 @@ driver_plugin: vagrant
3
3
  driver_config:
4
4
  require_chef_omnibus: true
5
5
 
6
+ provisioner:
7
+ name: chef_zero
8
+
6
9
  platforms:
7
10
  - name: sl6-box
8
11
  driver_config:
@@ -10,7 +13,8 @@ platforms:
10
13
  box_url: http://lyte.id.au/vagrant/sl6-matrix-64-lyte.box
11
14
 
12
15
  suites:
13
- - name: default
16
+ - name: <%= cookbook_name %>
14
17
  run_list: [ "recipe[<%= cookbook_name %>::default]" ]
15
18
  attributes: {
19
+ "dev_mode": true
16
20
  }
@@ -0,0 +1,6 @@
1
+ inherit_from:
2
+ - rubocop-disabled.yml
3
+
4
+ AllCops:
5
+ Excludes:
6
+ - vendor/**
@@ -1,18 +1,22 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'json', '1.7.7'
4
- gem 'berkshelf', '~> 2.0.10'
5
- gem 'thor-foodcritic', '~> 1.1.0'
4
+ gem 'berkshelf', '~> 2.0'
5
+ gem 'thor-foodcritic', '~> 1.1'
6
6
 
7
- gem 'tailor', '~> 1.3.1'
8
- gem 'strainer', '~> 3.3.0'
9
- gem 'foodcritic', '~> 3.0.3'
7
+ gem 'rubocop', '~> 0.18'
8
+ gem 'strainer', '~> 3.3'
9
+ gem 'foodcritic', '~> 3.0'
10
10
 
11
- gem 'chef', '~> 11.6.0'
12
- gem 'chefspec', '~> 3.0.2'
11
+ gem 'chef', '~> 11.8'
12
+ gem 'chefspec', '~> 3.0'
13
13
 
14
14
  group :integration do
15
- gem 'test-kitchen', '~> 1.1.1'
16
- gem 'kitchen-vagrant', '~> 0.14.0'
17
- gem 'serverspec', '~> 0.13.2'
15
+ gem 'test-kitchen', '~> 1.1'
16
+ gem 'kitchen-vagrant', '~> 0.14'
17
+ gem 'serverspec', '~> 0.15'
18
+ end
19
+
20
+ group :test do
21
+ gem 'chef-vault'
18
22
  end
@@ -1,3 +1,3 @@
1
- Copyright (C) 2013 Casecommons
1
+ Copyright (C) 2014 Casecommons
2
2
 
3
3
  All rights reserved - Do Not Redistribute
@@ -10,7 +10,7 @@
10
10
  # Recipes
11
11
 
12
12
  # Running test(unit and integration test)
13
- + Run chefspec, foodcritic and tailor using strainer:
13
+ + Run chefspec, foodcritic and rubocop using strainer:
14
14
 
15
15
  bundle install
16
16
  bundle exec strainer test
@@ -1,3 +1,3 @@
1
1
  foodcritic: bundle exec foodcritic -f any $SANDBOX/$COOKBOOK
2
- tailor: bundle exec tailor $SANDBOX/$COOKBOOK/**/*.rb
3
- chefspec: bundle exec rspec $SANDBOX/$COOKBOOK/spec/*.rb --color
2
+ rubocop: bundle exec rubocop $SANDBOX/$COOKBOOK/**/*.rb
3
+ chefspec: bundle exec rspec $SANDBOX/$COOKBOOK/spec/**/*.rb --color
@@ -0,0 +1,11 @@
1
+ Documentation:
2
+ Enabled: false
3
+
4
+ LineLength:
5
+ Enabled: false
6
+
7
+ MethodLength:
8
+ Enabled: false
9
+
10
+ RegexpLiteral:
11
+ Enabled: false
@@ -1,11 +1,9 @@
1
- def mock_encrypted_databag(bag, key, return_value)
2
- stub_data_bag_item('encryption_keys', 'databag_encryption_key').
3
- and_return({ 'id' => 'databag_encryption_key', 'key' => 'secret' })
4
-
5
- allow(Chef::EncryptedDataBagItem).to receive(:load_secret).
6
- and_return('secret')
1
+ require 'chefspec'
2
+ require 'chefspec/berkshelf'
3
+ require 'chef-vault'
7
4
 
8
- expect(Chef::EncryptedDataBagItem).to receive(:load).
9
- with(bag, key, 'secret').
5
+ def mock_encrypted_databag(bag, key, return_value)
6
+ allow(ChefVault::Item).to receive(:load).
7
+ with(bag, key).
10
8
  and_return(return_value)
11
9
  end
@@ -5,6 +5,6 @@ require 'chefspec/berkshelf'
5
5
  describe "<%= cookbook_name %>::default" do
6
6
  let(:chef_run) do
7
7
  ChefSpec::Runner.new do |node|
8
- end.converge '<%= cookbook_name %>::default'
8
+ end.converge(described_recipe)
9
9
  end
10
10
  end
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
- # http://serverspec.org/ for details
2
+
3
3
  describe '<%= cookbook_name %>::default' do
4
4
  it '' do
5
5
  pending
@@ -5,4 +5,5 @@ include SpecInfra::Helper::DetectOS
5
5
 
6
6
  RSpec.configure do |c|
7
7
  c.sudo_password = ENV['SUDO_PASSWORD']
8
+ c.path = '/sbin:/usr/sbin'
8
9
  end
data/lib/teststrap.rb CHANGED
@@ -14,10 +14,12 @@ module Teststrap
14
14
  @cookbook_name = current_directory_name
15
15
  puts "generating testfiles::"
16
16
  copy_file ".gitignore"
17
+ copy_file ".rubocop.yml"
17
18
  copy_file "Berksfile"
18
19
  copy_file "chefignore"
19
20
  copy_file "Gemfile"
20
21
  copy_file "LICENSE"
22
+ copy_file "rubocop-disabled.yml"
21
23
  copy_file "Strainerfile"
22
24
  copy_file "Thorfile"
23
25
  template "spec/default_spec.rb"
@@ -29,25 +31,6 @@ module Teststrap
29
31
  template "README.md"
30
32
  end
31
33
 
32
- desc "encrypt [data_path] [secret_path]", "encrypt plain databag item to encrypted databag item"
33
- def encrypt(data_path, secret_path)
34
- if !File.exist?(data_path)
35
- puts "file: #{data_path} doesn't exists"
36
- return nil
37
- end
38
-
39
- if !File.exist?(secret_path)
40
- puts "secret key file: #{secret_path} doesn't exists"
41
- return nil
42
- end
43
-
44
- plain_data = JSON.parse(File.read(data_path))
45
- secret = Chef::EncryptedDataBagItem.load_secret(secret_path)
46
- encrypted_data = Chef::EncryptedDataBagItem.encrypt_data_bag_item(plain_data, secret)
47
- puts JSON.pretty_generate(encrypted_data)
48
- return encrypted_data
49
- end
50
-
51
34
  no_commands do
52
35
  def current_directory_name
53
36
  Dir.pwd.split('/').last
@@ -53,15 +53,4 @@ describe Teststrap::Teststrap do
53
53
  .to include 'teststrap/generator_files'
54
54
  end
55
55
  end
56
-
57
- describe "encrypt" do
58
- it "encrypt data file with secret key" do
59
- directory = File.dirname(__FILE__)
60
- data_path = File.expand_path('test/data.json', directory)
61
- secret_path = File.expand_path('test/secret', directory)
62
- key = teststrap.encrypt(data_path, secret_path)
63
- expect(key["id"]).to eq "user"
64
- expect(key["password"]["cipher"]).to eq "aes-256-cbc"
65
- end
66
- end
67
56
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teststrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.8
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Casecommons
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-13 00:00:00.000000000 Z
11
+ date: 2013-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 0.18.0
19
+ version: '0.18'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 0.18.0
26
+ version: '0.18'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: chef
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 11.6.0
33
+ version: '11.8'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: 11.6.0
40
+ version: '11.8'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: 2.14.1
47
+ version: '2.14'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: 2.14.1
54
+ version: '2.14'
55
55
  description: A test generator for cookbook
56
56
  email: casebook-dev@googlegroups.com
57
57
  executables:
@@ -59,26 +59,26 @@ executables:
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - lib/teststrap.rb
62
+ - bin/teststrap
63
+ - generator_files/.gitignore
64
+ - generator_files/.kitchen.yml
65
+ - generator_files/.rubocop.yml
63
66
  - generator_files/Berksfile
64
- - generator_files/chefignore
65
67
  - generator_files/Gemfile
66
68
  - generator_files/LICENSE
67
- - generator_files/metadata.rb
68
69
  - generator_files/README.md
70
+ - generator_files/Strainerfile
71
+ - generator_files/Thorfile
72
+ - generator_files/chefignore
73
+ - generator_files/metadata.rb
74
+ - generator_files/rubocop-disabled.yml
69
75
  - generator_files/spec/chefspec_helper.rb
70
76
  - generator_files/spec/default_spec.rb
71
- - generator_files/Strainerfile
72
77
  - generator_files/test/integration/default/serverspec/localhost/default_spec.rb
73
78
  - generator_files/test/integration/default/serverspec/spec_helper.rb
74
- - generator_files/Thorfile
75
- - generator_files/.kitchen.yml
76
- - generator_files/.gitignore
79
+ - lib/teststrap.rb
77
80
  - spec/spec_helper.rb
78
- - spec/test/data.json
79
- - spec/test/secret
80
81
  - spec/teststrap_spec.rb
81
- - bin/teststrap
82
82
  homepage: https://github.com/CaseCommonsDevOps/teststrap
83
83
  licenses:
84
84
  - MIT
@@ -99,12 +99,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  version: '0'
100
100
  requirements: []
101
101
  rubyforge_project:
102
- rubygems_version: 2.0.14
102
+ rubygems_version: 2.2.1
103
103
  signing_key:
104
104
  specification_version: 4
105
105
  summary: cookbook test framework generator
106
106
  test_files:
107
107
  - spec/spec_helper.rb
108
- - spec/test/data.json
109
- - spec/test/secret
110
108
  - spec/teststrap_spec.rb
109
+ has_rdoc:
data/spec/test/data.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "id": "user",
3
- "password": "1234"
4
- }
data/spec/test/secret DELETED
@@ -1 +0,0 @@
1
- secret