librarian-chef-nochef 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,27 @@
1
+ module Support
2
+ module ProjectPath
3
+
4
+ project_path = Pathname.new(__FILE__).expand_path
5
+ project_path = project_path.dirname until project_path.join("Rakefile").exist?
6
+ project_path
7
+
8
+ PROJECT_PATH = project_path
9
+
10
+ def project_path
11
+ PROJECT_PATH
12
+ end
13
+
14
+ module ClassMethods
15
+ def project_path
16
+ PROJECT_PATH
17
+ end
18
+ end
19
+
20
+ def self.included(base)
21
+ base.extend ClassMethods
22
+ end
23
+
24
+ extend self
25
+
26
+ end
27
+ end
@@ -0,0 +1,85 @@
1
+ require "librarian-chef"
2
+ require "librarian/chef/metadata"
3
+
4
+ module Librarian
5
+ module Chef
6
+ describe Metadata do
7
+
8
+ context "depends" do
9
+ it "should default version constraint to >= 0.0.0" do
10
+ File.stub(:read).and_return("depends 'foo'\n")
11
+ metadata = described_class.new("foo")
12
+ expect(metadata.dependencies["foo"]).to eq(">= 0.0.0")
13
+ end
14
+
15
+ it "should default the operator to =" do
16
+ File.stub(:read).and_return("depends 'foo', '1.0.0'\n")
17
+ metadata = described_class.new("foo")
18
+ expect(metadata.dependencies["foo"]).to eq("= 1.0.0")
19
+ end
20
+
21
+ %w(< > = <= >= ~>).each do |operator|
22
+ it "should accept the #{operator} operator" do
23
+ File.stub(:read).and_return("depends 'foo', '#{operator} 1.0.0'\n")
24
+ metadata = described_class.new("foo")
25
+ expect(metadata.dependencies["foo"]).to eq("#{operator} 1.0.0")
26
+ end
27
+ end
28
+
29
+ it "should fail with a wrong operator" do
30
+ File.stub(:read).and_return("depends 'foo', '>~ 1.0.0'\n")
31
+ expect { described_class.new("foo") }.to raise_error(::Librarian::Error, "Invalid version constraint")
32
+ end
33
+
34
+ it "should fail with a wrong version format" do
35
+ File.stub(:read).and_return("depends 'foo', '>= wrong'\n")
36
+ expect { described_class.new("foo") }.to raise_error(::Librarian::Error, "Invalid cookbook version")
37
+ end
38
+ end
39
+
40
+ context "version" do
41
+ it "should allow version number in the format x.x.x" do
42
+ File.stub(:read).and_return("version '1.0.0'\n")
43
+ metadata = described_class.new("foo")
44
+ expect(metadata.version).to eq("1.0.0")
45
+ end
46
+
47
+ it "should allow version number in the format x.x" do
48
+ File.stub(:read).and_return("version '1.0'\n")
49
+ metadata = described_class.new("foo")
50
+ expect(metadata.version).to eq("1.0")
51
+ end
52
+
53
+ it "should fail with a wrong version format" do
54
+ File.stub(:read).and_return("version 'wrong'\n")
55
+ expect { described_class.new("foo") }.to raise_error(::Librarian::Error, "Invalid cookbook version")
56
+ end
57
+ end
58
+
59
+ context "misc" do
60
+ it "should ignore other definitions" do
61
+ File.stub(:read).and_return("suggest 'foo'\n")
62
+ metadata = described_class.new("foo")
63
+ expect(metadata.dependencies).to eq({})
64
+ expect(metadata.version).to eq("0.0.0")
65
+ end
66
+
67
+ it "should work with multiple definitions" do
68
+ definition = %Q{
69
+ maintainer "Myself"
70
+
71
+ depends "foo"
72
+ depends "bar", "~> 2.1.0"
73
+
74
+ version "0.1.0"
75
+ }
76
+ File.stub(:read).and_return(definition)
77
+ metadata = described_class.new("foo")
78
+ expect(metadata.dependencies).to eq({ "foo" => ">= 0.0.0", "bar" => "~> 2.1.0" })
79
+ expect(metadata.version).to eq("0.1.0")
80
+ end
81
+ end
82
+
83
+ end
84
+ end
85
+ end
metadata ADDED
@@ -0,0 +1,156 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: librarian-chef-nochef
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Emiliano Ticci
8
+ - Jay Feldblum
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-03-06 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: librarian
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ~>
19
+ - !ruby/object:Gem::Version
20
+ version: 0.1.0
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ version: 0.1.0
28
+ - !ruby/object:Gem::Dependency
29
+ name: minitar
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '>='
33
+ - !ruby/object:Gem::Version
34
+ version: 0.5.2
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '>='
40
+ - !ruby/object:Gem::Version
41
+ version: 0.5.2
42
+ - !ruby/object:Gem::Dependency
43
+ name: rake
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rspec
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: webmock
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ description: A Bundler for your Chef Cookbooks that does not depends on chef.
85
+ email:
86
+ - emiticci@gmail.com
87
+ - y_feldblum@yahoo.com
88
+ executables:
89
+ - librarian-chef
90
+ extensions: []
91
+ extra_rdoc_files: []
92
+ files:
93
+ - .gitignore
94
+ - .rspec
95
+ - .travis.yml
96
+ - CHANGELOG.md
97
+ - Gemfile
98
+ - LICENSE.txt
99
+ - README.md
100
+ - Rakefile
101
+ - bin/librarian-chef
102
+ - lib/librarian-chef.rb
103
+ - lib/librarian/chef.rb
104
+ - lib/librarian/chef/cli.rb
105
+ - lib/librarian/chef/dsl.rb
106
+ - lib/librarian/chef/environment.rb
107
+ - lib/librarian/chef/extension.rb
108
+ - lib/librarian/chef/integration/knife.rb
109
+ - lib/librarian/chef/manifest_reader.rb
110
+ - lib/librarian/chef/metadata.rb
111
+ - lib/librarian/chef/source.rb
112
+ - lib/librarian/chef/source/git.rb
113
+ - lib/librarian/chef/source/github.rb
114
+ - lib/librarian/chef/source/local.rb
115
+ - lib/librarian/chef/source/path.rb
116
+ - lib/librarian/chef/source/site.rb
117
+ - lib/librarian/chef/templates/Cheffile
118
+ - lib/librarian/chef/version.rb
119
+ - librarian-chef-nochef.gemspec
120
+ - spec/functional/chef/cli_spec.rb
121
+ - spec/functional/chef/source/site_spec.rb
122
+ - spec/integration/chef/source/git_spec.rb
123
+ - spec/integration/chef/source/site_spec.rb
124
+ - spec/support/project_path.rb
125
+ - spec/unit/metadata_spec.rb
126
+ homepage: https://github.com/emyl/librarian-chef-nochef
127
+ licenses:
128
+ - MIT
129
+ metadata: {}
130
+ post_install_message:
131
+ rdoc_options: []
132
+ require_paths:
133
+ - lib
134
+ required_ruby_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ required_rubygems_version: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - '>='
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
144
+ requirements: []
145
+ rubyforge_project:
146
+ rubygems_version: 2.0.14
147
+ signing_key:
148
+ specification_version: 4
149
+ summary: A Bundler for your Chef Cookbooks that does not depends on chef.
150
+ test_files:
151
+ - spec/functional/chef/cli_spec.rb
152
+ - spec/functional/chef/source/site_spec.rb
153
+ - spec/integration/chef/source/git_spec.rb
154
+ - spec/integration/chef/source/site_spec.rb
155
+ - spec/support/project_path.rb
156
+ - spec/unit/metadata_spec.rb