dango 0.3.5 → 0.3.6

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.
@@ -11,29 +11,38 @@ require 'dango/server_framework'
11
11
  require RAILS_ROOT + '/config/environment'
12
12
 
13
13
  class ScriptDangoServer
14
- def initialize(config = {}, start_options = {})
15
- start_options.each do |k, v|
16
- k =~ /\-\-(\w+?):(\w+?)$/
17
- key1 = Regexp.last_match(1)
18
- key2 = Regexp.last_match(2)
19
- if key1 && key2
20
- config[key1][key2] = v
21
- end
22
- end
23
-
24
- # serverファイル名一覧を取得
25
- load_files = []
26
- glob_str = 'dango/server/*.rb'
27
- Dir.glob(glob_str) do |srv_file|
28
- load_files.push({:file=>srv_file, :mtime=>File.mtime(srv_file)})
29
- end
30
-
31
- # ファイル名順にソート
32
- load_files = load_files.sort_by{|f| f[:file] }
33
- load_files.each do |f|
34
- load f[:file]
35
- end
36
-
37
- DangoServer.start(config)
38
- end
14
+ def initialize(config = {}, start_options = {})
15
+ # コマンドラインオプションでconfigを上書きする
16
+ start_options.each do |k, v|
17
+ k =~ /\-\-(\w+?):(\w+?)$/
18
+ key1 = Regexp.last_match(1)
19
+ key2 = Regexp.last_match(2)
20
+
21
+ value = v.dup
22
+ value = true if v == 'true'
23
+ value = false if v == 'false'
24
+
25
+ if key1 && key2
26
+ config[key1][key2] = value
27
+ end
28
+ end
29
+
30
+ # daemonモードで起動 (nochdir=true)
31
+ Process.daemon(true) if config['server']['daemon']
32
+
33
+ # serverファイル名一覧を取得
34
+ load_files = []
35
+ glob_str = 'dango/server/*.rb'
36
+ Dir.glob(glob_str) do |srv_file|
37
+ load_files.push({:file=>srv_file, :mtime=>File.mtime(srv_file)})
38
+ end
39
+
40
+ # ファイル名順にソート
41
+ load_files = load_files.sort_by{|f| f[:file] }
42
+ load_files.each do |f|
43
+ load f[:file]
44
+ end
45
+
46
+ DangoServer.start(config)
47
+ end
39
48
  end
@@ -13,7 +13,7 @@ end
13
13
  # pid保存ファイルの読み出し
14
14
  def get_dango_pid()
15
15
  begin
16
- pid = open("tmp/pids/dango.pid", "rb"){|fh| fh.read }.to_i
16
+ pid = open("tmp/pids/dango.#{ENV['RAILS_ENV']}.pid", "rb"){|fh| fh.read }.to_i
17
17
  rescue
18
18
  pid = nil
19
19
  end
@@ -82,7 +82,8 @@ def stop_process(pid)
82
82
  end
83
83
 
84
84
  else ## i386-mswin32以外
85
- system("kill -9 #{pid}")
85
+ # system("kill -9 #{pid}")
86
+ system("kill #{pid}")
86
87
  end
87
88
  end
88
89
 
data/lib/dango/version.rb CHANGED
@@ -2,7 +2,7 @@ module Dango #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- TINY = 5
5
+ TINY = 6
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dango
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keisuke Minami
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-07-28 00:00:00 +09:00
12
+ date: 2008-07-29 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency