daemon-ogre 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -1,74 +1,82 @@
1
1
  daemon-ogre
2
2
  ===========
3
3
 
4
- = daemon-ogre
4
+ Installation
5
+ ------------
5
6
 
7
+ ### [RubyGems](http://rubygems.org/)
6
8
 
7
- gem install 'daemon-ogre'
9
+ $ gem install 'daemon-ogre'
8
10
 
9
11
 
10
12
  require 'daemon-ogre'
11
13
  DaemonOgre.start
12
14
 
13
15
 
14
- but we love config our beloved App!
15
- -======================================================================================================================-
16
- DaemonOgre.start :name => "MySuperAppName!", #this will be the name of the application
17
- :log_path => "./var/log/log_file_name", #this will be the logfile place and name
18
- :pid_path => "./var/pid/pid_file_name", #this will be the pidfile place and name
19
- :terminate => true #this command not let start your code if it's not started
20
- # with "start" arguments like :
21
- # ruby my_awsome_app.rb start
16
+ but we love config our beloved App!
17
+ -----------------------------------
22
18
 
23
19
 
24
- -======================================================================================================================-
25
- othere stuffs to use:
26
- everybody love: require_relative...
27
- so why should not try require_directory instead all the fuss
28
- you can tell to it if you want some file to be excluded or just delayed loaded,
29
- because you want them loaded in the last place
30
- Example:
20
+ DaemonOgre.start :name => "MySuperAppName!", #this will be the name of the application
21
+ :log_path => "./var/log/log_file_name", #this will be the logfile place and name
22
+ :pid_path => "./var/pid/pid_file_name", #this will be the pidfile place and name
23
+ :terminate => true #this command not let start your code if it's not started
24
+ # with "start" arguments like :
25
+ # ruby my_awsome_app.rb start
31
26
 
32
- require_directory "some_dir_name_from_here_where_are_multi_dir_levels"
33
27
 
34
- or
28
+ othere stuffs to use:
29
+ ---------------------
30
+ everybody love: require_relative...
31
+ so why should not try require_directory instead all the fuss
32
+ you can tell to it if you want some file to be excluded or just delayed loaded,
33
+ because you want them loaded in the last place
34
+ Example:
35
35
 
36
- require_directory "some_dir_name_from_here_where_are_multi_dir_levels",
37
- :delayed => ["files","to","be","delayed","in","load"],
38
- :exclude => ["files","to","be","exclude","in","load"]
39
36
 
37
+ require_directory "some_dir_name_from_here_where_are_multi_dir_levels"
38
+
39
+ or
40
+
41
+ require_directory "some_dir_name_from_here_where_are_multi_dir_levels",
42
+ :delayed => ["files","to","be","delayed","in","load"],
43
+ :exclude => ["files","to","be","exclude","in","load"]
44
+
45
+
46
+
47
+ Helpers
48
+ -------
40
49
 
41
- -======================================================================================================================-
42
50
  and ofc what else what we love if not our beloved yml-s
43
51
  we should use a nice Config constant for this(or at least i love to do)
44
52
 
45
- CONFIG = require_ymls "some_dir_name_from_here_where_are_the_yml_files_in_multi_dir_level"
46
- the file names will be the hash-key and under that , there will be the yml file datas loaded in
53
+ CONFIG = require_ymls "some_dir_name_from_here_where_are_the_yml_files_in_multi_dir_level"
54
+ the file names will be the hash-key and under that , there will be the yml file datas loaded in
47
55
 
48
- if you need get a free port in a range or from, you can use this:
49
- get_port(from_nmb,to_nmb,host)
56
+ if you need get a free port in a range or from, you can use this:
57
+ get_port(from_nmb,to_nmb,host)
50
58
 
51
- or by simply
59
+ or by simply
52
60
 
53
- get_port(number)
61
+ get_port(number)
54
62
 
55
63
 
56
- and if you hate find all the bugs... you can use error_logger at your command like this:
64
+ and if you hate find all the bugs... you can use error_logger at your command like this:
57
65
 
58
66
 
59
- begin
67
+ begin
60
68
 
61
- your awsome code!
69
+ your awsome code!
62
70
 
63
- rescue xyexception => ex
64
- logger ex, #error_msg
65
- prefix, #this is optionable! but i usualy use: "#{__FILE__}/#{__LINE__}"
66
- log_file #this is optionable!
67
- end
71
+ rescue xyexception => ex
72
+ logger ex, #error_msg
73
+ prefix, #this is optionable! but i usualy use: "#{__FILE__}/#{__LINE__}"
74
+ log_file #this is optionable!
75
+ end
68
76
 
69
77
 
70
78
  if you need methods from any kind of class without the object methods, you should try this!
71
- Xyclassname.class_methods
79
+ Xyclassname.class_methods
72
80
 
73
81
 
74
82
  you want make some test script with rnd numbers, strings, dates, bools etc? use the Rnd class at your command
@@ -78,25 +86,26 @@ Rnd
78
86
  -boolean
79
87
  -date
80
88
 
81
- example: Rnd.number(100)
82
- or Rnd.string(15,2) #for rnd bla bla names
89
+ examples:
90
+ Rnd.number(100)
91
+ Rnd.string(15,2) #for rnd bla bla names
83
92
 
84
93
 
85
94
  You need get the index of an Array element? you can use:
86
- array_variable.index_of("something)
95
+ array_variable.index_of("something)
87
96
 
88
97
 
98
+ Do you wanted to know , does that process running on that pid or not?
99
+ process_running?(nmbr)
89
100
 
90
- -=========================================================-
91
101
 
92
102
 
93
103
 
94
104
  in Short:
95
- require 'daemon-ogre'
96
- DaemonOgre.start
97
-
98
- for boot your files and ymls, helpers above :)
99
- your_Super_app_code!
105
+ ---------
106
+ require 'daemon-ogre'
107
+ DaemonOgre.start #arguments if you want :)
108
+ your_Super_app_code!
100
109
 
101
110
 
102
111
 
@@ -118,4 +127,4 @@ further details.
118
127
 
119
128
 
120
129
 
121
- daemon-ogre
130
+ daemon-ogre
data/README.rdoc CHANGED
@@ -82,6 +82,9 @@ or Rnd.string(15,2) #for rnd bla bla names
82
82
  You need get the index of an Array element? you can use:
83
83
  array_variable.index_of("something)
84
84
 
85
+ Do you wanted to know , does that process running on that pid or not?
86
+ process_running?(nmbr)
87
+
85
88
 
86
89
 
87
90
  -=========================================================-
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.0
1
+ 1.2.1
data/daemon-ogre.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "daemon-ogre"
8
- s.version = "1.2.0"
8
+ s.version = "1.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Adam.Luzsi"]
data/lib/daemon-ogre.rb CHANGED
@@ -298,7 +298,8 @@ begin
298
298
  Daemon.kill DaemonOgre::App.pid_path
299
299
  kill_with_pid
300
300
  File.open(DaemonOgre::App.pid_path, "w").write("")
301
- terminate
301
+ Process.exit
302
+
302
303
  end
303
304
 
304
305
  def restart
@@ -306,8 +307,8 @@ begin
306
307
  Daemon.kill DaemonOgre::App.pid_path
307
308
  kill_with_pid
308
309
  File.open(DaemonOgre::App.pid_path, "w").write("")
309
-
310
310
  start
311
+
311
312
  end
312
313
 
313
314
  def kill_with_pid
@@ -332,10 +333,6 @@ begin
332
333
  end
333
334
  end
334
335
 
335
- def terminate
336
- Process.exit if DaemonOgre::App.terminate
337
- end
338
-
339
336
  def continue?
340
337
  Process.exit if !@@startup
341
338
  end
@@ -416,6 +413,9 @@ end
416
413
 
417
414
  #monkey patch
418
415
  begin
416
+ def process_running?(input)
417
+ DaemonOgre.process_running?(input)
418
+ end
419
419
  class File
420
420
  def self.create!(input,optionable_data=nil,optionable_file_mod="w")
421
421
  DaemonOgre.create_on_filesystem(input,optionable_data,optionable_file_mod)
@@ -455,15 +455,11 @@ begin
455
455
  end
456
456
 
457
457
  def number(length)
458
-
459
458
  Random.rand(length)
460
-
461
459
  end
462
460
 
463
461
  def boolean
464
-
465
462
  rand(2) == 1
466
-
467
463
  end
468
464
 
469
465
  def date from = Time.at(1114924812), to = Time.now
@@ -472,13 +468,11 @@ begin
472
468
  end
473
469
  end
474
470
  class Array
475
- #class << self
476
- def index_of(target_element)
477
- array = self
478
- hash = Hash[array.map.with_index.to_a]
479
- return hash[target_element]
480
- end
481
- #end
471
+ def index_of(target_element)
472
+ array = self
473
+ hash = Hash[array.map.with_index.to_a]
474
+ return hash[target_element]
475
+ end
482
476
  end
483
477
  end
484
478