aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2015-04-19 20:40:06 +0900
committerKazuki Yamaguchi <k@rhe.jp>2015-04-19 20:40:06 +0900
commitf99a3eb1d9f54c82397bc868162bcbe7bf598b3a (patch)
treef14f927de423a09df9249f22a046421d2fef0a4e
parentf37f0c563ddd36c1627e9e42ceab902b364099a4 (diff)
downloadaclog-f99a3eb1d9f54c82397bc868162bcbe7bf598b3a.tar.gz
sync settings with the output of `rails new` in Rails 4.2.1
-rw-r--r--Gemfile12
-rw-r--r--Gemfile.lock12
-rwxr-xr-xbin/rails2
-rwxr-xr-xbin/setup29
-rwxr-xr-xbin/spring11
-rw-r--r--config.ru2
-rw-r--r--config/application.rb10
-rw-r--r--config/environments/development.rb4
-rw-r--r--config/environments/production.rb29
-rw-r--r--config/environments/test.rb7
-rw-r--r--config/initializers/assets.rb1
-rw-r--r--config/initializers/cookies_serializer.rb2
-rw-r--r--config/initializers/session_store.rb2
13 files changed, 70 insertions, 53 deletions
diff --git a/Gemfile b/Gemfile
index a68f6c0..9ff2507 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,6 +1,6 @@
source "https://rubygems.org"
-gem "rails", "~> 4.2.0"
+gem "rails", "~> 4.2.1"
gem "activerecord-import"
gem "tzinfo-data"
gem "mysql2"
@@ -9,12 +9,12 @@ gem "yajl-ruby", require: "yajl"
gem "grape", "~> 0.9.0"
gem "grape-rabl"
gem "haml-rails"
-gem "sass-rails", "~> 5.0.0"
+gem "sass-rails", "~> 5.0"
+gem "coffee-rails"
gem "jbuilder"
gem "uglifier"
gem "jquery-rails"
gem "bootstrap-sass"
-gem "turbolinks"
gem "puma"
gem "dalli"
@@ -31,7 +31,7 @@ gem "pry-rails"
group :development, :test do
gem "thin"
gem "byebug"
- gem "web-console", "~> 2.0.0"
+ gem "web-console", "~> 2.0"
gem "spring"
gem "quiet_assets"
gem "oink"
@@ -47,7 +47,3 @@ group :test do
gem "coveralls", require: false
gem "simplecov", require: false
end
-
-group :doc do
- gem "yard"
-end
diff --git a/Gemfile.lock b/Gemfile.lock
index fef88f8..70ca0ed 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -313,8 +313,6 @@ GEM
timers (4.0.1)
hitimes
tins (0.13.2)
- turbolinks (2.5.3)
- coffee-rails
twitter (5.14.0)
addressable (~> 2.3)
buftok (~> 0.2.0)
@@ -352,7 +350,6 @@ GEM
addressable (>= 2.3.6)
crack (>= 0.3.2)
yajl-ruby (1.2.1)
- yard (0.8.7.6)
PLATFORMS
ruby
@@ -361,6 +358,7 @@ DEPENDENCIES
activerecord-import
bootstrap-sass
byebug
+ coffee-rails
connection_pool
coveralls
dalli
@@ -380,21 +378,19 @@ DEPENDENCIES
pry-rails
puma
quiet_assets
- rails (~> 4.2.0)
+ rails (~> 4.2.1)
rspec
rspec-rails
- sass-rails (~> 5.0.0)
+ sass-rails (~> 5.0)
settingslogic
simplecov
spring
spring-commands-rspec
thin
- turbolinks
twitter
twitter-text
tzinfo-data
uglifier
- web-console (~> 2.0.0)
+ web-console (~> 2.0)
webmock
yajl-ruby
- yard
diff --git a/bin/rails b/bin/rails
index 7feb6a3..4d608ed 100755
--- a/bin/rails
+++ b/bin/rails
@@ -3,6 +3,6 @@ begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
end
-APP_PATH = File.expand_path('../../config/application', __FILE__)
+APP_PATH = File.expand_path('../../config/application', __FILE__)
require_relative '../config/boot'
require 'rails/commands'
diff --git a/bin/setup b/bin/setup
new file mode 100755
index 0000000..acdb2c1
--- /dev/null
+++ b/bin/setup
@@ -0,0 +1,29 @@
+#!/usr/bin/env ruby
+require 'pathname'
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+Dir.chdir APP_ROOT do
+ # This script is a starting point to setup your application.
+ # Add necessary setup steps to this file:
+
+ puts "== Installing dependencies =="
+ system "gem install bundler --conservative"
+ system "bundle check || bundle install"
+
+ # puts "\n== Copying sample files =="
+ # unless File.exist?("config/database.yml")
+ # system "cp config/database.yml.sample config/database.yml"
+ # end
+
+ puts "\n== Preparing database =="
+ system "bin/rake db:setup"
+
+ puts "\n== Removing old logs and tempfiles =="
+ system "rm -f log/*"
+ system "rm -rf tmp/cache"
+
+ puts "\n== Restarting application server =="
+ system "touch tmp/restart.txt"
+end
diff --git a/bin/spring b/bin/spring
index 253ec37..7b45d37 100755
--- a/bin/spring
+++ b/bin/spring
@@ -1,17 +1,14 @@
#!/usr/bin/env ruby
-# This file loads spring without using Bundler, in order to be fast
-# It gets overwritten when you run the `spring binstub` command
+# This file loads spring without using Bundler, in order to be fast.
+# It gets overwritten when you run the `spring binstub` command.
unless defined?(Spring)
require "rubygems"
require "bundler"
- if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ spring \((.*?)\)$.*?^$/m)
- ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR)
- ENV["GEM_HOME"] = ""
- Gem.paths = ENV
-
+ if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)
+ Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq }
gem "spring", match[1]
require "spring/binstub"
end
diff --git a/config.ru b/config.ru
index 5bc2a61..bd83b25 100644
--- a/config.ru
+++ b/config.ru
@@ -1,4 +1,4 @@
# This file is used by Rack-based servers to start the application.
-require ::File.expand_path('../config/environment', __FILE__)
+require ::File.expand_path('../config/environment', __FILE__)
run Rails.application
diff --git a/config/application.rb b/config/application.rb
index fd8b6e8..388e12d 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -1,13 +1,14 @@
require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
+require "active_model/railtie"
+# require "active_job/railtie"
require "active_record/railtie"
require "action_controller/railtie"
+# require "action_mailer/railtie"
require "action_view/railtie"
-require "action_mailer/railtie"
-# require "active_job/railtie"
-# require "rails/test_unit/railtie"
require "sprockets/railtie"
+# require "rails/test_unit/railtie"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
@@ -35,6 +36,9 @@ module Aclog
config.i18n.default_locale = :ja
config.i18n.fallbacks = true
+ # Do not swallow errors in after_commit/after_rollback callbacks.
+ config.active_record.raise_in_transactional_callbacks = true
+
config.generators do |g|
g.test_framework :rspec
g.fixture_replacement :factory_girl
diff --git a/config/environments/development.rb b/config/environments/development.rb
index ddef61b..9b6375a 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -14,7 +14,7 @@ Rails.application.configure do
config.action_controller.perform_caching = false
# Don't care if the mailer can't send.
- config.action_mailer.raise_delivery_errors = false
+ # config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
@@ -27,7 +27,7 @@ Rails.application.configure do
# number of complex assets.
config.assets.debug = true
- # Asset digests allow you to set far-future HTTP expiration dates on all assets,
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 15df9eb..80f0ad3 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -16,11 +16,13 @@ Rails.application.configure do
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
- # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
+ # For large-scale production use, consider using a caching reverse proxy like
+ # NGINX, varnish or squid.
# config.action_dispatch.rack_cache = true
- # Disable Rails's static asset server (Apache or nginx will already do this).
- config.serve_static_assets = false
+ # Disable serving static files from the `/public` folder by default since
+ # Apache or NGINX already handles this.
+ config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
@@ -29,20 +31,21 @@ Rails.application.configure do
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
- # Asset digests allow you to set far-future HTTP expiration dates on all assets,
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# Specifies the header that your server uses for sending files.
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
- # Set to :debug to see everything in the log.
+ # Use the lowest log level to ensure availability of diagnostic information
+ # when problems arise.
config.log_level = :info
# Prepend all log lines with the following tags.
@@ -51,18 +54,11 @@ Rails.application.configure do
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
- # Do not log "Rendered */*.html.haml (25.0ms)"
- config.action_view.logger = nil
-
# Use a different cache store in production.
config.cache_store = :dalli_store, Settings.cache.memcached, { namespace: "aclog-web:", pool_size: 5 }
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
- # config.action_controller.asset_host = "http://assets.example.com"
-
- # Precompile additional assets.
- # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
- # config.assets.precompile += %w( search.js )
+ # config.action_controller.asset_host = 'http://assets.example.com'
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
@@ -75,9 +71,6 @@ Rails.application.configure do
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
- # Disable automatic flushing of the log to improve performance.
- # config.autoflush_log = false
-
# Use default logging formatter so that PID and timestamp are not suppressed.
# config.log_formatter = ::Logger::Formatter.new
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 053f5b6..1c19f08 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -12,8 +12,8 @@ Rails.application.configure do
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false
- # Configure static asset server for tests with Cache-Control for performance.
- config.serve_static_assets = true
+ # Configure static file server for tests with Cache-Control for performance.
+ config.serve_static_files = true
config.static_cache_control = 'public, max-age=3600'
# Show full error reports and disable caching.
@@ -31,6 +31,9 @@ Rails.application.configure do
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
+ # Randomize the order test cases are executed.
+ config.active_support.test_order = :random
+
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb
index 5b9129f..01ef3e6 100644
--- a/config/initializers/assets.rb
+++ b/config/initializers/assets.rb
@@ -9,4 +9,3 @@ Rails.application.config.assets.version = '1.0'
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile += %w( search.js )
-Rails.application.config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif *.eot *.woff *.ttf *.svg)
diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb
index 7a06a89..7f70458 100644
--- a/config/initializers/cookies_serializer.rb
+++ b/config/initializers/cookies_serializer.rb
@@ -1,3 +1,3 @@
# Be sure to restart your server when you modify this file.
-Rails.application.config.action_dispatch.cookies_serializer = :json \ No newline at end of file
+Rails.application.config.action_dispatch.cookies_serializer = :json
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index dd3097d..2a6c895 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -1,3 +1,3 @@
# Be sure to restart your server when you modify this file.
-Rails.application.config.session_store :cache_store, expire_after: 3.days
+Rails.application.config.session_store :cache_store