Skip to content

Commit

Permalink
Merge pull request #468 from tdiary/server-logging-option
Browse files Browse the repository at this point in the history
tdiary serverコマンドにlogオプションを追加
  • Loading branch information
hsbt committed Jan 10, 2015
2 parents 0996913 + 2304f16 commit ea80bf7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 21 deletions.
10 changes: 0 additions & 10 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@ group :coffee do
gem 'therubyracer'
end

group :server do
platforms :mri do
gem 'thin'
end

platforms :jruby do
gem 'trinidad'
end
end

group :development do
gem 'pit', require: false
gem 'racksh', require: false
Expand Down
8 changes: 0 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ GEM
simplecov (>= 0.7)
term-ansicolor (= 1.2.2)
thor (= 0.18.1)
daemons (1.1.9)
debugger-linecache (1.2.0)
diff-lcs (1.2.5)
docile (1.1.5)
eventmachine (1.0.4)
execjs (2.2.2)
fastimage (1.6.6)
addressable (~> 2.3, >= 2.3.5)
Expand Down Expand Up @@ -112,10 +110,6 @@ GEM
therubyracer (0.12.1)
libv8 (~> 3.16.14.0)
ref
thin (1.6.3)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0)
rack (~> 1.0)
thor (0.18.1)
tilt (1.4.1)
tins (0.13.2)
Expand Down Expand Up @@ -149,5 +143,3 @@ DEPENDENCIES
sqlite3
test-unit
therubyracer
thin
trinidad
10 changes: 8 additions & 2 deletions lib/tdiary/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ def test
"bind to the IP"
method_option "port", aliases: "p", type: :numeric, default: 19292, banner:
"use PORT"
method_option "log", aliases: "l", type: :string, banner:
"File to redirect output"
def server
require 'tdiary'
require 'tdiary/environment'

if options[:cgi]
Expand All @@ -105,22 +108,25 @@ def server
:bind => options[:bind],
:port => options[:port],
:logger => $stderr,
:access_log => $stderr,
:access_log => options[:log] ? File.open(options[:log], 'a') : $stderr
}
TDiary::Server.run( opts )
elsif
# --rack option
# Rack::Server reads ARGV as :config, so delete it
require 'webrick'
ARGV.shift
opts = {
:environment => ENV['RACK_ENV'] || "development",
:daemonize => false,
:Host => options[:bind],
:Port => options[:port],
:pid => File.expand_path("tdiary.pid"),
:AccessLog => $stderr,
:config => File.expand_path("config.ru")
}
if options[:log]
opts[:AccessLog] = [[File.open(options[:log], 'a'), WEBrick::AccessLog::CLF]]
end
::Rack::Server.start( opts )
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/tdiary/tasks/release.rake
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def make_tarball( repo, version = nil )
sh "chmod +x index.rb index.fcgi update.rb update.fcgi"
sh 'rake doc'
Bundler.with_clean_env do
sh "bundle --path .bundle --without coffee:server:development:test"
sh "bundle --path .bundle --without coffee:development:test"
end

# reduce filesize
Expand Down

0 comments on commit ea80bf7

Please sign in to comment.