librarian 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -14,19 +14,29 @@ Librarian::Chef
14
14
 
15
15
  An adapter for Librarian applying to Chef cookbooks in a Chef Repository.
16
16
 
17
- Usage:
17
+ ## Install librarian:
18
18
 
19
- # install librarian onto your system
20
19
  $ gem install librarian
21
20
 
22
- $ cd ~/path/to/chef-repo
23
21
 
24
- # make sure your cookbooks directory exists but is gitignored
22
+ __Make sure your cookbooks directory is gitignored__
23
+
24
+ $ cd ~/path/to/chef-repo
25
25
  $ git rm -r cookbooks # if the directory is present
26
- $ mkdir cookbooks
27
26
  $ echo cookbooks >> .gitignore
28
27
 
29
- # put dependencies and their sources into Cheffile
28
+ Note that librarian *takes over* your cookbooks directory
29
+ and manages it for you based on your Cheffile. Your
30
+ Cheffile becomes the authoritative source for what
31
+ cookbooks you have, rather than the directories in your
32
+ cookbooks directory.
33
+
34
+ __Make a Cheffile__
35
+
36
+ $ librarian-chef init
37
+
38
+ __Add dependencies and their sources to Cheffile__
39
+
30
40
  $ cat Cheffile
31
41
  site 'http://community.opscode.com/api/v1'
32
42
  cookbook 'ntp'
@@ -35,14 +45,17 @@ Usage:
35
45
  :git => 'https://github.com/fnichol/chef-rvm',
36
46
  :ref => 'v0.7.1'
37
47
 
38
- # install dependencies into ./cookbooks
48
+ __install dependencies into ./cookbooks__
49
+
39
50
  $ librarian-chef install [--clean] [--verbose]
40
51
 
41
- # check into version control your ./Cheffile.lock
52
+ __Check your Cheffile.lock into version control__
53
+
42
54
  $ git add Cheffile.lock
43
55
  $ git commit -m "I want these particular versions of these particular cookbooks from these particular."
44
56
 
45
- # update your cheffile with new/changed/removed constraints/sources/dependencies
57
+ __Update your cheffile with new/changed/removed constraints/sources/dependencies__
58
+
46
59
  $ cat Cheffile
47
60
  site 'http://community.opscode.com/api/v1'
48
61
  cookbook 'ntp'
@@ -58,16 +71,19 @@ Usage:
58
71
  $ git add Cheffile.lock
59
72
  $ git commit -m "I also want these additional cookbooks."
60
73
 
61
- # update the version of a dependency
74
+ __Update the version of a dependency__
75
+
62
76
  $ librarian-chef update ntp timezone monit [--verbose]
63
77
  $ git diff Cheffile.lock
64
78
  $ git add Cheffile.lock
65
79
  $ git commit -m "I want updated versions of these cookbooks."
66
80
 
67
- # push your changes to the git repository
81
+ __Push your changes to the git repository__
82
+
68
83
  $ git push origin master
69
84
 
70
- # upload the cookbooks to your chef-server
85
+ __Upload the cookbooks to your chef-server__
86
+
71
87
  $ knife cookbook upload --all
72
88
 
73
89
  You should `.gitignore` your `./cookbooks` directory.
@@ -88,6 +104,11 @@ In the above, make sure *not* to include the path to your `chef-repo/cookbooks`.
88
104
  not have any `:path`-sourced cookbooks in your `Cheffile` sourced from that directory,
89
105
  you still need to include your `chef-repo/site-cookbooks` directory in the above list.
90
106
 
107
+ What this integration does is when you use `knife`, it will enforce that your `Cheffile`
108
+ and `Cheffile.lock` are in sync. When you `knife cookbook upload`, it will be sure to
109
+ upload the same cookbook as is in your `Cheffile.lock`, regardless of what you've done
110
+ to your `chef-repo/cookbooks` directory.
111
+
91
112
  License
92
113
  -------
93
114
 
@@ -0,0 +1,10 @@
1
+ Feature: cli/init
2
+
3
+
4
+
5
+ Scenario: Initing a directory
6
+ When I run `librarian-chef init`
7
+ Then a file named "Cheffile" should exist
8
+
9
+
10
+
@@ -1,4 +1,4 @@
1
- Feature: cli/catalog
1
+ Feature: cli/install
2
2
 
3
3
 
4
4
 
@@ -19,7 +19,7 @@ Feature: cli/catalog
19
19
  cookbook 'apt',
20
20
  :path => 'cookbook-sources'
21
21
  """
22
- When I run "librarian-chef install --verbose"
22
+ When I run `librarian-chef install --verbose`
23
23
  Then the exit status should be 0
24
24
  And the file "cookbooks/apt/metadata.yaml" should contain exactly:
25
25
  """
@@ -49,7 +49,7 @@ Feature: cli/catalog
49
49
  path 'cookbook-sources'
50
50
  cookbook 'main'
51
51
  """
52
- When I run "librarian-chef install --verbose"
52
+ When I run `librarian-chef install --verbose`
53
53
  Then the exit status should be 0
54
54
  And the file "cookbooks/main/metadata.yaml" should contain exactly:
55
55
  """
@@ -1,3 +1,5 @@
1
+ require 'librarian/helpers'
2
+
1
3
  require 'librarian/cli'
2
4
  require 'librarian/chef'
3
5
  require 'librarian/chef/particularity'
@@ -9,6 +11,12 @@ module Librarian
9
11
  include Particularity
10
12
  extend Particularity
11
13
 
14
+ source_root Pathname.new(__FILE__).dirname.join("templates")
15
+
16
+ def init
17
+ copy_file root_module.specfile_name
18
+ end
19
+
12
20
  end
13
21
  end
14
22
  end
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ #^syntax detection
3
+
4
+ site 'http://community.opscode.com/api/v1'
5
+
6
+ # cookbook 'chef-client'
7
+
8
+ # cookbook 'rvm',
9
+ # :git => 'https://github.com/fnichol/chef-rvm'
10
+
11
+ # cookbook 'postgresql',
12
+ # :git => 'https://github.com/findsyou/cookbooks',
13
+ # :ref => 'postgresql-improvements'
data/lib/librarian/cli.rb CHANGED
@@ -72,5 +72,10 @@ module Librarian
72
72
  end
73
73
  end
74
74
 
75
+ desc "init", "Initializes the current directory."
76
+ def init
77
+ puts "Nothing to do."
78
+ end
79
+
75
80
  end
76
81
  end
@@ -1,3 +1,3 @@
1
1
  module Librarian
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/lib/librarian.rb CHANGED
@@ -105,6 +105,7 @@ module Librarian
105
105
  manifests.each do |manifest|
106
106
  manifest.source.cache!([manifest])
107
107
  end
108
+ install_path.mkpath unless install_path.exist?
108
109
  manifests.each do |manifest|
109
110
  manifest.install!
110
111
  end
data/librarian.gemspec CHANGED
@@ -26,5 +26,5 @@ Gem::Specification.new do |s|
26
26
  s.add_development_dependency "aruba"
27
27
  s.add_development_dependency "webmock"
28
28
 
29
- s.add_development_dependency "chef", ">= 0.10"
29
+ s.add_dependency "chef", ">= 0.10"
30
30
  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.4
4
+ version: 0.0.5
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-08-08 00:00:00.000000000Z
12
+ date: 2011-08-17 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &18652040 !ruby/object:Gem::Requirement
16
+ requirement: &25703580 !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: *18652040
24
+ version_requirements: *25703580
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &18651500 !ruby/object:Gem::Requirement
27
+ requirement: &25703120 !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: *18651500
35
+ version_requirements: *25703120
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: cucumber
38
- requirement: &18651020 !ruby/object:Gem::Requirement
38
+ requirement: &25702660 !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: *18651020
46
+ version_requirements: *25702660
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: aruba
49
- requirement: &18650380 !ruby/object:Gem::Requirement
49
+ requirement: &25702220 !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: *18650380
57
+ version_requirements: *25702220
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: webmock
60
- requirement: &18649560 !ruby/object:Gem::Requirement
60
+ requirement: &25701800 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,18 +65,18 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *18649560
68
+ version_requirements: *25701800
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: chef
71
- requirement: &18647940 !ruby/object:Gem::Requirement
71
+ requirement: &25701280 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0.10'
77
- type: :development
77
+ type: :runtime
78
78
  prerelease: false
79
- version_requirements: *18647940
79
+ version_requirements: *25701280
80
80
  description: Librarian
81
81
  email:
82
82
  - y_feldblum@yahoo.com
@@ -95,6 +95,7 @@ files:
95
95
  - bin/librarian-chef
96
96
  - bin/librarian-mock
97
97
  - config/cucumber.yaml
98
+ - features/chef/cli/init.feature
98
99
  - features/chef/cli/install.feature
99
100
  - features/support/env.rb
100
101
  - lib/librarian.rb
@@ -110,6 +111,7 @@ files:
110
111
  - lib/librarian/chef/source/local.rb
111
112
  - lib/librarian/chef/source/path.rb
112
113
  - lib/librarian/chef/source/site.rb
114
+ - lib/librarian/chef/templates/Cheffile
113
115
  - lib/librarian/cli.rb
114
116
  - lib/librarian/dependency.rb
115
117
  - lib/librarian/dsl.rb