a9n 0.0.4 → 0.0.5

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 CHANGED
@@ -19,7 +19,7 @@ module A9n
19
19
  end
20
20
 
21
21
  def local_app
22
- @local_app ||= Rails
22
+ @local_app ||= get_rails
23
23
  end
24
24
 
25
25
  def local_app=(local_app)
@@ -70,5 +70,9 @@ module A9n
70
70
  raise MissingConfigurationVariables.new("Following variables are missing in your configuration file: #{missing_keys.join(',')}")
71
71
  end
72
72
  end
73
+
74
+ def get_rails
75
+ defined?(Rails) ? Rails : nil
76
+ end
73
77
  end
74
78
  end
data/lib/a9n/struct.rb CHANGED
@@ -7,12 +7,11 @@ module A9n
7
7
  end
8
8
 
9
9
  def method_missing(name, *args)
10
- value = @table[name]
11
- if value.nil?
10
+ unless @table.key?(name.to_sym)
12
11
  raise NoSuchConfigurationVariable.new(name)
13
- else
14
- return value
15
12
  end
13
+
14
+ return @table[name.to_sym]
16
15
  end
17
16
  end
18
17
  end
data/lib/a9n/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module A9n
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/spec/a9n_spec.rb CHANGED
@@ -2,12 +2,10 @@ require 'spec_helper'
2
2
 
3
3
  describe A9n do
4
4
  describe '.local_app' do
5
- context 'when no rails found' do
6
- it 'raises error' do
7
- expect {
8
- described_class.local_app
9
- }.to raise_error(NameError)
10
- end
5
+ context 'when rails not found' do
6
+ specify {
7
+ described_class.local_app.should be_nil
8
+ }
11
9
  end
12
10
 
13
11
  context 'when custom non-rails app is being used' do
data/spec/spec_helper.rb CHANGED
@@ -2,8 +2,6 @@ require 'rubygems'
2
2
  require 'bundler/setup'
3
3
 
4
4
  require 'a9n'
5
- require 'a9n/struct'
6
- require 'a9n/version'
7
5
 
8
6
  RSpec.configure do |config|
9
7
  config.order = "random"
data/spec/struct_spec.rb CHANGED
@@ -1,15 +1,34 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe A9n::Struct do
4
- subject { described_class.new(:app_host => 'http://127.0.0.1:3000') }
4
+ subject {
5
+ described_class.new({
6
+ :non_empty_dwarf => 'dwarf',
7
+ :nil_dwarf => nil,
8
+ :false_dwarf => false,
9
+ :true_dwarf => true
10
+ })
11
+ }
5
12
 
6
- it 'gets value' do
7
- subject.app_host.should == 'http://127.0.0.1:3000'
13
+ it 'gets non-empty value' do
14
+ subject.non_empty_dwarf.should == 'dwarf'
15
+ end
16
+
17
+ it 'gets nil value' do
18
+ subject.nil_dwarf.should == nil
19
+ end
20
+
21
+ it 'gets true value' do
22
+ subject.true_dwarf.should == true
23
+ end
24
+
25
+ it 'gets false value' do
26
+ subject.false_dwarf.should == false
8
27
  end
9
28
 
10
29
  it 'raises exception when value not exists' do
11
30
  expect {
12
- subject.non_existing
31
+ subject.non_existing_dwarf
13
32
  }.to raise_error(A9n::NoSuchConfigurationVariable)
14
33
  end
15
34
  end
metadata CHANGED
@@ -1,23 +1,33 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: a9n
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.4
3
+ version: !ruby/object:Gem::Version
4
+ hash: 21
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 5
10
+ version: 0.0.5
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Krzysztof Knapik
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-12-07 00:00:00.000000000 Z
17
+
18
+ date: 2012-12-07 00:00:00 Z
13
19
  dependencies: []
20
+
14
21
  description: Simple tool for managing app configuration
15
- email:
22
+ email:
16
23
  - knapo@knapo.net
17
24
  executables: []
25
+
18
26
  extensions: []
27
+
19
28
  extra_rdoc_files: []
20
- files:
29
+
30
+ files:
21
31
  - .gitignore
22
32
  - .travis.yml
23
33
  - Gemfile
@@ -34,29 +44,38 @@ files:
34
44
  - spec/struct_spec.rb
35
45
  homepage: https://github.com/knapo/a9n
36
46
  licenses: []
47
+
37
48
  post_install_message:
38
49
  rdoc_options: []
39
- require_paths:
50
+
51
+ require_paths:
40
52
  - lib
41
- required_ruby_version: !ruby/object:Gem::Requirement
53
+ required_ruby_version: !ruby/object:Gem::Requirement
42
54
  none: false
43
- requirements:
44
- - - ! '>='
45
- - !ruby/object:Gem::Version
46
- version: '0'
47
- required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ hash: 3
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
63
  none: false
49
- requirements:
50
- - - ! '>='
51
- - !ruby/object:Gem::Version
52
- version: '0'
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ hash: 3
68
+ segments:
69
+ - 0
70
+ version: "0"
53
71
  requirements: []
72
+
54
73
  rubyforge_project:
55
74
  rubygems_version: 1.8.24
56
75
  signing_key:
57
76
  specification_version: 3
58
77
  summary: Simple tool for managing app configuration
59
- test_files:
78
+ test_files:
60
79
  - spec/a9n_spec.rb
61
80
  - spec/fixtures/configuration.yml
62
81
  - spec/spec_helper.rb