librarian-puppet-maestrodev 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/LICENSE +20 -0
- data/README.md +187 -0
- data/bin/librarian-puppet +9 -0
- data/lib/librarian/puppet.rb +13 -0
- data/lib/librarian/puppet/cli.rb +85 -0
- data/lib/librarian/puppet/dsl.rb +16 -0
- data/lib/librarian/puppet/environment.rb +54 -0
- data/lib/librarian/puppet/extension.rb +41 -0
- data/lib/librarian/puppet/lockfile/parser.rb +53 -0
- data/lib/librarian/puppet/source.rb +4 -0
- data/lib/librarian/puppet/source/forge.rb +279 -0
- data/lib/librarian/puppet/source/git.rb +114 -0
- data/lib/librarian/puppet/source/githubtarball.rb +234 -0
- data/lib/librarian/puppet/source/local.rb +57 -0
- data/lib/librarian/puppet/source/path.rb +12 -0
- data/lib/librarian/puppet/templates/Puppetfile +10 -0
- data/lib/librarian/puppet/version.rb +5 -0
- data/vendor/librarian/CHANGELOG.md +185 -0
- data/vendor/librarian/Gemfile +6 -0
- data/vendor/librarian/MIT-LICENSE +20 -0
- data/vendor/librarian/README.md +403 -0
- data/vendor/librarian/Rakefile +34 -0
- data/vendor/librarian/bin/librarian-chef +7 -0
- data/vendor/librarian/bin/librarian-mock +7 -0
- data/vendor/librarian/config/cucumber.yaml +1 -0
- data/vendor/librarian/features/chef/cli/init.feature +11 -0
- data/vendor/librarian/features/chef/cli/install.feature +64 -0
- data/vendor/librarian/features/chef/cli/show.feature +77 -0
- data/vendor/librarian/features/chef/cli/version.feature +11 -0
- data/vendor/librarian/features/support/env.rb +9 -0
- data/vendor/librarian/lib/librarian.rb +19 -0
- data/vendor/librarian/lib/librarian/action.rb +5 -0
- data/vendor/librarian/lib/librarian/action/base.rb +24 -0
- data/vendor/librarian/lib/librarian/action/clean.rb +44 -0
- data/vendor/librarian/lib/librarian/action/ensure.rb +24 -0
- data/vendor/librarian/lib/librarian/action/install.rb +99 -0
- data/vendor/librarian/lib/librarian/action/resolve.rb +81 -0
- data/vendor/librarian/lib/librarian/action/update.rb +78 -0
- data/vendor/librarian/lib/librarian/chef.rb +1 -0
- data/vendor/librarian/lib/librarian/chef/cli.rb +48 -0
- data/vendor/librarian/lib/librarian/chef/dsl.rb +15 -0
- data/vendor/librarian/lib/librarian/chef/environment.rb +27 -0
- data/vendor/librarian/lib/librarian/chef/extension.rb +9 -0
- data/vendor/librarian/lib/librarian/chef/integration/knife.rb +42 -0
- data/vendor/librarian/lib/librarian/chef/manifest_reader.rb +59 -0
- data/vendor/librarian/lib/librarian/chef/source.rb +3 -0
- data/vendor/librarian/lib/librarian/chef/source/git.rb +25 -0
- data/vendor/librarian/lib/librarian/chef/source/local.rb +69 -0
- data/vendor/librarian/lib/librarian/chef/source/path.rb +12 -0
- data/vendor/librarian/lib/librarian/chef/source/site.rb +446 -0
- data/vendor/librarian/lib/librarian/chef/templates/Cheffile +15 -0
- data/vendor/librarian/lib/librarian/cli.rb +205 -0
- data/vendor/librarian/lib/librarian/cli/manifest_presenter.rb +79 -0
- data/vendor/librarian/lib/librarian/config.rb +7 -0
- data/vendor/librarian/lib/librarian/config/database.rb +205 -0
- data/vendor/librarian/lib/librarian/config/file_source.rb +47 -0
- data/vendor/librarian/lib/librarian/config/hash_source.rb +33 -0
- data/vendor/librarian/lib/librarian/config/source.rb +149 -0
- data/vendor/librarian/lib/librarian/dependency.rb +91 -0
- data/vendor/librarian/lib/librarian/dsl.rb +108 -0
- data/vendor/librarian/lib/librarian/dsl/receiver.rb +48 -0
- data/vendor/librarian/lib/librarian/dsl/target.rb +172 -0
- data/vendor/librarian/lib/librarian/environment.rb +134 -0
- data/vendor/librarian/lib/librarian/error.rb +4 -0
- data/vendor/librarian/lib/librarian/helpers.rb +13 -0
- data/vendor/librarian/lib/librarian/lockfile.rb +29 -0
- data/vendor/librarian/lib/librarian/lockfile/compiler.rb +66 -0
- data/vendor/librarian/lib/librarian/lockfile/parser.rb +100 -0
- data/vendor/librarian/lib/librarian/logger.rb +46 -0
- data/vendor/librarian/lib/librarian/manifest.rb +132 -0
- data/vendor/librarian/lib/librarian/manifest_set.rb +153 -0
- data/vendor/librarian/lib/librarian/mock.rb +1 -0
- data/vendor/librarian/lib/librarian/mock/cli.rb +19 -0
- data/vendor/librarian/lib/librarian/mock/dsl.rb +15 -0
- data/vendor/librarian/lib/librarian/mock/environment.rb +24 -0
- data/vendor/librarian/lib/librarian/mock/extension.rb +9 -0
- data/vendor/librarian/lib/librarian/mock/source.rb +1 -0
- data/vendor/librarian/lib/librarian/mock/source/mock.rb +97 -0
- data/vendor/librarian/lib/librarian/mock/source/mock/registry.rb +83 -0
- data/vendor/librarian/lib/librarian/resolution.rb +44 -0
- data/vendor/librarian/lib/librarian/resolver.rb +78 -0
- data/vendor/librarian/lib/librarian/resolver/implementation.rb +118 -0
- data/vendor/librarian/lib/librarian/source.rb +2 -0
- data/vendor/librarian/lib/librarian/source/git.rb +150 -0
- data/vendor/librarian/lib/librarian/source/git/repository.rb +217 -0
- data/vendor/librarian/lib/librarian/source/local.rb +61 -0
- data/vendor/librarian/lib/librarian/source/path.rb +74 -0
- data/vendor/librarian/lib/librarian/spec.rb +13 -0
- data/vendor/librarian/lib/librarian/spec_change_set.rb +173 -0
- data/vendor/librarian/lib/librarian/specfile.rb +18 -0
- data/vendor/librarian/lib/librarian/support/abstract_method.rb +21 -0
- data/vendor/librarian/lib/librarian/ui.rb +64 -0
- data/vendor/librarian/lib/librarian/version.rb +3 -0
- data/vendor/librarian/librarian.gemspec +34 -0
- data/vendor/librarian/spec/functional/chef/source/git_spec.rb +432 -0
- data/vendor/librarian/spec/functional/chef/source/site_spec.rb +215 -0
- data/vendor/librarian/spec/functional/source/git/repository_spec.rb +149 -0
- data/vendor/librarian/spec/unit/action/base_spec.rb +18 -0
- data/vendor/librarian/spec/unit/action/clean_spec.rb +102 -0
- data/vendor/librarian/spec/unit/action/ensure_spec.rb +37 -0
- data/vendor/librarian/spec/unit/action/install_spec.rb +111 -0
- data/vendor/librarian/spec/unit/config/database_spec.rb +319 -0
- data/vendor/librarian/spec/unit/dependency_spec.rb +36 -0
- data/vendor/librarian/spec/unit/dsl_spec.rb +194 -0
- data/vendor/librarian/spec/unit/environment_spec.rb +9 -0
- data/vendor/librarian/spec/unit/lockfile/parser_spec.rb +162 -0
- data/vendor/librarian/spec/unit/lockfile_spec.rb +65 -0
- data/vendor/librarian/spec/unit/manifest_set_spec.rb +202 -0
- data/vendor/librarian/spec/unit/manifest_spec.rb +36 -0
- data/vendor/librarian/spec/unit/mock/source/mock_spec.rb +22 -0
- data/vendor/librarian/spec/unit/resolver_spec.rb +192 -0
- data/vendor/librarian/spec/unit/source/git_spec.rb +29 -0
- data/vendor/librarian/spec/unit/spec_change_set_spec.rb +169 -0
- metadata +227 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
require "tmpdir"
|
2
|
+
|
3
|
+
require "librarian/error"
|
4
|
+
require "librarian/action/ensure"
|
5
|
+
|
6
|
+
module Librarian
|
7
|
+
describe Action::Ensure do
|
8
|
+
|
9
|
+
let(:env) { mock }
|
10
|
+
let(:action) { described_class.new(env) }
|
11
|
+
|
12
|
+
before do
|
13
|
+
env.stub(:specfile_name) { "Specfile" }
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#run" do
|
17
|
+
|
18
|
+
context "when the environment does not know its project path" do
|
19
|
+
before { env.stub(:project_path) { nil } }
|
20
|
+
|
21
|
+
it "should raise an error describing that the specfile is mising" do
|
22
|
+
expect { action.run }.to raise_error(Error, "Cannot find Specfile!")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context "when the environment knows its project path" do
|
27
|
+
before { env.stub(:project_path) { Dir.tmpdir } }
|
28
|
+
|
29
|
+
it "should not raise an error" do
|
30
|
+
expect { action.run }.to_not raise_error
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
require "librarian/error"
|
2
|
+
require "librarian/action/install"
|
3
|
+
|
4
|
+
module Librarian
|
5
|
+
describe Action::Install do
|
6
|
+
|
7
|
+
let(:env) { mock(:specfile_name => "Specfile", :lockfile_name => "Specfile.lock") }
|
8
|
+
let(:action) { described_class.new(env) }
|
9
|
+
|
10
|
+
describe "#run" do
|
11
|
+
|
12
|
+
describe "behavior" do
|
13
|
+
|
14
|
+
describe "checking preconditions" do
|
15
|
+
|
16
|
+
context "when the specfile is missing" do
|
17
|
+
before do
|
18
|
+
env.stub_chain(:specfile_path, :exist?) { false }
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should raise an error explaining that the specfile is missing" do
|
22
|
+
expect { action.run }.to raise_error(Error, "Specfile missing!")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context "when the specfile is present but the lockfile is missing" do
|
27
|
+
before do
|
28
|
+
env.stub_chain(:specfile_path, :exist?) { true }
|
29
|
+
env.stub_chain(:lockfile_path, :exist?) { false }
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should raise an error explaining that the lockfile is missing" do
|
33
|
+
expect { action.run }.to raise_error(Error, "Specfile.lock missing!")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context "when the specfile and lockfile are present but inconsistent" do
|
38
|
+
before do
|
39
|
+
env.stub_chain(:specfile_path, :exist?) { true }
|
40
|
+
env.stub_chain(:lockfile_path, :exist?) { true }
|
41
|
+
action.stub(:spec_consistent_with_lock?) { false }
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should raise an error explaining the inconsistenty" do
|
45
|
+
expect { action.run }.to raise_error(Error, "Specfile and Specfile.lock are out of sync!")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context "when the specfile and lockfile are present and consistent" do
|
50
|
+
before do
|
51
|
+
env.stub_chain(:specfile_path, :exist?) { true }
|
52
|
+
env.stub_chain(:lockfile_path, :exist?) { true }
|
53
|
+
action.stub(:spec_consistent_with_lock?) { true }
|
54
|
+
action.stub(:perform_installation)
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should not raise an error" do
|
58
|
+
expect { action.run }.to_not raise_error
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
describe "performing the install" do
|
65
|
+
|
66
|
+
def mock_manifest(i)
|
67
|
+
double(:name => "manifest-#{i}")
|
68
|
+
end
|
69
|
+
|
70
|
+
let(:manifests) { 3.times.map{|i| mock_manifest(i)} }
|
71
|
+
let(:sorted_manifests) { 4.times.map{|i| mock_manifest(i + 3)} }
|
72
|
+
let(:install_path) { mock }
|
73
|
+
|
74
|
+
before do
|
75
|
+
env.stub(:install_path) { install_path }
|
76
|
+
action.stub(:check_preconditions)
|
77
|
+
action.stub_chain(:lock, :manifests) { manifests }
|
78
|
+
end
|
79
|
+
|
80
|
+
after do
|
81
|
+
action.run
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should sort and install the manifests" do
|
85
|
+
ManifestSet.should_receive(:sort).with(manifests).exactly(:once).ordered { sorted_manifests }
|
86
|
+
|
87
|
+
install_path.stub(:exist?) { false }
|
88
|
+
install_path.should_receive(:mkpath).exactly(:once).ordered
|
89
|
+
|
90
|
+
sorted_manifests.each do |manifest|
|
91
|
+
manifest.should_receive(:install!).exactly(:once).ordered
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should recreate the install path if it already exists" do
|
96
|
+
action.stub(:sorted_manifests) { sorted_manifests }
|
97
|
+
action.stub(:install_manifests)
|
98
|
+
|
99
|
+
install_path.stub(:exist?) { true }
|
100
|
+
install_path.should_receive(:rmtree)
|
101
|
+
install_path.should_receive(:mkpath)
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,319 @@
|
|
1
|
+
require "fileutils"
|
2
|
+
require "pathname"
|
3
|
+
require "yaml"
|
4
|
+
|
5
|
+
require "fakefs/spec_helpers"
|
6
|
+
|
7
|
+
require "librarian/config/database"
|
8
|
+
|
9
|
+
describe Librarian::Config::Database do
|
10
|
+
include FakeFS::SpecHelpers
|
11
|
+
|
12
|
+
def write_yaml!(path, *yamlables)
|
13
|
+
dir = File.dirname(path)
|
14
|
+
FileUtils.mkpath(dir) unless File.directory?(dir)
|
15
|
+
File.open(path, "wb"){|f| yamlables.each{|y| YAML.dump(y, f)}}
|
16
|
+
end
|
17
|
+
|
18
|
+
let(:adapter_name) { "gem" }
|
19
|
+
|
20
|
+
let(:env) { { } }
|
21
|
+
let(:pwd) { Pathname("/tmp") }
|
22
|
+
let(:home) { Pathname("~").expand_path }
|
23
|
+
let(:project_path) { nil }
|
24
|
+
let(:specfile_name) { nil }
|
25
|
+
let(:global) { home.join(".librarian/gem/config") }
|
26
|
+
let(:local) { pwd.join(".librarian/gem/config") }
|
27
|
+
let(:specfile) { pwd.join("Gemfile") }
|
28
|
+
|
29
|
+
before do
|
30
|
+
FileUtils.mkpath(pwd)
|
31
|
+
FileUtils.touch(specfile)
|
32
|
+
end
|
33
|
+
|
34
|
+
let(:database) do
|
35
|
+
described_class.new(adapter_name,
|
36
|
+
:env => env,
|
37
|
+
:pwd => pwd.to_s,
|
38
|
+
:home => home.to_s,
|
39
|
+
:project_path => project_path,
|
40
|
+
:specfile_name => specfile_name
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
context "when a key is given globally" do
|
45
|
+
let(:key) { "jam" }
|
46
|
+
let(:value) { "jelly" }
|
47
|
+
let(:raw_key) { "LIBRARIAN_GEM_JAM" }
|
48
|
+
|
49
|
+
before do
|
50
|
+
write_yaml! global, raw_key => value
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should have the key globally" do
|
54
|
+
database.global[key].should == value
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should not have the key in the env" do
|
58
|
+
database.env[key].should be_nil
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should not have the key locally" do
|
62
|
+
database.local[key].should be_nil
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should have the key generally" do
|
66
|
+
database[key].should == value
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
context "when a key is set globally" do
|
71
|
+
let(:key) { "jam" }
|
72
|
+
let(:value) { "jelly" }
|
73
|
+
let(:raw_key) { "LIBRARIAN_GEM_JAM" }
|
74
|
+
|
75
|
+
before do
|
76
|
+
database.global[key] = value
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should have the key globally" do
|
80
|
+
database.global[key].should == value
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should not have the key in the env" do
|
84
|
+
database.env[key].should be_nil
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should not have the key locally" do
|
88
|
+
database.local[key].should be_nil
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should have the key generally" do
|
92
|
+
database[key].should == value
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should persist the key" do
|
96
|
+
data = YAML.load_file(global)
|
97
|
+
|
98
|
+
data.should == {raw_key => value}
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
context "when the key is set and unset globally" do
|
103
|
+
let(:key) { "jam" }
|
104
|
+
let(:value) { "jelly" }
|
105
|
+
let(:raw_key) { "LIBRARIAN_GEM_JAM" }
|
106
|
+
|
107
|
+
before do
|
108
|
+
database.global[key] = value
|
109
|
+
database.global[key] = nil
|
110
|
+
end
|
111
|
+
|
112
|
+
it "should not have the key globally" do
|
113
|
+
database.global[key].should be_nil
|
114
|
+
end
|
115
|
+
|
116
|
+
it "should not have the key in the env" do
|
117
|
+
database.env[key].should be_nil
|
118
|
+
end
|
119
|
+
|
120
|
+
it "should not have the key locally" do
|
121
|
+
database.local[key].should be_nil
|
122
|
+
end
|
123
|
+
|
124
|
+
it "should not have the key generally" do
|
125
|
+
database[key].should be_nil
|
126
|
+
end
|
127
|
+
|
128
|
+
it "should unpersist the key" do
|
129
|
+
File.should_not exist global
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
context "when a key is given in the env" do
|
134
|
+
let(:key) { "jam" }
|
135
|
+
let(:value) { "jelly" }
|
136
|
+
let(:raw_key) { "LIBRARIAN_GEM_JAM" }
|
137
|
+
|
138
|
+
#override
|
139
|
+
let(:env) { {raw_key => value} }
|
140
|
+
|
141
|
+
it "should not have the key globally" do
|
142
|
+
database.global[key].should be_nil
|
143
|
+
end
|
144
|
+
|
145
|
+
it "should have the key in the env" do
|
146
|
+
database.env[key].should == value
|
147
|
+
end
|
148
|
+
|
149
|
+
it "should not have the key locally" do
|
150
|
+
database.local[key].should be_nil
|
151
|
+
end
|
152
|
+
|
153
|
+
it "should have the key generally" do
|
154
|
+
database[key].should == value
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
context "when a key is given locally" do
|
159
|
+
let(:key) { "jam" }
|
160
|
+
let(:value) { "jelly" }
|
161
|
+
let(:raw_key) { "LIBRARIAN_GEM_JAM" }
|
162
|
+
|
163
|
+
before do
|
164
|
+
write_yaml! local, raw_key => value
|
165
|
+
end
|
166
|
+
|
167
|
+
it "should not have the key globally" do
|
168
|
+
database.global[key].should be_nil
|
169
|
+
end
|
170
|
+
|
171
|
+
it "should not have the key in the env" do
|
172
|
+
database.env[key].should be_nil
|
173
|
+
end
|
174
|
+
|
175
|
+
it "should have the key locally" do
|
176
|
+
database.local[key].should == value
|
177
|
+
end
|
178
|
+
|
179
|
+
it "should have the key generally" do
|
180
|
+
database[key].should == value
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
context "when a key is set locally" do
|
185
|
+
let(:key) { "jam" }
|
186
|
+
let(:value) { "jelly" }
|
187
|
+
let(:raw_key) { "LIBRARIAN_GEM_JAM" }
|
188
|
+
|
189
|
+
before do
|
190
|
+
database.local[key] = value
|
191
|
+
end
|
192
|
+
|
193
|
+
it "should not have the key globally" do
|
194
|
+
database.global[key].should be_nil
|
195
|
+
end
|
196
|
+
|
197
|
+
it "should not have the key in the env" do
|
198
|
+
database.env[key].should be_nil
|
199
|
+
end
|
200
|
+
|
201
|
+
it "should have the key locally" do
|
202
|
+
database.local[key].should == value
|
203
|
+
end
|
204
|
+
|
205
|
+
it "should have the key generally" do
|
206
|
+
database[key].should == value
|
207
|
+
end
|
208
|
+
|
209
|
+
it "should persist the key" do
|
210
|
+
data = YAML.load_file(local)
|
211
|
+
|
212
|
+
data.should == {raw_key => value}
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
context "when the key is set and unset locally" do
|
217
|
+
let(:key) { "jam" }
|
218
|
+
let(:value) { "jelly" }
|
219
|
+
let(:raw_key) { "LIBRARIAN_GEM_JAM" }
|
220
|
+
|
221
|
+
before do
|
222
|
+
database.local[key] = value
|
223
|
+
database.local[key] = nil
|
224
|
+
end
|
225
|
+
|
226
|
+
it "should not have the key globally" do
|
227
|
+
database.global[key].should be_nil
|
228
|
+
end
|
229
|
+
|
230
|
+
it "should not have the key in the env" do
|
231
|
+
database.env[key].should be_nil
|
232
|
+
end
|
233
|
+
|
234
|
+
it "should not have the key locally" do
|
235
|
+
database.local[key].should be_nil
|
236
|
+
end
|
237
|
+
|
238
|
+
it "should not have the key generally" do
|
239
|
+
database[key].should be_nil
|
240
|
+
end
|
241
|
+
|
242
|
+
it "should unpersist the key" do
|
243
|
+
File.should_not exist local
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
context "setting malformatted keys" do
|
248
|
+
it "should ban caps" do
|
249
|
+
expect { database.global["JAM"] = "jelly" }.
|
250
|
+
to raise_error Librarian::Error, %[key not permitted: "JAM"]
|
251
|
+
end
|
252
|
+
|
253
|
+
it "should ban double dots" do
|
254
|
+
expect { database.global["jam..jam"] = "jelly" }.
|
255
|
+
to raise_error Librarian::Error, %[key not permitted: "jam..jam"]
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
context "setting banned keys" do
|
260
|
+
it "should ban the specfile key" do
|
261
|
+
expect { database.global["gemfile"] = "jelly" }.
|
262
|
+
to raise_error Librarian::Error, %[key not permitted: "gemfile"]
|
263
|
+
end
|
264
|
+
|
265
|
+
it "should ban the global-config key" do
|
266
|
+
expect { database.global["config"] = "jelly" }.
|
267
|
+
to raise_error Librarian::Error, %[key not permitted: "config"]
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
context "project_path" do
|
272
|
+
context "by default" do
|
273
|
+
it "should give the default project path" do
|
274
|
+
database.project_path.should == Pathname("/tmp")
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
278
|
+
context "when the specfile is set in the env" do
|
279
|
+
let(:env) { {"LIBRARIAN_GEM_GEMFILE" => "/non/sense/path/to/Sillyfile"} }
|
280
|
+
|
281
|
+
it "should give the project path from the env-set specfile" do
|
282
|
+
database.project_path.should == Pathname("/non/sense/path/to")
|
283
|
+
end
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
context "specfile_path" do
|
288
|
+
context "by default" do
|
289
|
+
it "should give the default specfile path" do
|
290
|
+
database.specfile_path.should == specfile
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
context "when set in the env" do
|
295
|
+
let(:env) { {"LIBRARIAN_GEM_GEMFILE" => "/non/sense/path/to/Sillyfile"} }
|
296
|
+
|
297
|
+
it "should give the given specfile path" do
|
298
|
+
database.specfile_path.should == Pathname("/non/sense/path/to/Sillyfile")
|
299
|
+
end
|
300
|
+
end
|
301
|
+
|
302
|
+
context "when the project_path is assigned" do
|
303
|
+
let(:project_path) { "/non/sense/path/to" }
|
304
|
+
|
305
|
+
it "should give the assigned specfile path" do
|
306
|
+
database.specfile_path.should == Pathname("/non/sense/path/to/Gemfile")
|
307
|
+
end
|
308
|
+
end
|
309
|
+
|
310
|
+
context "when the specfile_name is assigned" do
|
311
|
+
let(:specfile_name) { "Sillyfile" }
|
312
|
+
|
313
|
+
it "should give the assigned specfile path" do
|
314
|
+
database.specfile_path.should == Pathname("/tmp/Sillyfile")
|
315
|
+
end
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
319
|
+
end
|