Browse code

Move argument parsing to its method

Cinan Rakosnik authored on 17/12/2012 at 00:26:58
Showing 1 changed files
... ...
@@ -22,14 +22,7 @@ module Rubysermon
22 22
 			@enabled_mods	= []
23 23
 			@db				= nil
24 24
 
25
-			if not ARGV.empty?
26
-				config_path = ARGV.first
27
-				if File.exists?(config_path)
28
-					@config[:config_path] = config_path
29
-				else
30
-					abort("Wrong config file path. Exiting.")
31
-				end
32
-			end
25
+			check_args()
33 26
 		end
34 27
 
35 28
 		def run
... ...
@@ -40,12 +33,23 @@ module Rubysermon
40 40
 				abort(msg)
41 41
 			end
42 42
 
43
-			start_db()
43
+			#start_db()
44 44
 			start_fetch_process_sleep_cycle()
45 45
 		end
46 46
 
47 47
 		private
48 48
 
49
+		def check_args
50
+			if not ARGV.empty?
51
+				config_path = ARGV.first
52
+				if File.exists?(config_path)
53
+					@config[:config_path] = config_path
54
+				else
55
+					abort("Wrong config file path. Exiting.")
56
+				end
57
+			end
58
+		end
59
+
49 60
 		def read_config
50 61
 			configurator = Configurator.new(@config[:config_path])
51 62
 			config = configurator.get_settings()