gusteau 1.0.5.dev → 1.0.6.dev

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.
@@ -1,3 +1,7 @@
1
+ ## 1.0.6.dev / 2013-07-09
2
+ * Bugfix: Ruby 1.8.7 and Rubinius compatibility
3
+ * Highlight node yaml with Coderay in `gusteau show`.
4
+
1
5
  ## 1.0.5.dev / 2013-07-09
2
6
  * Bugfix: `cookbooks_path` was not working properly
3
7
  * Add an ability to specify a custom bootstrap script
data/README.md CHANGED
@@ -18,7 +18,7 @@ It aims to:
18
18
 
19
19
  Some of the features include:
20
20
 
21
- * YAML for readable infrastructure configuration
21
+ * YAML for readable, flexible infrastructure configuration
22
22
  * Usage of a single SSH connection to stream compressed files and commands
23
23
  * Support for normal Chef CLI flags:
24
24
  * `-W` or `--why-run` (dry run mode)
@@ -31,7 +31,7 @@ Gettings started
31
31
  Gusteau is a Ruby gem:
32
32
 
33
33
  ```
34
- gem install gusteau
34
+ gem install gusteau --pre
35
35
  ```
36
36
 
37
37
  The following command generates an example Chef-repo:
@@ -148,6 +148,12 @@ Notes
148
148
 
149
149
  By default, Gusteau installs the [Omnibus Chef](http://www.opscode.com/chef/install/). However if you're targetting an unsupported platform you might want to specify the `platform` value for a node: this invokes a specific [script](https://github.com/locomote/gusteau/tree/master/bootstrap).
150
150
 
151
+ Alternatively, you can specify a custom script in `.gusteau.yml`:
152
+
153
+ ```
154
+ bootstrap: ./scripts/freebsd.sh
155
+ ```
156
+
151
157
  ### Before and after hooks
152
158
 
153
159
  You can tell Gusteau to execute specific commands before and / or after `converge` or `apply` take place. They get executed on the host system. Example `.gusteau.yml` snippet:
@@ -158,9 +164,6 @@ before:
158
164
 
159
165
  after:
160
166
  - bundle exec rake spec
161
-
162
- environments:
163
- ...
164
167
  ```
165
168
 
166
169
  ### Custom cookbooks path
@@ -170,7 +173,4 @@ By default, Gusteau uploads and sets Chef Solo up to use cookbooks from `./cookb
170
173
  ```
171
174
  cookbooks_path: [ './my-cookbooks', '../something-else' ]
172
175
  roles_path: './base-roles'
173
-
174
- environments:
175
- ...
176
176
  ```
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'rubygems'
4
4
  require 'optitron'
5
+ require 'coderay'
5
6
 
6
7
  $LOAD_PATH << File.expand_path("../..", __FILE__)
7
8
  require 'lib/gusteau'
@@ -45,7 +46,8 @@ class Gusteau::CLI < Optitron::CLI
45
46
 
46
47
  desc 'Show the configuration of a specific node'
47
48
  def show(node_name)
48
- puts node(node_name).config.to_yaml
49
+ node_yaml = node(node_name).config.to_yaml
50
+ puts CodeRay.scan(node_yaml, :yaml).term
49
51
  end
50
52
 
51
53
  private
@@ -19,6 +19,7 @@ Gem::Specification.new do |gem|
19
19
 
20
20
  gem.add_dependency 'optitron'
21
21
  gem.add_dependency 'inform'
22
+ gem.add_dependency 'coderay'
22
23
  gem.add_dependency 'json'
23
24
  gem.add_dependency 'hashie'
24
25
  gem.add_dependency 'hash-deep-merge'
@@ -10,8 +10,8 @@ module Gusteau
10
10
  def run(dna, opts)
11
11
  @server.run "rm -rf #{@dest_dir} && mkdir #{@dest_dir} && mkdir -p /tmp/chef"
12
12
 
13
- with_src_files(dna[:path]) do |list|
14
- @server.upload list, @dest_dir, :exclude => '.git/', :strip_c => 2
13
+ with_gusteau_dir(dna[:path]) do |dir|
14
+ @server.upload [dir], @dest_dir, :exclude => '.git/', :strip_c => 2
15
15
  end
16
16
 
17
17
  @server.run "sh /etc/chef/bootstrap.sh" if opts['bootstrap']
@@ -25,10 +25,8 @@ module Gusteau
25
25
 
26
26
  private
27
27
 
28
- def with_src_files(dna_path)
29
- tmp_dir = FileUtils.mkdir_p("/tmp/gusteau-#{Time.now.to_i}")[0]
28
+ def files_list(dna_path)
30
29
  bootstrap_dir = File.expand_path('../../../bootstrap', __FILE__)
31
-
32
30
  bootstrap = Gusteau::Config.settings['bootstrap'] || "#{bootstrap_dir}/#{@platform}.sh"
33
31
 
34
32
  {
@@ -41,13 +39,18 @@ module Gusteau
41
39
  Gusteau::Config.settings['cookbooks_path'].each_with_index do |path, i|
42
40
  f[path] = "cookbooks-#{i}"
43
41
  end
42
+ end
43
+ end
44
44
 
45
- f.each_pair do |src, dest|
46
- FileUtils.cp_r(src, "#{tmp_dir}/#{dest}") if File.exists?(src)
47
- end
45
+ def with_gusteau_dir(dna_path)
46
+ tmp_dir = "/tmp/gusteau-#{Time.now.to_i}"
47
+ FileUtils.mkdir_p(tmp_dir)
48
+
49
+ files_list(dna_path).each_pair do |src, dest|
50
+ FileUtils.cp_r(src, "#{tmp_dir}/#{dest}") if File.exists?(src)
48
51
  end
49
52
 
50
- yield [ tmp_dir ]
53
+ yield tmp_dir
51
54
  FileUtils.rm_rf(tmp_dir)
52
55
  end
53
56
  end
@@ -1,3 +1,3 @@
1
1
  module Gusteau
2
- VERSION = "1.0.5.dev"
2
+ VERSION = "1.0.6.dev"
3
3
  end
@@ -3,3 +3,5 @@ cookbooks_path:
3
3
  - /home/user/.cookbooks
4
4
 
5
5
  roles_path: basic-roles
6
+
7
+ bootstrap: ./bootstrap/osx.sh
@@ -37,4 +37,15 @@ describe Gusteau::Chef do
37
37
  end
38
38
  end
39
39
  end
40
+
41
+ describe "#files_list" do
42
+ subject { chef.send(:files_list, '/some/dna.json') }
43
+
44
+ it "should produce a files paths hash" do
45
+ subject['/some/dna.json'].must_equal 'dna.json'
46
+ subject['private-cookbooks'].must_equal 'cookbooks-0'
47
+ subject['basic-roles'].must_equal 'roles'
48
+ subject['./bootstrap/osx.sh'].must_equal 'bootstrap.sh'
49
+ end
50
+ end
40
51
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gusteau
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5.dev
4
+ version: 1.0.6.dev
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-07-08 00:00:00.000000000 Z
13
+ date: 2013-07-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: optitron
@@ -44,6 +44,22 @@ dependencies:
44
44
  - - ! '>='
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: coderay
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
47
63
  - !ruby/object:Gem::Dependency
48
64
  name: json
49
65
  requirement: !ruby/object:Gem::Requirement
@@ -286,7 +302,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
286
302
  version: '0'
287
303
  segments:
288
304
  - 0
289
- hash: -3825904995135051259
305
+ hash: -2949705327041746768
290
306
  required_rubygems_version: !ruby/object:Gem::Requirement
291
307
  none: false
292
308
  requirements: