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 +4 -4
- data/generator_files/.kitchen.yml +5 -1
- data/generator_files/.rubocop.yml +6 -0
- data/generator_files/Gemfile +14 -10
- data/generator_files/LICENSE +1 -1
- data/generator_files/README.md +1 -1
- data/generator_files/Strainerfile +2 -2
- data/generator_files/rubocop-disabled.yml +11 -0
- data/generator_files/spec/chefspec_helper.rb +6 -8
- data/generator_files/spec/default_spec.rb +1 -1
- data/generator_files/test/integration/default/serverspec/localhost/default_spec.rb +1 -1
- data/generator_files/test/integration/default/serverspec/spec_helper.rb +1 -0
- data/lib/teststrap.rb +2 -19
- data/spec/teststrap_spec.rb +0 -11
- metadata +20 -21
- data/spec/test/data.json +0 -4
- data/spec/test/secret +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4111e91c3b159c7785f7a2d8065db40301f37b6f
|
4
|
+
data.tar.gz: f8cce3d5304e2baee95ec5fdf51cb27acbe3da09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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:
|
16
|
+
- name: <%= cookbook_name %>
|
14
17
|
run_list: [ "recipe[<%= cookbook_name %>::default]" ]
|
15
18
|
attributes: {
|
19
|
+
"dev_mode": true
|
16
20
|
}
|
data/generator_files/Gemfile
CHANGED
@@ -1,18 +1,22 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
gem 'json', '1.7.7'
|
4
|
-
gem 'berkshelf', '~> 2.0
|
5
|
-
gem 'thor-foodcritic', '~> 1.1
|
4
|
+
gem 'berkshelf', '~> 2.0'
|
5
|
+
gem 'thor-foodcritic', '~> 1.1'
|
6
6
|
|
7
|
-
gem '
|
8
|
-
gem 'strainer', '~> 3.3
|
9
|
-
gem 'foodcritic', '~> 3.0
|
7
|
+
gem 'rubocop', '~> 0.18'
|
8
|
+
gem 'strainer', '~> 3.3'
|
9
|
+
gem 'foodcritic', '~> 3.0'
|
10
10
|
|
11
|
-
gem 'chef', '~> 11.
|
12
|
-
gem 'chefspec', '~> 3.0
|
11
|
+
gem 'chef', '~> 11.8'
|
12
|
+
gem 'chefspec', '~> 3.0'
|
13
13
|
|
14
14
|
group :integration do
|
15
|
-
gem 'test-kitchen', '~> 1.1
|
16
|
-
gem 'kitchen-vagrant', '~> 0.14
|
17
|
-
gem 'serverspec', '~> 0.
|
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
|
data/generator_files/LICENSE
CHANGED
data/generator_files/README.md
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
foodcritic: bundle exec foodcritic -f any $SANDBOX/$COOKBOOK
|
2
|
-
|
3
|
-
chefspec: bundle exec rspec $SANDBOX/$COOKBOOK/spec
|
2
|
+
rubocop: bundle exec rubocop $SANDBOX/$COOKBOOK/**/*.rb
|
3
|
+
chefspec: bundle exec rspec $SANDBOX/$COOKBOOK/spec/**/*.rb --color
|
@@ -1,11 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
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
|
-
|
9
|
-
|
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
|
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
|
data/spec/teststrap_spec.rb
CHANGED
@@ -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.
|
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-
|
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
|
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
|
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.
|
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.
|
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
|
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
|
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
|
-
-
|
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
|
-
-
|
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.
|
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
data/spec/test/secret
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
secret
|