From 12b6f0507cf5040183ea79cb65cd90c551c0ebae Mon Sep 17 00:00:00 2001 From: Rhenium Date: Tue, 28 Jan 2014 22:41:41 +0900 Subject: update formats to Rails 4.0.2 style --- Rakefile | 1 - bin/bundle | 3 +++ bin/rails | 4 ++++ bin/rake | 4 ++++ bin/start.rb | 8 ++++++++ config.ru | 2 ++ config/application.rb | 10 ++++++++-- config/environment.rb | 2 -- config/environments/development.rb | 17 +++-------------- config/environments/production.rb | 8 ++++---- config/environments/test.rb | 6 ++---- config/initializers/secret_token.rb.example | 2 +- config/initializers/session_store.rb | 5 +++-- script/rails | 6 ------ script/start.rb | 8 -------- start_receiver.sh | 2 +- 16 files changed, 43 insertions(+), 45 deletions(-) create mode 100755 bin/bundle create mode 100755 bin/rails create mode 100755 bin/rake create mode 100644 bin/start.rb delete mode 100755 script/rails delete mode 100644 script/start.rb diff --git a/Rakefile b/Rakefile index c2dad7b..e16fef9 100644 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,3 @@ -#!/usr/bin/env rake # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. diff --git a/bin/bundle b/bin/bundle new file mode 100755 index 0000000..66e9889 --- /dev/null +++ b/bin/bundle @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +load Gem.bin_path('bundler', 'bundle') diff --git a/bin/rails b/bin/rails new file mode 100755 index 0000000..728cd85 --- /dev/null +++ b/bin/rails @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +APP_PATH = File.expand_path('../../config/application', __FILE__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/bin/rake b/bin/rake new file mode 100755 index 0000000..1724048 --- /dev/null +++ b/bin/rake @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +require_relative '../config/boot' +require 'rake' +Rake.application.run diff --git a/bin/start.rb b/bin/start.rb new file mode 100644 index 0000000..98ede1f --- /dev/null +++ b/bin/start.rb @@ -0,0 +1,8 @@ +Aclog::Receiver::Worker.spawn!( + working_dir: Rails.root, + pid_file: Rails.root.join("tmp", "pids", "receiver.pid").to_s, + log_file: Rails.root.join("log", "receiver.log").to_s, + sync_log: true, + singleton: true +) + diff --git a/config.ru b/config.ru index ec5b397..97e236e 100644 --- a/config.ru +++ b/config.ru @@ -1,3 +1,5 @@ +# This file is used by Rack-based servers to start the application. + require ::File.expand_path('../config/environment', __FILE__) if Rails.env.production? diff --git a/config/application.rb b/config/application.rb index e13c899..980d6b4 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,10 +1,16 @@ require File.expand_path('../boot', __FILE__) -require 'rails/all' +# Pick the frameworks you want: +require "active_record/railtie" +require "action_controller/railtie" +require "action_mailer/railtie" +require "sprockets/railtie" +# require "rails/test_unit/railtie" +require "./lib/apidoc" + # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(:default, Rails.env) -require "./lib/apidoc" module Aclog class Application < Rails::Application diff --git a/config/environment.rb b/config/environment.rb index a7ed809..79f1d14 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -3,5 +3,3 @@ require File.expand_path('../application', __FILE__) # Initialize the rails application. Aclog::Application.initialize! - - diff --git a/config/environments/development.rb b/config/environments/development.rb index eeee0e9..e05367e 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -22,19 +22,8 @@ Aclog::Application.configure do # Raise an error on page load if there are pending migrations config.active_record.migration_error = :page_load - # Expands the lines which load the assets. + # Debug mode disables concatenation and preprocessing of assets. + # This option may cause significant delays in view rendering with a large + # number of complex assets. config.assets.debug = true - - # Ommit logging when serving assets. - config.assets.logger = false - Rails::Rack::Logger.class_eval do - def call_with_quiet_assets(env) - previous_level = Rails.logger.level - Rails.logger.level = Logger::ERROR if env['PATH_INFO'].index("/assets/") == 0 - call_without_quiet_assets(env).tap do - Rails.logger.level = previous_level - end - end - alias_method_chain :call, :quiet_assets - end end diff --git a/config/environments/production.rb b/config/environments/production.rb index fc529ba..f44aa56 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -20,14 +20,14 @@ Aclog::Application.configure do # config.action_dispatch.rack_cache = true # Disable Rails's static asset server (Apache or nginx will already do this). - config.serve_static_assets = true + config.serve_static_assets = false # Compress JavaScripts and CSS. - config.assets.js_compressor = :uglifier + config.assets.js_compressor = :uglifier # config.assets.css_compressor = :sass - # Whether to fallback to assets pipeline if a precompiled asset is missed. - config.assets.compile = true + # Do not fallback to assets pipeline if a precompiled asset is missed. + config.assets.compile = false # Generate digests for assets URLs. config.assets.digest = true diff --git a/config/environments/test.rb b/config/environments/test.rb index 83e386b..60f7f8a 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -5,7 +5,7 @@ Aclog::Application.configure do # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between test runs. Don't rely on the data there! - config.cache_classes = false + config.cache_classes = true # Do not eager load code on boot. This avoids loading your whole application # just for the purpose of running a single test. If you are using a tool that @@ -13,7 +13,7 @@ Aclog::Application.configure do config.eager_load = false # Configure static asset server for tests with Cache-Control for performance. - config.serve_static_assets = true + config.serve_static_assets = true config.static_cache_control = "public, max-age=3600" # Show full error reports and disable caching. @@ -33,6 +33,4 @@ Aclog::Application.configure do # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr - - config.cache_store = :null_store end diff --git a/config/initializers/secret_token.rb.example b/config/initializers/secret_token.rb.example index 89bd5ae..889d589 100644 --- a/config/initializers/secret_token.rb.example +++ b/config/initializers/secret_token.rb.example @@ -1,6 +1,6 @@ # Be sure to restart your server when you modify this file. -# Your secret key for verifying the integrity of signed cookies. +# Your secret key is used for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index ef9ddff..39510c5 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,2 +1,3 @@ -require 'action_dispatch/middleware/session/dalli_store' -Aclog::Application.config.session_store ActionDispatch::Session::CacheStore, :expire_after => 3.days +# Be sure to restart your server when you modify this file. + +Aclog::Application.config.session_store ActionDispatch::Session::CacheStore, expire_after: 3.days diff --git a/script/rails b/script/rails deleted file mode 100755 index f8da2cf..0000000 --- a/script/rails +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env ruby -# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. - -APP_PATH = File.expand_path('../../config/application', __FILE__) -require File.expand_path('../../config/boot', __FILE__) -require 'rails/commands' diff --git a/script/start.rb b/script/start.rb deleted file mode 100644 index 98ede1f..0000000 --- a/script/start.rb +++ /dev/null @@ -1,8 +0,0 @@ -Aclog::Receiver::Worker.spawn!( - working_dir: Rails.root, - pid_file: Rails.root.join("tmp", "pids", "receiver.pid").to_s, - log_file: Rails.root.join("log", "receiver.log").to_s, - sync_log: true, - singleton: true -) - diff --git a/start_receiver.sh b/start_receiver.sh index b312f8c..a4586ea 100755 --- a/start_receiver.sh +++ b/start_receiver.sh @@ -1,7 +1,7 @@ #!/bin/sh export RAILS_ENV=production -receiver="bundle exec rails runner script/start.rb" +receiver="bundle exec rails runner bin/start.rb" case "$1" in start) -- cgit v1.2.3