meez 0.2.6 → 0.2.7

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: 4f7434a503a79a2e35d4ccc19740fa8f62bc5582
4
- data.tar.gz: 295d7840a520629cce5844981b00fbd307a49ac3
3
+ metadata.gz: 7724639e6e8040d470164acd8fb484375a2cd024
4
+ data.tar.gz: 672f53c838bee77c8bc7af2273d6ba07c0fdb31d
5
5
  SHA512:
6
- metadata.gz: 4b79c64e1fc5983593d048dd3bc5f6d9ad7a3c4fb56a759ee7da6494db740a6dee09c8bc5a59f8335ab6745d299d96e5b70440e29a4cd87ee34bc39c3c591e77
7
- data.tar.gz: 47b61f81aadb8da103f3d5742a35eddd6c1103e993c3a8f5a99e0965fb1ebc9965169c36cc7555ce1f01eb7622c1d5899d8d4706ebbed4cc1f7c633b4ad8af41
6
+ metadata.gz: 2309e47b1f3aee29d38dd700f2e51fc964e3dde4df268d892323ef8f2c56ae90b9d41d81c6d5d5f3397c5438b2f82ee318ed931acc81eedf1b8286e1ca1d69ed
7
+ data.tar.gz: fa76d5a3da6e8f6f76725b8836ea6d154ba35d1bedb0cd2d53eda075934c62140ddbf0097e519f8def95d292ca34c049e5c57c0ec1ce0d62ccc35da7b726fd8d
data/Dockerfile CHANGED
@@ -2,19 +2,15 @@ FROM racker/precise-with-updates
2
2
 
3
3
  RUN apt-get -yqq update && apt-get -yqq install curl build-essential libxml2-dev libxslt-dev git autoconf wget python-pip
4
4
 
5
- RUN wget -q -O /tmp/chefdk.deb https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chefdk_0.1.0-1_amd64.deb \
5
+ RUN wget -q -O /tmp/chefdk.deb https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chefdk_0.2.1-1_amd64.deb \
6
6
  && dpkg -i /tmp/chefdk.deb \
7
7
  && rm /tmp/chefdk.deb
8
8
 
9
- RUN wget -q -O /tmp/vagrant.deb http://files.vagrantup.com/packages/a40522f5fabccb9ddabad03d836e120ff5d14093/vagrant_1.3.5_x86_64.deb \
9
+ RUN wget -q -O /tmp/vagrant.deb http://files.vagrantup.com/packages/a40522f5fabccb9ddabad03d836e120ff5d14093/vagrant_1.6.5_x86_64.deb \
10
10
  && dpkg -i /tmp/vagrant.deb \
11
- && rm /tmp/vagrant.deb
11
+ && rm /tmp/vagrant.deb
12
12
 
13
13
  RUN pip install swiftly awscli
14
14
 
15
- ENV PATH /opt/chefdk/embedded/bin:/root/.chefdk/gem/ruby/2.1.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
15
+ ENV PATH /opt/chefdk/bin:/opt/chefdk/embedded/bin:/root/.chefdk/gem/ruby/2.1.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
16
16
  ENV USE_SYSTEM_GECODE 1
17
-
18
- ADD Gemfile /tmp/Gemfile
19
-
20
- RUN cd /tmp && bundle install && rm Gemfile*
data/Gemfile CHANGED
@@ -1,20 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'berkshelf', '= 3.1.3'
4
- gem 'chef', '> 11.12.0'
5
3
  gem 'rake', '>= 10.3'
6
4
  gem 'rubocop', '= 0.23'
7
- gem 'foodcritic', '>= 3.0'
8
- gem 'chefspec', '> 4'
9
- gem 'serverspec', '>= 1.10'
10
5
  gem 'guard', '>= 2.6'
11
6
  gem 'guard-rubocop', '>= 1.1'
12
- gem 'guard-foodcritic', '>= 1.0.2'
13
- gem 'test-kitchen'
14
- gem 'kitchen-vagrant'
15
- gem 'kitchen-docker'
16
-
17
- #group :infinite_loop_solver do
18
- # gem 'celluloid', '~> 0.14'
19
- # gem 'celluloid-io', '~> 0.14'
20
- #end
data/README.md CHANGED
@@ -15,6 +15,17 @@ Install
15
15
 
16
16
  Setting the environment variable `USE_SYSTEM_GECODE=1` will help speed up builds by using the system `gecode` rather than compiling it from scratch.
17
17
 
18
+ You may need to install `gecode` on your system: http://www.gecode.org/download.html
19
+
20
+ for OSX I did
21
+
22
+ ```
23
+ $ cd $( brew --prefix )
24
+ $ git checkout 3c5ca25 Library/Formula/gecode.rb
25
+ $ brew install gecode
26
+ $ brew link gecode
27
+ ```
28
+
18
29
  Official
19
30
  ----------
20
31
 
@@ -22,13 +33,6 @@ as of version `0.2.0` this is offered as a `chefdk` plugin.
22
33
 
23
34
  `chef gem install meez`
24
35
 
25
- Unofficial
26
- -------------
27
-
28
- Your results may vary using it outside of `chefdk`
29
-
30
- `gem install meez`
31
-
32
36
 
33
37
  Usage
34
38
  =====
@@ -49,36 +53,39 @@ Options
49
53
 
50
54
  ```
51
55
  $ meez --cookbook-path /tmp --copyright Foo -I apachev2 -m foo@bah.com test
56
+ chef exec meez -o . test
52
57
  * Initializing Cookbook
53
58
  ** Creating cookbook test
54
59
  ** Creating README for cookbook: test
55
60
  ** Creating CHANGELOG for cookbook: test
56
61
  ** Creating metadata for cookbook: test
57
- Rewriting metadata.rb
58
- Rewriting recipes/default.rb
62
+ Rewriting metadata.rb
63
+ Rewriting recipes/default.rb
59
64
  * Initializing Berkshelf
60
- create /tmp/test/Berksfile
61
- create /tmp/test/Thorfile
62
- create /tmp/test/.gitignore
63
- run git init from "/tmp/test"
64
- create /tmp/test/Gemfile
65
+ create test/Berksfile
66
+ create test/Thorfile
67
+ create test/chefignore
68
+ create test/.gitignore
69
+ create test/Gemfile
65
70
  * Initializing Vagrantfile
71
+ Creating ./test/Vagrantfile from template
66
72
  * Initializing Knife
67
- Append Gemfile
73
+ adding chef gem to Gemfile
68
74
  * Initializing Rakefile
69
- Creating /tmp/test/Rakefile
75
+ Creating ./test/Rakefile from template
76
+ adding rake gem to Gemfile
70
77
  * Initializing Rubocop
71
- Append Gemfile
78
+ Creating ./test/.rubocop.yml from template
79
+ adding rubocop gem to Gemfile
72
80
  * Initializing Food Critic
73
- Append Gemfile
81
+ adding foodcritic gem to Gemfile
74
82
  * Initializing Chef Spec
75
- Creating /tmp/test/test/unit/spec/spec_helper.rb
76
- Creating /tmp/test/test/unit/spec/default_spec.rb
77
- Append Gemfile
83
+ Creating ./test/test/unit/spec/spec_helper.rb from template
84
+ Creating ./test/test/unit/spec/default_spec.rb from template
85
+ adding chefspec gem to Gemfile
78
86
  * Initializing Server Spec
79
- Creating /tmp/test/test/integration/default/serverspec/spec_helper.rb
80
- Creating /tmp/test/test/integration/default/serverspec/default_spec.rb
81
- Append Gemfile
87
+ Creating ./test/test/integration/default/serverspec/spec_helper.rb from template
88
+ Creating ./test/test/integration/default/serverspec/default_spec.rb from template
82
89
  * Initializing Test Kitchen
83
90
  create .kitchen.yml
84
91
  append Rakefile
@@ -89,25 +96,36 @@ $ meez --cookbook-path /tmp --copyright Foo -I apachev2 -m foo@bah.com test
89
96
  append Gemfile
90
97
  append Gemfile
91
98
  You must run `bundle install' to fetch any new gems.
99
+ Creating ./test/.kitchen.yml from template
100
+ * Initializing Guard
101
+ Creating ./test/Guardfile from template
102
+ adding guard gem to Gemfile
103
+ adding guard-rubocop gem to Gemfile
104
+ adding guard-foodcritic gem to Gemfile
105
+ * Initializing Drone
106
+ Creating ./test/.drone.yml from template
107
+ * Initializing Docker
108
+ Creating ./test/Dockerfile from template
92
109
  Cookbook test created successfully
93
110
  Next steps...
94
- $ cd /tmp/test
111
+ $ cd ./test
95
112
  $ export USE_SYSTEM_GECODE=1
96
- $ bundle install
97
- $ bundle exec berks install
98
-
113
+ $ chef exec rake prepare
114
+ $ chef exec rake test
99
115
  $ cd /tmp/test
100
116
  $ export USE_SYSTEM_GECODE=1
101
- $ bundle install
102
- Fetching gem metadata from https://rubygems.org/
103
- Fetching additional metadata from https://rubygems.org/
117
+ $ chef exec rake prepare
118
+ chef exec bundle install --path .bundle
119
+ Fetching gem metadata from https://rubygems.org/.......
120
+ Fetching additional metadata from https://rubygems.org/..
104
121
  Resolving dependencies...
122
+ Installing rake (10.3.2)
105
123
  ...
106
124
  ...
107
125
  Your bundle is complete!
108
126
  $ bundle exec berks install
109
127
  Using test (0.1.0) from metadata
110
- $ bundle exec rake -T
128
+ $ chef exec rake -T
111
129
  rake integration # Run Test Kitchen integration tests
112
130
  rake kitchen:all # Run all test instances
113
131
  rake kitchen:default-ubuntu-1204 # Run default-ubuntu-1204 test instance
data/bin/meez CHANGED
@@ -11,7 +11,7 @@ options = {
11
11
  }
12
12
 
13
13
  opt_parser = OptionParser.new do |opt|
14
- opt.banner = 'Usage: meez [options] <cookbook name>'
14
+ opt.banner = 'Usage: chef exec meez [options] <cookbook name>'
15
15
  opt.separator ''
16
16
  opt.separator 'Options'
17
17
  opt.on('-o', '--cookbook-path PATH', 'The directory where the cookbook will be created') do |path|
@@ -35,7 +35,7 @@ opt_parser = OptionParser.new do |opt|
35
35
  end
36
36
  opt.on('-v', '--version', 'version') do
37
37
  options[:version] = true
38
- puts 'meez version 0.2.2'
38
+ puts 'meez version 0.2.7'
39
39
  end
40
40
  end
41
41
 
@@ -50,9 +50,8 @@ unless options[:help] || options[:version]
50
50
  puts 'Next steps...'
51
51
  puts " $ cd #{File.join(options[:path], cookbook_name)}"
52
52
  puts ' $ export USE_SYSTEM_GECODE=1'
53
- puts ' $ bundle install'
54
- puts ' $ bundle exec berks install'
55
- puts ' $ bundle exec rake'
53
+ puts ' $ chef exec rake prepare'
54
+ puts ' $ chef exec rake test'
56
55
  else
57
56
  puts 'Need to specify a cookbook'
58
57
  puts opt_parser
@@ -82,7 +82,7 @@ class Meez
82
82
  skip_vagrant: true
83
83
  ).invoke_all
84
84
  contents = File.read(File.join(path, 'Gemfile'))
85
- newgemfile = contents.gsub("\ngem 'berkshelf'\n", "\ngem 'berkshelf', '>= 3.1.3'\n")
85
+ newgemfile = contents.gsub("\ngem 'berkshelf'\n", "\ngem 'berkshelf', '> 3.1'\n")
86
86
  File.open(File.join(path, 'Gemfile'), 'w') { |f| f.write(newgemfile) }
87
87
  end
88
88
 
@@ -111,7 +111,7 @@ class Meez
111
111
  write_template('chefspec/spec_helper.rb.erb', spec_path, cookbook_name, options)
112
112
  write_template('chefspec/default_spec.rb.erb', spec_path, cookbook_name, options)
113
113
  gitignore(path, '.coverage/*')
114
- add_gem(path, 'chefspec', '> 4')
114
+ add_gem(path, 'chefspec')
115
115
  end
116
116
 
117
117
  def self.init_rakefile(cookbook_name, options)
@@ -125,19 +125,19 @@ class Meez
125
125
  puts '* Initializing Rubocop'
126
126
  path = File.join(options[:path], cookbook_name)
127
127
  write_template('.rubocop.yml.erb', path, cookbook_name, options)
128
- add_gem(path, 'rubocop', '= 0.23')
128
+ add_gem(path, 'rubocop')
129
129
  end
130
130
 
131
131
  def self.init_knife(cookbook_name, options)
132
132
  puts '* Initializing Knife'
133
133
  path = File.join(options[:path], cookbook_name)
134
- add_gem(path, 'chef', '> 11.12')
134
+ add_gem(path, 'chef', '> 11')
135
135
  end
136
136
 
137
137
  def self.init_foodcritic(cookbook_name, options)
138
138
  puts '* Initializing Food Critic'
139
139
  path = File.join(options[:path], cookbook_name)
140
- add_gem(path, 'foodcritic', '>= 3.0')
140
+ add_gem(path, 'foodcritic')
141
141
  end
142
142
 
143
143
  def self.init_serverspec(cookbook_name, options)
@@ -147,7 +147,6 @@ class Meez
147
147
  FileUtils.mkdir_p(spec_path)
148
148
  write_template('serverspec/spec_helper.rb.erb', spec_path, cookbook_name, options)
149
149
  write_template('serverspec/default_spec.rb.erb', spec_path, cookbook_name, options)
150
- add_gem(path, 'serverspec', '>= 1.10')
151
150
  end
152
151
 
153
152
  def self.init_guard(cookbook_name, options)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q(meez)
3
- s.version = '0.2.6'
3
+ s.version = '0.2.7'
4
4
  s.date = %q(2014-01-08)
5
5
  s.summary = 'Initializes a chef cookbook with TDD framework'
6
6
  s.description = <<EOF
@@ -3,6 +3,6 @@ env:
3
3
  - CI=drone
4
4
  - USE_SYSTEM_GECODE=1
5
5
  script:
6
- - bundle install
7
- - bundle exec berks install
8
- - bundle exec rake style spec
6
+ - rake prepare:chefdk
7
+ - chef exec rake prepare
8
+ - chef exec rake style unit
@@ -1,10 +1,4 @@
1
1
  # Rubocop, we're buddies and all, but we're going to have to disagree on the following -
2
2
 
3
- SingleSpaceBeforeFirstArg:
4
- Enabled: false
5
-
6
- UnusedBlockArgument:
7
- Enabled: false
8
-
9
3
  WordArray:
10
4
  MinSize: 5
@@ -1,40 +1,72 @@
1
1
  # Encoding: utf-8
2
- require 'bundler/setup'
2
+
3
+ namespace :prepare do
4
+
5
+ desc 'Install ChefDK'
6
+ task :chefdk do
7
+ begin
8
+ gem 'chef-dk', '0.2.1'
9
+ rescue Gem::LoadError
10
+ puts 'ChefDK not found. Installing it for you...'
11
+ sh %{wget -O /tmp/meez_chefdk.deb https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chefdk_0.2.1-1_amd64.deb}
12
+ sh %{sudo dpkg -i /tmp/meez_chefdk.deb}
13
+ end
14
+ end
15
+
16
+ task :bundle do
17
+ if ENV['CI']
18
+ sh %{chef exec bundle install --path=.bundle --jobs 1 --retry 3 --verbose}
19
+ else
20
+ sh %{chef exec bundle install --path .bundle}
21
+ end
22
+ end
23
+
24
+ task :berks do
25
+ sh %{chef exec berks install}
26
+ end
27
+
28
+ end
29
+
30
+ desc 'Install required Gems and Cookbooks'
31
+ task prepare: ['prepare:bundle', 'prepare:berks']
3
32
 
4
33
  namespace :style do
5
- require 'rubocop/rake_task'
6
- desc 'Run Ruby style checks'
7
- RuboCop::RakeTask.new(:ruby)
34
+ task :rubocop do
35
+ sh %{chef exec rubocop}
36
+ end
8
37
 
9
- require 'foodcritic'
10
- desc 'Run Chef style checks'
11
- FoodCritic::Rake::LintTask.new(:chef)
38
+ task :foodcritic do
39
+ sh %{chef exec foodcritic .}
40
+ end
12
41
  end
13
42
 
14
43
  desc 'Run all style checks'
15
- task style: ['style:chef', 'style:ruby']
16
-
17
- require 'kitchen'
18
- desc 'Run Test Kitchen integration tests'
19
- task :integration do
20
- Kitchen.logger = Kitchen.default_file_logger
21
- Kitchen::Config.new.instances.each do |instance|
22
- instance.test(:always)
44
+ task style: ['style:foodcritic', 'style:rubocop']
45
+
46
+ namespace :integration do
47
+ task :kitchen do
48
+ sh %{chef exec kitchen test}
23
49
  end
24
50
  end
25
51
 
26
- require 'rspec/core/rake_task'
27
- desc 'Run ChefSpec unit tests'
28
- RSpec::Core::RakeTask.new(:spec) do |t, args|
29
- t.rspec_opts = 'test/unit/spec'
52
+ task integration: ['integration:kitchen']
53
+
54
+ namespace :unit do
55
+ task :chefspec do
56
+ sh %{chef exec rspec test/unit/spec}
57
+ end
30
58
  end
31
59
 
60
+ desc 'Run all unit tests'
61
+ task unit: ['unit:chefspec']
62
+ task spec: ['unit']
63
+
64
+ # Run all tests
65
+ desc 'Run all tests'
66
+ task test: ['style', 'unit', 'integration']
67
+
32
68
  # The default rake task should just run it all
33
- task default: ['style', 'spec', 'integration']
69
+ desc 'Install required Gems and Cookbook then run all tests'
70
+ task default: ['prepare', 'test' ]
71
+
34
72
 
35
- begin
36
- require 'kitchen/rake_tasks'
37
- Kitchen::RakeTasks.new
38
- rescue LoadError
39
- puts '>>>>> Kitchen gem not loaded, omitting tasks' unless ENV['CI']
40
- end
@@ -8,7 +8,7 @@ describe '<%= cookbook_name %>::default' do
8
8
  let(:chef_run) { ChefSpec::Runner.new.converge(described_recipe) }
9
9
 
10
10
  it 'writes some chefspec code' do
11
- pending 'todo'
11
+ skip 'todo'
12
12
  end
13
13
 
14
14
  end
@@ -3,5 +3,5 @@
3
3
  require_relative 'spec_helper'
4
4
 
5
5
  describe 'default' do
6
- it { pending 'write some tests' }
6
+ it { skip 'write some tests' }
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meez
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Czarkowski