Sutto-perennial 0.2.2 → 0.2.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/lib/perennial/loader.rb +3 -4
- data/lib/perennial/option_parser.rb +1 -5
- data/lib/perennial.rb +1 -1
- metadata +1 -1
data/lib/perennial/loader.rb
CHANGED
@@ -6,14 +6,14 @@ module Perennial
|
|
6
6
|
include Perennial::Hookable
|
7
7
|
|
8
8
|
cattr_accessor :controllers, :current_type, :default_type
|
9
|
-
@@controllers =
|
9
|
+
@@controllers = {}
|
10
10
|
|
11
11
|
define_hook :before_run, :after_stop
|
12
12
|
|
13
13
|
def self.register_controller(name, controller)
|
14
14
|
return if name.blank? || controller.blank?
|
15
15
|
name = name.to_sym
|
16
|
-
@@
|
16
|
+
@@controllers[name] = controller
|
17
17
|
metaclass.class_eval(<<-RUBY, __FILE__, __LINE__ + 1)
|
18
18
|
def #{name}? # def client?
|
19
19
|
@@current_type == :#{name} # @@current_type == :client
|
@@ -32,7 +32,6 @@ module Perennial
|
|
32
32
|
|
33
33
|
def run!
|
34
34
|
self.register_signals
|
35
|
-
OptionParser.parse_argv
|
36
35
|
self.class.invoke_hooks! :before_setup
|
37
36
|
Daemon.daemonize! if Settings.daemon?
|
38
37
|
Logger.log_name = "#{@@current_type.to_s}.log"
|
@@ -64,7 +63,7 @@ module Perennial
|
|
64
63
|
begin
|
65
64
|
config_dir = Settings.root / "config"
|
66
65
|
setup_file = config_dir / "setup.rb"
|
67
|
-
require(setup_file) if File.directory?(
|
66
|
+
require(setup_file) if File.directory?(config_dir) && File.exist?(setup_file)
|
68
67
|
rescue LoadError
|
69
68
|
end
|
70
69
|
# Load any existing handlers assuming we can find the folder
|
@@ -45,10 +45,6 @@ module Perennial
|
|
45
45
|
return nil
|
46
46
|
end
|
47
47
|
|
48
|
-
def self.method_missing(name, *args, &blk)
|
49
|
-
self.default.send(name, *args, &blk)
|
50
|
-
end
|
51
|
-
|
52
48
|
# Over ride with your apps custom banner
|
53
49
|
def self.print_banner
|
54
50
|
end
|
@@ -81,7 +77,7 @@ module Perennial
|
|
81
77
|
@default = setup_default!
|
82
78
|
end
|
83
79
|
|
84
|
-
def parse_argv(with = default)
|
80
|
+
def self.parse_argv(with = default)
|
85
81
|
with.parse
|
86
82
|
ARGV.replace with.arguments
|
87
83
|
end
|
data/lib/perennial.rb
CHANGED