I have a rails 2.3.8 app. I just installed RVM, and apparently things are working ok (I created a very simple rails project to check that rails and mysql were running ok).
I am now trying to create a Gemfile... but am facing a problem with Thinking-Sphinx. Here is the current version of my Gemfile:
source :rubygems
source "http://rubygems.org"
source :rubyforge
source "http://gems.rubyforge.org"
source :gemcutter
source "http://gemcutter.org"
gem 'SystemTimer', :platforms => :ruby_18
gem "rails", "2.3.5"
# make sure to run "bundle config build.mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config" in terminal before running "bundle install" as per documentation in http://gembundler.com/man/bundle-config.1.html
gem "mysql"
gem "tlsmail"
gem 'delayed_job'
gem 'will_paginate', '~> 2.3.11'
gem "chronic"
gem "nokogiri"
gem "sphinx", '0.9.10.2122'
gem 'thinking-sphinx', '< 2.0.0', :require => 'thinking_sphinx'
gem 'ts-delayed-delta', :require => 'thinking_sphinx/deltas/delayed_delta'
gem "mini_magick"
gem "faker"
gem "populator"
gem "rspec"
gem "geokit"
gem "geokit-rails"
And my Rakefile is:
require 'thread'
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'
require 'thinking_sphinx/tasks'
require 'thinking_sphinx/deltas/delayed_delta/tasks'
begin
gem 'delayed_job', '~>2.0.3'
require 'delayed/tasks'
rescue LoadError
STDERR.puts "Run `rake gems:install` to install delayed_job"
end
When I run
rake ts:config
I get the following error message:
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)
Sphinx cannot be found on your system. You may need to configure the following
settings in your config/sphinx.yml file:
* bin_path
* searchd_binary_name
* indexer_binary_name
For more information, read the documentation:
http://freelancing-god.github.com/ts/en/advanced_config.html
Generating Configuration to /Users/alex/Sites/myproject/config/development.sphinx.conf
rake aborted!
uninitialized constant ThinkingSphinx::Deltas::DelayedDelta
Tasks: TOP => ts:config => thinking_sphinx:configure
(See full trace by running task with --trace)
I've been trying different things for a couple hours but can't find how to solve the problem... would love some help!
Try bundle exec rake ts:config
This will use the version you specified in your Gemfile.
My advice is to not use RVM. It is a good idea, but poorly implemented. If you need multiple ruby versions like me it is far less of a hassle to just create aliases for each one.
RVM causes issues from time to time, using aliases never does.
Related
This is our Gemfile.
Is the line require mongo redundant since gem 'mongo' is already included?
If not, what is the purpose of require mongo?
We're on Rails 3.
Thanks!
source 'http://rubygems.org'
require 'rubygems'
require 'mongo'
gem 'rails', '3.0.6'
gem 'mongo'
gem 'mongo_mapper'
gem 'fastercsv'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
#gem 'sqlite3'
gem 'mysql'
gem 'whois'
You shouldn't put require statements in your Gemfile. This is also true for the require 'rubygems' on the line before.
What require does, is what it always does: load the gem. The Gemfile is loaded when you run bundle install. If you try to load a gem before bundle install has run, the gem might not be installed yet.
Gems specified in your Gemfile are required by Rails by default too, by the way.
I have an application where I segregated all my gem based on groups
source 'http://rubygems.org'
...
...
...
group :development, :test do
gem 'ruby-debug19', :require => 'ruby-debug'
gem 'web-app-theme', '>= 0.6.2'
gem 'faker'
gem 'mailcatcher'
gem "pry"
gem 'annotate'
gem "unicorn"
gem "capistrano"
end
The important Thing over here is ruby-debug19
now in my config/application.rb
I have defined
Bundler.require *Rails.groups(:assets => %w(development test))
Still when I start my server
rails server --debugger
it give me this below error
`require': no such file to load -- ruby-debug (LoadError)
I have remove the ruby-debug19 from development group and put it in default it the server works
I compared the both the Gemfile.lock in either case
cat Gemfile.lock > intial_lock (When ruby-debug19 is in development group)
ran
bundle list
cat Gemfile.lock > final_lock (When ruby-debug19 is in default group)
also did a
diff initial_lock final_lock
No difference indicating the file are same
I also tried with
Bundler.require(:default, :assets, Rails.env)
Still no success
Can anyone let me know why Bundler.require is not working the way it should have
Check if you have not fall into the .bundle directory trap in your application directory It happen when you any time run anytime bundle install with --without options
Straight from bundle Gemfile manual
After running bundle install --without test, bundler will remember
that you excluded the test group in the last installation. The next
time you run bundle install, without any --without option, bundler
will recall it.
just remove .bundle/config directory from your application directory please first check the content first before removing it
Hope this help
I'm making a simple task where I need to parse an XML Http response, all the http is working fine, and I have my xml string....
I'm trying to use the xml-simple gem.
I've gem install xml-simple
I've also added gem 'xml-simple' to the gemfile
Ran bundle install with success
but when I try to require 'xml-simple' in my rake task it fails saying no such file to load -- xml-simple...
What am I missing???
Bundler tries to load the gem by using the gem name as the require path (i.e. require 'xml-simple'). But in the case of the xml-simple gem, the path is xmlsimple, not xml-simple.
So in your Gemfile, use this instead:
gem 'xml-simple', :require => 'xmlsimple'
Gems sometimes have a different require path than the gem name, try either:
gem 'xml-simple', :require => 'xml/simple'
or
gem 'xml-simple', :require => 'xmlsimple'
or whatever the correct require path is to specify
I'm a beginner programmer and I'm trying to run the Rails Server through my command line. I type in "rails server" in my command line, and receive this error:
Could not find gem 'sqlite3-ruby (= 1.2.5, runtime)' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.
After receiving this error, I run 'bundle install'. Once I run 'bundle install', I type in "rails server" in my command line and receive the same error:
Could not find gem 'sqlite3-ruby (= 1.2.5, runtime)' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.
Here's a copy of my GemFile:
source 'http://rubygems.org'
gem 'rails', '3.0.9'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug'
# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
# gem 'webrat'
# end
Can someone help me get my rails server up and running? Thanks!
try deleting the "1.2.5" in your gemfile so the line looks like:
gem 'sqlite3-ruby', :require => 'sqlite3'
then run
bundle install
again
I think I once got this error a long time ago - it had something to do with having sqlite.dll in my bin or lib folder in my computer's ruby dir or something like that. I think Michael Hartl's tutorial mentions something about it.
Have you tried just
gem 'sqlite3'
You might also want to confirm that your gem is properly installed in your environment:
gem list
You can also get more information about a specific gem:
gem specification sqlite3-ruby
I am assuming that you have no issues with installing other gems - that is, you don't need to set up a http_proxy environment variable for bundle install.
I ran a bundle install on my Gemfile recently, and tried to rake:db:migrate. This migration didn't work, and outputs:
WARNING: Global access to Rake DSL methods is deprecated. Please include
... Rake::DSL into classes and modules which use the Rake DSL methods.
WARNING: DSL method SampleApp::Application#task called at /Users/joshuaballoch/.rvm/gems/ruby-1.9.2-p180#rails3tutorial3/gems/railties-3.0.3/lib/rails/application.rb:214:in `initialize_tasks'
I read on another post that I should uninstall 0.9.1, but for some reason some gem I have requires 0.9.1 after the uninstall, so I don't know how to fix this. Any suggestions?
FYI my gemfile is:
source 'http://rubygems.org'
gem 'rails', '3.0.3'
gem 'sqlite3-ruby', '1.3.2', :require => 'sqlite3'
gem 'gravatar_image_tag', '1.0.0.pre2'
gem 'will_paginate', '3.0.pre2'
group :development do
gem 'rspec-rails', '2.3.0'
gem 'annotate-models', '1.0.4'
gem 'faker', '0.3.1'
end
group :test do
gem 'rspec', '2.3.0'
gem 'webrat', '0.7.1'
gem 'factory_girl_rails', '1.0'
end
Have you tried running it like so: bundle exec rake db:migrate
the bundle exec command runs your request in the environment defined by the bundle, so if your global gems differ this may help.
If not, you can add gem "rake", "0.8.7" to your gemfile, bundle install then try again. Your other dependency should still be met as you aren't removing 0.9.1, just asking bundle exec to use a different version.
Rails 3.0.8 was released yesterday, and includes "Fixing Rake 0.9.x integration". Worth a try.