[Momonga-devel.ja:03401] rails-1.1.4-1m の /usr/bin/rails
- From: zunda <zunda616e@xxxxxxxxxxx>
- Date: Wed, 26 Jul 2006 14:59:32 +0900 (JST)
ご無沙汰しています。zundaです。
先日やっとMomonga 3βを入れて、railsを使いはじめたところです。
rails-1.1.4-1mでは、手元の環境では、例えば、下記のようにサーバー
が起動しません。
$ rails scheduler --database=sqlite3
$ cd scheduler
$ ruby script/server
./script/../config/boot.rb:18:in `require': no such file to load -- rubygems (LoadError)
from ./script/../config/boot.rb:18
from script/server:2
一方、下記のようにすると無事にサーバーが起動します。
$ rails --database=sqlite3 scheduler
/usr/bin/rails を見ると、アプリケーション名(というのでしょうか?上記の「schedule」
の部分)が必ずコマンドライン引数の最後に来ることが仮定されているようでした。
手元では、/usr/bin/rails (Momongaのレポジトリではrails.sh) を下記のよう
にすると、この問題を解決できました。
rails初心者としてはこのままcommitしてしまうのはためらわれます。
お手数ですが、動作の確認と、うまくいくようでしたらcommitを
お願いします > Railsの偉い人
---
#!/usr/bin/env ruby
require 'fileutils'
system_path = '/usr/share/rails'
orig_argv = ARGV.dup
# execute normal rails command
load(File.join(system_path, 'railties', 'bin', 'rails'))
# check if we want the symlink in vendor/
no_symlink_args = %w(-h --help -p --pretend -t --backtrace)
make_symlink = (orig_argv & no_symlink_args).empty?
# get the application root
rails_root = Rails::Generator::Base.instance('app', orig_argv).destination_root
vendor_dir = File.expand_path('vendor', rails_root)
# make the symlink if we want
if make_symlink && File.directory?(vendor_dir)
unless File.exist?(File.expand_path('rails', vendor_dir))
begin
FileUtils.ln_s(system_path, vendor_dir)
rescue => ex
$stderr.puts ex.message
end
end
end
--------------------------------------
Let's start Yahoo! Auction - Free Campaign Now!
http://pr.mail.yahoo.co.jp/auction/