GAE/JRuby/Rails2でデモアプリ(2)
先日ブログに書いた方法(http://d.hatena.ne.jp/kurukuru-papa/20100220/1266661911)で、GAEのRailsアプリのスケルトンを作成しようとしましたが、作成スクリプトでエラーが発生して、作れなくなっていました。暫定対処方法をメモしておきます。
エラーメッセージは次のように出力(抜粋)されていました。スクリプト中で「appcfg.rb.bat bundle --update .」を実行したときに発生しています。
xxxxx/.gems/bundler_gems/jruby/1.8/gems/rails-2.3.5/lib/rails_generator/options.rb:32:in `default_options': undefined method `write_inheritable_attribute' for Rails::Generator::Base:Class (NoMethodError) C:/Program Files/ruby-1.8/lib/ruby/1.8/open-uri.rb:32:in `initialize': No such file or directory - config/boot_rb (Errno::ENOENT)
よくわからないのですが、スクリプト内でダウンロードしてきたGemfileにいくつかライブラリが足りないようです。そのため、ダウンロード後、ライブラリを追加してみることにしました。
(省略) # Install Rails 2.3.5 FileUtils.touch 'config.ru' #system "curl -s -o Gemfile #{FILE_BASE}Gemfile" download("#{FILE_BASE}Gemfile", "Gemfile") # --- 2010/02/28 追加 Start --- open("Gemfile_", "wb") do |dest| open("Gemfile") do |src| dest.write(src.read) end dest.puts("gem 'i18n'") dest.puts("gem 'tzinfo'") dest.puts("gem 'builder'") end FileUtils.rm 'Gemfile' FileUtils.mv 'Gemfile_', 'Gemfile' # --- 2010/02/28 追加 End --- system 'appcfg.rb.bat bundle --update .' (省略)
変更後スクリプトを実行してみると、正常にスケルトンを作成出来るようになりました。