kitchen-scribe 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1 +1,3 @@
1
- .chef
1
+ .chef
2
+ Gemfile.lock
3
+ gemfiles/*.lock
@@ -0,0 +1 @@
1
+ kitchen-scribe
@@ -0,0 +1 @@
1
+ ruby-1.9.3-p327
@@ -0,0 +1,13 @@
1
+ language: ruby
2
+ rvm:
3
+ - "1.9.2"
4
+ - "1.9.3"
5
+ - "2.0.0"
6
+ gemfile:
7
+ - gemfiles/Gemfile.chef-11
8
+ - gemfiles/Gemfile.chef-10
9
+ matrix:
10
+ exclude:
11
+ - rvm: 2.0.0
12
+ gemfile: gemfiles/Gemfile.chef-10
13
+ script: bundle exec rspec spec
@@ -0,0 +1,19 @@
1
+ ## 0.3.0
2
+
3
+ Bugfixes:
4
+
5
+ * Adjusting a node was overwriting normal attributes and erasing automatic attributes set by ohai. This is no longer the case.
6
+ * Updated all adjustment templates
7
+ * Changed the name for node attributes stored by scribe copy to `normal` to make loading configurations from chronicle backups more convinient
8
+
9
+ ## 0.2.0
10
+
11
+ Features:
12
+
13
+ * Added `scribe hire` for making precise updates to environments, roles and nodes by using json data structure describing the change.
14
+
15
+ ## 0.1.0
16
+
17
+ Features:
18
+
19
+ * First edition of `scribe` with a single directive called `copy`. It pulls the configuration of all your environements, roles, and nodes then saves them into json files in the place of your choosing and commits the changes to a local git repository. It can also pull/push them to a remote repostory for safekeeping.
data/Gemfile CHANGED
@@ -1,5 +1,3 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
- gem "chef"
4
- gem "rspec"
5
- gem "kitchen-scribe"
3
+ gemspec
data/README.md CHANGED
@@ -17,8 +17,10 @@ The philosophy behind using scribe to update your environments, roles an nodes i
17
17
 
18
18
  The plugin is still in the beta stage, I've tested it manualy to some extent, but I'm sure there are things I missed. Please submit any bugs you find through the github issue system and I promiss to take care of them as soon as possible.
19
19
 
20
- [![Code Climate](https://codeclimate.com/github/khozlov/kitchen-scribe.png)](https://codeclimate.com/github/khozlov/kitchen-scribe)
21
20
  [![Gem Version](https://badge.fury.io/rb/kitchen-scribe.png)](http://badge.fury.io/rb/kitchen-scribe)
21
+ [![Build Status](https://travis-ci.org/khozlov/kitchen-scribe.png?branch=master)](https://travis-ci.org/khozlov/kitchen-scribe)
22
+ [![Dependency Status](https://gemnasium.com/khozlov/kitchen-scribe.png)](https://gemnasium.com/khozlov/kitchen-scribe)
23
+ [![Code Climate](https://codeclimate.com/github/khozlov/kitchen-scribe.png)](https://codeclimate.com/github/khozlov/kitchen-scribe)
22
24
 
23
25
  USAGE
24
26
  -----
@@ -51,6 +53,8 @@ You can also specify all the params in your `knife.rb` not to type it in every t
51
53
  :commit_message => "your_commit_message"
52
54
  }
53
55
 
56
+ At this moment, when using ruby 1.8.7 or earlier the diff between subsequent revisions might be inaccurate due to non-deterministic hash ordering in versions prior to 1.9. I'll try to fix it in future releases.
57
+
54
58
  ### Making Changes
55
59
 
56
60
  `adjust` action is your friend here.
@@ -116,8 +120,7 @@ Have fun!
116
120
  WHAT'S NEXT
117
121
  -----------
118
122
  * Refactoring, refactoring, refactoring
119
- * Testing
120
- * Bug fixes
123
+ * Ruby 1.8.7 fix
121
124
 
122
125
  LICENSE
123
126
  -------
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "chef", '~> 10.0'
4
+
5
+ gemspec :path => '..'
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "chef", '~> 11.2'
4
+
5
+ gemspec :path => '..'
@@ -12,6 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.summary = "Knife plugin for tracking your chef configuration changes"
13
13
  s.description = s.summary
14
14
  s.extra_rdoc_files = ["README.md", "LICENSE" ]
15
+ s.license = "Apache License (2.0)"
15
16
 
16
17
  s.files = `git ls-files`.split("\n")
17
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -220,7 +220,7 @@ class Chef
220
220
  def prepare_object_hash(chef_object)
221
221
  prepared_hash = chef_object.to_hash
222
222
  if prepared_hash["chef_type"] == "node"
223
- prepared_hash.keep_if { |key, value| ["name","chef_type","chef_environment","run_list"].include? key }
223
+ prepared_hash.reject! { |key, value| !(["name","chef_type","chef_environment","run_list"].include? key) }
224
224
  prepared_hash.merge!({ "normal" => chef_object.normal_attrs })
225
225
  end
226
226
  prepared_hash
@@ -1,4 +1,4 @@
1
1
  module KitchenScribe
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  MAJOR, MINOR, TINY = VERSION.split('.')
4
4
  end
@@ -133,7 +133,7 @@ describe Chef::Knife::ScribeAdjust do
133
133
 
134
134
  it "prints errors but does not exit" do
135
135
  @scribe.should_receive(:print_errors)
136
- lambda { @scribe.parse_adjustments }.should_not raise_error(SystemExit)
136
+ lambda { @scribe.parse_adjustments }.should_not raise_error()
137
137
  end
138
138
  end
139
139
  end
@@ -535,7 +535,7 @@ describe Chef::Knife::ScribeAdjust do
535
535
 
536
536
  it "doesn't throw an exception" do
537
537
  File.should_receive(:open).with(@filename, "r").and_yield('{"a" : 3, b => ]')
538
- lambda { @scribe.parse_adjustment_file(@filename) }.should_not raise_error(JSON::ParserError)
538
+ lambda { @scribe.parse_adjustment_file(@filename) }.should_not raise_error()
539
539
  end
540
540
  end
541
541
 
@@ -713,7 +713,7 @@ describe Chef::Knife::ScribeAdjust do
713
713
  }
714
714
  @chef_obj.stub(:to_hash).and_return( @node_data)
715
715
  @chef_obj.stub(:normal_attrs).and_return({"nx" => "ny"})
716
- @prepared_data = @node_data.select { |key, value| ["name","chef_type","chef_environment","run_list"].include? key }
716
+ @prepared_data = @node_data.reject { |key, value| !(["name","chef_type","chef_environment","run_list"].include? key) }
717
717
  @prepared_data.merge!({"normal" => {"nx" => "ny"}})
718
718
  end
719
719
 
@@ -434,8 +434,8 @@ describe Chef::Knife::ScribeCopy do
434
434
  describe "#deep_sort" do
435
435
  describe "when it gets a hash as a parameter" do
436
436
  it "sorts the hash" do
437
- sorted_hash = @scribe.deep_sort({:c => 3, :a => 1, :x => 0, :d => -2})
438
- sorted_values = [[:a, 1], [:c,3], [:d,-2], [:x,0]]
437
+ sorted_hash = @scribe.deep_sort({"c" => 3, "a" => 1, "x" => 0, "d" => -2})
438
+ sorted_values = [["a", 1], ["c",3], ["d",-2], ["x",0]]
439
439
  i = 0
440
440
  sorted_hash.each do |key, value|
441
441
  key.should eql(sorted_values[i][0])
@@ -445,7 +445,7 @@ describe Chef::Knife::ScribeCopy do
445
445
  end
446
446
 
447
447
  it "calls itself recursively with each value" do
448
- hash_to_sort = {:g => 3, :b => 1, :z => 0, :h => -2}
448
+ hash_to_sort = {"g" => 3, "b" => 1, "z" => 0, "h" => -2}
449
449
  @scribe.should_receive(:deep_sort).with(hash_to_sort).and_call_original
450
450
  hash_to_sort.values.each {|value| @scribe.should_receive(:deep_sort).with(value)}
451
451
  @scribe.deep_sort(hash_to_sort)
@@ -20,8 +20,8 @@ require File.expand_path('../../../spec_helper', __FILE__)
20
20
 
21
21
  describe Chef::Knife::ScribeHire do
22
22
  before(:each) do
23
- Dir.stub!(:mkdir)
24
- Dir.stub!(:pwd) { "some_path" }
23
+ Dir.stub(:mkdir)
24
+ Dir.stub(:pwd) { "some_path" }
25
25
  @scribe = Chef::Knife::ScribeHire.new
26
26
  Chef::Config[:knife][:scribe] = {}
27
27
  @scribe.configure
@@ -31,7 +31,7 @@ describe Chef::Knife::ScribeHire do
31
31
  before(:each) do
32
32
  @scribe.stub(:setup_remote)
33
33
  @scribe.stub(:init_chronicle)
34
- File.stub!(:directory?) { false }
34
+ File.stub(:directory?) { false }
35
35
  end
36
36
 
37
37
  it "calls #configure" do
@@ -22,3 +22,7 @@ require 'chef/knife'
22
22
  require 'chef/knife/scribe_hire'
23
23
  require 'chef/knife/scribe_copy'
24
24
  require 'chef/knife/scribe_adjust'
25
+ require 'chef/role'
26
+ require 'chef/environment'
27
+ require 'chef/node'
28
+ require 'chef/search/query'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-scribe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-25 00:00:00.000000000 Z
12
+ date: 2013-09-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef
@@ -85,11 +85,15 @@ extra_rdoc_files:
85
85
  - LICENSE
86
86
  files:
87
87
  - .gitignore
88
- - .rvmrc
88
+ - .ruby-gemset
89
+ - .ruby-version
90
+ - .travis.yml
91
+ - CHANGELOG.md
89
92
  - Gemfile
90
- - Gemfile.lock
91
93
  - LICENSE
92
94
  - README.md
95
+ - gemfiles/Gemfile.chef-10
96
+ - gemfiles/Gemfile.chef-11
93
97
  - kitchen-scribe.gemspec
94
98
  - lib/chef/knife/scribe_adjust.rb
95
99
  - lib/chef/knife/scribe_copy.rb
@@ -100,7 +104,8 @@ files:
100
104
  - spec/chef/knife/scribe_hire_spec.rb
101
105
  - spec/spec_helper.rb
102
106
  homepage: https://github.com/khozlov/kitchen-scribe
103
- licenses: []
107
+ licenses:
108
+ - Apache License (2.0)
104
109
  post_install_message:
105
110
  rdoc_options: []
106
111
  require_paths:
data/.rvmrc DELETED
@@ -1,34 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
- # development environment upon cd'ing into the directory
5
-
6
- # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
7
- # Only full ruby name is supported here, for short names use:
8
- # echo "rvm use 1.9.3" > .rvmrc
9
- environment_id="ruby-1.9.3-p327@kitchen-scribe"
10
-
11
- # Uncomment the following lines if you want to verify rvm version per project
12
- # rvmrc_rvm_version="1.17.3 (stable)" # 1.10.1 seams as a safe start
13
- # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14
- # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15
- # return 1
16
- # }
17
-
18
- # First we attempt to load the desired environment directly from the environment
19
- # file. This is very fast and efficient compared to running through the entire
20
- # CLI and selector. If you want feedback on which environment was used then
21
- # insert the word 'use' after --create as this triggers verbose mode.
22
- if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
23
- && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
24
- then
25
- \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
26
- [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
27
- \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
28
- else
29
- # If the environment file has not yet been created, use the RVM CLI to select.
30
- rvm --create "$environment_id" || {
31
- echo "Failed to create RVM environment '${environment_id}'."
32
- return 1
33
- }
34
- fi
@@ -1,76 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- bunny (0.7.9)
5
- chef (10.18.2)
6
- bunny (>= 0.6.0, < 0.8.0)
7
- erubis
8
- highline (>= 1.6.9)
9
- json (>= 1.4.4, <= 1.6.1)
10
- mixlib-authentication (>= 1.3.0)
11
- mixlib-cli (>= 1.1.0)
12
- mixlib-config (>= 1.1.2)
13
- mixlib-log (>= 1.3.0)
14
- mixlib-shellout
15
- moneta (< 0.7.0)
16
- net-ssh (~> 2.2.2)
17
- net-ssh-multi (~> 1.1.0)
18
- ohai (>= 0.6.0)
19
- rest-client (>= 1.0.4, < 1.7.0)
20
- treetop (~> 1.4.9)
21
- uuidtools
22
- yajl-ruby (~> 1.1)
23
- diff-lcs (1.1.3)
24
- erubis (2.7.0)
25
- highline (1.6.15)
26
- ipaddress (0.8.0)
27
- json (1.6.1)
28
- kitchen-scribe (0.1.0)
29
- chef (>= 0.10.10)
30
- mime-types (1.19)
31
- mixlib-authentication (1.3.0)
32
- mixlib-log
33
- mixlib-cli (1.3.0)
34
- mixlib-config (1.1.2)
35
- mixlib-log (1.4.1)
36
- mixlib-shellout (1.1.0)
37
- moneta (0.6.0)
38
- net-ssh (2.2.2)
39
- net-ssh-gateway (1.1.0)
40
- net-ssh (>= 1.99.1)
41
- net-ssh-multi (1.1)
42
- net-ssh (>= 2.1.4)
43
- net-ssh-gateway (>= 0.99.0)
44
- ohai (6.16.0)
45
- ipaddress
46
- mixlib-cli
47
- mixlib-config
48
- mixlib-log
49
- mixlib-shellout
50
- systemu
51
- yajl-ruby
52
- polyglot (0.3.3)
53
- rest-client (1.6.7)
54
- mime-types (>= 1.16)
55
- rspec (2.12.0)
56
- rspec-core (~> 2.12.0)
57
- rspec-expectations (~> 2.12.0)
58
- rspec-mocks (~> 2.12.0)
59
- rspec-core (2.12.2)
60
- rspec-expectations (2.12.1)
61
- diff-lcs (~> 1.1.3)
62
- rspec-mocks (2.12.1)
63
- systemu (2.5.2)
64
- treetop (1.4.12)
65
- polyglot
66
- polyglot (>= 0.3.1)
67
- uuidtools (2.1.3)
68
- yajl-ruby (1.1.0)
69
-
70
- PLATFORMS
71
- ruby
72
-
73
- DEPENDENCIES
74
- chef
75
- kitchen-scribe
76
- rspec