Skip to content

Instantly share code, notes, and snippets.

@stan
Created October 12, 2011 06:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stan/1280458 to your computer and use it in GitHub Desktop.
Save stan/1280458 to your computer and use it in GitHub Desktop.
Differences between Rails 3.0.9 & Rails 3.1.1 generated apps (all in one)
Only in 3.1.1/blank/app: assets
Only in 3.1.1/blank/app/mailers: .gitkeep
Only in 3.1.1/blank/app/models: .gitkeep
diff -U 0 -r 3.0.9/blank/app/views/layouts/application.html.erb 3.1.1/blank/app/views/layouts/application.html.erb
--- 3.0.9/blank/app/views/layouts/application.html.erb 2011-10-12 15:17:34.853020000 +0900
+++ 3.1.1/blank/app/views/layouts/application.html.erb 2011-10-12 15:23:26.162309000 +0900
@@ -5,3 +5,3 @@
- <%= stylesheet_link_tag :all %>
- <%= javascript_include_tag :defaults %>
- <%= csrf_meta_tag %>
+ <%= stylesheet_link_tag "application" %>
+ <%= javascript_include_tag "application" %>
+ <%= csrf_meta_tags %>
diff -U 0 -r 3.0.9/blank/config/application.rb 3.1.1/blank/config/application.rb
--- 3.0.9/blank/config/application.rb 2011-10-12 15:17:34.886989000 +0900
+++ 3.1.1/blank/config/application.rb 2011-10-12 15:23:26.208260000 +0900
@@ -5,3 +5,6 @@
-# If you have a Gemfile, require the gems listed there, including any gems
-# you've limited to :test, :development, or :production.
-Bundler.require(:default, Rails.env) if defined?(Bundler)
+if defined?(Bundler)
+ # If you precompile assets before deploying to production, use this line
+ Bundler.require(*Rails.groups(:assets => %w(development test)))
+ # If you want your assets lazily compiled in production, use this line
+ # Bundler.require(:default, :assets, Rails.env)
+end
@@ -33,3 +35,0 @@
- # JavaScript files you want as :defaults (application.js is always included).
- # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
-
@@ -40,0 +41,6 @@
+
+ # Enable the asset pipeline
+ config.assets.enabled = true
+
+ # Version of your assets, change this if you want to expire all your assets
+ config.assets.version = '1.0'
diff -U 0 -r 3.0.9/blank/config/database.yml 3.1.1/blank/config/database.yml
--- 3.0.9/blank/config/database.yml 2011-10-12 15:17:34.947929000 +0900
+++ 3.1.1/blank/config/database.yml 2011-10-12 15:23:26.264203000 +0900
@@ -2,0 +3,3 @@
+#
+# Ensure the SQLite 3 gem is defined in your Gemfile
+# gem 'sqlite3'
diff -U 0 -r 3.0.9/blank/config/environments/development.rb 3.1.1/blank/config/environments/development.rb
--- 3.0.9/blank/config/environments/development.rb 2011-10-12 15:17:34.893985000 +0900
+++ 3.1.1/blank/config/environments/development.rb 2011-10-12 15:23:26.232235000 +0900
@@ -6 +6 @@
- # since you don't have to restart the webserver when you make code changes.
+ # since you don't have to restart the web server when you make code changes.
@@ -14 +13,0 @@
- config.action_view.debug_rjs = true
@@ -25 +23,0 @@
-end
@@ -26,0 +25,6 @@
+ # Do not compress assets
+ config.assets.compress = false
+
+ # Expands the lines which load the assets
+ config.assets.debug = true
+end
diff -U 0 -r 3.0.9/blank/config/environments/production.rb 3.1.1/blank/config/environments/production.rb
--- 3.0.9/blank/config/environments/production.rb 2011-10-12 15:17:34.896978000 +0900
+++ 3.1.1/blank/config/environments/production.rb 2011-10-12 15:23:26.234233000 +0900
@@ -4 +3,0 @@
- # The production environment is meant for finished, "live" apps.
@@ -12,2 +11,11 @@
- # Specifies the header that your server uses for sending files
- config.action_dispatch.x_sendfile_header = "X-Sendfile"
+ # Disable Rails's static asset server (Apache or nginx will already do this)
+ config.serve_static_assets = false
+
+ # Compress JavaScripts and CSS
+ config.assets.compress = true
+
+ # Don't fallback to assets pipeline if a precompiled asset is missed
+ config.assets.compile = false
+
+ # Generate digests for assets URLs
+ config.assets.digest = true
@@ -15,2 +23,2 @@
- # For nginx:
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
+ # Defaults to Rails.root.join("public/assets")
+ # config.assets.manifest = YOUR_PATH
@@ -18,2 +26,6 @@
- # If you have no front-end server that supports something like X-Sendfile,
- # just comment this out and Rails will serve the files
+ # 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
+
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
+ # config.force_ssl = true
@@ -30,5 +42 @@
- # Disable Rails's static asset server
- # In production, Apache or nginx will already do this
- config.serve_static_assets = false
-
- # Enable serving of images, stylesheets, and javascripts from an asset server
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
@@ -36,0 +45,3 @@
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
+ # config.assets.precompile += %w( search.js )
+
diff -U 0 -r 3.0.9/blank/config/environments/test.rb 3.1.1/blank/config/environments/test.rb
--- 3.0.9/blank/config/environments/test.rb 2011-10-12 15:17:34.899972000 +0900
+++ 3.1.1/blank/config/environments/test.rb 2011-10-12 15:23:26.237230000 +0900
@@ -10 +10,5 @@
- # Log error messages when you accidentally call methods on nil.
+ # Configure static asset server for tests with Cache-Control for performance
+ config.serve_static_assets = true
+ config.static_cache_control = "public, max-age=3600"
+
+ # Log error messages when you accidentally call methods on nil
diff -U 0 -r 3.0.9/blank/config/initializers/secret_token.rb 3.1.1/blank/config/initializers/secret_token.rb
--- 3.0.9/blank/config/initializers/secret_token.rb 2011-10-12 15:17:34.912960000 +0900
+++ 3.1.1/blank/config/initializers/secret_token.rb 2011-10-12 15:23:26.247220000 +0900
@@ -7 +7 @@
-Blank::Application.config.secret_token = 'e1b5a5e6bd0cf36653c6024b130fae2199a7e7667c006f1e8b332a32ac0432d31f2608f5d2f46d4a2c5ecd72d9a2bf8acd2807b34b41c7c6895ce13609d26cb6'
+Blank::Application.config.secret_token = '8bf71e3bbaa0e9aa793b482ddcd1cdd58d48aac3225e25c3a4593e7137ed8caeddd5880bca1d8146e6bb30171a5c93d3df411488164efbe3d916c2c34026bf2d'
diff -U 0 -r 3.0.9/blank/config/initializers/session_store.rb 3.1.1/blank/config/initializers/session_store.rb
--- 3.0.9/blank/config/initializers/session_store.rb 2011-10-12 15:17:34.914958000 +0900
+++ 3.1.1/blank/config/initializers/session_store.rb 2011-10-12 15:23:26.251215000 +0900
@@ -3 +3 @@
-Blank::Application.config.session_store :cookie_store, :key => '_blank_session'
+Blank::Application.config.session_store :cookie_store, key: '_blank_session'
Only in 3.1.1/blank/config/initializers: wrap_parameters.rb
diff -U 0 -r 3.0.9/blank/config/locales/en.yml 3.1.1/blank/config/locales/en.yml
--- 3.0.9/blank/config/locales/en.yml 2011-10-12 15:17:34.930948000 +0900
+++ 3.1.1/blank/config/locales/en.yml 2011-10-12 15:23:26.258215000 +0900
@@ -2 +2 @@
-# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
+# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
diff -U 0 -r 3.0.9/blank/config/routes.rb 3.1.1/blank/config/routes.rb
--- 3.0.9/blank/config/routes.rb 2011-10-12 15:17:34.857018000 +0900
+++ 3.1.1/blank/config/routes.rb 2011-10-12 15:23:26.205264000 +0900
@@ -51 +51 @@
- # root :to => "welcome#index"
+ # root :to => 'welcome#index'
diff -U 0 -r 3.0.9/blank/db/seeds.rb 3.1.1/blank/db/seeds.rb
--- 3.0.9/blank/db/seeds.rb 2011-10-12 15:17:34.953919000 +0900
+++ 3.1.1/blank/db/seeds.rb 2011-10-12 15:23:26.280192000 +0900
@@ -6,2 +6,2 @@
-# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
-# Mayor.create(:name => 'Daley', :city => cities.first)
+# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
+# Mayor.create(name: 'Emanuel', city: cities.first)
diff -U 0 -r 3.0.9/blank/Gemfile 3.1.1/blank/Gemfile
--- 3.0.9/blank/Gemfile 2011-10-12 15:17:34.832050000 +0900
+++ 3.1.1/blank/Gemfile 2011-10-12 15:23:26.115353000 +0900
@@ -3 +3 @@
-gem 'rails', '3.0.9'
+gem 'rails', '3.1.1'
@@ -6 +6 @@
-# gem 'rails', :git => 'git://github.com/rails/rails.git'
+# gem 'rails', :git => 'git://github.com/rails/rails.git'
@@ -9,0 +10,14 @@
+
+# Gems used only for assets and not required
+# in production environments by default.
+group :assets do
+ gem 'sass-rails', '~> 3.1.4'
+ gem 'coffee-rails', '~> 3.1.1'
+ gem 'uglifier', '>= 1.0.3'
+end
+
+gem 'jquery-rails'
+
+# To use ActiveModel has_secure_password
+# gem 'bcrypt-ruby', '~> 3.0.0'
+
@@ -16,2 +30 @@
-# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
-# gem 'ruby-debug'
+# To use debugger
@@ -20,12 +33,4 @@
-# Bundle the extra gems:
-# gem 'bj'
-# gem 'nokogiri'
-# gem 'sqlite3-ruby', :require => 'sqlite3'
-# gem 'aws-s3', :require => 'aws/s3'
-
-# Bundle gems for the local environment. Make sure to
-# put test-only gems in this group so their generators
-# and rake tasks are available in development mode:
-# group :development, :test do
-# gem 'webrat'
-# end
+group :test do
+ # Pretty printed test output
+ gem 'turn', :require => false
+end
diff -U 0 -r 3.0.9/blank/.gitignore 3.1.1/blank/.gitignore
--- 3.0.9/blank/.gitignore 2011-10-12 15:17:34.830043000 +0900
+++ 3.1.1/blank/.gitignore 2011-10-12 15:23:26.113358000 +0900
@@ -4,0 +5 @@
+.sass-cache/
Only in 3.1.1/blank/lib: assets
Only in 3.0.9/blank/log: development.log
Only in 3.1.1/blank/log: .gitkeep
Only in 3.0.9/blank/log: production.log
Only in 3.0.9/blank/log: server.log
Only in 3.0.9/blank/log: test.log
Only in 3.0.9/blank/public: images
diff -U 0 -r 3.0.9/blank/public/index.html 3.1.1/blank/public/index.html
--- 3.0.9/blank/public/index.html 2011-10-12 15:17:34.984894000 +0900
+++ 3.1.1/blank/public/index.html 2011-10-12 15:23:26.307193000 +0900
@@ -55 +54,0 @@
-
@@ -63 +62 @@
- background-image: url("images/rails.png");
+ background-image: url("/assets/rails.png");
@@ -170,0 +170,3 @@
+ .filename {
+ font-style: italic;
+ }
@@ -193,3 +194,0 @@
- <li><a href="http://api.rubyonrails.org/">Rails API</a></li>
- <li><a href="http://stdlib.rubyonrails.org/">Ruby standard library</a></li>
- <li><a href="http://corelib.rubyonrails.org/">Ruby core</a></li>
@@ -196,0 +196,3 @@
+ <li><a href="http://api.rubyonrails.org/">Rails API</a></li>
+ <li><a href="http://www.ruby-doc.org/core/">Ruby core</a></li>
+ <li><a href="http://www.ruby-doc.org/stdlib/">Ruby standard library</a></li>
@@ -224,2 +226,2 @@
- <h2>Set up a default route and remove or rename this file</h2>
- <p>Routes are set up in config/routes.rb.</p>
+ <h2>Set up a default route and remove <span class="filename">public/index.html</span></h2>
+ <p>Routes are set up in <span class="filename">config/routes.rb</span>.</p>
@@ -230 +232 @@
- <p>Run <code>rake db:migrate</code> to create your database. If you're not using SQLite (the default), edit <code>config/database.yml</code> with your username and password.</p>
+ <p>Run <code>rake db:create</code> to create your database. If you're not using SQLite (the default), edit <span class="filename">config/database.yml</span> with your username and password.</p>
Only in 3.0.9/blank/public: javascripts
Only in 3.0.9/blank/public: stylesheets
diff -U 0 -r 3.0.9/blank/Rakefile 3.1.1/blank/Rakefile
--- 3.0.9/blank/Rakefile 2011-10-12 15:17:34.825051000 +0900
+++ 3.1.1/blank/Rakefile 2011-10-12 15:23:26.109359000 +0900
@@ -0,0 +1 @@
+#!/usr/bin/env rake
@@ -5 +5,0 @@
-require 'rake'
diff -U 0 -r 3.0.9/blank/README 3.1.1/blank/README
--- 3.0.9/blank/README 2011-10-12 15:17:34.823049000 +0900
+++ 3.1.1/blank/README 2011-10-12 15:23:26.107360000 +0900
@@ -94 +94 @@
- @posts = Post.find(:all)
+ @posts = Post.all
@@ -142 +142 @@
-link:http://www.rubycentral.com/pickaxe/irb.html
+link:http://www.rubycentral.org/pickaxe/irb.html
@@ -158,0 +159,4 @@
+ | |-- assets
+ | |-- images
+ | |-- javascripts
+ | `-- stylesheets
@@ -175,3 +178,0 @@
- | |-- images
- | |-- javascripts
- | `-- stylesheets
@@ -190,0 +192,2 @@
+ |-- assets
+ `-- stylesheets
@@ -195,0 +199,3 @@
+app/assets
+ Contains subdirectories for images, stylesheets, and JavaScript files.
+
@@ -240,2 +246 @@
- The directory available for the web server. Contains subdirectories for
- images, stylesheets, and javascripts. Also contains the dispatchers and the
+ The directory available for the web server. Also contains the dispatchers and the
Only in 3.1.1/blank/test/fixtures: .gitkeep
Only in 3.1.1/blank/test/functional: .gitkeep
Only in 3.1.1/blank/test/integration: .gitkeep
diff -U 0 -r 3.0.9/blank/test/performance/browsing_test.rb 3.1.1/blank/test/performance/browsing_test.rb
--- 3.0.9/blank/test/performance/browsing_test.rb 2011-10-12 15:17:35.093778000 +0900
+++ 3.1.1/blank/test/performance/browsing_test.rb 2011-10-12 15:23:26.357192000 +0900
@@ -4 +3,0 @@
-# Profiling results for each test method are written to tmp/performance.
@@ -5,0 +5,4 @@
+ # Refer to the documentation for all available options
+ # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory]
+ # :output => 'tmp/performance', :formats => [:flat] }
+
Only in 3.1.1/blank/test/unit: .gitkeep
Only in 3.1.1/blank/tmp/cache: assets
Only in 3.0.9/blank/tmp: pids
Only in 3.0.9/blank/tmp: sessions
Only in 3.0.9/blank/tmp: sockets
Only in 3.1.1/blank/vendor: assets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment