Upgrade to Rails 4.2

* Update boilerplate with `bin/rake rails:upgrade`
* Use test instead of test:all rake task
* Change stylesheet extensions from .css.scss to .scss
* Update docs to use localhost instead of 0.0.0.0 because Rails 4.2
  no longer listens on all addresses by default.
This commit is contained in:
Dan Rice 2015-08-09 17:07:07 -04:00
parent 86bcc4d6c6
commit d7d86446c0
26 changed files with 161 additions and 101 deletions

View file

@ -1,8 +1,8 @@
source 'https://rubygems.org'
gem 'rails', '~>4.1.11'
gem 'sass-rails', '~>4.0'
gem 'coffee-rails', '~>4.0'
gem 'rails', '~> 4.2.6'
gem 'sass-rails', '~> 5.0'
gem 'coffee-rails', '~> 4.1.0'
#gem 'json'

View file

@ -3,38 +3,47 @@ GEM
specs:
RedCloth (4.2.9)
aasm (3.4.0)
actionmailer (4.1.14.1)
actionpack (= 4.1.14.1)
actionview (= 4.1.14.1)
actionmailer (4.2.6)
actionpack (= 4.2.6)
actionview (= 4.2.6)
activejob (= 4.2.6)
mail (~> 2.5, >= 2.5.4)
actionpack (4.1.14.1)
actionview (= 4.1.14.1)
activesupport (= 4.1.14.1)
rack (~> 1.5.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.6)
actionview (= 4.2.6)
activesupport (= 4.2.6)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionpack-xml_parser (1.0.1)
actionpack (>= 4.0.0.rc1)
actionview (4.1.14.1)
activesupport (= 4.1.14.1)
actionview (4.2.6)
activesupport (= 4.2.6)
builder (~> 3.1)
erubis (~> 2.7.0)
activemodel (4.1.14.1)
activesupport (= 4.1.14.1)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (4.2.6)
activesupport (= 4.2.6)
globalid (>= 0.3.0)
activemodel (4.2.6)
activesupport (= 4.2.6)
builder (~> 3.1)
activerecord (4.1.14.1)
activemodel (= 4.1.14.1)
activesupport (= 4.1.14.1)
arel (~> 5.0.0)
activerecord (4.2.6)
activemodel (= 4.2.6)
activesupport (= 4.2.6)
arel (~> 6.0)
activerecord-deprecated_finders (1.0.3)
activesupport (4.1.14.1)
i18n (~> 0.6, >= 0.6.9)
activesupport (4.2.6)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
acts_as_list (0.5.0)
activerecord (>= 3.0)
arel (5.0.1.20140414130214)
arel (6.0.3)
aruba (0.6.1)
childprocess (>= 0.3.6)
cucumber (>= 1.1.1)
@ -68,10 +77,11 @@ GEM
coffee-rails (4.1.0)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
coffee-script (2.3.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.8.0)
coffee-script-source (1.9.1.1)
concurrent-ruby (1.0.2)
crass (0.2.1)
cucumber (1.3.18)
builder (>= 2.1.2)
@ -102,7 +112,8 @@ GEM
sass (>= 3.2)
gherkin (2.12.2)
multi_json (~> 1.3)
hike (1.2.3)
globalid (0.3.6)
activesupport (>= 4.1.0)
htmlentities (4.3.3)
i18n (0.7.0)
jquery-rails (3.1.3)
@ -112,20 +123,22 @@ GEM
railties (>= 3.2.16)
json (1.8.3)
libv8 (3.16.14.7)
mail (2.6.3)
mime-types (>= 1.16, < 3)
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.4)
mime-types (>= 1.16, < 4)
metaclass (0.0.4)
method_source (0.8.2)
mime-types (2.99)
mime-types (2.99.2)
mimemagic (0.3.0)
mini_portile2 (2.0.0)
minitest (5.8.4)
minitest (5.9.0)
mocha (1.1.0)
metaclass (~> 0.0.1)
multi_json (1.11.2)
multi_test (0.1.1)
mysql2 (0.3.20)
nokogiri (1.6.7)
nokogiri (1.6.7.2)
mini_portile2 (~> 2.0.0.rc2)
nokogumbo (1.1.12)
nokogiri
@ -139,31 +152,40 @@ GEM
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
rack (1.5.5)
rack (1.6.4)
rack-dev-mark (0.7.3)
rack (>= 1.1)
rack-mini-profiler (0.9.2)
rack (>= 1.1.3)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.1.14.1)
actionmailer (= 4.1.14.1)
actionpack (= 4.1.14.1)
actionview (= 4.1.14.1)
activemodel (= 4.1.14.1)
activerecord (= 4.1.14.1)
activesupport (= 4.1.14.1)
rails (4.2.6)
actionmailer (= 4.2.6)
actionpack (= 4.2.6)
actionview (= 4.2.6)
activejob (= 4.2.6)
activemodel (= 4.2.6)
activerecord (= 4.2.6)
activesupport (= 4.2.6)
bundler (>= 1.3.0, < 2.0)
railties (= 4.1.14.1)
sprockets-rails (~> 2.0)
railties (= 4.2.6)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.7)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
rails_autolink (1.1.6)
rails (> 3.1)
railties (4.1.14.1)
actionpack (= 4.1.14.1)
activesupport (= 4.1.14.1)
railties (4.2.6)
actionpack (= 4.2.6)
activesupport (= 4.2.6)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.5.0)
rake (11.1.2)
ref (1.0.5)
rspec-expectations (3.1.2)
diff-lcs (>= 1.2.0, < 2.0)
@ -175,12 +197,13 @@ GEM
crass (~> 0.2.0)
nokogiri (>= 1.4.4)
nokogumbo (= 1.1.12)
sass (3.2.19)
sass-rails (4.0.4)
sass (3.4.22)
sass-rails (5.0.4)
railties (>= 4.0.0, < 5.0)
sass (~> 3.2.2)
sprockets (~> 2.8, < 2.12)
sprockets-rails (~> 2.0)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
selenium-webdriver (2.50.0)
childprocess (~> 0.5)
multi_json (~> 1.0)
@ -195,15 +218,13 @@ GEM
spring (1.1.3)
spring-commands-cucumber (1.0.1)
spring (>= 0.9.1)
sprockets (2.11.3)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.3.3)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
sprockets (3.6.0)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.0.4)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.10)
swf_fu (2.0.4)
coffee-script
@ -217,7 +238,7 @@ GEM
rack (~> 1.0)
thor (0.19.1)
thread_safe (0.3.5)
tilt (1.4.1)
tilt (2.0.4)
tolk (1.9.3)
rails (>= 4.0, < 4.3)
safe_yaml (>= 0.8.6)
@ -248,7 +269,7 @@ DEPENDENCIES
bullet
capybara
codeclimate-test-reporter
coffee-rails (~> 4.0)
coffee-rails (~> 4.1.0)
cucumber-rails
database_cleaner
factory_girl_rails
@ -262,11 +283,11 @@ DEPENDENCIES
pry
rack-dev-mark
rack-mini-profiler
rails (~> 4.1.11)
rails (~> 4.2.6)
rails_autolink
rspec-expectations
sanitize (>= 3.0.0)
sass-rails (~> 4.0)
sass-rails (~> 5.0)
selenium-webdriver (>= 2.50)
simplecov
spring
@ -281,4 +302,4 @@ DEPENDENCIES
yard
BUNDLED WITH
1.10.6
1.11.2

View file

@ -2,7 +2,7 @@
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.

View file

@ -3,7 +3,7 @@
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles

3
bin/bundle Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env ruby
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
load Gem.bin_path('bundler', 'bundle')

View file

@ -1,10 +1,4 @@
#!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
end
# 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__)
APP_PATH = File.expand_path('../../config/application', __FILE__)
require_relative '../config/boot'
require 'rails/commands'

View file

@ -1,7 +1,4 @@
#!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
end
require 'bundler/setup'
load Gem.bin_path('rake', 'rake')
require_relative '../config/boot'
require 'rake'
Rake.application.run

29
bin/setup Executable file
View file

@ -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

View file

@ -28,6 +28,9 @@ module Tracksapp
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
# Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true
# configure Tracks to handle deployment in a subdir
config.relative_url_root = SITE_CONFIG['subdir'] if SITE_CONFIG['subdir']

View file

@ -1,4 +1,3 @@
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
require 'bundler/setup' # Set up gems listed in the Gemfile.

View file

@ -27,6 +27,10 @@ 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,
# yet still be able to expire them through the digest params.
config.assets.digest = true
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.

View file

@ -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 = SITE_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? || SITE_CONFIG['serve_static_assets'] || false
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
@ -29,20 +31,22 @@ Rails.application.configure do
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Generate digests for assets URLs.
# 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.
config.log_level = :info
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :debug
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
@ -54,7 +58,7 @@ Rails.application.configure do
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = "http://assets.example.com"
# 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.
@ -67,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

View file

@ -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

View file

@ -3,6 +3,9 @@
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path
# Rails.application.config.assets.paths << Emoji.images_path
# 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( print.css mobile.css jquery-ui/datepicker-*.js )

View file

@ -0,0 +1,3 @@
# Be sure to restart your server when you modify this file.
Rails.application.config.action_dispatch.cookies_serializer = :marshal

View file

@ -2,7 +2,6 @@
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
Mime::Type.register_alias "text/html", :m
Mime::Type.register_alias "text/plain", :autocomplete

View file

@ -2,6 +2,7 @@
* Removed support for deprecated password-hashing algorithm. This
eliminates config.salt. Note the addition of a pre-upgrade step to
check for obsolete passwords.
* Rails 4.2
* Thin replaces WEBrick as the included web server
* Tracks is tested on Ruby 1.9.3, 2.0.0, 2.1, and 2.2.
* The MessageGateway will save the received email as an attachement to the todo

View file

@ -94,11 +94,11 @@ While still in the Terminal inside the Tracks root directory, issue the followin
bundle exec rails server -e production
If all goes well, you should see some text informing you that the server is running: `=> Rails application starting in production on http://0.0.0.0:3000`. If you are already running other services on port 3000, you need to select a different port when running the server, using the `-p` option.
If all goes well, you should see some text informing you that the server is running: `=> Rails application starting in production on http://localhost:3000`. If you are already running other services on port 3000, you need to select a different port when running the server, using the `-p` option.
## Visit Tracks in a browser
Visit `http://0.0.0.0:3000/signup` in a browser (or whatever URL and port was reported when you started the server in the step above) and chose a user name and password for admin user. Once logged in as admin, you can add other (ordinary level) users. If you need to access Tracks from a mobile/cellular phone browser, visit `http://yourdomain.com/mobile/`. This mobile version is a special, lightweight version of Tracks, designed to use on a mobile browser.
Visit `http://localhost:3000/signup` in a browser (or whatever URL and port was reported when you started the server in the step above) and chose a user name and password for admin user. Once logged in as admin, you can add other (ordinary level) users. If you need to access Tracks from a mobile/cellular phone browser, visit `http://yourdomain.com/mobile/`. This mobile version is a special, lightweight version of Tracks, designed to use on a mobile browser.
## Customise Tracks

View file

@ -37,7 +37,7 @@ require 'activeresource'
module Tracks
class Base < ActiveResource::Base
self.site = ENV["SITE"] || "http://username:password@0.0.0.0:3000/"
self.site = ENV["SITE"] || "http://username:password@localhost:3000/"
end
class Todo < Base

View file

@ -5,7 +5,7 @@ namespace :ci do
puts 'Running "lite" test suite'
[:environment, 'db:create', 'test:all'].each do |t|
[:environment, 'db:create', :test].each do |t|
Rake::Task[t].invoke
end
end