Skip to content

Instantly share code, notes, and snippets.

@erebor
Created July 30, 2010 19:32
Show Gist options
  • Save erebor/501173 to your computer and use it in GitHub Desktop.
Save erebor/501173 to your computer and use it in GitHub Desktop.
The "Reporting Bugs" section asks for this info (since I don't have a test case or clear instructions how to reproduce in another app)
* Whether you have locked or not
I have not explicitly locked, because I'm currently using 1.0.0.rc.1, which says not to do that any more. But running 'bundle install' now creates a Gemfile.lock.
* What version of bundler you are using
Currently 1.0.0.rc.1, though the behavior is identical with 0.9.26.
* What version of Ruby you are using
Ruby 1.8.7p299.
* Whether you are using RVM, and if so what version
Yes, RVM version 1.41
* Your Gemfile
source :gemcutter
source "http://gems.github.com"
gem "rails", "2.3.5", :require => nil
gem "googlecharts", :require => "gchart"
gem "scruffy"
gem "ferret", "~>0.11.6"
gem "google-geocode", "~>1.2"
gem "gruff"
gem "sparklines"
gem "rubyzip", :require => "zip/zip"
gem "color"
gem "pdf-writer", :require => "pdf/writer"
gem "mysql"
gem "newrelic_rpm"
gem "xml-simple", :require => "xmlsimple"
gem "spreadsheet"
gem "phone_wrangler"
gem "fastercsv"
# Needed for "rake tmp:assets:clear" to work
gem "rcov"
group :development do
# bundler requires these gems in development
# gem 'rails-footnotes'
end
group :test do
# bundler requires these gems while running tests
gem 'rspec'
gem "ZenTest", :require => nil
gem "mocha", ">=0.9.8", :require => nil
gem "thoughtbot-shoulda", :require => "shoulda"
gem "shoulda-addons", :require => 'shoulda_addons'
gem "webrat"
gem "metric_fu", '1.3.0', :require => 'metric_fu'
end
group :delayed_job do
gem 'daemon-spawn'
end
* The command you ran to generate exception(s)
script/delayed_job, which is this:
---snip---
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'daemon-spawn'
class DelayedJobWorker < DaemonSpawn::Base
def start(args)
ENV['RAILS_ENV'] ||= args.first || 'production'
Dir.chdir RAILS_ROOT
require File.join('config', 'environment')
Delayed::Worker.new.start
end
def stop
system("kill `cat #{RAILS_ROOT}/tmp/pids/delayed_job.pid`")
end
end
DelayedJobWorker.spawn!(:log_file => File.join(RAILS_ROOT, "log", "delayed_job.log"),
:pid_file => File.join(RAILS_ROOT, 'tmp', 'pids', 'delayed_job.pid'),
:sync_log => true,
:working_dir => RAILS_ROOT)
---snip---
* The exception backtrace(s)
No backtrace, just this error:
script/delayed_job:4:in `require': no such file to load -- daemon-spawn (LoadError)
from script/delayed_job:4
Bundler has installed the gem, though, and knows where to find it:
$ bundle show daemon-spawn
/Users/rew/.rvm/gems/ruby-1.8.7-p299/gems/daemon-spawn-0.3.0
If you are using Rails 2.3, please also include:
* Your boot.rb file
# Don't change this file!
# Configure your app in config/environment.rb and config/environments/*.rb
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
module Rails
class << self
def boot!
unless booted?
preinitialize
pick_boot.run
end
end
def booted?
defined? Rails::Initializer
end
def pick_boot
(vendor_rails? ? VendorBoot : GemBoot).new
end
def vendor_rails?
File.exist?("#{RAILS_ROOT}/vendor/rails")
end
def preinitialize
load(preinitializer_path) if File.exist?(preinitializer_path)
end
def preinitializer_path
"#{RAILS_ROOT}/config/preinitializer.rb"
end
end
class Boot
def run
load_initializer
Rails::Initializer.run(:set_load_path)
end
end
class VendorBoot < Boot
def load_initializer
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
Rails::Initializer.run(:install_gem_spec_stubs)
Rails::GemDependency.add_frozen_gem_path
end
end
class GemBoot < Boot
def load_initializer
self.class.load_rubygems
load_rails_gem
require 'initializer'
end
def load_rails_gem
if version = self.class.gem_version
gem 'rails', version
else
gem 'rails'
end
rescue Gem::LoadError => load_error
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
exit 1
end
class << self
def rubygems_version
Gem::RubyGemsVersion rescue nil
end
def gem_version
if defined? RAILS_GEM_VERSION
RAILS_GEM_VERSION
elsif ENV.include?('RAILS_GEM_VERSION')
ENV['RAILS_GEM_VERSION']
else
parse_gem_version(read_environment_rb)
end
end
def load_rubygems
require 'rubygems'
min_version = '1.3.1'
unless rubygems_version >= min_version
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
exit 1
end
rescue LoadError
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
exit 1
end
def parse_gem_version(text)
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
end
private
def read_environment_rb
File.read("#{RAILS_ROOT}/config/environment.rb")
end
end
end
end
# http://gembundler.com/rails23.html
class Rails::Boot
def run
load_initializer
Rails::Initializer.class_eval do
def load_gems
@bundler_loaded ||= Bundler.require :default, Rails.env
end
end
Rails::Initializer.run(:set_load_path)
end
end
# All that for this:
Rails.boot!
* Your preinitializer.rb file
begin
require "rubygems"
require "bundler"
rescue LoadError
raise "Could not load the bundler gem. Install it with `gem install bundler`."
end
if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24")
raise RuntimeError, "Your bundler version (#{Gem::Version.new(Bundler::VERSION)}) is too old." +
"Run `gem install bundler` to upgrade."
end
begin
# Set up load paths for all bundled gems
ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)
Bundler.setup
rescue Bundler::GemNotFound
raise RuntimeError, "Bundler couldn't find some gems." +
"Did you run `bundle install`?"
end
* Your environment.rb file
# Be sure to restart your web server when you modify this file.
# Uncomment below to force Rails into production mode
# (Use only when you can't set environment variables through your web/app server)
# ENV['RAILS_ENV'] ||= 'production'
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
#Bundler.require_env RAILS_ENV
# H/T to Giles.
Rails::VendorGemSourceIndex.silence_spec_warnings = true
Rails::Initializer.run do |config|
# Skip frameworks you're not going to use
# config.frameworks -= [ :action_web_service, :action_mailer ]
# Add additional load paths for your own custom dirs
# config.load_paths += %W( #{RAILS_ROOT}/extras )
config.load_paths += %W( #{RAILS_ROOT}/extras/qb/lib )
# 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 create_sessions_table')
config.action_controller.session_store = :active_record_store
config.action_controller.session = { :session_key => "_cc_session", :secret => "i love chunky bacon yes i do, yes i do" }
# Enable page/fragment caching by setting a file-based store
# (remember to create the caching directory and make it readable to the application)
# config.action_controller.cache_store = :file_store, "#{RAILS_ROOT}/tmp/cache"
config.action_controller.cache_store = :mem_cache_store
Dir.mkdir "#{RAILS_ROOT}/tmp" rescue nil
Dir.mkdir "#{RAILS_ROOT}/tmp/cache" rescue nil
# Activate observers that should always be running
# Make Active Record use UTC-base instead of local time
config.active_record.default_timezone = :cst
# Use Active Record's schema dumper instead of SQL when creating the test database
# (enables use of different database adapters for development and test environments)
# config.active_record.schema_format = :ruby
config.after_initialize do
# bring in date validation code
require 'date_validator'
config.has_many_polymorphs_options['requirements'] << 'lib/date_validator'
end
require 'hodel_3000_compliant_logger'
config.logger = Hodel3000CompliantLogger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log", 5, 104857600)
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
ActiveSupport::Inflector.inflections do |inflect|
inflect.uncountable %w(office_equipment)
end
# Include your application configuration below
# bring in other extensions
require_dependency 'extensions.rb'
include PhoneWrangler
# wrap validation errors in a span instead of a div to avoid block
# display and nesting problems.
ActionView::Base.field_error_proc = lambda {|html, instance| "<span class=\"fieldWithErrors\">#{html}</span>"}
require 'acts_as_ferret'
require 'base64'
Mime::Type.register "image/png", :png
Mime::Type.register_alias "text/html", :print
# Don't kill jobs that fail out; re-running them might help.
Delayed::Job.destroy_failed_jobs = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment