From fb595de457788e84b2587e54d9b1d2f68fcffac9 Mon Sep 17 00:00:00 2001 From: Taylor Griffin Date: Tue, 18 Nov 2014 22:24:58 +1100 Subject: [PATCH] edited configuration and dependencies --- Gemfile | 144 +++++++++++------------------ Gemfile.lock | 37 +------- config/application.rb | 4 +- config/environments/development.rb | 16 +++- config/environments/production.rb | 27 +++--- config/environments/staging.rb | 27 +++--- config/environments/test.rb | 9 +- spec/rails_helper.rb | 1 - spec/spec_helper.rb | 2 + 9 files changed, 110 insertions(+), 157 deletions(-) diff --git a/Gemfile b/Gemfile index 6a26ea327..5701d9bbc 100644 --- a/Gemfile +++ b/Gemfile @@ -1,103 +1,54 @@ source 'https://rubygems.org' -ruby "2.1.2" +ruby '2.1.2' + +gem 'rails', '4.1.7' -# gems for Rails 4 upgrade -gem 'rails4_upgrade' -gem 'actionpack-action_caching', '~>1.0.0' -gem 'actionpack-page_caching', '~>1.0.0' -gem 'actionpack-xml_parser', '~>1.0.0' -gem 'actionview-encoded_mail_to', '~>1.0.4' -gem 'activerecord-session_store', '~>0.0.1' -gem 'activeresource', '~>4.0.0.beta1' -# gem 'protected_attributes', '~>1.0.1' gem 'rails-observers', '~>0.1.1' -gem 'rails-perftest', '~>0.0.2' - -gem 'byebug' gem 'bundler', '>=1.1.5' -gem 'rails', '4.1.7' -# gem 'rack', '~>1.4.5' -# gem 'json', '~>1.7.7' -gem 'haml' -gem 'leaflet-rails' -gem 'leaflet-markercluster-rails' -gem 'unicorn' # http server - -gem 'pg' - -gem 'figaro' # for handling config via ENV variables - -gem 'cancancan', '~> 1.9' # for checking member privileges - -gem 'gibbon' # for Mailchimp newsletter subscriptions - -gem 'csv_shaper' # CSV export - -# vendored activemerchant for testing- needed for bogus paypal -# gateway monkeypatch -gem 'activemerchant', '1.33.0', - :path => 'vendor/gems/activemerchant-1.33.0', - :require => 'active_merchant' -gem 'active_utils', '1.0.5', - :path => 'vendor/gems/active_utils-1.0.5' - -group :production, :staging do - gem 'newrelic_rpm' - gem 'dalli' - gem 'memcachier' - gem 'rails_12factor' # supresses heroku plugin injection -end - -# CSS preprocessor, used for app/assets/stylesheets/application.css gem 'sass-rails', '~> 4.0.4' -# CoffeeScript is a Python-like language that compiles to JavaScript gem 'coffee-rails', '~> 4.1.0' - -# less-rails depends on a JavaScript engine; we use therubyracer. -# See https://github.com/sstephenson/execjs#readme for more supported runtimes -# long term, we'll probably want node.js for performance, but this will do -# for now as it's easier for new people to install -gem "therubyracer", "~> 0.12", :platforms => :ruby -# libv8 is needed by therubyracer and is a bit finicky -gem 'libv8', '3.16.14.3' +gem 'haml' # Another CSS preprocessor, used for Bootstrap overrides -gem "less", '~>2.5.0' -gem "less-rails", '~> 2.5.0' +gem 'less', '~>2.5.0' +gem 'less-rails', '~> 2.5.0' # CSS framework -gem "less-rails-bootstrap", '~> 3.2.0' +gem 'less-rails-bootstrap', '~> 3.2.0' -gem 'uglifier', '~> 2.5.3' # JavaScript compressor - -# gem 'compass-rails', '~> 1.0.3' # Yet Another CSS framework +gem 'uglifier', '~> 2.5.3' # JavaScript compressor gem 'jquery-rails' gem 'jquery-ui-rails', '~> 5.0.2' gem 'js-routes' # provides access to Rails routes in Javascript gem 'flickraw' -# To use ActiveModel has_secure_password -# gem 'bcrypt-ruby', '~> 3.0.0' +gem 'leaflet-rails' +gem 'leaflet-markercluster-rails' +gem 'unicorn' # http server +gem 'pg' +gem 'figaro' # for handling config via ENV variables +gem 'cancancan', '~> 1.9' # for checking member privileges +gem 'gibbon' # for Mailchimp newsletter subscriptions +gem 'csv_shaper' # CSV export -# To use Jbuilder templates for JSON -# gem 'jbuilder' +# vendored activemerchant for testing- needed for bogus paypal +# gateway monkeypatch +gem 'activemerchant', '1.33.0', + :path => 'vendor/gems/activemerchant-1.33.0', + :require => 'active_merchant' +gem 'active_utils', '1.0.5', + :path => 'vendor/gems/active_utils-1.0.5' -# Use unicorn as the app server -# gem 'unicorn' - -# To use debugger -group :development do - # A debugger and irb alternative. Pry doesn't play nice - # with unicorn, so start a Webrick server when debugging - # with Pry - gem 'pry' - gem 'better_errors' - gem 'binding_of_caller' - gem 'letter_opener' -end +# less-rails depends on a JavaScript engine; we use therubyracer. +# See https://github.com/sstephenson/execjs#readme for more supported runtimes +# long term, we'll probably want node.js for performance, but this will do +# for now as it's easier for new people to install +gem 'therubyracer', '~> 0.12', :platforms => :ruby +# libv8 is needed by therubyracer and is a bit finicky +gem 'libv8', '3.16.14.3' # Markdown formatting for updates etc gem 'bluecloth' @@ -129,16 +80,33 @@ gem 'omniauth-flickr', '>= 0.0.15' gem 'rake', '>= 10.0.0' +group :production, :staging do + gem 'newrelic_rpm' + gem 'dalli' + gem 'memcachier' + gem 'rails_12factor' # supresses heroku plugin injection +end + +group :development do + # A debugger and irb alternative. Pry doesn't play nice + # with unicorn, so start a Webrick server when debugging + # with Pry + gem 'pry' + gem 'better_errors' + gem 'binding_of_caller' + gem 'letter_opener' +end + group :development, :test do - gem 'haml-rails' # HTML templating language - gem 'rspec-rails', '~> 3.1.0' # unit testing framework + gem 'haml-rails' # HTML templating language + gem 'rspec-rails', '~> 3.1.0' # unit testing framework gem 'rspec-activemodel-mocks' gem 'database_cleaner', '~> 1.3.0' - gem 'webrat' # provides HTML matchers for view tests - gem 'factory_girl_rails', '~> 4.5.0' # for creating test data - gem 'coveralls', require: false # coverage analysis - gem 'capybara' # integration tests - gem 'capybara-email' # integration tests for email - gem 'poltergeist', '~> 1.5.1' # for headless JS testing - gem 'i18n-tasks' # adds tests for finding missing and unused translations + gem 'webrat' # provides HTML matchers for view tests + gem 'factory_girl_rails', '~> 4.5.0' # for creating test data + gem 'coveralls', require: false # coverage analysis + gem 'capybara' # integration tests + gem 'capybara-email' # integration tests for email + gem 'poltergeist', '~> 1.5.1' # for headless JS testing + gem 'i18n-tasks' # adds tests for finding missing and unused translations end diff --git a/Gemfile.lock b/Gemfile.lock index cbf90269d..cd1ae9ba1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -29,18 +29,10 @@ GEM activesupport (= 4.1.7) rack (~> 1.5.2) rack-test (~> 0.6.2) - actionpack-action_caching (1.0.0) - actionpack (>= 4.0.0.beta, < 5.0) - actionpack-page_caching (1.0.2) - actionpack (>= 4.0.0, < 5) - actionpack-xml_parser (1.0.1) - actionpack (>= 4.0.0.rc1) actionview (4.1.7) activesupport (= 4.1.7) builder (~> 3.1) erubis (~> 2.7.0) - actionview-encoded_mail_to (1.0.5) - rails activemodel (4.1.7) activesupport (= 4.1.7) builder (~> 3.1) @@ -48,14 +40,6 @@ GEM activemodel (= 4.1.7) activesupport (= 4.1.7) arel (~> 5.0.0) - activerecord-session_store (0.0.1) - actionpack (>= 4.0.0.beta, < 5) - activerecord (>= 4.0.0.beta, < 5) - railties (>= 4.0.0.beta, < 5) - activeresource (4.0.0.beta1) - activemodel (>= 4.0.0.beta1) - activesupport (>= 4.0.0.beta1) - rails-observers (~> 0.1.1) activesupport (4.1.7) i18n (~> 0.6, >= 0.6.9) json (~> 1.7, >= 1.7.7) @@ -75,10 +59,6 @@ GEM bootstrap-datepicker-rails (1.3.0.2) railties (>= 3.0) builder (3.2.2) - byebug (3.5.1) - columnize (~> 0.8) - debugger-linecache (~> 1.2) - slop (~> 3.6) cancancan (1.9.2) capybara (2.4.4) mime-types (>= 1.16) @@ -98,7 +78,6 @@ GEM coffee-script-source execjs coffee-script-source (1.8.0) - columnize (0.8.9) commonjs (0.2.7) coveralls (0.7.1) multi_json (~> 1.3) @@ -111,7 +90,6 @@ GEM dalli (2.7.2) database_cleaner (1.3.0) debug_inspector (0.0.2) - debugger-linecache (1.2.0) devise (3.4.1) bcrypt (~> 3.0) orm_adapter (~> 0.1) @@ -201,7 +179,7 @@ GEM multi_json (1.10.1) multi_xml (0.5.5) netrc (0.8.0) - newrelic_rpm (3.9.6.257) + newrelic_rpm (3.9.7.266) nokogiri (1.6.4.1) mini_portile (~> 0.6.0) oauth (0.4.7) @@ -242,10 +220,6 @@ GEM sprockets-rails (~> 2.0) rails-observers (0.1.2) activemodel (~> 4.0) - rails-perftest (0.0.5) - rails4_upgrade (0.5.0) - bundler (>= 1.2.2) - terminal-table (>= 1.4.5) rails_12factor (0.0.3) rails_serve_static_assets rails_stdout_logging @@ -340,20 +314,13 @@ PLATFORMS ruby DEPENDENCIES - actionpack-action_caching (~> 1.0.0) - actionpack-page_caching (~> 1.0.0) - actionpack-xml_parser (~> 1.0.0) - actionview-encoded_mail_to (~> 1.0.4) active_utils (= 1.0.5)! activemerchant (= 1.33.0)! - activerecord-session_store (~> 0.0.1) - activeresource (~> 4.0.0.beta1) better_errors binding_of_caller bluecloth bootstrap-datepicker-rails bundler (>= 1.1.5) - byebug cancancan (~> 1.9) capybara capybara-email @@ -393,8 +360,6 @@ DEPENDENCIES pry rails (= 4.1.7) rails-observers (~> 0.1.1) - rails-perftest (~> 0.0.2) - rails4_upgrade rails_12factor rake (>= 10.0.0) rspec-activemodel-mocks diff --git a/config/application.rb b/config/application.rb index d9b29247c..113d0bc66 100644 --- a/config/application.rb +++ b/config/application.rb @@ -26,13 +26,13 @@ module Growstuff # Activate observers that should always be running. # config.active_record.observers = :cacher, :garbage_collector, :forum_observer + I18n.config.enforce_available_locales = true + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. config.time_zone = 'UTC' config.active_record.default_timezone = :local - config.i18n.enforce_available_locales = true - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. I18n.load_path += Dir[Rails.root.join('config', 'locales', '*.{rb,yml}')] I18n.default_locale = :en diff --git a/config/environments/development.rb b/config/environments/development.rb index ba15889c5..45d7b96bf 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,6 +1,7 @@ Growstuff::Application.configure do # Settings specified here will take precedence over those in config/application.rb + # Do not eager load code on boot. config.eager_load = false # In the development environment your application's code is reloaded on @@ -24,15 +25,24 @@ Growstuff::Application.configure do # Only use best-standards-support built into browsers config.action_dispatch.best_standards_support = :builtin - # Raise exception on mass assignment protection for Active Record models - # config.active_record.mass_assignment_sanitizer = :strict - # Do not compress assets config.assets.compress = false # Expands the lines which load the 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. + config.assets.raise_runtime_errors = true + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true + # Growstuff config config.new_crops_request_link = "http://example.com/not-a-real-url" config.action_mailer.default_url_options = { :host => 'localhost:8080' } diff --git a/config/environments/production.rb b/config/environments/production.rb index e2b6d5735..523418b32 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,6 +1,10 @@ Growstuff::Application.configure do # Settings specified here will take precedence over those in config/application.rb + # Eager load code on boot. This eager loads most of Rails and + # your application in memory, allowing both threaded web servers + # and those relying on copy on write to perform better. + # Rake tasks automatically ignore this option for performance. config.eager_load = true # Code is not reloaded between requests @@ -13,8 +17,9 @@ Growstuff::Application.configure do # 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 + # Compress JavaScripts and CSS. + config.assets.js_compressor = :uglifier + config.assets.css_compressor = :sass # Don't fallback to assets pipeline if a precompiled asset is missed config.assets.compile = true @@ -22,9 +27,6 @@ Growstuff::Application.configure do # Generate digests for assets URLs config.assets.digest = true - # Defaults to nil and saved in location specified by config.assets.prefix - # config.assets.manifest = YOUR_PATH - # 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 @@ -47,15 +49,10 @@ Growstuff::Application.configure do # 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 are already added) - # config.assets.precompile += %w( search.js ) - - # Disable delivery errors, bad email addresses will be ignored + # 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. # config.action_mailer.raise_delivery_errors = false - # Enable threaded mode - # config.threadsafe! - # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation can not be found) config.i18n.fallbacks = true @@ -63,6 +60,12 @@ Growstuff::Application.configure do # Send deprecation notices to registered listeners config.active_support.deprecation = :notify + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + + # Do not dump schema after migrations. + config.active_record.dump_schema_after_migration = false + # Growstuff configuration config.new_crops_request_link = "http://growstuff.org/posts/skud-20130319-requests-for-new-crops" config.action_mailer.default_url_options = { :host => 'growstuff.org' } diff --git a/config/environments/staging.rb b/config/environments/staging.rb index fda2929ef..a40a82dfd 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -1,6 +1,10 @@ Growstuff::Application.configure do # Settings specified here will take precedence over those in config/application.rb + # Eager load code on boot. This eager loads most of Rails and + # your application in memory, allowing both threaded web servers + # and those relying on copy on write to perform better. + # Rake tasks automatically ignore this option for performance. config.eager_load = true # Code is not reloaded between requests @@ -13,8 +17,9 @@ Growstuff::Application.configure do # 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 + # Compress JavaScripts and CSS. + config.assets.js_compressor = :uglifier + config.assets.css_compressor = :sass # Don't fallback to assets pipeline if a precompiled asset is missed config.assets.compile = true @@ -22,9 +27,6 @@ Growstuff::Application.configure do # Generate digests for assets URLs config.assets.digest = true - # Defaults to nil and saved in location specified by config.assets.prefix - # config.assets.manifest = YOUR_PATH - # 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 @@ -47,15 +49,10 @@ Growstuff::Application.configure do # 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 are already added) - # config.assets.precompile += %w( search.js ) - - # Disable delivery errors, bad email addresses will be ignored + # 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. # config.action_mailer.raise_delivery_errors = false - # Enable threaded mode - # config.threadsafe! - # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation can not be found) config.i18n.fallbacks = true @@ -63,6 +60,12 @@ Growstuff::Application.configure do # Send deprecation notices to registered listeners config.active_support.deprecation = :notify + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + + # Do not dump schema after migrations. + config.active_record.dump_schema_after_migration = false + # Growstuff configuration config.new_crops_request_link = "http://example.com/not-a-real-url" config.action_mailer.default_url_options = { :host => 'dev.growstuff.org' } diff --git a/config/environments/test.rb b/config/environments/test.rb index 0ac2b3ba7..ffdc4c972 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,6 +1,9 @@ Growstuff::Application.configure do # Settings specified here will take precedence over those in config/application.rb + # 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 + # preloads Rails for running tests, you may have to set it to true. config.eager_load = false # The test environment is used exclusively to run your application's @@ -30,12 +33,12 @@ Growstuff::Application.configure do # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test - # Raise exception on mass assignment protection for Active Record models - # config.active_record.mass_assignment_sanitizer = :strict - # Print deprecation notices to the stderr config.active_support.deprecation = :stderr + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true + # Growstuff config config.new_crops_request_link = "http://example.com/not-a-real-url" config.action_mailer.default_url_options = { :host => 'localhost:8080' } diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 24be064ae..8080d4651 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -4,7 +4,6 @@ require 'spec_helper' require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' # Add additional requires below this line. Rails is not loaded until this point! -require 'rspec/autorun' require 'simplecov' require 'coveralls' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 7b09b0a2d..191e049ee 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -26,6 +26,7 @@ RSpec.configure do |config| # # => "be bigger than 2 and smaller than 4" # ...rather than: # # => "be bigger than 2" + expectations.syntax = [:should, :expect] expectations.include_chain_clauses_in_custom_matcher_descriptions = true end @@ -36,6 +37,7 @@ RSpec.configure do |config| # a real object. This is generally recommended, and will default to # `true` in RSpec 4. mocks.verify_partial_doubles = false + mocks.syntax = [:should, :expect] end # The settings below are suggested to provide a good initial experience