jeremyevans / home_run

Fast Date/DateTime classes for ruby :: Unmaintained, unnecessary on ruby 1.9.3+
Other
465 stars 10 forks source link

Compatibility with Rails #4

Closed remigijusj closed 14 years ago

remigijusj commented 14 years ago

Using Rails 2.3.5, after installing the gem, Rails console and/or server fails to start (no modifications to codebase):

It seems that ActiveSupport still tries to load original date eventhough home_run's date is already loaded.

one case: http://gist.github.com/547360

another case on a windows machine:


C:\Web\same3>ruby script/console
Loading development environment (Rails 2.3.5)
C:/Ruby19/lib/ruby/1.9.1/date/format.rb:8: warning: already initialized constant MONTHS
C:/Ruby19/lib/ruby/1.9.1/date/format.rb:14: warning: already initialized constant DAYS
C:/Ruby19/lib/ruby/1.9.1/date/format.rb:19: warning: already initialized constant ABBR_MONTHS
C:/Ruby19/lib/ruby/1.9.1/date/format.rb:25: warning: already initialized constant ABBR_DAYS
C:/Ruby19/lib/ruby/1.9.1/date/format.rb:30: warning: already initialized constant ZONES
C:/Ruby19/lib/ruby/1.9.1/date.rb:236: warning: already initialized constant MONTHNAMES
C:/Ruby19/lib/ruby/1.9.1/date.rb:242: warning: already initialized constant DAYNAMES
C:/Ruby19/lib/ruby/1.9.1/date.rb:245: warning: already initialized constant ABBR_MONTHNAMES
C:/Ruby19/lib/ruby/1.9.1/date.rb:249: warning: already initialized constant ABBR_DAYNAMES
C:/Ruby19/lib/ruby/1.9.1/date.rb:301: warning: already initialized constant ITALY
C:/Ruby19/lib/ruby/1.9.1/date.rb:305: warning: already initialized constant ENGLAND
C:/Ruby19/lib/ruby/1.9.1/date.rb:309: warning: already initialized constant JULIAN
C:/Ruby19/lib/ruby/1.9.1/date.rb:313: warning: already initialized constant GREGORIAN
C:/Ruby19/lib/ruby/1.9.1/date.rb:1831:in `private_class_method': undefined method `today' for class `Class' (NameError)
        from C:/Ruby19/lib/ruby/1.9.1/date.rb:1831:in `'
        from C:/Ruby19/lib/ruby/1.9.1/date.rb:1817:in `'
        from C:/Ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/core_ext/date.rb:1:in `require'
        from C:/Ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/core_ext/date.rb:1:in `'
        from C:/Ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/core_ext.rb:8:in `require'
        from C:/Ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/core_ext.rb:8:in `block in '
        from C:/Ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/core_ext.rb:8:in `each'
        from C:/Ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/core_ext.rb:8:in `'
        from C:/Ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support.rb:55:in `require'
        from C:/Ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support.rb:55:in `'
        from C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record.rb:25:in `require'
        from C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record.rb:25:in `'
        from C:/Ruby19/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/initializer.rb:268:in `require'
        from C:/Ruby19/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/initializer.rb:268:in `block in require_frameworks'
        from C:/Ruby19/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/initializer.rb:268:in `each'
        from C:/Ruby19/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/initializer.rb:268:in `require_frameworks'
        from C:/Ruby19/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/initializer.rb:134:in `process'
        from C:/Ruby19/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
        from C:/Web/same3/config/environment.rb:11:in `'
        from C:/Ruby19/lib/ruby/1.9.1/irb/init.rb:264:in `require'
        from C:/Ruby19/lib/ruby/1.9.1/irb/init.rb:264:in `block in load_modules'
        from C:/Ruby19/lib/ruby/1.9.1/irb/init.rb:262:in `each'
        from C:/Ruby19/lib/ruby/1.9.1/irb/init.rb:262:in `load_modules'
        from C:/Ruby19/lib/ruby/1.9.1/irb/init.rb:20:in `setup'
        from C:/Ruby19/lib/ruby/1.9.1/irb.rb:53:in `start'
        from C:/Ruby19/bin/irb:12:in `
'
jeremyevans commented 14 years ago

Could you try both of the following and let me know the results with each:

home_run script/console # or home_run script/server

And

home_run --install
script/console # or script/server

I'm not sure why it would attempt to load the stdlib date.rb if you've already loaded home_run's version, unless something you are using is messing with the load path and $LOADED_FEATURES. I don't know all of the intricacies of loading/requiring on 1.9, though.

mmc1ntyre commented 14 years ago

Using rails 2.3.4 ... script/console and script/server do not work. It's not finding rubygems for some reason

Rails requires RubyGems >= . Please install RubyGems and try again: http://rubygems.rubyforge.org

jeremyevans commented 14 years ago

mmc1ntyer, is this using the gem or the master branch? Are you using the home_run command line to run script/console or script/server, or are you using home_run --install? Which version of ruby are you using?

mmc1ntyre commented 14 years ago

I was using the gem and home_run --install. And I was using ruby 1.8.6 (2008-03-03 patchlevel 114) [i686-darwin9.2.0]

jeremyevans commented 14 years ago

OK. Can you see if you get the same issues using:

home_run script/server

Also, does the problem only happen with rails, or does it happen outside of rails? For example, if you already used home_run --install, what happens when you do:

ruby -r date -e "p Date.today"

If you want to chat using IRC to try to work this out, I'm in #home_run on freenode.

mmc1ntyre commented 14 years ago

I get the same error for both tests:

/opt/local/lib/ruby/site_ruby/1.8/date.rb:5:in `require': no such file to load -- 1.8/date_ext (LoadError) from /opt/local/lib/ruby/site_ruby/1.8/date.rb:5

jeremyevans commented 14 years ago

Part of that is a bug where it thinks you're on Windows (which has since been fixed), but you should only be hitting it if you can't require 'date_ext'. Can you send me the output of:

home_run --uninstall
home_run --install
mmc1ntyre commented 14 years ago
sudo home_run --uninstall
Password:
/opt/local/lib/ruby/site_ruby/1.8/date.rb:5:in `require': no such file to load -1.8/date_ext (LoadError)
from /opt/local/lib/ruby/site_ruby/1.8/date.rb:5
from /opt/local/lib/ruby/1.8/yaml/rubytypes.rb:2:in `require'
from /opt/local/lib/ruby/1.8/yaml/rubytypes.rb:2
from /opt/local/lib/ruby/1.8/yaml.rb:392:in `require'
from /opt/local/lib/ruby/1.8/yaml.rb:392
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/config_file.rb:7:in `require'
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/config_file.rb:7
from /opt/local/lib/ruby/site_ruby/1.8/rubygems.rb:882:in `require'
from /opt/local/lib/ruby/site_ruby/1.8/rubygems.rb:882
from /opt/local/bin/home_run:9:in `require'
from /opt/local/bin/home_run:9

I get the same error if I try to install it again. Note: It did install when I originally ran the install.

jeremyevans commented 14 years ago

That's very odd. What's the output of:

find /opt/local/lib/ruby/site_ruby
mmc1ntyre commented 14 years ago
find /opt/local/lib/ruby/site_ruby
/opt/local/lib/ruby/site_ruby
/opt/local/lib/ruby/site_ruby/1.8
/opt/local/lib/ruby/site_ruby/1.8/capistrano
/opt/local/lib/ruby/site_ruby/1.8/capistrano/callback.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/cli
/opt/local/lib/ruby/site_ruby/1.8/capistrano/cli/execute.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/cli/help.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/cli/help.txt
/opt/local/lib/ruby/site_ruby/1.8/capistrano/cli/options.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/cli/ui.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/cli.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/command.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/configuration
/opt/local/lib/ruby/site_ruby/1.8/capistrano/configuration/actions
/opt/local/lib/ruby/site_ruby/1.8/capistrano/configuration/actions/file_transfer.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/configuration/actions/inspect.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/configuration/actions/invocation.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/configuration/callbacks.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/configuration/connections.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/configuration/execution.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/configuration/loading.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/configuration/namespaces.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/configuration/roles.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/configuration/servers.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/configuration/variables.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/configuration.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/errors.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/extensions.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/logger.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/processable.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/compat.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy/dependencies.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy/local_dependency.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy/remote_dependency.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy/scm
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy/scm/accurev.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy/scm/base.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy/scm/bzr.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy/scm/cvs.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy/scm/darcs.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy/scm/git.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy/scm/mercurial.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy/scm/none.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy/scm/perforce.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy/scm/subversion.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy/scm.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy/strategy
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy/strategy/base.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy/strategy/checkout.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy/strategy/copy.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy/strategy/export.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy/strategy/remote.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy/strategy/remote_cache.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy/strategy.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy/templates
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy/templats /maintenance.rhtml
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/deploy.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/standard.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/templates
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/templates/maintenance.rhtml
/opt/local/lib/ruby/site_ruby/1.8/capistrano/recipes/upgrade.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/role.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/server_definition.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/shell.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/ssh.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/task_definition.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/transfer.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano/version.rb
/opt/local/lib/ruby/site_ruby/1.8/capistrano.rb
/opt/local/lib/ruby/site_ruby/1.8/date
/opt/local/lib/ruby/site_ruby/1.8/date/format.rb
/opt/local/lib/ruby/site_ruby/1.8/date.rb
/opt/local/lib/ruby/site_ruby/1.8/i686-darwin9.2.0
/opt/local/lib/ruby/site_ruby/1.8/i686-darwin9.2.0/.turd_ruby
/opt/local/lib/ruby/site_ruby/1.8/i686-darwin9.2.0/date_ext.bundle
/opt/local/lib/ruby/site_ruby/1.8/rbconfig
/opt/local/lib/ruby/site_ruby/1.8/rbconfig/datadir.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems
/opt/local/lib/ruby/site_ruby/1.8/rubygems/builder.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/build_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/cert_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/check_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/cleanup_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/contents_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/dependency_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/environment_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/fetch_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/generate_index_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/help_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/list_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/lock_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/mirror_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/outdated_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/pristine_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/query_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/rdoc_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/search_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/server_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/sources_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/specification_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/stale_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/uninstall_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/unpack_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/update_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/which_command.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/config_file.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/defaults.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/dependency.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/dependency_list.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/digest
/opt/local/lib/ruby/site_ruby/1.8/rubygems/digest/digest_adapter.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/digest/md5.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/digest/sha1.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/digest/sha2.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/doc_manager.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/exceptions.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/ext
/opt/local/lib/ruby/site_ruby/1.8/rubygems/ext/builder.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/ext/configure_builder.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/ext/ext_conf_builder.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/ext/rake_builder.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/ext.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/format.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/gem_openssl.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/gem_path_searcher.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/indexer.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/install_update_options.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/installer.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/local_remote_options.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/old_format.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/package
/opt/local/lib/ruby/site_ruby/1.8/rubygems/package/f_sync_dir.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/package/tar_header.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/package/tar_output.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/package/tar_reader
/opt/local/lib/ruby/site_ruby/1.8/rubygems/package/tar_reader/entry.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/package/tar_reader.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/package/tar_writer.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/package.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/platform.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/require_paths_builder.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/requirement.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/rubygems_version.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/security.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/server.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/source_info_cache.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/source_info_cache_entry.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/specification.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/test_utilities.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/timer.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/uninstaller.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/user_interaction.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/validator.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/version.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/version_option.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems.rb
/opt/local/lib/ruby/site_ruby/1.8/ubygems.rb
/opt/local/lib/ruby/site_ruby/site-specific.rb
jeremyevans commented 14 years ago

Interesting. I see you have this file installed:

/opt/local/lib/ruby/site_ruby/1.8/i686-darwin9.2.0/date_ext.bundle

But I'm not sure why ruby isn't attempting to load it. Can you give me the output of:

ruby -e "p $:"

I thought Mac's used a .dylib extension for ruby extensions, but your machine uses a .bundle extension. The problem may be related to that, but I don't have any Mac experience, so I can't say for sure.

Can you give me the output of:

find /opt/local/lib/ruby/gems/1.8/gems/home_run*
mmc1ntyre commented 14 years ago
ruby -e "p $:"
["/opt/local/lib/ruby/site_ruby/1.8", "/opt/local/lib/ruby/site_ruby/1.8/i686-darwin9.2.0", "/opt/local/lib/ruby/site_ruby", "/opt/local/lib/ruby/vendor_ruby/1.8", "/opt/local/lib/ruby/vendor_ruby/1.8/i686-darwin9.2.0", "/opt/local/lib/ruby/vendor_ruby", "/opt/local/lib/ruby/1.8", "/opt/local/lib/ruby/1.8/i686-darwin9.2.0", "."]

And another long list....

find /opt/local/lib/ruby/gems/1.8/gems/home_run*

/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/.require_paths
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/bench
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/bench/cpu_bench.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/bench/dt_garbage_bench.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/bench/dt_mem_bench.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/bench/garbage_bench.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/bench/mem_bench.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/bin
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/bin/home_run
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/CHANGELOG
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/default.mspec
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/ext
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/ext/date
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/ext/date/format.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/ext/date.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/ext/date_ext.bundle
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/ext/date_ext.c
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/ext/date_ext.o
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/ext/date_parser.c
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/ext/date_parser.rl
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/ext/datetime.c
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/ext/extconf.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/ext/Makefile
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/LICENSE
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/Rakefile
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/README.rdoc
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/accessor_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/add_month_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/add_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/boat_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/civil_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/commercial_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/constants_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/conversions_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/day_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/downto_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/eql_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/format_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/gregorian_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/hash_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/julian_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/leap_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/minus_month_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/minus_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/next_prev_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/ordinal_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/parse_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/parsing_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/relationship_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/step_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/strftime_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/strptime_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/succ_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/today_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/date/upto_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/datetime
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/datetime/accessor_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/datetime/add_month_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/datetime/add_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/datetime/boat_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/datetime/constructor_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/datetime/conversions_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/datetime/day_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/datetime/downto_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/datetime/eql_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/datetime/format_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/datetime/hash_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/datetime/leap_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/datetime/minus_month_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/datetime/minus_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/datetime/next_prev_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/datetime/now_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/datetime/parse_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/datetime/parsing_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/datetime/relationship_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/datetime/step_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/datetime/strftime_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/datetime/strptime_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/datetime/succ_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/datetime/upto_spec.rb
/opt/local/lib/ruby/gems/1.8/gems/home_run-0.9.0/spec/spec_helper.rb
jeremyevans commented 14 years ago

I really don't get it. The file is in the load path, and it's the only compiled file created.

What's the result of:

ruby -e "load '/opt/local/lib/ruby/site_ruby/1.8/i686-darwin9.2.0/date_ext.bundle'; p Date.today"
mmc1ntyre commented 14 years ago

Syntax Error...wierd

ruby -e "load '/opt/local/lib/ruby/site_ruby/1.8/i686-darwin9.2.0/date_ext.bundle'; p Date.today"
-e:1:in `load': /opt/local/lib/ruby/site_ruby/1.8/i686-darwin9.2.0/date_ext.bundle:1:     Invalid char `\317' in expression (SyntaxError)
/opt/local/lib/ruby/site_ruby/1.8/i686-darwin9.2.0/date_ext.bundle:1: Invalid char `\372' in expression
/opt/local/lib/ruby/site_ruby/1.8/i686-darwin9.2.0/date_ext.bundle:1: Invalid char `\355' in expression
/opt/local/lib/ruby/site_ruby/1.8/i686-darwin9.2.0/date_ext.bundle:1: Invalid char `\376' in expression
/opt/local/lib/ruby/site_ruby/1.8/i686-darwin9.2.0/date_ext.bundle:1: Invalid char `\007' in expression from -e:1
jeremyevans commented 14 years ago

Very weird. Looks like it's trying to parse the .bundle file as a ruby file instead of as a native extension. I'll see if I can find a knowledgeable Mac user to help diagnose.

jeremyevans commented 14 years ago

Turns out you can't load C extensions with load, you can only require them. But that still doesn't explain why the require 'date_ext' is raising a LoadError, even though that directory is in the load_path.

jeremyevans commented 14 years ago

Since load doesn't work, could you try require:

ruby -e "require '/opt/local/lib/ruby/site_ruby/1.8/i686-darwin9.2.0/date_ext.bundle'; p Date.today"
mmc1ntyre commented 14 years ago

Hmmmm....this might be a problem with upgrading to from Tiger (32 bit) to Snow Leopard (64 bit). Thoughts?

ruby -e "require '/opt/local/lib/ruby/site_ruby/1.8/i686-darwin9.2.0/date_ext.bundle'; p Date.today"
/opt/local/lib/ruby/site_ruby/1.8/i686-darwin9.2.0/date_ext.bundle: dlopen(/opt/local/lib/ruby/site_ruby/1.8/i686-darwin9.2.0/date_ext.bundle, 9): no suitable image found.  Did find: (LoadError)
/opt/local/lib/ruby/site_ruby/1.8/i686-darwin9.2.0/date_ext.bundle: mach-o, but wrong architecture - /opt/local/lib/ruby/site_ruby/1.8/i686-darwin9.2.0/date_ext.bundle from -e:1
jeremyevans commented 14 years ago

Maybe try:

sudo env ARCHFLAGS="-arch i386 -arch x86_64" gem install home_run

Again, I know very little about Macs, but from what I've read that will compile both a 32-bit and a 64-bit version in the same bundle.

If that doesn't give an error, try requiring the .bundle file manually from the gem directory. If that works, manually remove the existing files from site_ruby and try "home_run --install" again.

remigijusj commented 14 years ago

I have traced my issues with Rails loading down to ruby-ole-1.2.10.1 gem, which is messing with DateTime.new to "make it faster". After disabling hacks in that gem, my apps started working.

Personally, i think this approach to overriding Date is too aggressive, because just installing the gem makes other things to break (because of incompatibilities). F.ex. if i have this gem installed, but not added as a dependency to Gemfile, my Rails app refuse to load. It would be nicer to load the overrides only after explicitly requiring 'home_run'.

jeremyevans commented 14 years ago

It shouldn't break anything just by installing the gem on 1.8. On 1.9, ruby adds all gem directories to the load path, so just installing it can break things. In this case, the ruby-ole library was doing things it probably shouldn't be doing, which caused it to break.

The problem with only loading the extension after requiring home_run is that you end up in situations where you have Date objects created before the require using the standard lib Date, and Date objects created after the require using home_run's Date. That may be even more problematic.

I recently added a home_run.rb file to allow usage like you are requesting, but for a different reason (to work on Heroku). However, because of the way 1.9 handles the load path, it won't work there. On 1.9, you'd have to clone the repository yourself (or install the gem, unpack it, and uninstall it), and only add the repository directory to the load path and require home_run in the applications you wanted to use it in. Note that if you are using rvm with gemsets, it's less of a problem, as you can install home_run only in the specific gemsets you need it in.

jeremyevans commented 14 years ago

Since it looks like the Rails issue cause has been found, and the unrelated Mac OS issue is either fixed or deserves it's own ticket, I'm closing this.

jeremyevans commented 14 years ago

I've added a known incompatibilities section to the README, to make it easier to keep track of other libraries known to be incompatible (http://github.com/jeremyevans/home_run/commit/9b020b8152f870c8646ffb3bc5205c3aa5ccc06c)

remigijusj commented 14 years ago

I have got no further problems, my Rails apps finally got some speed (heavily dependent on dates management). Thanks for quick response. Great job, btw :)