easy_app_helper 1.0.8 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +30 -8
- data/easy_app_helper.gemspec +11 -11
- data/lib/easy_app_helper/core/places.rb +12 -11
- data/lib/easy_app_helper/version.rb +1 -1
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70bf9f13848d8863f18d949d02b4c741fceb8185
|
4
|
+
data.tar.gz: c49ba93f589254ee9ce4a6e539fd02dacb6102d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4ea7b8676fa7bf3ad627cf99b3bcfe38c45c32c787c8d0d26e65c90076919ce7670af4526b42328d3eac58c0fe465d0a918b9462d661761d86b67c929aaba3d
|
7
|
+
data.tar.gz: 8b6c6ab66f91bed56ecf62f0e091aff5c37b99b283f1abb67c904b446134d533c3c03b695e95be54eaf26378e8c564992ecdb128322161e17fa4628d234688d2
|
data/README.md
CHANGED
@@ -7,8 +7,8 @@
|
|
7
7
|
|
8
8
|
This is a complete rewrite of the initial easy_app_helper gem. **It is not compatible with
|
9
9
|
apps designed for easy_app_helper prior to version 1.0.0**, although they could be very easily adapted
|
10
|
-
(anyway you always specify your gem dependencies using the [pessimistic version operator]
|
11
|
-
(http://
|
10
|
+
(anyway you always specify your gem dependencies using [semantic versioning](http://semver.org/) and the [pessimistic version operator]
|
11
|
+
(http://robots.thoughtbot.com/post/2508037841/rubys-pessimistic-operator), don't you ? More info [here](http://guides.rubygems.org/patterns/#declaring_dependencies)). Older applications should explicitly
|
12
12
|
require to use the latest version of the 0.x.x series instead. The config files themselves remain
|
13
13
|
compatible with all versions of **EasyAppHelper**, as they are actually just plain Yaml files...
|
14
14
|
|
@@ -34,7 +34,7 @@ a ready-for-prod config, logger and command line management.
|
|
34
34
|
|
35
35
|
Currently the only runtime dependency is the cool [Slop gem][slop] which is used to process the command line options.
|
36
36
|
|
37
|
-
[Why this gem][
|
37
|
+
[Why this gem][wiki] ?
|
38
38
|
|
39
39
|
|
40
40
|
|
@@ -63,7 +63,7 @@ To use it, once you installed them, you just need to require it:
|
|
63
63
|
require 'easy_app_helper'
|
64
64
|
```
|
65
65
|
|
66
|
-
Then
|
66
|
+
Then you can immediately access the logger or the config objects. Here under a first example:
|
67
67
|
|
68
68
|
```ruby
|
69
69
|
require 'easy_app_helper'
|
@@ -110,6 +110,10 @@ puts config.internal_configs.to_yaml
|
|
110
110
|
# :content: {}
|
111
111
|
# :source:
|
112
112
|
# :origin: EasyAppHelper
|
113
|
+
#:internal:
|
114
|
+
# :content: {}
|
115
|
+
# :source:
|
116
|
+
# :origin: ''
|
113
117
|
#:global:
|
114
118
|
# :content: {}
|
115
119
|
# :source:
|
@@ -183,7 +187,8 @@ regarding the rules described above, the framework will for the following files
|
|
183
187
|
|
184
188
|
### Internal config file
|
185
189
|
|
186
|
-
This is an internal config file for the Gem itself. It will be located in the etc directory **inside** the Gem.
|
190
|
+
This is an internal config file for the Gem itself. It will be located in the ```etc/``` or ```config/``` directory **inside** the Gem.
|
191
|
+
It is a way for a Gem to define a system default configuration.
|
187
192
|
|
188
193
|
```text
|
189
194
|
# The :internal layer
|
@@ -195,6 +200,14 @@ etc/myscript.CFG
|
|
195
200
|
etc/myscript.YML
|
196
201
|
etc/myscript.YAML
|
197
202
|
etc/myscript.Yaml
|
203
|
+
config/myscript.conf
|
204
|
+
config/myscript.yml
|
205
|
+
config/myscript.cfg
|
206
|
+
config/myscript.yaml
|
207
|
+
config/myscript.CFG
|
208
|
+
config/myscript.YML
|
209
|
+
config/myscript.YAML
|
210
|
+
config/myscript.Yaml
|
198
211
|
```
|
199
212
|
|
200
213
|
|
@@ -393,6 +406,15 @@ D, [2013-06-23T19:43:47.977031 #16294] DEBUG -- : Temporary initialisation logge
|
|
393
406
|
D, [2013-06-23T19:43:47.977861 #16294] DEBUG -- : Trying "/etc/EasyAppHelper.conf" as config file.
|
394
407
|
D, [2013-06-23T19:43:47.977908 #16294] DEBUG -- : Trying "/etc/EasyAppHelper.yml" as config file.
|
395
408
|
D, [2013-06-23T19:43:47.977938 #16294] DEBUG -- : Loading config file "/etc/EasyAppHelper.cfg"
|
409
|
+
D, [2013-06-23T19:43:47.977961 #16294] DEBUG -- : Trying "/home/laurent/devel/ruby/gems/test4_app/etc/test4_app.conf" as config file.
|
410
|
+
D, [2013-06-23T19:43:47.977982 #16294] DEBUG -- : Trying "/home/laurent/devel/ruby/gems/test4_app/etc/test4_app.yml" as config file.
|
411
|
+
D, [2013-06-23T19:43:47.977995 #16294] DEBUG -- : Trying "/home/laurent/devel/ruby/gems/test4_app/etc/test4_app.cfg" as config file.
|
412
|
+
D, [2013-06-23T19:43:47.978032 #16294] DEBUG -- : Trying "/home/laurent/devel/ruby/gems/test4_app/etc/test4_app.yaml" as config file.
|
413
|
+
D, [2013-06-23T19:43:47.978082 #16294] DEBUG -- : Trying "/home/laurent/devel/ruby/gems/test4_app/etc/test4_app.CFG" as config file.
|
414
|
+
D, [2013-06-23T19:43:47.978119 #16294] DEBUG -- : Trying "/home/laurent/devel/ruby/gems/test4_app/etc/test4_app.YML" as config file.
|
415
|
+
D, [2013-06-23T19:43:47.978163 #16294] DEBUG -- : Trying "/home/laurent/devel/ruby/gems/test4_app/etc/test4_app.YAML" as config file.
|
416
|
+
D, [2013-06-23T19:43:47.978206 #16294] DEBUG -- : Trying "/home/laurent/devel/ruby/gems/test4_app/etc/test4_app.Yaml" as config file.
|
417
|
+
I, [2013-06-23T19:43:47.978255 #16294] INFO -- : No config file found for layer internal.
|
396
418
|
D, [2013-06-23T19:43:47.978300 #16294] DEBUG -- : Trying "/etc/test4_app.conf" as config file.
|
397
419
|
D, [2013-06-23T19:43:47.978332 #16294] DEBUG -- : Trying "/etc/test4_app.yml" as config file.
|
398
420
|
D, [2013-06-23T19:43:47.978355 #16294] DEBUG -- : Trying "/etc/test4_app.cfg" as config file.
|
@@ -516,8 +538,8 @@ did eventually end-up in the same log...
|
|
516
538
|
That's all folks.
|
517
539
|
|
518
540
|
|
519
|
-
[EAP]: https://rubygems.org/gems/easy_app_helper "
|
541
|
+
[EAP]: https://rubygems.org/gems/easy_app_helper "EasyAppHelper gem"
|
520
542
|
[slop]: https://rubygems.org/gems/slop "Slop gem"
|
521
543
|
[yaml]: http://www.yaml.org/ "The Yaml official site"
|
522
|
-
[doc]: http://rubydoc.info/github/lbriais/easy_app_helper/master "
|
523
|
-
[
|
544
|
+
[doc]: http://rubydoc.info/github/lbriais/easy_app_helper/master "EasyAppHelper documentation"
|
545
|
+
[wiki]: https://github.com/lbriais/easy_app_helper/wiki "EasyAppHelper wiki"
|
data/easy_app_helper.gemspec
CHANGED
@@ -4,24 +4,24 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'easy_app_helper/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'easy_app_helper'
|
8
8
|
spec.version = EasyAppHelper::EASY_APP_HELPER_VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['L.Briais']
|
10
|
+
spec.email = ['lbnetid+rb@gmail.com']
|
11
11
|
spec.description = %q{Easy Application Helpers framework}
|
12
12
|
spec.summary = %q{Provides cool helpers to your application, including configuration and logging features}
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
13
|
+
spec.homepage = 'https://github.com/lbriais/easy_app_helper'
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/).delete_if { |file| file =~ /^(bin|\.)/ or file =~ /test\d*_app\.rb$/ }
|
17
17
|
# spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features|etc)/})
|
19
|
-
spec.require_paths = [
|
19
|
+
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_development_dependency
|
22
|
-
spec.add_development_dependency
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_development_dependency
|
21
|
+
spec.add_development_dependency 'bundler'
|
22
|
+
spec.add_development_dependency 'rake'
|
23
|
+
spec.add_development_dependency 'pry'
|
24
|
+
spec.add_development_dependency 'rspec', '~> 2.0'
|
25
25
|
|
26
|
-
spec.add_runtime_dependency
|
26
|
+
spec.add_runtime_dependency 'slop'
|
27
27
|
end
|
@@ -5,14 +5,16 @@
|
|
5
5
|
# http://opensource.org/licenses/MIT
|
6
6
|
################################################################################
|
7
7
|
|
8
|
-
#
|
8
|
+
# The goal of this class is to return a module containing the POSSIBLE_PLACES hash
|
9
|
+
# that provides a list of OS dependant paths.
|
10
|
+
# The only method that should be used is the #get_os_module method that returns this module.
|
9
11
|
# TODO: Add equivalent for Mac
|
10
12
|
class EasyAppHelper::Core::Config::Places
|
11
13
|
|
12
14
|
module Helper
|
13
15
|
|
14
16
|
def get_internal_config_place
|
15
|
-
File.expand_path('../../etc', $PROGRAM_NAME)
|
17
|
+
[File.expand_path('../../etc', $PROGRAM_NAME), File.expand_path('../../config', $PROGRAM_NAME)]
|
16
18
|
end
|
17
19
|
|
18
20
|
def possible_config_places key
|
@@ -22,34 +24,33 @@ class EasyAppHelper::Core::Config::Places
|
|
22
24
|
end
|
23
25
|
|
24
26
|
|
27
|
+
# Defines some places for Unix machines
|
25
28
|
module Unix
|
26
|
-
|
27
|
-
# based applications.
|
29
|
+
|
28
30
|
extend Helper
|
29
31
|
|
30
32
|
POSSIBLE_PLACES = {
|
31
33
|
|
32
|
-
internal:
|
34
|
+
internal: self.get_internal_config_place,
|
33
35
|
|
34
|
-
system: [
|
36
|
+
system: ['/etc'],
|
35
37
|
|
36
38
|
# Where could be stored global wide configuration
|
37
|
-
global: [
|
38
|
-
|
39
|
+
global: ['/etc',
|
40
|
+
'/usr/local/etc'],
|
39
41
|
|
40
42
|
# Where could be stored user configuration
|
41
43
|
user: ["#{ENV['HOME']}/.config"]
|
42
44
|
}
|
43
45
|
end
|
44
46
|
|
47
|
+
# Defines some places for Windows machines
|
45
48
|
module Windows
|
46
|
-
# Where could be stored admin configuration that rules all EasyAppHelper
|
47
|
-
# based applications.
|
48
49
|
extend Helper
|
49
50
|
|
50
51
|
POSSIBLE_PLACES = {
|
51
52
|
|
52
|
-
internal:
|
53
|
+
internal: self.get_internal_config_place,
|
53
54
|
|
54
55
|
system: ["#{ENV['systemRoot']}/Config"],
|
55
56
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy_app_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- L.Briais
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -56,16 +56,16 @@ dependencies:
|
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
61
|
+
version: '2.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
68
|
+
version: '2.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: slop
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|
126
126
|
rubyforge_project:
|
127
|
-
rubygems_version: 2.0.0
|
127
|
+
rubygems_version: 2.0.0
|
128
128
|
signing_key:
|
129
129
|
specification_version: 4
|
130
130
|
summary: Provides cool helpers to your application, including configuration and logging
|
@@ -134,4 +134,3 @@ test_files:
|
|
134
134
|
- spec/config_spec.rb
|
135
135
|
- spec/logger_spec.rb
|
136
136
|
- test/test.yml
|
137
|
-
has_rdoc:
|