daemon-ogre 1.2.8 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.md +49 -1
  2. data/README.rdoc +49 -1
  3. data/VERSION +1 -1
  4. data/lib/daemon-ogre.rb +13 -1
  5. metadata +3 -3
data/README.md CHANGED
@@ -1,6 +1,29 @@
1
1
  daemon-ogre
2
2
  ===========
3
3
 
4
+ Description
5
+ -----------
6
+
7
+ This gem is made for one purpose.
8
+
9
+ Ruby meant to be for easy use, not hardcore coding!
10
+ And in terms for this, ogre will aid you in the brute way, so you can relax...
11
+
12
+ Are you need load a whole bunch of folders to your rack application ?
13
+ Do it! You want one nice hash for config constant
14
+ from ymls all over your dirs? sure you can! you want have
15
+ start/stop/status/restart/daemon/etc argument commands from
16
+ terminal to control your application without any fuss?
17
+ There you go! Are you need an easy way,
18
+ to do the classic way of daemonise your awsome app?
19
+ There will be no problem at all, let the Ogre do the job!
20
+
21
+ so all you need is enjoy your code!
22
+ Follow me on Github and send request,
23
+ if you have idea what can be usefull in creating your app :)
24
+
25
+
26
+
4
27
  Installation
5
28
  ------------
6
29
 
@@ -81,8 +104,11 @@ or
81
104
 
82
105
  require_directory "some_dir_name_from_here_where_are_multi_dir_levels",
83
106
  :delayed => ["files","to","be","delayed","in","load"],
84
- :exclude => ["files","to","be","exclude","in","load"]
107
+ :exclude => ["files","to","be","exclude","in","load"],
108
+ :type => "rb"
85
109
 
110
+ remember, you can use any of those modifier hash-tag by it self only! :)
111
+ by default the type will be .rb files
86
112
 
87
113
 
88
114
  Helpers
@@ -92,8 +118,21 @@ and ofc what else what we love if not our beloved yml-s
92
118
  we should use a nice Config constant for this(or at least i love to do)
93
119
 
94
120
  CONFIG = require_ymls "some_dir_name_from_here_where_are_the_yml_files_in_multi_dir_level"
121
+
95
122
  the file names will be the hash-key and under that , there will be the yml file datas loaded in
96
123
 
124
+ And if we are at hashs, than when you need remove an element perm, or not perm you can use
125
+ * remove will return the hash w/o the the key
126
+ * remove! will delete the key, than return the hash
127
+ example:
128
+
129
+ CONFIG.remove key
130
+ CONFIG.remove! key
131
+
132
+
133
+
134
+
135
+
97
136
  if you need get a free port in a range or from, you can use this:
98
137
  get_port(from_nmb,to_nmb,host)
99
138
 
@@ -124,6 +163,15 @@ and if you hate find all the bugs... you can use error_logger at your command li
124
163
  ex.logger
125
164
  end
126
165
 
166
+
167
+ or the better way to do Exception handle is to rescue only those exceptions what we are know will be raised! so the app broke if something unexpected stupp come up! (development:)
168
+
169
+
170
+ begin
171
+ raise ArgumentError, "failed"
172
+ rescue ArgumentError => ex
173
+ ex.logger
174
+ end
127
175
 
128
176
 
129
177
 
data/README.rdoc CHANGED
@@ -1,6 +1,29 @@
1
1
  daemon-ogre
2
2
  ===========
3
3
 
4
+ Description
5
+ -----------
6
+
7
+ This gem is made for one purpose.
8
+
9
+ Ruby meant to be for easy use, not hardcore coding!
10
+ And in terms for this, ogre will aid you in the brute way, so you can relax...
11
+
12
+ Are you need load a whole bunch of folders to your rack application ?
13
+ Do it! You want one nice hash for config constant
14
+ from ymls all over your dirs? sure you can! you want have
15
+ start/stop/status/restart/daemon/etc argument commands from
16
+ terminal to control your application without any fuss?
17
+ There you go! Are you need an easy way,
18
+ to do the classic way of daemonise your awsome app?
19
+ There will be no problem at all, let the Ogre do the job!
20
+
21
+ so all you need is enjoy your code!
22
+ Follow me on Github and send request,
23
+ if you have idea what can be usefull in creating your app :)
24
+
25
+
26
+
4
27
  Installation
5
28
  ------------
6
29
 
@@ -81,8 +104,11 @@ or
81
104
 
82
105
  require_directory "some_dir_name_from_here_where_are_multi_dir_levels",
83
106
  :delayed => ["files","to","be","delayed","in","load"],
84
- :exclude => ["files","to","be","exclude","in","load"]
107
+ :exclude => ["files","to","be","exclude","in","load"],
108
+ :type => "rb"
85
109
 
110
+ remember, you can use any of those modifier hash-tag by it self only! :)
111
+ by default the type will be .rb files
86
112
 
87
113
 
88
114
  Helpers
@@ -92,8 +118,21 @@ and ofc what else what we love if not our beloved yml-s
92
118
  we should use a nice Config constant for this(or at least i love to do)
93
119
 
94
120
  CONFIG = require_ymls "some_dir_name_from_here_where_are_the_yml_files_in_multi_dir_level"
121
+
95
122
  the file names will be the hash-key and under that , there will be the yml file datas loaded in
96
123
 
124
+ And if we are at hashs, than when you need remove an element perm, or not perm you can use
125
+ * remove will return the hash w/o the the key
126
+ * remove! will delete the key, than return the hash
127
+ example:
128
+
129
+ CONFIG.remove key
130
+ CONFIG.remove! key
131
+
132
+
133
+
134
+
135
+
97
136
  if you need get a free port in a range or from, you can use this:
98
137
  get_port(from_nmb,to_nmb,host)
99
138
 
@@ -124,6 +163,15 @@ and if you hate find all the bugs... you can use error_logger at your command li
124
163
  ex.logger
125
164
  end
126
165
 
166
+
167
+ or the better way to do Exception handle is to rescue only those exceptions what we are know will be raised! so the app broke if something unexpected stupp come up! (development:)
168
+
169
+
170
+ begin
171
+ raise ArgumentError, "failed"
172
+ rescue ArgumentError => ex
173
+ ex.logger
174
+ end
127
175
 
128
176
 
129
177
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.8
1
+ 1.3.0
data/lib/daemon-ogre.rb CHANGED
@@ -19,13 +19,14 @@ begin
19
19
  "Array! Example:\n:exclude => ['abc']" if arg[:exclude].class == Array
20
20
  end
21
21
 
22
+ arg[:type]= "rb" if !arg[:type].nil?
22
23
 
23
24
  #=================================================================================================================
24
25
 
25
26
  puts "LOADING_FILES_FROM_"+directory.to_s.split('/').last.split('.').first.capitalize if App.debug
26
27
 
27
28
  delayed_loads = Array.new
28
- Dir["#{directory}/**/*.rb"].each do |file|
29
+ Dir["#{directory}/**/*.#{arg[:type]}"].each do |file|
29
30
 
30
31
  arg[:delayed]= [nil] if arg[:delayed].nil?
31
32
  arg[:exclude]= [nil] if arg[:exclude].nil?
@@ -545,6 +546,17 @@ begin
545
546
  return hash[target_element]
546
547
  end
547
548
  end
549
+ class Hash
550
+ #pass single or array of keys, which will be removed, returning the remaining hash
551
+ def remove!(*keys)
552
+ keys.each{|key| self.delete(key) }
553
+ self
554
+ end
555
+ #non-destructive version
556
+ def remove(*keys)
557
+ self.dup.remove!(*keys)
558
+ end
559
+ end
548
560
  end
549
561
 
550
562
  #StartUp
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daemon-ogre
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.8
4
+ version: 1.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-01 00:00:00.000000000 Z
12
+ date: 2013-06-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdoc
@@ -112,7 +112,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
112
112
  version: '0'
113
113
  segments:
114
114
  - 0
115
- hash: 878568399509540350
115
+ hash: 849905104438420836
116
116
  required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  none: false
118
118
  requirements: