a9n 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/a9n.rb +10 -1
- data/lib/a9n/version.rb +1 -1
- data/spec/a9n_spec.rb +27 -2
- metadata +2 -2
data/lib/a9n.rb
CHANGED
@@ -27,6 +27,15 @@ module A9n
|
|
27
27
|
@local_app = local_app
|
28
28
|
end
|
29
29
|
|
30
|
+
def root
|
31
|
+
@root ||= @local_app.root
|
32
|
+
end
|
33
|
+
|
34
|
+
def root=(path)
|
35
|
+
path = path.to_s
|
36
|
+
@root = path.empty? ? nil : Pathname.new(path.to_s)
|
37
|
+
end
|
38
|
+
|
30
39
|
def load
|
31
40
|
base = load_yml('config/configuration.yml.example')
|
32
41
|
local = load_yml('config/configuration.yml')
|
@@ -43,7 +52,7 @@ module A9n
|
|
43
52
|
end
|
44
53
|
|
45
54
|
def load_yml(file)
|
46
|
-
path = File.join(
|
55
|
+
path = File.join(self.root, file)
|
47
56
|
return unless File.exists?(path)
|
48
57
|
yml = YAML.load_file(path)
|
49
58
|
|
data/lib/a9n/version.rb
CHANGED
data/spec/a9n_spec.rb
CHANGED
@@ -12,7 +12,7 @@ describe A9n do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
context 'when custom non-rails app is being used' do
|
15
|
-
let(:local_app) { stub(:env => 'test', :root => '
|
15
|
+
let(:local_app) { stub(:env => 'test', :root => '/apps/a9n') }
|
16
16
|
before { described_class.local_app = local_app }
|
17
17
|
|
18
18
|
specify { described_class.local_app.should == local_app }
|
@@ -20,6 +20,31 @@ describe A9n do
|
|
20
20
|
|
21
21
|
after { described_class.local_app = nil }
|
22
22
|
end
|
23
|
+
|
24
|
+
describe '.root' do
|
25
|
+
let(:local_app) { stub(:env => 'test', :root => '/apps/a9n') }
|
26
|
+
before { described_class.local_app = local_app }
|
27
|
+
|
28
|
+
context 'with custom path' do
|
29
|
+
before {
|
30
|
+
described_class.root = '/home/knapo/workspace/a9n'
|
31
|
+
}
|
32
|
+
specify {
|
33
|
+
described_class.root.should == Pathname.new('/home/knapo/workspace/a9n')
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'with local app path' do
|
38
|
+
specify {
|
39
|
+
described_class.root.should == '/apps/a9n'
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
after {
|
44
|
+
described_class.root = nil
|
45
|
+
described_class.local_app = nil
|
46
|
+
}
|
47
|
+
end
|
23
48
|
|
24
49
|
describe '.load' do
|
25
50
|
let(:base_sample_config){
|
@@ -104,7 +129,7 @@ describe A9n do
|
|
104
129
|
subject { described_class.load_yml(file_path) }
|
105
130
|
|
106
131
|
before do
|
107
|
-
described_class.should_receive(:
|
132
|
+
described_class.should_receive(:root).at_least(:once).and_return(root)
|
108
133
|
end
|
109
134
|
|
110
135
|
context 'when file not exists' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: a9n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
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:
|
12
|
+
date: 2013-02-20 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Simple tool for managing app configuration
|
15
15
|
email:
|