codestock 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/codestock.gemspec +1 -1
- data/lib/codestock/cdweb/cli_cdweb.rb +14 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/codestock.gemspec
CHANGED
@@ -3,6 +3,7 @@ require 'rubygems'
|
|
3
3
|
require 'rack'
|
4
4
|
require 'launchy'
|
5
5
|
require 'optparse'
|
6
|
+
require 'codestock/cdweb/lib/database'
|
6
7
|
|
7
8
|
module Rack
|
8
9
|
class Server
|
@@ -64,7 +65,8 @@ module CodeStock
|
|
64
65
|
:config => "config.ru",
|
65
66
|
# ----------------------------
|
66
67
|
:server => "thin",
|
67
|
-
:LaunchBrowser => true
|
68
|
+
:LaunchBrowser => true,
|
69
|
+
:DbDir => select_dbdir,
|
68
70
|
}
|
69
71
|
|
70
72
|
opts = OptionParser.new("#{File.basename($0)}")
|
@@ -74,11 +76,22 @@ module CodeStock
|
|
74
76
|
opts.on('-n', '--no-browser', 'No launch browser.') {|v| options[:LaunchBrowser] = false }
|
75
77
|
opts.parse!(argv)
|
76
78
|
|
79
|
+
# 使用するデータベースの位置設定
|
80
|
+
Database.setup(File.expand_path(options[:DbDir]))
|
81
|
+
|
77
82
|
# サーバースクリプトのある場所へ移動
|
78
83
|
FileUtils.cd(File.dirname(__FILE__))
|
79
84
|
|
80
85
|
# Rackサーバー起動
|
81
86
|
Rack::Server.start(options)
|
82
87
|
end
|
88
|
+
|
89
|
+
def self.select_dbdir
|
90
|
+
if (dbdir?('.') || !dbdir?(db_default_dir))
|
91
|
+
'.'
|
92
|
+
else
|
93
|
+
db_default_dir
|
94
|
+
end
|
95
|
+
end
|
83
96
|
end
|
84
97
|
end
|