easy_app_helper 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +47 -47
- data/Gemfile +4 -4
- data/LICENSE.txt +22 -22
- data/README.md +498 -498
- data/Rakefile +1 -1
- data/easy_app_helper.gemspec +26 -26
- data/lib/easy_app_helper/core/base.rb +141 -128
- data/lib/easy_app_helper/core/config.rb +203 -203
- data/lib/easy_app_helper/core/logger.rb +111 -103
- data/lib/easy_app_helper/core/merge_policies.rb +37 -37
- data/lib/easy_app_helper/core/places.rb +51 -51
- data/lib/easy_app_helper/module_manager.rb +67 -60
- data/lib/easy_app_helper/version.rb +10 -10
- data/lib/easy_app_helper.rb +20 -20
- data/test/test.yml +7 -7
- data/test/test2_app.rb +33 -33
- data/test/test3_app.rb +90 -90
- data/test/test4_app.rb +35 -35
- data/test/test_app.rb +55 -55
- metadata +2 -3
data/test/test4_app.rb
CHANGED
@@ -1,36 +1,36 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'easy_app_helper'
|
4
|
-
|
5
|
-
class MyApp
|
6
|
-
include EasyAppHelper
|
7
|
-
|
8
|
-
APP_NAME = "My super application"
|
9
|
-
# SCRIPT_NAME = File.basename($0, '.*')
|
10
|
-
VERSION = '0.0.1'
|
11
|
-
DESCRIPTION = 'This application is a proof of concept for EasyAppHelper.'
|
12
|
-
|
13
|
-
|
14
|
-
def initialize
|
15
|
-
# Providing this data is optional
|
16
|
-
config.describes_application(app_name: APP_NAME, app_version: VERSION, app_description: DESCRIPTION)
|
17
|
-
end
|
18
|
-
|
19
|
-
|
20
|
-
def run
|
21
|
-
if config[:help]
|
22
|
-
puts config.help
|
23
|
-
exit 0
|
24
|
-
end
|
25
|
-
puts_and_logs "Application is starting"
|
26
|
-
do_some_processing
|
27
|
-
end
|
28
|
-
|
29
|
-
def do_some_processing
|
30
|
-
puts_and_logs "Starting some heavy processing"
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'easy_app_helper'
|
4
|
+
|
5
|
+
class MyApp
|
6
|
+
include EasyAppHelper
|
7
|
+
|
8
|
+
APP_NAME = "My super application"
|
9
|
+
# SCRIPT_NAME = File.basename($0, '.*')
|
10
|
+
VERSION = '0.0.1'
|
11
|
+
DESCRIPTION = 'This application is a proof of concept for EasyAppHelper.'
|
12
|
+
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
# Providing this data is optional
|
16
|
+
config.describes_application(app_name: APP_NAME, app_version: VERSION, app_description: DESCRIPTION)
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
def run
|
21
|
+
if config[:help]
|
22
|
+
puts config.help
|
23
|
+
exit 0
|
24
|
+
end
|
25
|
+
puts_and_logs "Application is starting"
|
26
|
+
do_some_processing
|
27
|
+
end
|
28
|
+
|
29
|
+
def do_some_processing
|
30
|
+
puts_and_logs "Starting some heavy processing"
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
36
|
MyApp.new.run
|
data/test/test_app.rb
CHANGED
@@ -1,56 +1,56 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
|
4
|
-
require 'easy_app_helper'
|
5
|
-
|
6
|
-
|
7
|
-
class Pipo
|
8
|
-
include EasyAppHelper
|
9
|
-
|
10
|
-
|
11
|
-
def toto
|
12
|
-
puts_and_logs "Now from a second class"
|
13
|
-
puts_and_logs config.to_hash
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
class TestApp
|
20
|
-
include EasyAppHelper
|
21
|
-
|
22
|
-
def initialize
|
23
|
-
#config.script_filename = File.basename $0
|
24
|
-
config.app_name = 'Test application'
|
25
|
-
#config.app_description = 'Best app to test the framework'
|
26
|
-
#config.app_version = '1.0.0'
|
27
|
-
puts_and_logs "Hello World"
|
28
|
-
p = Pipo.new.toto
|
29
|
-
config.script_filename = 'batch_audio_convert'
|
30
|
-
puts config.to_hash
|
31
|
-
config.internal_configs.each do |layer|
|
32
|
-
puts layer
|
33
|
-
end
|
34
|
-
add_cmd_line_options
|
35
|
-
puts config.help
|
36
|
-
logger.error "INTARG: #{config[:intarg]}"
|
37
|
-
|
38
|
-
# puts config.help
|
39
|
-
end
|
40
|
-
|
41
|
-
def add_cmd_line_options
|
42
|
-
config.add_command_line_section do |slop|
|
43
|
-
slop.on :u, :useless, 'Stupid option', :argument => false
|
44
|
-
slop.on :anint, 'Stupid option with integer argument', :argument => true, :as => Integer
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
t = TestApp.new
|
51
|
-
include EasyAppHelper
|
52
|
-
logger.warn "Yeah"
|
53
|
-
EasyAppHelper.logger.error "Groovy baby !"
|
54
|
-
puts_and_logs "Hey man"
|
55
|
-
#puts config.inspect
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
|
4
|
+
require 'easy_app_helper'
|
5
|
+
|
6
|
+
|
7
|
+
class Pipo
|
8
|
+
include EasyAppHelper
|
9
|
+
|
10
|
+
|
11
|
+
def toto
|
12
|
+
puts_and_logs "Now from a second class"
|
13
|
+
puts_and_logs config.to_hash
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
class TestApp
|
20
|
+
include EasyAppHelper
|
21
|
+
|
22
|
+
def initialize
|
23
|
+
#config.script_filename = File.basename $0
|
24
|
+
config.app_name = 'Test application'
|
25
|
+
#config.app_description = 'Best app to test the framework'
|
26
|
+
#config.app_version = '1.0.0'
|
27
|
+
puts_and_logs "Hello World"
|
28
|
+
p = Pipo.new.toto
|
29
|
+
config.script_filename = 'batch_audio_convert'
|
30
|
+
puts config.to_hash
|
31
|
+
config.internal_configs.each do |layer|
|
32
|
+
puts layer
|
33
|
+
end
|
34
|
+
add_cmd_line_options
|
35
|
+
puts config.help
|
36
|
+
logger.error "INTARG: #{config[:intarg]}"
|
37
|
+
|
38
|
+
# puts config.help
|
39
|
+
end
|
40
|
+
|
41
|
+
def add_cmd_line_options
|
42
|
+
config.add_command_line_section do |slop|
|
43
|
+
slop.on :u, :useless, 'Stupid option', :argument => false
|
44
|
+
slop.on :anint, 'Stupid option with integer argument', :argument => true, :as => Integer
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
t = TestApp.new
|
51
|
+
include EasyAppHelper
|
52
|
+
logger.warn "Yeah"
|
53
|
+
EasyAppHelper.logger.error "Groovy baby !"
|
54
|
+
puts_and_logs "Hey man"
|
55
|
+
#puts config.inspect
|
56
56
|
puts "bye"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- L.Briais
|
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
112
|
version: '0'
|
113
113
|
requirements: []
|
114
114
|
rubyforge_project:
|
115
|
-
rubygems_version: 2.0.
|
115
|
+
rubygems_version: 2.0.2
|
116
116
|
signing_key:
|
117
117
|
specification_version: 4
|
118
118
|
summary: Provides cool helpers to your application, including configuration and logging
|
@@ -123,4 +123,3 @@ test_files:
|
|
123
123
|
- test/test3_app.rb
|
124
124
|
- test/test4_app.rb
|
125
125
|
- test/test_app.rb
|
126
|
-
has_rdoc:
|