GemFile error + General Help?

Hello,

I’m a complete beginner in Ruby on Rails, so excuse me if this is a
ridiculous question. Just to bare in mind, I’m using Mac OSX (Snow
Leopard), Rails 3, and sqlite3 as a database. I’ve checked, and
everything is up to date (Rails, Ruby, Gems). I am simply creating a
test application, and I understand the way to run that is by running the
‘rails server’ command in Terminal. Unfortunately, that results in an
error message (in red) saying ‘Could not find gem ‘sqlite3 (>= 0,
runtime)’ in any of the gem sources listed in your Gemfile.’

Now I’ve checked if sqlite3 is listed in the GemFile, and it is. Here’s
what it says (this is just the first part of the GemFile, I didn’t want
to post the whole thing of course):

source ‘http://rubygems.org

gem ‘rails’, ‘3.0.4’

Bundle edge Rails instead:

gem ‘rails’, :git => ‘git://github.com/rails/rails.git’

gem ‘sqlite3’

Use unicorn as the web server

gem ‘unicorn’

It may have to do with my database.yml file, which is setup like this:

'# SQLite version 3.x

gem install sqlite3

development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000’

Is the default setup correct? If not, what would be an appropriate way
to set it up?

On a sidenote, if anyone knows how to get rid of MySQL (to start fresh)
on a mac, please let me know. I’m not sure where the default
installation is, and I would like to get rid of it.

Thanks,

From Jake

On 12 February 2011 21:10, Jake B. [email protected] wrote:

Now I’ve checked if sqlite3 is listed in the GemFile, and it is. Here’s
what it says (this is just the first part of the GemFile, I didn’t want
to post the whole thing of course):

Have you run
bundle install
If so what does it say about sqlite3 in Gemfile.lock?

Let me qualify the fact that I am still getting up to speed with
bundler, so take this advice with a grain of salt. I don’t know if this
is still necessary, but in my Gemfile I have:

gem ‘sqlite3-ruby’, :require => ‘sqlite3’

So the gem I’m using is sqlite3-ruby but the library is sqlite3.

If just running bundle install doesn’t work, you might try changing the
gemfile as above and then rerunning bundler (bundle install),

Best Wishes,
Peter

On 13 February 2011 00:04, Jake B. [email protected] wrote:

I have run bundle install, and that runs fine. The ‘rake db:create’
command also produces the same error.

To peter, if you had seen the attached GemFile, it does say additionally
that part as one of the gems. Apologies for not initially writing it.

But the one

gem ‘sqlite3-ruby’, :require => ‘sqlite3’

is commented out (it starts with #). I think Peter is probably right.
Remove the line
gem ‘sqlite3’
and uncomment the currently commented out one. Then run
bundle install
again.

Colin

I have run bundle install, and that runs fine. The ‘rake db:create’
command also produces the same error.

To peter, if you had seen the attached GemFile, it does say additionally
that part as one of the gems. Apologies for not initially writing it.

On 13 February 2011 16:26, Jake B. [email protected] wrote:

Nope, still no luck, same error, nothing new. :frowning:

Please don’t top post, it makes it difficult to follow the thread.
Insert your reply at appropriate places in previous message. Thanks

Paste you Gemfile and Gemfile.lock here please.

Colin

Nope, still no luck, same error, nothing new. :frowning:

Grrr…this is very frustrating.

As a side note question, should Gemfile.lock be added to the repository
and uploaded to the production server?

On 13 February 2011 16:35, Fernando P. [email protected] wrote:

As a side note question, should Gemfile.lock be added to the repository
and uploaded to the production server?

This would have been better as a new thread since it is nothing to do
with the OPs problem as far as I know.
You should run bundle install on the production server, so I suppose
the answer is no, though I have not used bundler on a production
server yet, so others may correct me.

Colin

On Feb 13, 2011, at 11:35 AM, Fernando P. wrote:

As a side note question, should Gemfile.lock be added to the repository
and uploaded to the production server?

Generally it’s not a good idea to include generated artifacts in a
repository, but I do check my gemfile.lock in for a number of reasons.

Firstly it’s good documentation as it shows clearly in the commit log
the gems, versions and dependencies (and you can easily see what new
dependencies are introduced with each gem which can be useful).

Also, my understanding is that in production mode, the --deployment flag
should be used, and that required a gemfile.lock to ensure your
production version is using the same versions that you tested in dev and
production.

Yehuda posted something on this:

The key is the third paragraph.

Best Wishes,
Peter

On 13 February 2011 17:03, Peter B. [email protected] wrote:


Yehuda posted something on this:

Excellent link, thanks for posting it. Highly recommended for anyone
not clear on what bundler and Gemfiles are all about.

Colin