Browse Source

Migration to Ruby on Rails 5.2

remotes/origin/master
echarp 3 years ago
parent
commit
135e33c44c
  1. 3
      .rubocop.yml
  2. 180
      Gemfile.lock
  3. 1
      app/assets/javascripts/application.js.coffee
  4. 9
      app/assets/stylesheets/application.sass
  5. 2
      app/controllers/stats_controller.rb
  6. 2
      app/models/event_callbacks.rb
  7. 12
      bin/yarn
  8. 2
      deploy/before_restart
  9. 8
      test/models/event_test.rb

3
.rubocop.yml

@ -1,9 +1,12 @@
AllCops:
Exclude:
- db/schema.rb
TargetRubyVersion: 2.5
BlockLength:
Exclude:
- app/admin/*.rb
- config/routes.rb
Rails/HttpPositionalArguments:
Enabled: false
Style/FrozenStringLiteralComment:
Enabled: false

180
Gemfile.lock

@ -2,68 +2,72 @@ GEM
remote: https://rubygems.org/
remote: https://rails-assets.org/
specs:
actioncable (5.1.6)
actionpack (= 5.1.6)
actioncable (5.2.0)
actionpack (= 5.2.0)
nio4r (~> 2.0)
websocket-driver (~> 0.6.1)
actionmailer (5.1.6)
actionpack (= 5.1.6)
actionview (= 5.1.6)
activejob (= 5.1.6)
websocket-driver (>= 0.6.1)
actionmailer (5.2.0)
actionpack (= 5.2.0)
actionview (= 5.2.0)
activejob (= 5.2.0)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.1.6)
actionview (= 5.1.6)
activesupport (= 5.1.6)
actionpack (5.2.0)
actionview (= 5.2.0)
activesupport (= 5.2.0)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.1.6)
activesupport (= 5.1.6)
actionview (5.2.0)
activesupport (= 5.2.0)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
actionview-encoded_mail_to (1.0.9)
rails
activeadmin (1.2.1)
activeadmin (1.3.0)
arbre (>= 1.1.1)
coffee-rails
formtastic (~> 3.1)
formtastic_i18n
inherited_resources (~> 1.7)
inherited_resources (>= 1.7.0)
jquery-rails (>= 4.2.0)
kaminari (>= 0.15, < 2.0)
railties (>= 4.2, < 5.2)
kaminari (>= 0.15)
railties (>= 4.2, < 5.3)
ransack (~> 1.3)
sass (~> 3.1)
sprockets (< 4.1)
activejob (5.1.6)
activesupport (= 5.1.6)
activejob (5.2.0)
activesupport (= 5.2.0)
globalid (>= 0.3.6)
activemodel (5.1.6)
activesupport (= 5.1.6)
activerecord (5.1.6)
activemodel (= 5.1.6)
activesupport (= 5.1.6)
arel (~> 8.0)
activesupport (5.1.6)
activemodel (5.2.0)
activesupport (= 5.2.0)
activerecord (5.2.0)
activemodel (= 5.2.0)
activesupport (= 5.2.0)
arel (>= 9.0)
activestorage (5.2.0)
actionpack (= 5.2.0)
activerecord (= 5.2.0)
marcel (~> 0.3.1)
activesupport (5.2.0)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
acts-as-taggable-on (5.0.0)
activerecord (>= 4.2.8)
acts-as-taggable-on (6.0.0)
activerecord (~> 5.0)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
arbre (1.1.1)
activesupport (>= 3.0.0)
arel (8.0.0)
arel (9.0.0)
ast (2.4.0)
bcrypt (3.1.11)
bcrypt (3.1.12)
bindex (0.5.0)
brakeman (4.2.1)
brakeman (4.3.1)
buftok (0.2.0)
builder (3.2.3)
bundler-audit (0.6.0)
@ -88,17 +92,17 @@ GEM
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.0.5)
crass (1.0.3)
crass (1.0.4)
devise (4.4.3)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0, < 6.0)
responders
warden (~> 1.2.3)
devise-i18n (1.6.1)
devise-i18n (1.6.2)
devise (>= 4.4)
differ (0.1.2)
domain_name (0.5.20170404)
domain_name (0.5.20180417)
unf (>= 0.0.5, < 1.0.0)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
@ -108,18 +112,18 @@ GEM
equalizer (0.0.11)
erubi (1.7.1)
erubis (2.7.0)
eventmachine (1.2.5)
eventmachine (1.2.7)
execjs (2.7.0)
ffi (1.9.23)
ffi (1.9.25)
flag-icons-rails (3.1.0)
sass (~> 3.2)
font-awesome-sass (5.0.9)
sass (>= 3.2)
font-awesome-sass (5.0.13)
sassc (>= 1.11)
formatador (0.2.5)
formtastic (3.1.5)
actionpack (>= 3.2.13)
formtastic_i18n (0.6.0)
geocoder (1.4.7)
geocoder (1.4.9)
globalid (0.4.1)
activesupport (>= 4.2.0)
guard (2.14.2)
@ -166,32 +170,32 @@ GEM
haml (>= 4.0.6, < 6.0)
html2haml (>= 1.0.1)
railties (>= 4.0.1)
haml_lint (0.27.0)
haml_lint (0.28.0)
haml (>= 4.0, < 5.1)
rainbow
rake (>= 10, < 13)
rubocop (>= 0.50.0)
sysexits (~> 1.1)
has_scope (0.7.1)
actionpack (>= 4.1, < 5.2)
activesupport (>= 4.1, < 5.2)
high_voltage (3.0.0)
has_scope (0.7.2)
actionpack (>= 4.1)
activesupport (>= 4.1)
high_voltage (3.1.0)
html2haml (2.2.0)
erubis (~> 2.7.0)
haml (>= 4.0, < 6)
nokogiri (>= 1.6.0)
ruby_parser (~> 3.5)
http (3.0.0)
http (3.3.0)
addressable (~> 2.3)
http-cookie (~> 1.0)
http-form_data (>= 2.0.0.pre.pre2, < 3)
http-form_data (~> 2.0)
http_parser.rb (~> 0.6.0)
http-cookie (1.0.3)
domain_name (~> 0.5)
http-form_data (2.1.0)
http-form_data (2.1.1)
http_accept_language (2.1.1)
http_parser.rb (0.6.0)
i18n (1.0.0)
i18n (1.0.1)
concurrent-ruby (~> 1.0)
i18n-active_record (0.2.2)
i18n (>= 0.5.0)
@ -201,10 +205,11 @@ GEM
has_scope (~> 0.6)
railties (>= 4.2, <= 5.2)
responders
jaro_winkler (1.5.1)
jbuilder (2.7.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
jquery-rails (4.3.1)
jquery-rails (4.3.3)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
@ -222,7 +227,7 @@ GEM
activerecord
kaminari-core (= 1.1.1)
kaminari-core (1.1.1)
kramdown (1.16.2)
kramdown (1.17.0)
libv8 (3.16.14.19)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
@ -234,31 +239,37 @@ GEM
lumberjack (1.0.13)
mail (2.7.0)
mini_mime (>= 0.1.1)
marcel (0.3.2)
mimemagic (~> 0.3.2)
memoizable (0.4.2)
thread_safe (~> 0.3, >= 0.3.1)
meta-tags (2.9.0)
meta-tags (2.10.0)
actionpack (>= 3.2.0, < 5.3)
method_source (0.9.0)
mimemagic (0.3.2)
mini_mime (1.0.0)
mini_portile2 (2.3.0)
minitest (5.11.3)
modernizr-rails (2.7.1)
multi_json (1.13.1)
multipart-post (2.0.0)
mysql2 (0.5.0)
mysql2 (0.5.2)
naught (1.1.0)
nenv (0.3.0)
nio4r (2.3.0)
nokogiri (1.8.2)
nio4r (2.3.1)
nokogiri (1.8.4)
mini_portile2 (~> 2.3.0)
notiffany (0.1.1)
nenv (~> 0.1)
shellany (~> 0.0)
orm_adapter (0.5.0)
paper_trail (9.0.0)
paper_trail (9.2.0)
activerecord (>= 4.2, < 5.3)
paper_trail-association_tracking (< 2)
request_store (~> 1.1)
paper_trail-association_tracking (1.0.0)
parallel (1.12.1)
parser (2.5.0.5)
parser (2.5.1.0)
ast (~> 2.4.0)
piwik_analytics (1.0.2)
actionpack
@ -266,28 +277,29 @@ GEM
rails (>= 3.0.0)
polyamorous (1.3.3)
activerecord (>= 3.0)
powerpack (0.1.1)
powerpack (0.1.2)
pry (0.11.3)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
public_suffix (3.0.2)
puma (3.11.3)
rack (2.0.4)
puma (3.11.4)
rack (2.0.5)
rack-livereload (0.3.17)
rack
rack-test (1.0.0)
rack (>= 1.0, < 3)
rails (5.1.6)
actioncable (= 5.1.6)
actionmailer (= 5.1.6)
actionpack (= 5.1.6)
actionview (= 5.1.6)
activejob (= 5.1.6)
activemodel (= 5.1.6)
activerecord (= 5.1.6)
activesupport (= 5.1.6)
rails (5.2.0)
actioncable (= 5.2.0)
actionmailer (= 5.2.0)
actionpack (= 5.2.0)
actionview (= 5.2.0)
activejob (= 5.2.0)
activemodel (= 5.2.0)
activerecord (= 5.2.0)
activestorage (= 5.2.0)
activesupport (= 5.2.0)
bundler (>= 1.3.0)
railties (= 5.1.6)
railties (= 5.2.0)
sprockets-rails (>= 2.0.0)
rails-assets-jquery-sparkline (2.1.3)
rails-assets-leaflet (1.3.1)
@ -305,9 +317,9 @@ GEM
rails-i18n (5.1.1)
i18n (>= 0.7, < 2)
railties (>= 5.0, < 6)
railties (5.1.6)
actionpack (= 5.1.6)
activesupport (= 5.1.6)
railties (5.2.0)
actionpack (= 5.2.0)
activesupport (= 5.2.0)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
@ -322,14 +334,15 @@ GEM
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rdoc (6.0.3)
rdoc (6.0.4)
ref (2.0.0)
request_store (1.4.1)
rack (>= 1.4)
responders (2.4.0)
actionpack (>= 4.2.0, < 5.3)
railties (>= 4.2.0, < 5.3)
rubocop (0.54.0)
rubocop (0.58.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.5)
powerpack (~> 0.1)
@ -352,9 +365,12 @@ GEM
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
sassc (1.12.1)
ffi (~> 1.9.6)
sass (>= 3.3.0)
sdoc (1.0.0)
rdoc (>= 5.0)
selenium-webdriver (3.11.0)
selenium-webdriver (3.13.0)
childprocess (~> 0.5)
rubyzip (~> 1.2)
sexp_processor (4.11.0)
@ -367,7 +383,7 @@ GEM
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
sprockets (3.7.1)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
@ -387,11 +403,11 @@ GEM
thor (0.20.0)
thread_safe (0.3.6)
tilt (2.0.8)
tinymce-rails (4.7.10)
tinymce-rails (4.7.13)
railties (>= 3.1.1)
tinymce-rails-langs (4.20180103)
tinymce-rails (~> 4.1, >= 4.1.10)
turbolinks (5.1.0)
turbolinks (5.1.1)
turbolinks-source (~> 5.1)
turbolinks-source (5.1.0)
twitter (6.2.0)
@ -407,23 +423,23 @@ GEM
simple_oauth (~> 0.3.0)
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (4.1.8)
uglifier (4.1.14)
execjs (>= 0.3.0, < 3)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.5)
unicode-display_width (1.3.0)
unicode-display_width (1.4.0)
warden (1.2.7)
rack (>= 1.0)
web-console (3.5.1)
web-console (3.6.2)
actionview (>= 5.0)
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
websocket-driver (0.6.5)
websocket-driver (0.7.0)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
xpath (3.0.0)
xpath (3.1.0)
nokogiri (~> 1.8)
PLATFORMS

1
app/assets/javascripts/application.js.coffee

@ -22,7 +22,6 @@
#= require leaflet
#= require leaflet.markercluster
#= require leaflet.awesome-markers
#= require frTypo
#= require_tree .
$(document).on 'turbolinks:load', ->

9
app/assets/stylesheets/application.sass

@ -10,12 +10,13 @@
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require jquery-ui
*= require jquery.tagsinput
*= require flag-icon
*= require frTypo
*= require_tree .
*/
@import jquery-ui/core
@import jquery-ui/autocomplete
@import jquery-ui/menu
@import jquery.tagsinput
@import font-awesome-sprockets
@import font-awesome
@import flag-icon

2
app/controllers/stats_controller.rb

@ -22,7 +22,7 @@ class StatsController < ApplicationController
def local
@region_events = @events.group(:region_id, year_grouping).count
@regions = Region.all.find_all do |region|
@years.sum { |year| @region_events[[region.id, year[0]]] || 0 } > 0
@years.sum { |year| @region_events[[region.id, year[0]]] || 0 }.positive?
end
@city_events = @events.group(:city).having('count(city) > 3')
.order('count(city) desc').count

2
app/models/event_callbacks.rb

@ -56,7 +56,7 @@ class EventCallbacks
def self.create_sub_event(event, schedule)
att = event.attributes.reject do |a|
a == 'id' || a == 'lock_version' || a == 'tags'
%w[id lock_version tags].include? a
end
att[:start_time] = schedule.start_time
att[:end_time] = schedule.end_time

12
bin/yarn

@ -1,11 +1,9 @@
#!/usr/bin/env ruby
VENDOR_PATH = File.expand_path('..', __dir__)
Dir.chdir(VENDOR_PATH) do
begin
exec "yarnpkg #{ARGV.join(' ')}"
rescue Errno::ENOENT
warn 'Yarn executable was not detected in the system.'
warn 'Download Yarn at https://yarnpkg.com/en/docs/install'
exit 1
end
exec "yarnpkg #{ARGV.join(' ')}"
rescue Errno::ENOENT
warn 'Yarn executable was not detected in the system.'
warn 'Download Yarn at https://yarnpkg.com/en/docs/install'
exit 1
end

2
deploy/before_restart

@ -23,7 +23,7 @@ if File.file? 'Rakefile'
`git diff #{oldrev} #{newrev} --diff-filter=A --name-only -z db/migrate`
.split("\0").size
# run migrations if new ones have been added
if num_migrations > 0
if num_migrations.positive?
run "#{rake_cmd} db:migrate RAILS_ENV=#{RAILS_ENV}"
run "#{rake_cmd} db:migrate RAILS_ENV=#{RAILS_ENV}_be"
run "#{rake_cmd} db:migrate RAILS_ENV=#{RAILS_ENV}_ch"

8
test/models/event_test.rb

@ -47,17 +47,17 @@ class EventTest < ActiveSupport::TestCase
assert_equal @event.contact, @event.submitter
@event.contact = 'hop@@@'
assert !@event.valid?, @event.errors.messages
assert_not @event.valid?, @event.errors.messages
@event.contact = 'contact@example.com'
assert @event.valid?, @event.errors.messages
# Check invalid url
@event.url = 'htt://truc.com'
assert !@event.valid?, @event.errors.messages
assert_not @event.valid?, @event.errors.messages
@event.url = 'http:/truc.com'
assert !@event.valid?, @event.errors.messages
assert_not @event.valid?, @event.errors.messages
end
test 'moderation' do
@ -118,6 +118,6 @@ class EventTest < ActiveSupport::TestCase
@event.city = 'world'
@event.region.name = 'here'
@event.region.code = 'xyz'
assert_equal 'hello, world, here', @event.full_address
assert_equal 'hello, world', @event.full_address
end
end

Loading…
Cancel
Save