config_context 0.6.0 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,7 @@ module ConfigContext
6
6
 
7
7
  @config ||= {}
8
8
 
9
- class Error < StandardError; end
9
+ class ConfigError < StandardError; end
10
10
 
11
11
 
12
12
  private
@@ -47,11 +47,7 @@ module ConfigContext
47
47
 
48
48
  case arguments[0]
49
49
  when /\.(yml|yaml|conf|config)/i
50
- if(File.exist?(arguments[0]))
51
- @config.merge!(YAML.load_file(arguments[0]))
52
- else
53
- raise ConfigContext::Error.new("The config file: #{arguments[0]} do not exist")
54
- end
50
+ @config.merge!(YAML.load_file(arguments[0]))
55
51
  when Hash
56
52
  @config.merge!(arguments[0])
57
53
  else
@@ -59,8 +55,8 @@ module ConfigContext
59
55
  end
60
56
 
61
57
  self
62
- rescue Exception=>e
63
- raise ConfigContext::Error.new(e.message)
58
+ rescue StandardError=>e
59
+ raise ConfigError.new(e.message)
64
60
  end
65
61
 
66
62
  def to_hash()
data/lib/version.rb CHANGED
@@ -1,10 +1,24 @@
1
- module Version
2
- INFO = {
3
- :major =>0,
4
- :minor =>6,
5
- :patch =>0
6
- }
1
+ module ConfigContext
2
+ class Version
3
+
4
+ INFO = {
5
+ :major =>0,
6
+ :minor =>6,
7
+ :patch =>2
8
+ }
9
+
10
+ def self.number(version_info=INFO)
7
11
 
8
- NAME = 'config_context'
9
- VERSION = [INFO[:major], INFO[:minor], INFO[:patch]].join( '.' )
10
- end
12
+ if RUBY_VERSION =~ /1\.8\.\d/
13
+ [version_info[:major], version_info[:minor],version_info[:patch]].join('.')
14
+ else
15
+ version_info.values.join('.')
16
+ end
17
+ end
18
+
19
+
20
+ NAME = 'config_context'
21
+ NUMBER = "#{number()}"
22
+ VERSION = [INFO[:major], INFO[:minor], INFO[:patch]].join( '.' )
23
+ end
24
+ end
@@ -63,7 +63,7 @@ class TestConfigContext < Test::Unit::TestCase
63
63
 
64
64
  [ "yml", "yaml", "conf", "config" ].each do |extension|
65
65
 
66
- assert_raises( ConfigContext::Error ) { ConfigContext.configure( "this_file_do_not_exist.#{extension}" ) }
66
+ assert_raises( ConfigContext::ConfigError ) { ConfigContext.configure( "this_file_do_not_exist.#{extension}" ) }
67
67
  end
68
68
 
69
69
  assert_equal( ConfigContext.to_hash, ConfigContext.configure( "total_foo_bar.file" ).to_hash )
metadata CHANGED
@@ -1,61 +1,81 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: config_context
3
- version: !ruby/object:Gem::Version
4
- version: 0.6.0
3
+ version: !ruby/object:Gem::Version
4
+ hash: 3
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 6
9
+ - 2
10
+ version: 0.6.2
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Javier Juarez
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2011-06-07 00:00:00.000000000Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: jeweler
16
- requirement: &2156909680 !ruby/object:Gem::Requirement
17
+
18
+ date: 2011-06-20 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ requirement: &id001 !ruby/object:Gem::Requirement
17
22
  none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ hash: 3
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ version_requirements: *id001
22
31
  type: :development
32
+ name: jeweler
23
33
  prerelease: false
24
- version_requirements: *2156909680
25
34
  description: My config DSL
26
35
  email: javier.juarez@gmail.com
27
36
  executables: []
37
+
28
38
  extensions: []
29
- extra_rdoc_files:
39
+
40
+ extra_rdoc_files:
30
41
  - README.rdoc
31
- files:
42
+ files:
32
43
  - lib/config_context.rb
33
44
  - lib/version.rb
34
45
  - test/unit/test_config_context.rb
35
46
  - README.rdoc
36
47
  homepage: http://github.com/jjuarez/config_context
37
- licenses:
48
+ licenses:
38
49
  - MIT
39
50
  post_install_message:
40
51
  rdoc_options: []
41
- require_paths:
52
+
53
+ require_paths:
42
54
  - lib
43
- required_ruby_version: !ruby/object:Gem::Requirement
55
+ required_ruby_version: !ruby/object:Gem::Requirement
44
56
  none: false
45
- requirements:
46
- - - ! '>='
47
- - !ruby/object:Gem::Version
48
- version: '0'
49
- required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ hash: 3
61
+ segments:
62
+ - 0
63
+ version: "0"
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
50
65
  none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ hash: 3
70
+ segments:
71
+ - 0
72
+ version: "0"
55
73
  requirements: []
74
+
56
75
  rubyforge_project: http://github.com/jjuarez/config_context
57
76
  rubygems_version: 1.8.5
58
77
  signing_key:
59
78
  specification_version: 3
60
79
  summary: A Config Context for little applications
61
80
  test_files: []
81
+