librarian 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -75,6 +75,19 @@ If you are manually tracking/vendoring outside cookbooks within the repository,
75
75
  put them in another directory such as `./cookbooks-sources` and use the `:path` source.
76
76
  You should typically not need to do this.
77
77
 
78
+ You can integrate your `knife.rb` with Librarian. Stick the following in your `knife.rb`:
79
+
80
+ require 'librarian/chef/integration/knife'
81
+ cookbook_path Librarian::Chef.install_path, "chef-repo/site-cookbooks"
82
+
83
+ In the above, make sure *not* to include the path to your `chef-repo/cookbooks`. If you
84
+ have additional cookbooks directories in your chef-repo that you use for `:path`-sourced
85
+ cookbooks in your `Cheffile`, make sure *not* to include the paths to those additional
86
+ cookbooks directories either in your chef-repo. Since your `chef-repo/site-cookbooks`
87
+ directory is for overrides (monkey-patches) to external cookbooks, and since you should
88
+ not have any `:path`-sourced cookbooks in your `Cheffile` sourced from that directory,
89
+ you still need to include your `chef-repo/site-cookbooks` directory in the above list.
90
+
78
91
  License
79
92
  -------
80
93
 
@@ -0,0 +1,48 @@
1
+ require 'securerandom'
2
+
3
+ require 'librarian'
4
+ require 'librarian/chef'
5
+
6
+ module Librarian
7
+ module Chef
8
+
9
+ module KnifeIntegration
10
+ def install_path
11
+ @install_path ||= begin
12
+ has_home = ENV["HOME"] && File.directory?(ENV["HOME"])
13
+ tmp_dir = Pathname.new(has_home ? "~/.librarian/tmp" : "/tmp/librarian").expand_path
14
+ enclosing = tmp_dir.join("chef/integration/knife/install")
15
+ enclosing.mkpath unless enclosing.exist?
16
+ dir = enclosing.join(SecureRandom.hex(16))
17
+ dir.mkpath
18
+ at_exit { dir.rmtree }
19
+ dir
20
+ end
21
+ end
22
+ end
23
+
24
+ extend KnifeIntegration
25
+
26
+ def install_consistent_resolution!
27
+ raise Error, "#{specfile_name} missing!" unless specfile_path.exist?
28
+ raise Error, "#{lockfile_name} missing!" unless lockfile_path.exist?
29
+
30
+ previous_resolution = lockfile.load(lockfile_path.read)
31
+ spec = specfile.read(previous_resolution.sources)
32
+ spec_changes = spec_change_set(spec, previous_resolution)
33
+ raise Error, "#{specfile_name} and #{lockfile_name} are out of sync!" unless spec_changes.same?
34
+
35
+ previous_resolution.manifests.each do |manifest|
36
+ manifest.install!
37
+ end
38
+ rescue Error => e
39
+ hl = HighLine.new
40
+ message = hl.color(e.message, HighLine::RED)
41
+ hl.say(message)
42
+ Process.exit!(1)
43
+ end
44
+
45
+ install_consistent_resolution!
46
+
47
+ end
48
+ end
@@ -1,3 +1,3 @@
1
1
  module Librarian
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: librarian
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-06-25 00:00:00.000000000Z
12
+ date: 2011-08-08 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &14553540 !ruby/object:Gem::Requirement
16
+ requirement: &18652040 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *14553540
24
+ version_requirements: *18652040
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &14551080 !ruby/object:Gem::Requirement
27
+ requirement: &18651500 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *14551080
35
+ version_requirements: *18651500
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: cucumber
38
- requirement: &14238840 !ruby/object:Gem::Requirement
38
+ requirement: &18651020 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *14238840
46
+ version_requirements: *18651020
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: aruba
49
- requirement: &14237000 !ruby/object:Gem::Requirement
49
+ requirement: &18650380 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *14237000
57
+ version_requirements: *18650380
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: webmock
60
- requirement: &14235300 !ruby/object:Gem::Requirement
60
+ requirement: &18649560 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *14235300
68
+ version_requirements: *18649560
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: chef
71
- requirement: &14233080 !ruby/object:Gem::Requirement
71
+ requirement: &18647940 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0.10'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *14233080
79
+ version_requirements: *18647940
80
80
  description: Librarian
81
81
  email:
82
82
  - y_feldblum@yahoo.com
@@ -102,6 +102,7 @@ files:
102
102
  - lib/librarian/chef/cli.rb
103
103
  - lib/librarian/chef/dsl.rb
104
104
  - lib/librarian/chef/extension.rb
105
+ - lib/librarian/chef/integration/knife.rb
105
106
  - lib/librarian/chef/manifest.rb
106
107
  - lib/librarian/chef/particularity.rb
107
108
  - lib/librarian/chef/source.rb
@@ -163,21 +164,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
163
164
  - - ! '>='
164
165
  - !ruby/object:Gem::Version
165
166
  version: '0'
166
- segments:
167
- - 0
168
- hash: 434978619910249069
169
167
  required_rubygems_version: !ruby/object:Gem::Requirement
170
168
  none: false
171
169
  requirements:
172
170
  - - ! '>='
173
171
  - !ruby/object:Gem::Version
174
172
  version: '0'
175
- segments:
176
- - 0
177
- hash: 434978619910249069
178
173
  requirements: []
179
174
  rubyforge_project: librarian
180
- rubygems_version: 1.7.1
175
+ rubygems_version: 1.8.5
181
176
  signing_key:
182
177
  specification_version: 3
183
178
  summary: Librarian