bovem 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bovem (1.2.0)
4
+ bovem (1.2.1)
5
5
  lazier (~> 1.0)
6
6
  open4 (~> 1.3.0)
7
7
 
@@ -24,16 +24,16 @@ GEM
24
24
  activesupport (3.2.8)
25
25
  i18n (~> 0.6)
26
26
  multi_json (~> 1.0)
27
- builder (3.0.0)
27
+ builder (3.0.3)
28
28
  coderay (1.0.7)
29
29
  diff-lcs (1.1.3)
30
30
  erubis (2.7.0)
31
31
  github-markup (0.7.4)
32
32
  hike (1.2.1)
33
- i18n (0.6.0)
33
+ i18n (0.6.1)
34
34
  journey (1.0.4)
35
35
  json (1.7.5)
36
- lazier (1.0.3)
36
+ lazier (1.0.4)
37
37
  actionpack (~> 3.0)
38
38
  json (~> 1.7.0)
39
39
  tzinfo (~> 0.3.0)
@@ -47,7 +47,7 @@ GEM
47
47
  rack (1.4.1)
48
48
  rack-cache (1.2)
49
49
  rack (>= 0.4)
50
- rack-test (0.6.1)
50
+ rack-test (0.6.2)
51
51
  rack (>= 1.0)
52
52
  rake (0.9.2.2)
53
53
  redcarpet (2.1.1)
@@ -56,14 +56,14 @@ GEM
56
56
  rspec-expectations (~> 2.11.0)
57
57
  rspec-mocks (~> 2.11.0)
58
58
  rspec-core (2.11.1)
59
- rspec-expectations (2.11.2)
59
+ rspec-expectations (2.11.3)
60
60
  diff-lcs (~> 1.1.3)
61
- rspec-mocks (2.11.2)
61
+ rspec-mocks (2.11.3)
62
62
  simplecov (0.6.4)
63
63
  multi_json (~> 1.0)
64
64
  simplecov-html (~> 0.5.3)
65
65
  simplecov-html (0.5.3)
66
- slop (3.3.2)
66
+ slop (3.3.3)
67
67
  sprockets (2.1.3)
68
68
  hike (~> 1.2)
69
69
  rack (~> 1.0)
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![Build Status](https://secure.travis-ci.org/ShogunPanda/bovem.png?branch=master)](http://travis-ci.org/ShogunPanda/bovem)
4
4
  [![Dependency Status](https://gemnasium.com/ShogunPanda/bovem.png?travis)](https://gemnasium.com/ShogunPanda/bovem)
5
+ [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/ShogunPanda/bovem)
5
6
 
6
7
  A collection of utilities for developers.
7
8
 
@@ -45,17 +45,22 @@ module Bovem
45
45
  # @param logger [Logger] The logger to use for notifications.
46
46
  # @param overrides [Hash] A set of values which override those set in the configuration file.
47
47
  def parse(file = nil, overrides = {}, logger = nil)
48
- if file.present? then
49
- begin
50
- # Open the file
51
- path = ::Pathname.new(file).realpath
52
- logger.info("Using configuration file #{path}.") if logger
53
- self.tap do |config|
54
- eval(::File.read(path))
48
+ file = file.present? ? File.expand_path(file) : nil
49
+
50
+ if file then # We have a file to parse
51
+ if File.readable?(file) then
52
+ begin
53
+ # Open the file
54
+ path = ::Pathname.new(file).realpath
55
+ logger.info("Using configuration file #{path}.") if logger
56
+ self.tap do |config|
57
+ eval(::File.read(path))
58
+ end
59
+ rescue ::Exception => e
60
+ raise Bovem::Errors::InvalidConfiguration.new("Config file #{file} is not valid.")
55
61
  end
56
- rescue ::Errno::ENOENT, ::LoadError
57
- rescue ::Exception => e
58
- raise Bovem::Errors::InvalidConfiguration.new("Config file #{file} is not valid.")
62
+ else
63
+ raise Bovem::Errors::InvalidConfiguration.new("Config file #{file} is not existing or not readable.")
59
64
  end
60
65
  end
61
66
 
data/lib/bovem/version.rb CHANGED
@@ -17,7 +17,7 @@ module Bovem
17
17
  MINOR = 2
18
18
 
19
19
  # The patch version.
20
- PATCH = 0
20
+ PATCH = 1
21
21
 
22
22
  # The current version number of Bovem.
23
23
  STRING = [MAJOR, MINOR, PATCH].compact.join(".")
@@ -14,7 +14,7 @@ describe Bovem::Configuration do
14
14
  let(:log_file) { "/tmp/bovem-test-log-#{Time.now.strftime("%Y%m%d-%H:%M:%S")}" }
15
15
  let(:test_prefix) { "/tmp/bovem-test-#{Time.now.strftime("%Y%m%d-%H:%M:%S")}" }
16
16
 
17
- describe "#initialize" do
17
+ describe "#parse" do
18
18
  it "reads a valid configuration file" do
19
19
  file = ::File.open("#{test_prefix}", "w") {|f| f.write("config.property = 1234") }
20
20
 
@@ -23,6 +23,10 @@ describe Bovem::Configuration do
23
23
  File.unlink(test_prefix)
24
24
  end
25
25
 
26
+ it "reject a missing or unreadable file" do
27
+ expect { config = BaseConfiguration.new("/non-existing")}.to raise_error(::Bovem::Errors::InvalidConfiguration)
28
+ end
29
+
26
30
  it "reject an invalid configuration" do
27
31
  file1 = ::File.open("#{test_prefix}-1", "w") {|f| f.write("config.property = ") }
28
32
  file2 = ::File.open("#{test_prefix}-2", "w") {|f| f.write("config.non_property = 1234") }
metadata CHANGED
@@ -1,173 +1,167 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: bovem
3
- version: !ruby/object:Gem::Version
4
- hash: 31
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.1
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 2
9
- - 0
10
- version: 1.2.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Shogun
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-09-23 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- version_requirements: &id001 !ruby/object:Gem::Requirement
22
- none: false
23
- requirements:
24
- - - ~>
25
- - !ruby/object:Gem::Version
26
- hash: 15
27
- segments:
28
- - 1
29
- - 0
30
- version: "1.0"
31
- prerelease: false
32
- type: :runtime
12
+ date: 2012-10-06 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
33
15
  name: lazier
34
- requirement: *id001
35
- - !ruby/object:Gem::Dependency
36
- version_requirements: &id002 !ruby/object:Gem::Requirement
37
- none: false
38
- requirements:
39
- - - ~>
40
- - !ruby/object:Gem::Version
41
- hash: 27
42
- segments:
43
- - 1
44
- - 3
45
- - 0
46
- version: 1.3.0
47
- prerelease: false
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.0'
48
22
  type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.0'
30
+ - !ruby/object:Gem::Dependency
49
31
  name: open4
50
- requirement: *id002
51
- - !ruby/object:Gem::Dependency
52
- version_requirements: &id003 !ruby/object:Gem::Requirement
53
- none: false
54
- requirements:
55
- - - ~>
56
- - !ruby/object:Gem::Version
57
- hash: 35
58
- segments:
59
- - 2
60
- - 11
61
- - 0
62
- version: 2.11.0
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 1.3.0
38
+ type: :runtime
63
39
  prerelease: false
64
- type: :development
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 1.3.0
46
+ - !ruby/object:Gem::Dependency
65
47
  name: rspec
66
- requirement: *id003
67
- - !ruby/object:Gem::Dependency
68
- version_requirements: &id004 !ruby/object:Gem::Requirement
69
- none: false
70
- requirements:
71
- - - ~>
72
- - !ruby/object:Gem::Version
73
- hash: 59
74
- segments:
75
- - 0
76
- - 9
77
- - 0
78
- version: 0.9.0
79
- prerelease: false
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 2.11.0
80
54
  type: :development
81
- name: rake
82
- requirement: *id004
83
- - !ruby/object:Gem::Dependency
84
- version_requirements: &id005 !ruby/object:Gem::Requirement
85
- none: false
86
- requirements:
87
- - - ~>
88
- - !ruby/object:Gem::Version
89
- hash: 7
90
- segments:
91
- - 0
92
- - 6
93
- - 0
94
- version: 0.6.0
95
55
  prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 2.11.0
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 0.9.0
96
70
  type: :development
97
- name: simplecov
98
- requirement: *id005
99
- - !ruby/object:Gem::Dependency
100
- version_requirements: &id006 !ruby/object:Gem::Requirement
101
- none: false
102
- requirements:
103
- - - ">="
104
- - !ruby/object:Gem::Version
105
- hash: 3
106
- segments:
107
- - 0
108
- version: "0"
109
71
  prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 0.9.0
78
+ - !ruby/object:Gem::Dependency
79
+ name: simplecov
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: 0.6.0
110
86
  type: :development
111
- name: pry
112
- requirement: *id006
113
- - !ruby/object:Gem::Dependency
114
- version_requirements: &id007 !ruby/object:Gem::Requirement
115
- none: false
116
- requirements:
117
- - - ~>
118
- - !ruby/object:Gem::Version
119
- hash: 63
120
- segments:
121
- - 0
122
- - 8
123
- - 0
124
- version: 0.8.0
125
87
  prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 0.6.0
94
+ - !ruby/object:Gem::Dependency
95
+ name: pry
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
126
102
  type: :development
127
- name: yard
128
- requirement: *id007
129
- - !ruby/object:Gem::Dependency
130
- version_requirements: &id008 !ruby/object:Gem::Requirement
131
- none: false
132
- requirements:
133
- - - ~>
134
- - !ruby/object:Gem::Version
135
- hash: 11
136
- segments:
137
- - 2
138
- - 1
139
- - 0
140
- version: 2.1.0
141
103
  prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: yard
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: 0.8.0
142
118
  type: :development
143
- name: redcarpet
144
- requirement: *id008
145
- - !ruby/object:Gem::Dependency
146
- version_requirements: &id009 !ruby/object:Gem::Requirement
147
- none: false
148
- requirements:
149
- - - ~>
150
- - !ruby/object:Gem::Version
151
- hash: 3
152
- segments:
153
- - 0
154
- - 7
155
- - 0
156
- version: 0.7.0
157
119
  prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: 0.8.0
126
+ - !ruby/object:Gem::Dependency
127
+ name: redcarpet
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ~>
132
+ - !ruby/object:Gem::Version
133
+ version: 2.1.0
158
134
  type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ version: 2.1.0
142
+ - !ruby/object:Gem::Dependency
159
143
  name: github-markup
160
- requirement: *id009
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ~>
148
+ - !ruby/object:Gem::Version
149
+ version: 0.7.0
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ~>
156
+ - !ruby/object:Gem::Version
157
+ version: 0.7.0
161
158
  description: A collection of utilities for developers.
162
- email:
159
+ email:
163
160
  - shogun_panda@me.com
164
161
  executables: []
165
-
166
162
  extensions: []
167
-
168
163
  extra_rdoc_files: []
169
-
170
- files:
164
+ files:
171
165
  - .gitignore
172
166
  - .travis.yml
173
167
  - .yardopts
@@ -191,38 +185,35 @@ files:
191
185
  - spec/spec_helper.rb
192
186
  homepage: http://github.com/ShogunPanda/bovem
193
187
  licenses: []
194
-
195
188
  post_install_message:
196
189
  rdoc_options: []
197
-
198
- require_paths:
190
+ require_paths:
199
191
  - lib
200
- required_ruby_version: !ruby/object:Gem::Requirement
192
+ required_ruby_version: !ruby/object:Gem::Requirement
201
193
  none: false
202
- requirements:
203
- - - ">="
204
- - !ruby/object:Gem::Version
205
- hash: 3
206
- segments:
194
+ requirements:
195
+ - - ! '>='
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
198
+ segments:
207
199
  - 0
208
- version: "0"
209
- required_rubygems_version: !ruby/object:Gem::Requirement
200
+ hash: -520678126399173554
201
+ required_rubygems_version: !ruby/object:Gem::Requirement
210
202
  none: false
211
- requirements:
212
- - - ">="
213
- - !ruby/object:Gem::Version
214
- hash: 3
215
- segments:
203
+ requirements:
204
+ - - ! '>='
205
+ - !ruby/object:Gem::Version
206
+ version: '0'
207
+ segments:
216
208
  - 0
217
- version: "0"
209
+ hash: -520678126399173554
218
210
  requirements: []
219
-
220
211
  rubyforge_project: bovem
221
212
  rubygems_version: 1.8.24
222
213
  signing_key:
223
214
  specification_version: 3
224
215
  summary: A collection of utilities for developers.
225
- test_files:
216
+ test_files:
226
217
  - spec/bovem/configuration_spec.rb
227
218
  - spec/bovem/console_spec.rb
228
219
  - spec/bovem/logger_spec.rb