diff --git a/Gemfile b/Gemfile index 9ff86576..3b025590 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ gem 'has_scope' # Use SASS for stylesheets, this version is required to compile active_admin # assets, TODO -gem 'sass-rails', '5.0.0.beta1' +gem 'sass-rails' # Use Uglifier as compressor for JavaScript assets gem 'uglifier' # Use CoffeeScript for .coffee assets and views @@ -67,6 +67,8 @@ gem 'differ' # A generic library to administrate the tool gem 'activeadmin', github: 'activeadmin' +gem 'inherited_resources', github: 'josevalim/inherited_resources', + branch: 'rails-4-2' # A nicer markdown editor in active admin gem 'activeadmin_pagedown' diff --git a/Gemfile.lock b/Gemfile.lock index 48c7fb99..b3122aaf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: git://github.com/activeadmin/activeadmin.git - revision: 679b51e8c7c498c04ef8f9904be14e710281b791 + revision: 7aef260921d418d904d2dba9b1a97eed893e9019 specs: activeadmin (1.0.0.pre) arbre (~> 1.0, >= 1.0.2) @@ -12,7 +12,7 @@ GIT jquery-rails jquery-ui-rails (~> 5.0) kaminari (~> 0.15) - rails (>= 3.2, < 4.2) + rails (>= 3.2, < 5.0) ransack (~> 1.3) sass-rails @@ -24,6 +24,17 @@ GIT jquery-rails rails (>= 3.2.2) +GIT + remote: git://github.com/josevalim/inherited_resources.git + revision: ff1c991307ff78cce98882b6986aeabbbcfd70c4 + branch: rails-4-2 + specs: + inherited_resources (1.5.1) + actionpack (>= 3.2, < 5) + has_scope (~> 0.6.0.rc) + railties (>= 3.2, < 5) + responders + GIT remote: git://github.com/svenfuchs/i18n-active_record.git revision: 2d9a22b6a4e5d809782cdbfa65b14d9e47aa27fc @@ -34,48 +45,57 @@ GIT GEM remote: https://rubygems.org/ specs: - actionmailer (4.1.8) - actionpack (= 4.1.8) - actionview (= 4.1.8) + actionmailer (4.2.0) + actionpack (= 4.2.0) + actionview (= 4.2.0) + activejob (= 4.2.0) mail (~> 2.5, >= 2.5.4) - actionpack (4.1.8) - actionview (= 4.1.8) - activesupport (= 4.1.8) - rack (~> 1.5.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.0) + actionview (= 4.2.0) + activesupport (= 4.2.0) + rack (~> 1.6.0) rack-test (~> 0.6.2) - actionview (4.1.8) - activesupport (= 4.1.8) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.1) + actionview (4.2.0) + activesupport (= 4.2.0) builder (~> 3.1) erubis (~> 2.7.0) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.1) actionview-encoded_mail_to (1.0.5) rails activeadmin_pagedown (0.0.2) activeadmin (>= 0.5.0) - activemodel (4.1.8) - activesupport (= 4.1.8) + activejob (4.2.0) + activesupport (= 4.2.0) + globalid (>= 0.3.0) + activemodel (4.2.0) + activesupport (= 4.2.0) builder (~> 3.1) - activerecord (4.1.8) - activemodel (= 4.1.8) - activesupport (= 4.1.8) - arel (~> 5.0.0) - activesupport (4.1.8) - i18n (~> 0.6, >= 0.6.9) + activerecord (4.2.0) + activemodel (= 4.2.0) + activesupport (= 4.2.0) + arel (~> 6.0) + activesupport (4.2.0) + 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) addressable (2.3.6) arbre (1.0.2) activesupport (>= 3.0.0) - arel (5.0.1.20140414130214) + arel (6.0.0) ast (2.0.0) astrolabe (1.3.0) parser (>= 2.2.0.pre.3, < 3.0) bcrypt (3.1.9) - bourbon (4.0.2) + bourbon (4.1.0) sass (~> 3.3) thor - brakeman (2.6.3) + brakeman (3.0.0) erubis (~> 2.6) fastercsv (~> 1.5) haml (>= 3.0, < 5.0) @@ -111,8 +131,10 @@ GEM sass (>= 3.3.0, < 3.5) compass-import-once (1.0.5) sass (>= 3.2, < 3.5) - compass-rails (2.0.1) + compass-rails (2.0.4) compass (~> 1.0.0) + sass-rails (<= 5.0.1) + sprockets (< 2.13) devise (3.4.1) bcrypt (~> 3.0) orm_adapter (~> 0.1) @@ -132,23 +154,27 @@ GEM erubis (2.7.0) eventmachine (1.0.4) execjs (2.2.2) - faraday (0.9.0) + faraday (0.9.1) multipart-post (>= 1.2, < 3) fastercsv (1.5.5) ffi (1.9.6) font-awesome-rails (4.2.0.0) railties (>= 3.2, < 5.0) formatador (0.2.5) - formtastic (3.1.2) + formtastic (3.1.3) actionpack (>= 3.2.13) formtastic_i18n (0.1.1) geocoder (1.2.6) - guard (2.10.5) + globalid (0.3.0) + activesupport (>= 4.1.0) + guard (2.11.1) formatador (>= 0.2.4) listen (~> 2.7) lumberjack (~> 1.0) nenv (~> 0.1) + notiffany (~> 0.0) pry (>= 0.9.12) + shellany (~> 0.0) thor (>= 0.18.1) guard-brakeman (0.8.3) brakeman (>= 2.1.1) @@ -194,21 +220,19 @@ GEM http_accept_language (2.0.2) http_parser.rb (0.6.0) i18n (0.7.0) - inherited_resources (1.4.1) - has_scope (~> 0.6.0.rc) - responders (~> 1.0.0.rc) jbuilder (2.2.6) activesupport (>= 3.0.0, < 5) multi_json (~> 1.2) - jquery-rails (3.1.2) - railties (>= 3.0, < 5.0) + jquery-rails (4.0.3) + rails-dom-testing (~> 1.0) + railties (>= 4.2.0) thor (>= 0.14, < 2.0) jquery-turbolinks (2.1.0) railties (>= 3.1.0) turbolinks jquery-ui-rails (5.0.3) railties (>= 3.2.16) - json (1.8.1) + json (1.8.2) kaminari (0.16.1) actionpack (>= 3.0.0) activesupport (>= 3.0.0) @@ -216,10 +240,12 @@ GEM railties (>= 3.1) leaflet-rails (0.7.4) libv8 (3.16.14.7) - listen (2.8.4) + listen (2.8.5) celluloid (>= 0.15.2) rb-fsevent (>= 0.9.3) rb-inotify (>= 0.9) + loofah (2.0.1) + nokogiri (>= 1.5.9) lumberjack (1.0.9) mail (2.6.3) mime-types (>= 1.16, < 3) @@ -229,6 +255,7 @@ GEM actionpack (>= 3.0.0) method_source (0.8.2) mime-types (2.4.3) + mini_portile (0.6.2) minitest (5.5.0) modernizr-rails (2.7.1) multi_json (1.10.1) @@ -236,10 +263,14 @@ GEM mysql2 (0.3.17) naught (1.0.0) nenv (0.1.1) + nokogiri (1.6.5) + mini_portile (~> 0.6.0) + notiffany (0.0.3) + nenv (~> 0.1) + shellany (~> 0.0) orm_adapter (0.5.0) - parser (2.2.0.1) + parser (2.2.0.2) ast (>= 1.1, < 3.0) - slop (~> 3.4, >= 3.4.5) polyamorous (1.1.0) activerecord (>= 3.0) powerpack (0.0.9) @@ -249,25 +280,34 @@ GEM slop (~> 3.4) quiet_assets (1.1.0) railties (>= 3.1, < 5.0) - rack (1.5.2) - rack-test (0.6.2) + rack (1.6.0) + rack-test (0.6.3) rack (>= 1.0) - rails (4.1.8) - actionmailer (= 4.1.8) - actionpack (= 4.1.8) - actionview (= 4.1.8) - activemodel (= 4.1.8) - activerecord (= 4.1.8) - activesupport (= 4.1.8) + rails (4.2.0) + actionmailer (= 4.2.0) + actionpack (= 4.2.0) + actionview (= 4.2.0) + activejob (= 4.2.0) + activemodel (= 4.2.0) + activerecord (= 4.2.0) + activesupport (= 4.2.0) bundler (>= 1.3.0, < 2.0) - railties (= 4.1.8) - sprockets-rails (~> 2.0) + railties (= 4.2.0) + sprockets-rails + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.5) + activesupport (>= 4.2.0.beta, < 5.0) + nokogiri (~> 1.6.0) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.0.1) + loofah (~> 2.0) rails-i18n (4.0.3) i18n (~> 0.6) railties (~> 4.0) - railties (4.1.8) - actionpack (= 4.1.8) - activesupport (= 4.1.8) + railties (4.2.0) + actionpack (= 4.2.0) + activesupport (= 4.2.0) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (2.0.0) @@ -285,8 +325,8 @@ GEM json (~> 1.4) redcarpet (3.2.2) ref (1.0.5) - responders (1.0.0) - railties (>= 3.2, < 5) + responders (2.0.2) + railties (>= 4.2.0.alpha, < 5) rubocop (0.28.0) astrolabe (~> 1.3) parser (>= 2.2.0.pre.7, < 3.0) @@ -300,20 +340,22 @@ GEM ruby_parser (3.5.0) sexp_processor (~> 4.1) sass (3.4.9) - sass-rails (5.0.0.beta1) + sass-rails (5.0.1) railties (>= 4.0.0, < 5.0) - sass (~> 3.2) - sprockets (~> 2.12) + sass (~> 3.1) + sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) + tilt (~> 1.1) sdoc (0.4.1) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) select2-rails (3.5.9.1) thor (~> 0.14) sexp_processor (4.4.4) + shellany (0.0.1) simple_calendar (1.1.9) rails (>= 3.0) - simple_oauth (0.3.0) + simple_oauth (0.3.1) simplecov (0.9.1) docile (~> 1.1.0) multi_json (~> 1.0) @@ -366,7 +408,7 @@ GEM simple_oauth (~> 0.3.0) tzinfo (1.2.2) thread_safe (~> 0.1) - uglifier (2.6.0) + uglifier (2.7.0) execjs (>= 0.3.0) json (>= 1.8.0) warden (1.2.3) @@ -402,6 +444,7 @@ DEPENDENCIES has_scope http_accept_language i18n-active_record! + inherited_resources! jbuilder jquery-rails jquery-sparkline-rails! @@ -415,7 +458,7 @@ DEPENDENCIES rails rails-i18n redcarpet - sass-rails (= 5.0.0.beta1) + sass-rails sdoc (~> 0.4.0) select2-rails simple_calendar diff --git a/Guardfile b/Guardfile index 98bd7805..b1ed13b8 100644 --- a/Guardfile +++ b/Guardfile @@ -27,8 +27,6 @@ guard :minitest do watch(%r{^test/test_helper\.rb}) { 'test' } end -notification :notifysend - guard :brakeman, run_on_start: true, quiet: true, min_confidence: 10 do watch(%r{^app/.+\.(erb|haml|rhtml|rb)$}) watch(%r{^config/.+\.rb$}) diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb index 9b458651..4fc6d62c 100644 --- a/app/controllers/events_controller.rb +++ b/app/controllers/events_controller.rb @@ -121,14 +121,14 @@ class EventsController < ApplicationController def send_creation_mails # Send an event creation mail to its author - EventMailer.create(@event).deliver + EventMailer.create(@event).deliver_now # Send a mail to moderators - ModerationMailer.create(@event).deliver + ModerationMailer.create(@event).deliver_now end def send_update_mails # Send an update mail to moderators - ModerationMailer.update(@older_event, @event, nil).deliver + ModerationMailer.update(@older_event, @event, nil).deliver_now end def locked diff --git a/app/controllers/moderations_controller.rb b/app/controllers/moderations_controller.rb index 5ba4d5b2..47b58415 100644 --- a/app/controllers/moderations_controller.rb +++ b/app/controllers/moderations_controller.rb @@ -80,17 +80,17 @@ class ModerationsController < ApplicationController def send_mails # Send an update mail to moderators - ModerationMailer.update(@older_mod, @moderation, current_user).deliver + ModerationMailer.update(@older_mod, @moderation, current_user).deliver_now end def send_accept_mails tweet # Send an acceptation mail to its author - EventMailer.accept(@moderation, current_user).deliver + EventMailer.accept(@moderation, current_user).deliver_now # Send an acceptation mail to moderators - ModerationMailer.accept(@moderation, current_user).deliver + ModerationMailer.accept(@moderation, current_user).deliver_now end # Tweet this event, if configured using apache/system variables! @@ -112,8 +112,8 @@ class ModerationsController < ApplicationController @reason = t "moderations.refuse.reason_#{params[:reason]}_long" end - EventMailer.destroy(@moderation, current_user, @reason).deliver - ModerationMailer.destroy(@moderation, current_user, @reason).deliver + EventMailer.destroy(@moderation, current_user, @reason).deliver_now + ModerationMailer.destroy(@moderation, current_user, @reason).deliver_now end def locked diff --git a/app/controllers/notes_controller.rb b/app/controllers/notes_controller.rb index a28ce1a6..1695a9ce 100644 --- a/app/controllers/notes_controller.rb +++ b/app/controllers/notes_controller.rb @@ -46,10 +46,10 @@ class NotesController < ApplicationController def send_mails if params[:envoiParMail] == 'oui' # Send an update mail to its author - NoteMailer.notify(@note).deliver + NoteMailer.notify(@note).deliver_now @note.contents = t '.sendByMailWrap', contents: @note.contents @note.save end - NoteMailer.create(@note).deliver + NoteMailer.create(@note).deliver_now end end diff --git a/bin/rails b/bin/rails index 728cd85a..5191e692 100755 --- a/bin/rails +++ b/bin/rails @@ -1,4 +1,4 @@ #!/usr/bin/env ruby -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 00000000..defc1922 --- /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/config/boot.rb b/config/boot.rb index 5e5f0c1f..6b750f00 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -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. diff --git a/config/environments/development.rb b/config/environments/development.rb index 103e1c54..cd391aca 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -28,6 +28,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. diff --git a/config/environments/production.rb b/config/environments/production.rb index daca57cb..83ddcb9c 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -18,11 +18,12 @@ 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. + # 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 @@ -31,22 +32,24 @@ 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 - # Version of your assets, change this if you want to expire all your assets. - config.assets.version = '1.0' + # `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 ] @@ -58,19 +61,13 @@ 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' config.action_controller.asset_host = 'http://assets%d.agendadulibre.org' - # 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 ) - # 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 - config.action_mailer.smtp_settings = { openssl_verify_mode: 'none' } # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). @@ -79,9 +76,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 fc0e8f12..7ac80d3c 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -13,8 +13,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. @@ -32,6 +32,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 new file mode 100644 index 00000000..a71e9524 --- /dev/null +++ b/config/initializers/assets.rb @@ -0,0 +1,12 @@ +# Be sure to restart your server when you modify this file. + +# 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( search.js )