knife-skeleton 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTgxM2Y1NzhmZGVhZGM5ZGYzNTZhMWE2Mzc1OTRkOWExMjczYTBhYQ==
4
+ NzU0M2VlMTE1OGM1ZWJkZjQ1MDU5MjcyOTUxYzk1NjMxZmY4Zjc4MQ==
5
5
  data.tar.gz: !binary |-
6
- ODBmYjk0OWUwYzJlZjNmNTgzZWQwYTczNjgzMDRmZThhYTZjMDg5Nw==
6
+ YTE2NjM3NzlmZjc3MjdjMDU1MGFjYjZmMzQzNzZiNmI1OTQwYWE0MA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OTc1ZjBiMWQ1M2FjODk5MDdlZjRiOTVmYWM4NmRkY2ZhMmFiYjU1Y2NkMjRj
10
- NGMyYmMwYmNlY2UwZTIxYzJlODVjNDg1NWM4NmQyNjA5YTRmNmIyMDA0N2Zl
11
- NWFhYzY2MDc2NmE1YzIyZjExNjNhNzdiY2Y3MmYzYWJlMWRiZTE=
9
+ MjlhYzlkZDE1OGQwZDMwMWY5ZDg5MDUxYmJiOTY4MmYzMGEyOGFiMjUyODVh
10
+ ODQxMDM0ODkyNjM5N2IyYmE3NGY0NGU1ZDdiNjYwMWNlM2E2ZDE2MGE5NDZl
11
+ YjhlOWJhNGEwZjM2MjI5ZDNjZjk3ZDJmOGI3MzYxZmIxZWMwZDg=
12
12
  data.tar.gz: !binary |-
13
- M2UzOTgxZTg2MjgwZjhjNjQ0NWUzNTEwMzczYTE5MGU4ODM4Nzk4YTliNDcw
14
- MDJkZjYwNDQ0MjNlMTdhNTM3YWRmYTkwMDVlNDBlMTk5Y2Q3NWM5OGI4MzZj
15
- OGMyMTllMzUxMmJlNGZlN2E2NDVlMGFmOGEyOGZhYmExOTlkYjI=
13
+ NjY4YmFkY2I1MTZkOWM3NGFjMDMwYjlkMDU1NTJjNWI4MTU2NjRjMmYyZmY5
14
+ ZjM5NWU3YWQxNWI3OGJkNmRiNDRlNDlkZGRhYTk0MTU1NDQ5NzZjOWMwMTY4
15
+ OGI0NDViZTNiZjdkM2IzYmI3M2ZmMzA3NGYyY2E0NzY2ZDA2MzI=
data/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  Knife plugin to create skeleton integrating chefspec, rubocop, foodcritic, knife test and kitchen.
4
4
 
5
+ ##Motivation
6
+
7
+ The current "knife cookbook create" does not include tests, and many of us need to use chefspec, checkstyle and kitchen.
8
+
5
9
  ##Installation
6
10
 
7
11
  With rubygems:
@@ -52,9 +56,6 @@ Create your cookbook
52
56
  knife skeleton create my-cookbook -o /tmp/cookbooks
53
57
  ```
54
58
 
55
- ##Motivation
56
- The current "knife cookbook create" does not include tests, and many of us need to use chefspec, checkstyle and kitchen.
57
-
58
59
  ## License and Authors
59
60
 
60
61
  Authors:
@@ -2,8 +2,8 @@
2
2
  require File.expand_path('../lib/knife_skeleton/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
- s.authors = ['Pierre Rambaud']
6
- s.email = ['pierre.rambaud@numergy.com']
5
+ s.authors = ['Pierre Rambaud', 'Antoine Rouyer']
6
+ s.email = ['pierre.rambaud@numergy.com', 'antoine.rouyer@numergy.com']
7
7
  s.description = <<-eos
8
8
  Knife plugin to create skeleton with rubocop, chefspec, kitchen,
9
9
  strainer, etc...
@@ -20,7 +20,7 @@ eos
20
20
  s.version = KnifeSkeleton::VERSION
21
21
 
22
22
  s.add_dependency 'chef', '~> 0.10'
23
- s.add_dependency 'erubis', '~> 0.2'
23
+ s.add_dependency 'erubis', '~> 2.7'
24
24
 
25
25
  s.add_development_dependency 'rake', '~> 10'
26
26
  s.add_development_dependency 'rspec', '~> 2.14'
@@ -45,7 +45,8 @@ eos
45
45
 
46
46
  # Public: Knife skeleton create runner
47
47
  #
48
- # Returns void
48
+ # @return [Void]
49
+ #
49
50
  def run
50
51
  self.config = Chef::Config.merge!(config)
51
52
  if @name_args.length < 1
@@ -94,7 +95,8 @@ eos
94
95
  # cookbook_license_name
95
96
  # # => 'GNU Public LIcense 3.0'
96
97
  #
97
- # Returns string
98
+ # @return [String]
99
+ #
98
100
  def cookbook_license_name
99
101
  case cookbook_license
100
102
  when 'apachev2'
@@ -114,14 +116,14 @@ eos
114
116
 
115
117
  # Protected: Create cookbook directories
116
118
  #
117
- # cookbook_path - Cookbook path
118
- # cookbook_name - Cookbook name
119
- #
120
119
  # Examples:
121
120
  #
122
121
  # create_cookbook_directories('/tmp', 'my-cookbook')
123
122
  #
124
- # Returns void
123
+ # @param [String] cookbook_path Cookbook path
124
+ # @param [String] cookbook_name Cookbook name
125
+ # @return [Void]
126
+ #
125
127
  def create_cookbook_directories(cookbook_path, cookbook_name)
126
128
  ui.msg("** Create cookbook #{cookbook_name} into #{cookbook_path}")
127
129
 
@@ -147,13 +149,13 @@ eos
147
149
 
148
150
  # Protected: Create cookbook files from templates
149
151
  #
150
- # params - An Hash of parameters to use for binding template
151
- #
152
152
  # Examples:
153
153
  #
154
154
  # create_cookbook_templates({ cookbook_path: '/tmp', title: 'GoT' })
155
155
  #
156
- # Returns void
156
+ # @params [Hash] params An Hash of parameters to use for binding template
157
+ # @return [Void]
158
+ #
157
159
  def create_cookbook_templates(params)
158
160
  params[:license_content] = File.read(
159
161
  File.join(
@@ -182,14 +184,14 @@ eos
182
184
 
183
185
  # Protected: Copy all files into the cookbook
184
186
  #
185
- # cookbook_path - Cookbook path
186
- # cookbook_name - Cookbook name
187
- #
188
187
  # Examples:
189
188
  #
190
189
  # create_cookbook_files('/tmp', 'my-cookbook')
191
190
  #
192
- # Returns void
191
+ # @param [String] cookbook_path Cookbook path
192
+ # @param [String] cookbook_name Cookbook name
193
+ # @return [Void]
194
+ #
193
195
  def create_cookbook_files(
194
196
  cookbook_path,
195
197
  cookbook_name
@@ -208,15 +210,15 @@ eos
208
210
 
209
211
  # Protected: Copy files
210
212
  #
211
- # cookbook_path - Cookbook path
212
- # cookbook_name - Cookbook name
213
- # file_name - File name to used without erb extension
214
- #
215
213
  # Examples:
216
214
  #
217
215
  # copy_file('/tmp', '/cookbooks', 'my-cookbook', 'README.md')
218
216
  #
219
- # Returns void
217
+ # @param [String] cookbook_path Cookbook path
218
+ # @param [String] cookbook_name Cookbook name
219
+ # @param [String] file_name File name to used without erb extension
220
+ # @return [Void]
221
+ #
220
222
  def copy_file(cookbook_path, cookbook_name, file_name)
221
223
  dst = File.join(
222
224
  cookbook_path,
@@ -240,14 +242,14 @@ eos
240
242
 
241
243
  # Protected: Render template
242
244
  #
243
- # file_name - File name to used without erb extension
244
- # params - Binding parameters
245
- #
246
245
  # Examples:
247
246
  #
248
247
  # render_template('/tmp', 'my-file.rb', { title: 'GoT' })
249
248
  #
250
- # Returns void
249
+ # @param [String] file_name File name to used without erb extension
250
+ # @param [Hash] params Binding parameters
251
+ # @return [void]
252
+ #
251
253
  def render_template(file_name, params)
252
254
  dst = File.join(
253
255
  params[:cookbook_path],
@@ -280,8 +282,6 @@ eos
280
282
 
281
283
  # Protected: Test if parameter is empty
282
284
  #
283
- # parameter - The tested parameter
284
- #
285
285
  # Examples:
286
286
  #
287
287
  # parameter_empty?('my string')
@@ -289,28 +289,33 @@ eos
289
289
  # parameter_empty?('')
290
290
  # # => true
291
291
  #
292
- # Returns string
292
+ # @param [Mixed] parameter The tested parameter
293
+ # @return [String]
294
+ #
293
295
  def parameter_empty?(parameter)
294
296
  parameter.nil? || parameter.empty?
295
297
  end
296
298
 
297
299
  # Protected: Get cookbook copyright
298
300
  #
299
- # Returns string
301
+ # @return [String]
302
+ #
300
303
  def cookbook_copyright
301
304
  config[:cookbook_copyright] || 'YOUR_COMPANY_NAME'
302
305
  end
303
306
 
304
307
  # Protected: Get maintener email
305
308
  #
306
- # Returns string
309
+ # @return [String]
310
+ #
307
311
  def cookbook_email
308
312
  config[:cookbook_email] || 'YOUR_EMAIL'
309
313
  end
310
314
 
311
315
  # Protected: Get license name
312
316
  #
313
- # Returns string
317
+ # @return [String]
318
+ #
314
319
  def cookbook_license
315
320
  ((config[:cookbook_license] != 'false') &&
316
321
  config[:cookbook_license]) || 'none'
@@ -318,14 +323,16 @@ eos
318
323
 
319
324
  # Protected: Get readme format
320
325
  #
321
- # Returns string
326
+ # @return [String]
327
+ #
322
328
  def cookbook_readme_format
323
329
  ((config[:readme_format] != 'false') && config[:readme_format]) || 'md'
324
330
  end
325
331
 
326
332
  # Protected: Get files directory
327
333
  #
328
- # Returns string
334
+ # @return [String]
335
+ #
329
336
  def files_directory
330
337
  File.expand_path(
331
338
  '../../../../files',
@@ -335,7 +342,8 @@ eos
335
342
 
336
343
  # Protected: Get templates directory
337
344
  #
338
- # Returns string
345
+ # @return [String]
346
+ #
339
347
  def templates_directory
340
348
  File.expand_path(
341
349
  '../../../../templates',
@@ -6,15 +6,14 @@ module KnifeSkeleton
6
6
  class Template
7
7
  # Static: Render template with Erubis
8
8
  #
9
- # template - Template string to used for rendering
10
- # data - Data binding
11
- #
12
9
  # Examples:
13
10
  #
14
11
  # create_cookbook_directories('Hello <%= title %>', {title: 'GoT'})
15
12
  # # => "Hello GoT"
16
13
  #
17
- # Returns string
14
+ # @param [String] template Template string to used for rendering
15
+ # @param [String] data Data binding
16
+ # return [String]
18
17
  def self.render(template, data)
19
18
  eruby = Erubis::Eruby.new(template)
20
19
  output = eruby.result(data)
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # Knife skeleton version
3
3
  module KnifeSkeleton
4
- VERSION = '0.0.1'
4
+ VERSION = '0.0.2'
5
5
  MAJOR, MINOR, TINY = VERSION.split('.')
6
6
  end
metadata CHANGED
@@ -1,10 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-skeleton
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre Rambaud
8
+ - Antoine Rouyer
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
@@ -30,14 +31,14 @@ dependencies:
30
31
  requirements:
31
32
  - - ~>
32
33
  - !ruby/object:Gem::Version
33
- version: '0.2'
34
+ version: '2.7'
34
35
  type: :runtime
35
36
  prerelease: false
36
37
  version_requirements: !ruby/object:Gem::Requirement
37
38
  requirements:
38
39
  - - ~>
39
40
  - !ruby/object:Gem::Version
40
- version: '0.2'
41
+ version: '2.7'
41
42
  - !ruby/object:Gem::Dependency
42
43
  name: rake
43
44
  requirement: !ruby/object:Gem::Requirement
@@ -115,6 +116,7 @@ description: ! 'Knife plugin to create skeleton with rubocop, chefspec, kitchen,
115
116
  '
116
117
  email:
117
118
  - pierre.rambaud@numergy.com
119
+ - antoine.rouyer@numergy.com
118
120
  executables: []
119
121
  extensions: []
120
122
  extra_rdoc_files: []