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 CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{codestock}
8
- s.version = "0.1.3"
8
+ s.version = "0.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["ongaeshi"]
@@ -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
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 3
9
- version: 0.1.3
8
+ - 4
9
+ version: 0.1.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - ongaeshi