chake 0.11 → 0.12

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: 1984eadb9d5b222a4e1aed1b8180b04819c8158b
4
- data.tar.gz: ec4ed19becc23cbe25377524ddc800fbc8da1e4c
3
+ metadata.gz: bd36fdb7ba1e6821df011b23e5124f0a1a333666
4
+ data.tar.gz: c8a209c44c58782d0faf734faa5aa782c5fd64f1
5
5
  SHA512:
6
- metadata.gz: 32a7a9675766f6ea039d8e1c07587c210e831e97d497f2f229be1f4253b2c0c1374a74be6e27f679fd5eedaa4905ca380a02d98d5e41fceb69989240be3e4576
7
- data.tar.gz: 775af5a4f9d52c8d70a10cab818a235a6af76b8b167c7616d6fcb97dcd343195f44da6df986200bc19f19dfb04a6e5bfa696d2d8831dc324e2d2ef9da4bf5819
6
+ metadata.gz: d62c682ea5e0bad45b623a3aa20fc4eb07c7d05f2a823710ce40c34065c474396c03d0dc2a4af71b48a0eadfdfcaaad50116369347791001aeef392aeabfdf77
7
+ data.tar.gz: e4709a62cbaa6e046be70f8252e49b1ba5a34842f48f17d85a30eb659250ab43d14e78172a041f4791ae1af80f6e89837e1ffae04366fe641c505f0c25244ad4
@@ -0,0 +1,10 @@
1
+ before_script:
2
+ - pwd
3
+ - echo $USER
4
+ - bundle install --path .bundle
5
+
6
+ tests:
7
+ script: bundle exec rake
8
+ cache:
9
+ paths:
10
+ - .bundle
@@ -1,3 +1,10 @@
1
+ # 0.12
2
+
3
+ * Switch manpage build from ronn to asciidoctor
4
+ * Add ability to override the Chef configuration file by setting
5
+ `$CHAKE_CHEF_CONFIG` (default: `config.rb`)
6
+ * bootstrap: ensure short hostname is in /etc/hosts
7
+
1
8
  # 0.11
2
9
 
3
10
  * bootstrap: make sure FQDN matches hostname
data/README.md CHANGED
@@ -1,5 +1,10 @@
1
- chake(1) - serverless configuration with chef
2
- =============================================
1
+ # chake(1)
2
+
3
+ ## NAME
4
+
5
+ chake - serverless configuration with chef
6
+
7
+ ## Introduction
3
8
 
4
9
  chake is a tool that helps you manage multiple hosts with, without the need for
5
10
  a chef server. Configuration is managed in a local directory, which should
@@ -26,14 +31,12 @@ $ chake init
26
31
 
27
32
  A brief explanation of the created files:
28
33
 
29
- |File|Description|
30
- |----|-----------|
31
- | `nodes.yaml` | where you will list the hosts you will be managing, and what recipes to apply to each of them. |
32
- | `nodes.d` | a directory with multiple files in the same format as nodes.yaml. All files matching `*.yaml` in it will be added to the list of nodes. |
33
- | `config.rb` | contains the chef-solo configuration. You can modify it, but usually you won't need to. |
34
- | `config/roles` | directory is where you can put your role definitions. |
35
- | `cookbooks` | directory where you will store your cookbooks. A sample cookbook called "basics" is created, but feel free to remove it and add actual cookbooks. |
36
- | `Rakefile` | Contains just the `require 'chake'` line. You can augment it with other tasks specific to your intrastructure. |
34
+ * `nodes.yaml`: where you will list the hosts you will be managing, and what recipes to apply to each of them.
35
+ * `nodes.d`: a directory with multiple files in the same format as nodes.yaml. All files matching `*.yaml` in it will be added to the list of nodes.
36
+ * `config.rb`: contains the chef-solo configuration. You can modify it, but usually you won't need to.
37
+ * `config/roles`: directory is where you can put your role definitions.
38
+ * `cookbooks`: directory where you will store your cookbooks. A sample cookbook called "basics" is created, but feel free to remove it and add actual cookbooks.
39
+ * `Rakefile`: Contains just the `require 'chake'` line. You can augment it with other tasks specific to your intrastructure.
37
40
 
38
41
  After the repository is created, you can call either `chake` or `rake`, as they
39
42
  are completely equivalent.
@@ -191,14 +194,11 @@ the node URLs:
191
194
  [backend://][username@]hostname[:port][/path]
192
195
  ```
193
196
 
194
- |Parameter|Meaning|Default value|
195
- |---------|-------|-------------|
196
- | backend | backend to use to connect to the host. `ssh` or `local` | `ssh` |
197
- | username | user name to connect with | The username on your local workstation |
198
- | hostname | the hostname to connect to | _none_ |
199
- | port | port number to connect to | 22 |
200
- | /path | where to store the cookbooks at the node | `/var/tmp/chef.$USERNAME` |
201
-
197
+ * `backend`: backend to use to connect to the host. `ssh` or `local` (default: `ssh`)
198
+ * `username`: user name to connect with (default: the username on your local workstation)
199
+ * `hostname`: the hostname to connect to (default: _none_)
200
+ * `port`: port number to connect to (default: 22)
201
+ * `/path`: where to store the cookbooks at the node (default: `/var/tmp/chef.$USERNAME`)
202
202
 
203
203
  ## Extra features
204
204
 
@@ -298,6 +298,8 @@ vice-versa.
298
298
  Directory containing node definition files servers to be managed. Default: `nodes.d`.
299
299
  * `$CHAKE_TMPDIR`:
300
300
  Directory used to store temporary cache files. Default: `tmp/chake`.
301
+ * `$CHAKE_CHEF_CONFIG`:
302
+ Chef configuration file, relative to the root of the repository. Default: `config.rb`.
301
303
 
302
304
  ## See also
303
305
 
data/Rakefile CHANGED
@@ -20,6 +20,8 @@ task 'build:debsrc' => ['build:tarball'] do
20
20
  chdir 'pkg' do
21
21
  sh 'gem2deb', '--no-wnpp-check', '-s', '-p', pkg.name, "#{dirname}.tar.gz"
22
22
  chdir dirname do
23
+ ln 'man/Rakefile', 'debian/dh_ruby.rake'
24
+ sh "sed -i -e 's/-1/-1~0/ ; s/\*.*/* Development snapshot/' debian/changelog"
23
25
  sh 'dpkg-buildpackage', '-S', '-us', '-uc'
24
26
  end
25
27
  end
@@ -30,7 +32,7 @@ task 'deb:install' => 'build:debsrc'do
30
32
  chdir "pkg/#{pkg.name}-#{pkg.version}" do
31
33
  sh 'fakeroot debian/rules binary'
32
34
  end
33
- sh 'sudo', 'dpkg', '-i', "pkg/#{pkg.name}_#{pkg.version}-1_all.deb"
35
+ sh 'sudo', 'dpkg', '-i', "pkg/#{pkg.name}_#{pkg.version}-1~0_all.deb"
34
36
  end
35
37
 
36
38
  desc 'Create source RPM package'
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.5"
22
22
  spec.add_development_dependency "rspec"
23
23
  spec.add_development_dependency "simplecov"
24
+ spec.add_development_dependency "asciidoctor", '>= 1.5.3'
24
25
 
25
26
  spec.add_dependency "rake"
26
27
  end
@@ -9,6 +9,7 @@ require 'chake/node'
9
9
  require 'chake/readline'
10
10
  require 'chake/tmpdir'
11
11
 
12
+ chef_config = ENV['CHAKE_CHEF_CONFIG'] || 'config.rb'
12
13
  nodes_file = ENV['CHAKE_NODES'] || 'nodes.yaml'
13
14
  nodes_directory = ENV['CHAKE_NODES_D'] || 'nodes.d'
14
15
  node_data = File.exists?(nodes_file) && YAML.load_file(nodes_file) || {}
@@ -212,13 +213,13 @@ $nodes.each do |node|
212
213
  desc "converge #{hostname}"
213
214
  task "converge:#{hostname}" => converge_dependencies do
214
215
  chef_logging = Rake.application.options.silent && '-l fatal' || ''
215
- node.run_as_root "chef-solo -c #{node.path}/config.rb #{chef_logging} -j #{node.path}/#{$chake_tmpdir}/#{hostname}.json"
216
+ node.run_as_root "chef-solo -c #{node.path}/#{chef_config} #{chef_logging} -j #{node.path}/#{$chake_tmpdir}/#{hostname}.json"
216
217
  end
217
218
 
218
219
  desc 'apply <recipe> on #{hostname}'
219
220
  task "apply:#{hostname}", [:recipe] => [:recipe_input] do |task, args|
220
221
  chef_logging = Rake.application.options.silent && '-l fatal' || ''
221
- node.run_as_root "chef-solo -c #{node.path}/config.rb #{chef_logging} -j #{node.path}/#{$chake_tmpdir}/#{hostname}.json --override-runlist recipe[#{$recipe_to_apply}]"
222
+ node.run_as_root "chef-solo -c #{node.path}/#{chef_config} #{chef_logging} -j #{node.path}/#{$chake_tmpdir}/#{hostname}.json --override-runlist recipe[#{$recipe_to_apply}]"
222
223
  end
223
224
  task "apply:#{hostname}" => converge_dependencies
224
225
 
@@ -5,6 +5,11 @@ hostname --file /etc/hostname
5
5
 
6
6
  fqdn=$(hostname --fqdn || true)
7
7
  if [ "$fqdn" != "$hostname" ]; then
8
+ # if hostname is bar.example.com, we also want `bar` to be in /etc/hosts
9
+ short_hostname=$(echo "$hostname" | cut -d . -f 1)
10
+ if [ "$short_hostname" != "$hostname" ] && ! grep -q "\s${short_hostname}" /etc/hosts; then
11
+ hostname="$hostname $short_hostname"
12
+ fi
8
13
  printf "127.0.1.1\t%s\n" "$hostname" >> /etc/hosts
9
14
  fi
10
15
 
@@ -1,3 +1,3 @@
1
1
  module Chake
2
- VERSION = "0.11"
2
+ VERSION = "0.12"
3
3
  end
@@ -1,10 +1,15 @@
1
1
  task :default => 'man/chake.1'
2
2
 
3
- file 'man/chake.1' => ['man/chake.1.ronn', 'man/readme2man.sed'] do
4
- sh 'ronn --roff man/chake.1.ronn'
3
+ file 'man/chake.1' => ['man/chake.adoc'] do
4
+ command = 'asciidoctor --backend manpage --out-file man/chake.1 man/chake.adoc'
5
+ if ENV['SOURCE_DATE_EPOCH']
6
+ date = Time.at(ENV['SOURCE_DATE_EPOCH'].to_i)
7
+ command << " --attribute docdate=#{date.strftime('%Y-%m-%d')}"
8
+ end
9
+ sh command
5
10
  end
6
11
 
7
- file 'man/chake.1.ronn' => 'README.md' do |t|
12
+ file 'man/chake.adoc' => ['README.md', 'man/readme2man.sed'] do |t|
8
13
  sh "sed -f man/readme2man.sed README.md > #{t.name} || (rm -f #{t.name}; false)"
9
14
  end
10
15
 
@@ -18,5 +23,5 @@ end
18
23
 
19
24
  task :clean do
20
25
  rm_f 'man/chake.1'
21
- rm_f 'man/chake.1.ronn'
26
+ rm_f 'man/chake.adoc'
22
27
  end
@@ -1,3 +1,5 @@
1
+ 1a :doctype: manpage
2
+
1
3
  /^## Install/,/^[^#]/ d
2
4
  /^## Contributing/,$ d
3
5
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chake
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.11'
4
+ version: '0.12'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antonio Terceiro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-14 00:00:00.000000000 Z
11
+ date: 2016-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: asciidoctor
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 1.5.3
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 1.5.3
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rake
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -79,6 +93,7 @@ extensions: []
79
93
  extra_rdoc_files: []
80
94
  files:
81
95
  - ".gitignore"
96
+ - ".gitlab-ci.yml"
82
97
  - ChangeLog.md
83
98
  - Gemfile
84
99
  - LICENSE.txt
@@ -141,3 +156,4 @@ test_files:
141
156
  - spec/chake/backend_spec.rb
142
157
  - spec/chake/node_spec.rb
143
158
  - spec/spec_helper.rb
159
+ has_rdoc: