chef-raketasks 0.2.0 → 0.5.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
  SHA256:
3
- metadata.gz: de3a81f91933796f84623d88036f3a891d4f74e4194cf8f14eeac0243f382a8c
4
- data.tar.gz: 56da97b647d22b54646b1f4f6710f553631fd48e56aa9acce23d7320bd9c7c34
3
+ metadata.gz: fd6c2fd289683cb8a5c5e68deafe185baead939f260e8b0bc7366fecc06731ee
4
+ data.tar.gz: 0a87509dabd7be5d9a1c286bef48f7ca0cf9b47fd638b64848d595a9714a21a1
5
5
  SHA512:
6
- metadata.gz: 727860aa43b68c056ee435f00b1ad31863e00e895e8a056d5c84cc2a45515a4236d3289aacd82f345424b8f8fcccdc00c1832e2839e7d178a4e2c323cb0e5bfd
7
- data.tar.gz: 6ad1066f6eccdcbf899ae73307386a087e5626f844c15a7265b6a4482b96db4f9e157688ff9c1824efdc096944a4b91f890ea6aa2789c417f038bb82f7decc63
6
+ metadata.gz: 90cfa6434edce820f235aeddb8fd0038bac23323f650ba990e3c1c5c4f85b2a166944a3c883b6fd35d1d4c9ce72883aae40ed689b743d7a5d524688e0d97b9f4
7
+ data.tar.gz: 854217379784de4611c83f0ed677e85a20b07d2ba6e1bbd2ae17d855b0ceb4c90a7e06e46b0092d708bd2dd085d2895f1265521a7743738dad6d5bc514fad09a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## Version 0.5.0
4
+
5
+ - Add gem:vendor as new raketask to vendor gems for cookbooks and others
6
+
7
+ ## Version 0.4.0
8
+
9
+ - Extend rake release:supermarket with multiple additional options
10
+
11
+ ## Version 0.3.0
12
+
13
+ - Enable `cookstyle` as linting option for `rake test:lint:cookbook[autocorrect]` with autocorrect options
14
+
3
15
  ## Version 0.2.0
4
16
 
5
17
  - Add `repin` tasks
data/README.md CHANGED
@@ -26,7 +26,7 @@ Rakefile. After that, just run ```rake -T``` or ```rake --tasks``` to see all
26
26
  available tasks.
27
27
 
28
28
  If you start a Rake task with parameters, please assure to not use spaces
29
- between `[ ]`. This will result in `Don't know how to build task` errors.
29
+ between `[ ]`. This will result in `Don't know how to build task` errors.
30
30
 
31
31
  ## Cleanup Tasks
32
32
 
@@ -76,6 +76,15 @@ Installs vcenter sdk for kitchen.
76
76
  * `version`: define a specific version of the gem
77
77
  * `source`: define a different source than rubygems.org
78
78
 
79
+ ### rake gem:vendor[gemname, version, source, installdir]
80
+
81
+ Vendors rubygems to a specific directory inside the cookbook
82
+
83
+ * `gemname`: the name of the gem to be used
84
+ * `version`: define a specific version of the gem
85
+ * `source`: define a different source than rubygems.org
86
+ * `installdir`: define the desired targetdir where the vendoring should happen
87
+
79
88
  ## Packaging Tasks
80
89
 
81
90
  ### rake package:cookbook
@@ -107,11 +116,20 @@ Upload to Artifactory with required settings like:
107
116
  Upload to Chef Server.
108
117
  It uses the current configured supermarket in your knife.rb or config.rb.
109
118
 
110
- ### rake release:supermarket
119
+ ### rake release:supermarket[siteurl,user,authkeyfile,cookbookpath,cookbookname,configfile]
111
120
 
112
121
  Upload to Chef Supermarket.
113
122
  It uses the current configured supermarket in your knife.rb or config.rb.
114
123
 
124
+ You are also allowed to use multiple additional settings:
125
+
126
+ * `siteurl`: defines the url of a Chef Supermarket
127
+ * `user`: the user to authenticate
128
+ * `authkeyfile`: the keyfile to use (it must be a file present on your system)
129
+ * `cookbookpath`: the path where to look up for cookbooks (default: `../`)
130
+ * `cookbookname`: define different cookbookname instead of the current one
131
+ * `configfile`: define a config.rb file instead of the settings above (this might look like `rake release:supermarket[,,,,,~/.chef/config.rb]`)
132
+
115
133
  ## Repin Tasks
116
134
 
117
135
  ### rake repin:chef-client[gem,version]
@@ -197,10 +215,12 @@ specific file for this task is `.kitchen.vcenter.yml`.
197
215
 
198
216
  Details at <https://github.com/chef/kitchen-vcenter>
199
217
 
200
- ### rake test:lint:cookbook
218
+ ### rake test:lint:cookbook[autocorrect]
201
219
 
202
220
  Run linting tests for cookbook in current dir.
203
221
 
222
+ You can add true as option to auto-correct found issues that can be automatically fixed.
223
+
204
224
  ## Contributing
205
225
 
206
226
  For information on contributing to this project see <https://github.com/chef/chef/blob/master/CONTRIBUTING.md>
@@ -24,18 +24,20 @@ module ChefRake
24
24
  super
25
25
 
26
26
  namespace :gem do
27
- desc 'gem:install'
28
- namespace :install do
29
- def install_gem(name, version, source)
30
- cmd = 'chef gem install '
31
- cmd << "#{name} "
32
- cmd << "-v #{version} " unless version.nil?
33
- cmd << "-s #{source} " unless source.nil?
34
- cmd << '--no-document'
27
+ def install_gem(name, version, source, installdir)
28
+ cmd = 'chef gem install '
29
+ cmd << "#{name} "
30
+ cmd << "-v \"#{version}\" " unless version.nil?
31
+ cmd << "-s #{source} " unless source.nil?
32
+ cmd << "--install-dir #{installdir} " unless installdir.nil? # used mostly for vendoring
33
+ cmd << '--no-user-install ' unless installdir.nil? # used for vendoring
34
+ cmd << '--no-document'
35
35
 
36
- sh cmd
37
- end
36
+ sh cmd
37
+ end
38
38
 
39
+ desc 'gem:install'
40
+ namespace :install do
39
41
  # NAMESPACE: gem:install:static
40
42
  desc 'Installs necessary static gems for kitchen'
41
43
  task static: %i[
@@ -66,6 +68,18 @@ module ChefRake
66
68
  end
67
69
  end # namespace vcenter
68
70
  end # namespace install
71
+
72
+ # NAMESPACE: gem:vendor
73
+ desc 'Vendors gems into cookbook'
74
+ task :vendor, [:gemname, :version, :source, :installdir] do |_t, args|
75
+ args.with_defaults(
76
+ version: '>= 0', # so use latest when not set
77
+ source: nil,
78
+ installdir: 'files/default/vendor'
79
+ )
80
+
81
+ install_gem(args.gemname, args.version, args.source, args.installdir)
82
+ end
69
83
  end # namespace gem
70
84
  end # def initialize
71
85
  end # class Gem
@@ -70,7 +70,7 @@ module ChefRake
70
70
  end
71
71
 
72
72
  desc 'Upload to Chef Supermarket'
73
- task :supermarket do
73
+ task :supermarket, [:siteurl, :user, :authkeyfile, :cookbookpath, :cookbookname, :configfile] do |_t, args|
74
74
  Rake::Task['clean:cookbook'].execute
75
75
 
76
76
  require 'berkshelf'
@@ -79,8 +79,20 @@ module ChefRake
79
79
  metadata = Chef::Cookbook::Metadata.new
80
80
  metadata.from_file File.join(current_dir, 'metadata.rb')
81
81
 
82
+ args.with_defaults(
83
+ cookbookpath: parent_dir
84
+ )
85
+
82
86
  cmd = "knife supermarket share #{metadata.name}"
83
- cmd << " --cookbook-path #{parent_dir}"
87
+ if args.configfile.nil?
88
+ cmd << " --cookbook-path #{parent_dir}"
89
+ cmd << " --supermarket-site #{args.siteurl}" unless args.siteurl.nil?
90
+ cmd << " --user #{args.user}" unless args.user.nil?
91
+ cmd << " --key #{args.authkeyfile}" unless args.authkeyfile.nil?
92
+ elsif args.configfile
93
+ cmd << " --config #{args.configfile}" unless args.configfile.nil?
94
+ end
95
+
84
96
  sh cmd
85
97
 
86
98
  # require 'chef/mixin/shell_out'
@@ -94,9 +94,12 @@ module ChefRake
94
94
 
95
95
  namespace :lint do
96
96
  desc 'Run linting tests for cookbook'
97
- task :cookbook do
98
- puts 'running cookstyle for cookbook'
99
- puts `cookstyle`
97
+ task :cookbook, [:autocorrect] do |_t, args|
98
+ args.with_defaults(autocorrect: false)
99
+
100
+ cmd = 'cookstyle'
101
+ cmd << ' --auto-correct' if args.autocorrect
102
+ sh cmd
100
103
  end
101
104
  end # namespace lint
102
105
  end # namespace test
@@ -18,6 +18,6 @@
18
18
 
19
19
  module ChefRake
20
20
  module Task
21
- VERSION = '0.2.0'.freeze
21
+ VERSION = '0.5.0'.freeze
22
22
  end
23
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-raketasks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Schaumburg
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-11-03 00:00:00.000000000 Z
12
+ date: 2021-12-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mdl
@@ -145,7 +145,8 @@ files:
145
145
  homepage: https://www.tecracer.de
146
146
  licenses:
147
147
  - Apache-2.0
148
- metadata: {}
148
+ metadata:
149
+ rubygems_mfa_required: 'true'
149
150
  post_install_message: Add `require 'chef-raketasks'` to your `Rakefile`.
150
151
  rdoc_options: []
151
152
  require_paths:
@@ -161,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
162
  - !ruby/object:Gem::Version
162
163
  version: '0'
163
164
  requirements: []
164
- rubygems_version: 3.0.3
165
+ rubygems_version: 3.2.22
165
166
  signing_key:
166
167
  specification_version: 4
167
168
  summary: Collection of reusable Rake tasks for Chef