`gem_original_require': no such file to load

アプリケション起動時にエラーになる件の調査の続きをやる。
http://d.hatena.ne.jp/kurusaki/20080625/p2
の続き。

エラー内容

"3855"
=> Booting WEBrick...
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- /Users/kuru/01_Projects/saikaiproject/skp001/vendor/plugins/engines/lib/engines/deprecated_config_support (MissingSourceFile)
	from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
	from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
	from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in'
	from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
	from /Users/kuru/01_Projects/saikaiproject/skp001/config/environment.rb:13
	from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
	from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
	from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
	 ... 10 levels...
	from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
	from ./script/server:3
	from -e:2:in `load'
	from -e:2


enginesプラグインの設定が以前のバージョンのままになっているのが原因ではないかと思う。

エラーメッセージの下記の行を見るとenvironment.rbに問題があるようだ。

	from /Users/kuru/01_Projects/saikaiproject/skp001/config/environment.rb:13

environment.rbの内容

# Be sure to restart your web server when you modify this file.

# Uncomment below to force Rails into production mode when 
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'

# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.1.0' unless defined? RAILS_GEM_VERSION

# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
require File.join(RAILS_ROOT, "vendor", "plugins", "engines",
                    "lib", "engines", "deprecated_config_support")

Rails::Initializer.run do |config|
  # Settings in config/environments/* take precedence over those specified here
  
  # Skip frameworks you're not going to use (only works if using vendor/rails)
  # config.frameworks -= [ :action_web_service, :action_mailer ]

  # Only load the plugins named here, by default all plugins in vendor/plugins are loaded
  # config.plugins = %W( exception_notification ssl_requirement )
  config.plugins = ["engines", "*"]

  # Add additional load paths for your own custom dirs
  # config.load_paths += %W( #{RAILS_ROOT}/extras )

  # Force all environments to use the same logger level 
  # (by default production uses :info, the others :debug)
  # config.log_level = :debug

  # Use the database for sessions instead of the file system
  # (create the session table with 'rake db:sessions:create')
  # config.action_controller.session_store = :active_record_store

  # Use SQL instead of Active Record's schema dumper when creating the test database.
  # This is necessary if your schema can't be completely dumped by the schema dumper, 
  # like if you have constraints or database-specific column types
  # config.active_record.schema_format = :sql

  # Activate observers that should always be running
  # config.active_record.observers = :cacher, :garbage_collector

  # Make Active Record use UTC-base instead of local time
  # config.active_record.default_timezone = :utc
  
  # See Rails::Configuration for more options
end

# Add new inflection rules using the following format 
# (all these examples are active by default):
# Inflector.inflections do |inflect|
#   inflect.plural /^(ox)$/i, '\1en'
#   inflect.singular /^(ox)en/i, '\1'
#   inflect.irregular 'person', 'people'
#   inflect.uncountable %w( fish sheep )
# end

# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register "application/x-mobile", :mobile

# Include your application configuration below



module LoginEngine
  config :salt, "your-salt-here"
  config :use_email_notification, false
  config :user_table, "users"
  config :app_name, "atotok"
end

ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.update :default => "%Y/%m/%d %H:%M:%S"
environment.rbの下記の行が問題のようだ
require File.join(RAILS_ROOT, "vendor", "plugins", "engines",
                    "lib", "engines", "deprecated_config_support")

vendor/plugins/engines/README

READMEを見ると下記の記述がある。

Once you've installed the engines plugin, you'll need to add a single line to the top of config/environment.rb:

  require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')

environment.rbを修正する。

エラーになっていた行をコメントにし、READMEの記述のを追加する。

# Be sure to restart your web server when you modify this file.

# Uncomment below to force Rails into production mode when 
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'

# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.1.0' unless defined? RAILS_GEM_VERSION

# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
#require File.join(RAILS_ROOT, "vendor", "plugins", "engines",
#                    "lib", "engines", "deprecated_config_support")
require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')

Rails::Initializer.run do |config|
  # Settings in config/environments/* take precedence over those specified here
  
  # Skip frameworks you're not going to use (only works if using vendor/rails)
  # config.frameworks -= [ :action_web_service, :action_mailer ]

  # Only load the plugins named here, by default all plugins in vendor/plugins are loaded
  # config.plugins = %W( exception_notification ssl_requirement )
  config.plugins = ["engines", "*"]

  # Add additional load paths for your own custom dirs
  # config.load_paths += %W( #{RAILS_ROOT}/extras )

  # Force all environments to use the same logger level 
  # (by default production uses :info, the others :debug)
  # config.log_level = :debug

  # Use the database for sessions instead of the file system
  # (create the session table with 'rake db:sessions:create')
  # config.action_controller.session_store = :active_record_store

  # Use SQL instead of Active Record's schema dumper when creating the test database.
  # This is necessary if your schema can't be completely dumped by the schema dumper, 
  # like if you have constraints or database-specific column types
  # config.active_record.schema_format = :sql

  # Activate observers that should always be running
  # config.active_record.observers = :cacher, :garbage_collector

  # Make Active Record use UTC-base instead of local time
  # config.active_record.default_timezone = :utc
  
  # See Rails::Configuration for more options
end

# Add new inflection rules using the following format 
# (all these examples are active by default):
# Inflector.inflections do |inflect|
#   inflect.plural /^(ox)$/i, '\1en'
#   inflect.singular /^(ox)en/i, '\1'
#   inflect.irregular 'person', 'people'
#   inflect.uncountable %w( fish sheep )
# end

# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register "application/x-mobile", :mobile

# Include your application configuration below



module LoginEngine
  config :salt, "your-salt-here"
  config :use_email_notification, false
  config :user_table, "users"
  config :app_name, "atotok"
end

ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.update :default => "%Y/%m/%d %H:%M:%S"

起動してみる

状況は変わったが、まだエラーになる。

"3867"
=> Booting WEBrick...

      *******************************************************************
      * config.breakpoint_server has been deprecated and has no effect. *
      *******************************************************************
      
/Library/Ruby/Gems/1.8/gems/rails-2.1.0/lib/rails/plugin/loader.rb:145:in `ensure_all_registered_plugins_are_loaded!': Could not locate the following plugins: engines and * (LoadError)
	from /Library/Ruby/Gems/1.8/gems/rails-2.1.0/lib/rails/plugin/loader.rb:36:in `load_plugins'
	from /Library/Ruby/Gems/1.8/gems/rails-2.1.0/lib/initializer.rb:283:in `load_plugins'
	from /Library/Ruby/Gems/1.8/gems/rails-2.1.0/lib/initializer.rb:138:in `process'
	from /Library/Ruby/Gems/1.8/gems/rails-2.1.0/lib/initializer.rb:93:in `send'
	from /Library/Ruby/Gems/1.8/gems/rails-2.1.0/lib/initializer.rb:93:in `run'
	from /Users/kuru/01_Projects/saikaiproject/skp001/config/environment.rb:16
	from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
	from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
	 ... 11 levels...
	from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
	from ./script/server:3
	from -e:2:in `load'
	from -e:2


まだ、environment.rbに問題があるようだ。

	from /Users/kuru/01_Projects/saikaiproject/skp001/config/environment.rb:16

environment.rbを修正

下記の行を削除

  config.plugins = ["engines", "*"]
修正後のenvironment.rb
# Be sure to restart your web server when you modify this file.

# Uncomment below to force Rails into production mode when 
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'

# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.1.0' unless defined? RAILS_GEM_VERSION

# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
# 2008.7.2 修正
#require File.join(RAILS_ROOT, "vendor", "plugins", "engines",
#                    "lib", "engines", "deprecated_config_support")
require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')

Rails::Initializer.run do |config|
  # Settings in config/environments/* take precedence over those specified here
  
  # Skip frameworks you're not going to use (only works if using vendor/rails)
  # config.frameworks -= [ :action_web_service, :action_mailer ]

  # Only load the plugins named here, by default all plugins in vendor/plugins are loaded
  # config.plugins = %W( exception_notification ssl_requirement )
# 2008.7.2 コメントにした
#  config.plugins = ["engines", "*"]

  # Add additional load paths for your own custom dirs
  # config.load_paths += %W( #{RAILS_ROOT}/extras )

  # Force all environments to use the same logger level 
  # (by default production uses :info, the others :debug)
  # config.log_level = :debug

  # Use the database for sessions instead of the file system
  # (create the session table with 'rake db:sessions:create')
  # config.action_controller.session_store = :active_record_store

  # Use SQL instead of Active Record's schema dumper when creating the test database.
  # This is necessary if your schema can't be completely dumped by the schema dumper, 
  # like if you have constraints or database-specific column types
  # config.active_record.schema_format = :sql

  # Activate observers that should always be running
  # config.active_record.observers = :cacher, :garbage_collector

  # Make Active Record use UTC-base instead of local time
  # config.active_record.default_timezone = :utc
  
  # See Rails::Configuration for more options
end

# Add new inflection rules using the following format 
# (all these examples are active by default):
# Inflector.inflections do |inflect|
#   inflect.plural /^(ox)$/i, '\1en'
#   inflect.singular /^(ox)en/i, '\1'
#   inflect.irregular 'person', 'people'
#   inflect.uncountable %w( fish sheep )
# end

# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register "application/x-mobile", :mobile

# Include your application configuration below



module LoginEngine
  config :salt, "your-salt-here"
  config :use_email_notification, false
  config :user_table, "users"
  config :app_name, "atotok"
end

ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.update :default => "%Y/%m/%d %H:%M:%S"

アプリケーソンを起動してみる

状況が変わりエラーの内容が変わった。

"3876"
=> Booting WEBrick...

      *******************************************************************
      * config.breakpoint_server has been deprecated and has no effect. *
      *******************************************************************
      
/Users/kuru/01_Projects/saikaiproject/skp001/vendor/plugins/login_engine/lib/login_engine.rb:14: undefined method `config' for LoginEngine:Module (NoMethodError)
	from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
	from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
	from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
	from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in'
	from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
	from /Users/kuru/01_Projects/saikaiproject/skp001/app/controllers/application.rb:3
	from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:215:in `load_without_new_constant_marking'
	from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:215:in `load_file'
	 ... 34 levels...
	from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
	from ./script/server:3
	from -e:2:in `load'
	from -e:2
application.rbに問題がるのか?
	from /Users/kuru/01_Projects/saikaiproject/skp001/app/controllers/application.rb:3

application.rb

この時のapplication.rb

# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
require 'login_engine'

class ApplicationController < ActionController::Base
  include LoginEngine
    
  # Pick a unique cookie name to distinguish our session data from others'
  session :session_key => '_skp001_session_id'


end


下記の行でエラーになっているのでlogin_engineの設定がマズそうだ。

require 'login_engine'


今日はここまで
次はlogin_engineの設定を見直してみる。


ここが参考になりそう。
http://blog.memoja.com/?p=32