rsence 2.0.0.2.pre → 2.0.0.3.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/conf/argv.rb +91 -13
- metadata +5 -5
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.0.
|
1
|
+
2.0.0.3.pre
|
data/lib/conf/argv.rb
CHANGED
@@ -223,6 +223,13 @@ Available options:
|
|
223
223
|
|
224
224
|
EOF
|
225
225
|
|
226
|
+
@@cmd_help[:version] = <<-EOF
|
227
|
+
usage: 'rsence version'
|
228
|
+
|
229
|
+
The 'version' command simply outputs the version number of RSence.
|
230
|
+
|
231
|
+
EOF
|
232
|
+
|
226
233
|
@@cmd_help[:tail] = <<-EOF
|
227
234
|
RSence is a self-contained rich internet application client-server framework.
|
228
235
|
For further information, see http://rsence.org/
|
@@ -274,7 +281,7 @@ EOF
|
|
274
281
|
@argv[1..-1].each_with_index do |arg,i|
|
275
282
|
if expect_option
|
276
283
|
if [:port,:latency].include?(option_name) and arg.to_i.to_s != arg
|
277
|
-
puts "invalid #{
|
284
|
+
puts "invalid #{option_name.to_s}, expected number: #{arg.inspect}"
|
278
285
|
puts "Type 'rsence help #{@cmd.to_s}' for usage."
|
279
286
|
exit
|
280
287
|
elsif option_name == :conf_files
|
@@ -474,8 +481,8 @@ EOF
|
|
474
481
|
if @argv.length >= 2
|
475
482
|
@argv[1..-1].each_with_index do |arg,i|
|
476
483
|
if expect_option
|
477
|
-
if [:port
|
478
|
-
puts "invalid #{
|
484
|
+
if [:port].include?(option_name) and arg.to_i.to_s != arg
|
485
|
+
puts "invalid #{option_name.to_s}, expected number: #{arg.inspect}"
|
479
486
|
puts "Type 'rsence help #{@cmd.to_s}' for usage."
|
480
487
|
exit
|
481
488
|
elsif option_name == :conf_files
|
@@ -502,9 +509,6 @@ EOF
|
|
502
509
|
elsif arg == '--addr'
|
503
510
|
expect_option = true
|
504
511
|
option_name = :addr
|
505
|
-
elsif arg == '--server'
|
506
|
-
expect_option = true
|
507
|
-
option_name = :server
|
508
512
|
elsif arg == '--conf' or arg == '--config'
|
509
513
|
expect_option = true
|
510
514
|
option_name = :conf_files
|
@@ -580,11 +584,7 @@ EOF
|
|
580
584
|
if @argv.length >= 2
|
581
585
|
@argv[1..-1].each_with_index do |arg,i|
|
582
586
|
if expect_option
|
583
|
-
if
|
584
|
-
puts "invalid #{option_nam.to_s}, expected number: #{arg.inspect}"
|
585
|
-
puts "Type 'rsence help #{@cmd.to_s}' for usage."
|
586
|
-
exit
|
587
|
-
elsif option_name == :conf_files
|
587
|
+
if option_name == :conf_files
|
588
588
|
if not File.exists?( arg ) or not File.file?( arg )
|
589
589
|
puts "no such configuration file: #{arg.inspect}"
|
590
590
|
puts "Type 'rsence help #{@cmd.to_s}' for usage."
|
@@ -672,7 +672,85 @@ EOF
|
|
672
672
|
end
|
673
673
|
|
674
674
|
def parse_initenv_argv
|
675
|
-
|
675
|
+
init_args
|
676
|
+
expect_option = false
|
677
|
+
option_name = false
|
678
|
+
valid_env
|
679
|
+
if @argv.length >= 2
|
680
|
+
@argv[1..-1].each_with_index do |arg,i|
|
681
|
+
if expect_option
|
682
|
+
if [:port].include?(option_name) and arg.to_i.to_s != arg
|
683
|
+
puts "invalid #{option_name.to_s}, expected number: #{arg.inspect}"
|
684
|
+
puts "Type 'rsence help #{@cmd.to_s}' for usage."
|
685
|
+
exit
|
686
|
+
else
|
687
|
+
@args[option_name] = arg
|
688
|
+
end
|
689
|
+
expect_option = false
|
690
|
+
else
|
691
|
+
if arg.start_with?('--')
|
692
|
+
if arg == '--port'
|
693
|
+
expect_option = true
|
694
|
+
option_name = :port
|
695
|
+
elsif arg == '--addr'
|
696
|
+
expect_option = true
|
697
|
+
option_name = :addr
|
698
|
+
elsif arg == '--server'
|
699
|
+
expect_option = true
|
700
|
+
option_name = :server
|
701
|
+
elsif arg == '--title'
|
702
|
+
expect_option = true
|
703
|
+
option_name = :title
|
704
|
+
else
|
705
|
+
invalid_option(arg)
|
706
|
+
end
|
707
|
+
elsif valid_env?(arg)
|
708
|
+
@args[:env_path] = File.expand_path(arg)
|
709
|
+
end
|
710
|
+
end
|
711
|
+
end
|
712
|
+
if expect_option
|
713
|
+
puts "no value for option #{option_name.to_s.inspect}"
|
714
|
+
puts "Type 'rsence help #{@cmd.to_s} for usage."
|
715
|
+
exit
|
716
|
+
end
|
717
|
+
end
|
718
|
+
if valid_env?(@args[:env_path])
|
719
|
+
conf_file = File.expand_path( File.join( @args[:env_path], 'conf', 'config.yaml' ) )
|
720
|
+
@args[:conf_files].push( conf_file ) unless @args[:conf_files].include?( conf_file )
|
721
|
+
else
|
722
|
+
puts "invalid environment."
|
723
|
+
exit
|
724
|
+
end
|
725
|
+
require 'conf/default'
|
726
|
+
config = Configuration.new(@args).config
|
727
|
+
port = config[:http_server][:port]
|
728
|
+
addr = config[:http_server][:bind_address]
|
729
|
+
port_status = test_port( port, addr )
|
730
|
+
if RSence.pid_support?
|
731
|
+
pid_fn = config[:daemon][:pid_fn]
|
732
|
+
if File.exists?( pid_fn )
|
733
|
+
pid = File.read( pid_fn ).to_i
|
734
|
+
pid_status = RSence::SIGComm.wait_signal_response(
|
735
|
+
pid, pid_fn, 'USR2', 3
|
736
|
+
)
|
737
|
+
else
|
738
|
+
puts "no PID file, unable to check process status" if @args[:verbose]
|
739
|
+
pid_status = nil
|
740
|
+
end
|
741
|
+
else
|
742
|
+
puts "no PID support, unable to check process status" if @args[:verbose]
|
743
|
+
pid_status = nil
|
744
|
+
end
|
745
|
+
if RSence.pid_support?
|
746
|
+
if pid_status == nil
|
747
|
+
puts "No process id, unable to check process status."
|
748
|
+
elsif pid_status == false
|
749
|
+
puts "No process running#{port_status ? ' but something responds on ' : ' and nothing responds on ' }#{addr}:#{port}."
|
750
|
+
else
|
751
|
+
puts "Process id #{pid} is running#{port_status ? ' and responds on ' : ', but does not respond on '}#{addr}:#{port}."
|
752
|
+
end
|
753
|
+
end
|
676
754
|
end
|
677
755
|
|
678
756
|
def help( cmd )
|
@@ -711,7 +789,7 @@ EOF
|
|
711
789
|
if cmd == :help
|
712
790
|
parse_help_argv
|
713
791
|
elsif cmd == :version
|
714
|
-
version
|
792
|
+
puts version
|
715
793
|
exit
|
716
794
|
elsif [:run,:start,:stop,:restart].include? cmd
|
717
795
|
parse_startup_argv
|
metadata
CHANGED
@@ -6,9 +6,9 @@ version: !ruby/object:Gem::Version
|
|
6
6
|
- 2
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
9
|
+
- 3
|
10
10
|
- pre
|
11
|
-
version: 2.0.0.
|
11
|
+
version: 2.0.0.3.pre
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Riassence Inc.
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-05-
|
19
|
+
date: 2010-05-09 00:00:00 +03:00
|
20
20
|
default_executable: rsence
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -27,8 +27,8 @@ dependencies:
|
|
27
27
|
- - "="
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
segments:
|
30
|
-
-
|
31
|
-
version: "
|
30
|
+
- 956
|
31
|
+
version: "956"
|
32
32
|
type: :runtime
|
33
33
|
version_requirements: *id001
|
34
34
|
description: |
|