Eliminate MySQL dependency of Rails 5 stub server (#279)

* [rails] In order to set up the Ruby on Rails stub server easily, remove the dependency on MySQL

* [rails] Update sample codes of Ruby on Rails stub server
This commit is contained in:
shigeru.nakajima 2018-06-17 13:44:25 +09:00 committed by William Cheng
parent cb28ada0aa
commit 86a82d103e
5 changed files with 33 additions and 97 deletions

View File

@ -3,8 +3,8 @@ source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.0' gem 'rails', '~> 5.0.0'
# Use mysql as the database for Active Record # Use sqlite as the database for Active Record
gem 'mysql2', '>= 0.3.18', '< 0.5' gem 'sqlite3', '~> 1.3'
# Use Puma as the app server # Use Puma as the app server
gem 'puma', '~> 3.0' gem 'puma', '~> 3.0'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder

View File

@ -1,54 +1,22 @@
# MySQL. Versions 5.0 and up are supported. # SQLite version 3.x
# # gem install sqlite3-ruby (not necessary on OS X Leopard)
# Install the MySQL driver
# gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
# gem 'mysql2'
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.7/en/old-client.html
#
default: &default
adapter: mysql2
encoding: utf8
pool: 5
username: root
password:
socket: /tmp/mysql.sock
development: development:
<<: *default adapter: sqlite3
database: api_demo_development database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and # Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake". # re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production. # Do not set this db to the same as development or production.
test: test:
<<: *default adapter: sqlite3
database: api_demo_test database: db/test.sqlite3
pool: 5
timeout: 5000
# As with config/secrets.yml, you never want to store sensitive information,
# like your database password, in your source code. If your source code is
# ever seen by anyone, they now have access to your database.
#
# Instead, provide the password as a unix environment variable when you boot
# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
# for a full rundown on how to provide these environment variables in a
# production deployment.
#
# On Heroku and other platform providers, you may have a full connection URL
# available as an environment variable. For example:
#
# DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase"
#
# You can use this database configuration with:
#
# production:
# url: <%= ENV['DATABASE_URL'] %>
#
production: production:
<<: *default adapter: sqlite3
database: api_demo_production database: db/production.sqlite3
username: api_demo pool: 5
password: <%= ENV['API_DEMO_DATABASE_PASSWORD'] %> timeout: 5000

View File

@ -1 +1 @@
3.0.0-SNAPSHOT 3.0.1-SNAPSHOT

View File

@ -3,8 +3,8 @@ source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.0' gem 'rails', '~> 5.0.0'
# Use mysql as the database for Active Record # Use sqlite as the database for Active Record
gem 'mysql2', '>= 0.3.18', '< 0.5' gem 'sqlite3', '~> 1.3'
# Use Puma as the app server # Use Puma as the app server
gem 'puma', '~> 3.0' gem 'puma', '~> 3.0'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder

View File

@ -1,54 +1,22 @@
# MySQL. Versions 5.0 and up are supported. # SQLite version 3.x
# # gem install sqlite3-ruby (not necessary on OS X Leopard)
# Install the MySQL driver
# gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
# gem 'mysql2'
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.7/en/old-client.html
#
default: &default
adapter: mysql2
encoding: utf8
pool: 5
username: root
password:
socket: /tmp/mysql.sock
development: development:
<<: *default adapter: sqlite3
database: api_demo_development database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and # Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake". # re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production. # Do not set this db to the same as development or production.
test: test:
<<: *default adapter: sqlite3
database: api_demo_test database: db/test.sqlite3
pool: 5
timeout: 5000
# As with config/secrets.yml, you never want to store sensitive information,
# like your database password, in your source code. If your source code is
# ever seen by anyone, they now have access to your database.
#
# Instead, provide the password as a unix environment variable when you boot
# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
# for a full rundown on how to provide these environment variables in a
# production deployment.
#
# On Heroku and other platform providers, you may have a full connection URL
# available as an environment variable. For example:
#
# DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase"
#
# You can use this database configuration with:
#
# production:
# url: <%= ENV['DATABASE_URL'] %>
#
production: production:
<<: *default adapter: sqlite3
database: api_demo_production database: db/production.sqlite3
username: api_demo pool: 5
password: <%= ENV['API_DEMO_DATABASE_PASSWORD'] %> timeout: 5000