Skip to content

Commit

Permalink
Changing sqlite3-ruby to sqlite3. backporting 8f88a28 to 3-0-stable.
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Jan 18, 2011
1 parent 64c1cb3 commit 97d4766
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 14 deletions.
8 changes: 4 additions & 4 deletions railties/guides/source/initialization.textile
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Now with Rails 3 we have a Gemfile which defines the basics our application need
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3-ruby', :require => 'sqlite3'
gem 'sqlite3'

# Use unicorn as the web server
# gem 'unicorn'
Expand All @@ -119,7 +119,7 @@ Now with Rails 3 we have a Gemfile which defines the basics our application need
# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'

# Bundle gems for certain environments:
Expand All @@ -130,7 +130,7 @@ Now with Rails 3 we have a Gemfile which defines the basics our application need

</ruby>

Here the only two gems we need are +rails+ and +sqlite3-ruby+, so it seems. This is until you run +bundle pack+. This command freezes all the gems required by your application into _vendor/cache_. The gems installed by default are:
Here the only two gems we need are +rails+ and +sqlite3+, so it seems. This is until you run +bundle pack+. This command freezes all the gems required by your application into _vendor/cache_. The gems installed by default are:

* abstract-1.0.0.gem
* actionmailer-3.0.0.gem
Expand All @@ -155,7 +155,7 @@ Here the only two gems we need are +rails+ and +sqlite3-ruby+, so it seems. This
* rails-3.0.0.gem
* railties-3.0.0.gem
* rake-0.8.7.gem
* sqlite3-ruby-1.3.1.gem
* sqlite3-1.3.3.gem
* text-format-1.0.0.gem
* text-hyphen-1.0.0.gem
* thor-0.13.7.gem
Expand Down
8 changes: 1 addition & 7 deletions railties/lib/rails/generators/rails/app/app_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -398,19 +398,13 @@ def gem_for_database
case options[:database]
when "oracle" then "ruby-oci8"
when "postgresql" then "pg"
when "sqlite3" then "sqlite3-ruby"
when "sqlite3" then "sqlite3"
when "frontbase" then "ruby-frontbase"
when "mysql" then "mysql2"
else options[:database]
end
end

def require_for_database
case options[:database]
when "sqlite3" then "sqlite3"
end
end

def mysql_socket
@mysql_socket ||= [
"/tmp/mysql.sock", # default
Expand Down
2 changes: 1 addition & 1 deletion railties/lib/rails/generators/rails/app/templates/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ gem 'rails', '<%= Rails::VERSION::STRING %>'
<%- end -%>
<% unless options[:skip_active_record] -%>
gem '<%= gem_for_database %>'<% if require_for_database %>, :require => '<%= require_for_database %>'<% end %>
gem '<%= gem_for_database %>'
<% end -%>
# Use unicorn as the web server
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SQLite version 3.x
# gem install sqlite3-ruby (not necessary on OS X Leopard)
# gem install sqlite3
development:
adapter: sqlite3
database: db/development.sqlite3
Expand Down
2 changes: 1 addition & 1 deletion railties/test/generators/app_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def test_application_names_are_not_singularized
def test_config_database_is_added_by_default
run_generator
assert_file "config/database.yml", /sqlite3/
assert_file "Gemfile", /^gem\s+["']sqlite3-ruby["'],\s+:require\s+=>\s+["']sqlite3["']$/
assert_file "Gemfile", /^gem\s+["']sqlite3["']$/
end

def test_config_another_database
Expand Down

0 comments on commit 97d4766

Please sign in to comment.