Skip to content

Commit

Permalink
Upgrading to Rails 5.2.3 (#891)
Browse files Browse the repository at this point in the history
* Configurations update for rails 4.0

* ActiveSupport::Testing::Performance extracted to a gem

* ruby prof required as a dependency

* disable rubocop on bin folder

* http patch

* Comment out to allow testing

* no longer supports plugin loading

* lock to sprockets 2.12

* Active record patches

* remove deprecated test syntax

* fix failing tests

* change new super class

* replace right_aws with right_aws_api

right_aws is no longer maintained, was throwing an error

* lock to rails 4.2.11.1

* change rails version in install script

* remove deprecation warnings

* Change test lib to minitest, add  minitest reporters

* make app work

* active record find patches

* root_in_json include defaulted to false

* confirm option removed in link helper

* cookies serializer changed to hybrid

* Change render :text to :plain

render :text will be deprecated and poses a security risk

* console for dev web

* Check and fix interface functionality

* fix export functionality

* add protected attributes for the warpable model

* fix image upload

* Fix comments and images failing tests

* include mass assignment security in annotations

* render html for update images

* clear mail array before every test

* Fix codeclimate issues

* skip failing test

The test is failing because of different names in model(warpable) and
controller(images) skipping this for now until we decide if we want to
standardize the names

* replace unprotected redirects

* Fix codeclimate issues

* Autofixing rubocop offenses and Problematic test for #578 (#667)

* Autofixing rubocop offenses

* Adding Rubocop to Travis pipelines and development branch

* Fixing maps controller test

* Fixing remaining offenses

* change post test to create since action new is a get action

* remove unprotected redirects

* Fix codeclimate issues

* Add yarn

* Remove error log

* Fix oauth icons

* Modify package.json

* Add yarn install to start.sh

* Add leaflet google

* Remove leaflet-google from package json

* remove passenger error logs

* Fix install script

* Remove flag

* Fix gemfile.lock

* Fix gemfile.lock

* Fix login

* Upgrade Gemfile to Rails 5.0

* require rake'

* Change config files

* Add application record

* Bump mysql

* Local builds for Travis runners (#672)

* Using local mysql for travis

* Fix codeclimate issues

* Refactoring yamls

* Autofixing rubocop offenses and Problematic test for #578 (#667)

* Autofixing rubocop offenses

* Adding Rubocop to Travis pipelines and development branch

* Fixing maps controller test

* Fixing remaining offenses

* Fixing unit tests

* Adding docker build to travis pipelines

* Adding docker build to travis pipelines

* Staging builds in travis

* fix travis.yml

* Upgrading sintax of assets and using required gems

* Using updated version of GDAL and installing required dependencies

* Enabling cache in between builds

* Test yarn for travis

* Conditionalize rake db:setup for travis

* Add semicolon

* Remove comment

* modify database.yml

* Migrate seperately

* Run create only for production

* Locking newer Rails v

* Running update task

* Adding missing bootsnap gem

* Fixing missing database

* Adding missing listen gem

* Fixing schema example version

* Fixing migration versions

* Updating dependencies for Rails 5

* Adding ApplicationMailer abstraction

* Adding required initializers

* Prefer require_relative instead of full path

* Making associations not required by default

* Regenerating schema file

* Hotfixing MassAssigment

* Upgrade web-console, remove mysql adapter override

* Remove attr_accessible

* Add rails-controller-testing gem

* Follow new syntax for tests

* Remove extra web-console from gemfile

* Regenerating lock file

* Fixing rubocop offenses and bundler version

* Using correct Paperclip class as in rails/rails#26404 (comment)

* Fix images functional tests

* images controller test typecast to string

* Fix rails logger

* Fix map tests

* Bumping rubocop version

* Autofixing rubocop offenses

* Including performance cop to rubocop

* Refactoring deprecated routing and secret_token

* Fixing routes for feed controller

* Using correct routes for RSS builder

* Fixing missing routes

* Fixing travis bundler and yarn cache

* Fixing bundle path

* Splitting bundle and yarn verifications

* Autofixing rubocop offenses

* Fixing prod host for travis, private class usage and rubocop offenses

* Upgrade to Rails 5.2 (#685)

* Upgrade Gemfile to Rails 5.0

* require rake'

* Change config files

* Add application record

* Bump mysql

* Locking newer Rails v

* Running update task

* Adding missing bootsnap gem

* Fixing missing database

* Adding missing listen gem

* Fixing schema example version

* Fixing migration versions

* Updating dependencies for Rails 5

* Adding ApplicationMailer abstraction

* Adding required initializers

* Prefer require_relative instead of full path

* Making associations not required by default

* Regenerating schema file

* Hotfixing MassAssigment

* Upgrade web-console, remove mysql adapter override

* Remove attr_accessible

* Add rails-controller-testing gem

* Follow new syntax for tests

* Remove extra web-console from gemfile

* Regenerating lock file

* Fixing rubocop offenses and bundler version

* Using correct Paperclip class as in rails/rails#26404 (comment)

* Fix images functional tests

* images controller test typecast to string

* Fix rails logger

* Fix map tests

* Bumping rubocop version

* Autofixing rubocop offenses

* Including performance cop to rubocop

* Refactoring deprecated routing and secret_token

* Fixing routes for feed controller

* Using correct routes for RSS builder

* Fixing missing routes

* Fixing travis bundler and yarn cache

* Fixing bundle path

* Splitting bundle and yarn verifications

* Fixing prod host for travis, private class usage and rubocop offenses

* Enforcing params usage on get method

* Using correct folder names to Rails >5 conventions

* Enforcing params wrapping and adding missing front_ui route

* Precompiling assets before serving

* Improving Jenkins startup script

* Using supported docker yaml version by Jenkins

* Adding task to check database existance

* Improving start script

* Improving Makefile's recipes and target

* Adding task to check database existance

* Improving start script

* Improving Makefile's recipes and target

* Improving Makefile's recipes and target

* Patching #803

* Improving Jenkins setup

* Fix map loading

* h

* Fixing Leaflet-Environmental-Layers map loading

* h

* leaflet

* fix

* change

* updates

* stop precompiling assets

* precompile

* Using correct Yarn, NPM and Node version, avoiding mismatch

* Removing unwanted tags.js invocation

* Improving Makefile recipe

* Using node_modules/ as dependencies folder, since sass/node-sass#2050 (comment)

* Upgrading Yarn dependencies

* Removing duplicate rubocop directive

* Removing test/ from codeclimate checks

* Removing fixed FIXME comments

* Removing fixed FIXME comments

* Updating docs in README

* Bumping recaptcha and include methods

* Fixing migration version

* Using strong params in requests

* Using strong params in requests

* Use Rack::Test::UploadedFile instead of ActionDispatch::Http::UploadedFile

* Remove rubocop linter

* Fix codeclimate issues

* Fix minor asset issue

* Remove manual asset references and add them to application js

* Fix asset ordering in application.js

* Configure System tests  (#936)

* Add new system tests and fix minor asset loading

* modify test

* Add chromedriver to travis

* Add sudo

* Add dependencies to dockerfile

* Properly installing chrome and chromedriver

* Fixing Map loading since merges
  • Loading branch information
alaxalves authored and jywarren committed Aug 15, 2019
1 parent 1281de8 commit 27f8941
Show file tree
Hide file tree
Showing 173 changed files with 5,539 additions and 1,573 deletions.
3 changes: 0 additions & 3 deletions .bowerrc

This file was deleted.

3 changes: 1 addition & 2 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ plugins:
enabled: true
fixme:
enabled: true
rubocop:
enabled: true

exclude_patterns:
- config/
- db/
- vendor/
- log/
- bin/
- test/


8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public/warpables/*
public/system/*
public/warps/*
public/tms/*
public/lib/*
db/schema.rb
*.db
config/database.yml
Expand All @@ -36,13 +37,14 @@ vendor/bundle
app/assets/bower_components
app/assets/node_modules
public/assets
public/lib
node_modules
node_modules/
todo.txt
.sass-cache
.byebug_history
coverage_report/
test/reports/
yarn-error.log
yarn.lock
.idea/
.idea/
passenger.3000.pid
passenger.3000.pid.lock
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require: rubocop-performance

# Start with Spotifys style guide as a base then customize from there
inherit_from:
- .rubocop_shopify_styleguide.yml
Expand All @@ -11,6 +13,7 @@ AllCops:
- '/config.ru'
Exclude:
- 'vendor/*'
- 'node_modules/**/*'
- 'spec/**/*'
- 'bin/*'
- 'doc/*'
Expand Down
1 change: 1 addition & 0 deletions .simplecov
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ SimpleCov.start 'rails' do
add_filter '/vendor/'
add_filter '/log/'
add_filter '/tmp/'
add_filter '/node_modules/'
end
47 changes: 33 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,42 @@
language: ruby

rvm:
- 2.4.6

node_js:
- "12.6.0"

services:
- mysql
- docker

cache:
directories:
- $PWD/public/lib/
- $PWD/node_modules/
- $PWD/vendor/.bundle/

before_install:
- npm i -g npm@6.9.0
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.17.3
- export PATH="$HOME/.yarn/bin:$PATH"

install:
- cp config/database.yml.example config/database.yml
- cp config/config.yml.example config/config.yml
- cp db/schema.rb.example db/schema.rb
- ./lib/exporter-deps.sh > /dev/null 2>&1
- bundle check --path vendor/.bundle/ || bundle install --path vendor/.bundle/
- yarn check || yarn install
- bundle exec rake db:setup || bundle exec rake db:migrate
- if [ $RAILS_ENV != 'production' ]; then
yarn check || yarn install;
fi
- if [ $RAILS_ENV == 'production' ]; then
mysql -e "CREATE DATABASE mapknitter;";
mysql -e "CREATE USER 'mapknitter'@'%' IDENTIFIED BY 'mapknitter';";
mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'mapknitter'@'%';";
bundle exec rails db:schema:load;
else
bundle exec rails db:setup || bundle exec rails db:migrate;
fi

env:
global:
Expand All @@ -28,25 +46,26 @@ env:

jobs:
include:
- name: "Unit Tests"
script: bundle exec rake test:unit
- name: "Models Tests"
script: bundle exec rails test:models
- name: "Integration Tests"
script: bundle exec rake test:integration
- name: "Functional Tests"
script: bundle exec rake test:functional
script: bundle exec rails test:integration
- name: "Controllers Tests"
script: bundle exec rails test:controllers
- name: "System Tests"
script: bundle exec rails test:system
- name: "Rubocop Linter"
script: bundle exec rubocop
- name: "Docker Builds"
script: docker build -t mapknitter .
# Configure this option after full yarn setup
# - name: "Asset Precompilation"
# env:
# - RAILS_ENV=production
# script: bundle exec rake assets:precompile
- name: "Asset Precompilation"
env:
- RAILS_ENV=production
script:
- bundle exec rails assets:precompile

branches:
only:
- main
- unstable
- development

1 change: 0 additions & 1 deletion .yarnrc

This file was deleted.

19 changes: 18 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,33 @@ RUN echo "deb http://packages.laboratoriopublico.org/publiclab/ stretch main" >
COPY sysadmin.publiclab.key /app/sysadmin.publiclab.key
RUN apt-key add /app/sysadmin.publiclab.key

# Install dependencies
# Install dependencies for Mapknitter
RUN apt-get update -qq && apt-get install -y \
nodejs gdal-bin curl procps git imagemagick python-gdal zip

# Install dependencies for system tests
RUN apt-get -y install fonts-liberation libappindicator3-1 libasound2 \
libatk-bridge2.0-0 libatspi2.0-0 libgtk-3-0 libnspr4 \
libnss3 libx11-xcb1 libxss1 libxtst6 lsb-release xdg-utils && \
wget https://github.com/webnicer/chrome-downloads/raw/master/x64.deb/google-chrome-stable_75.0.3770.142-1_amd64.deb \
-O google-chrome.deb && \
dpkg -i google-chrome.deb && \
apt-get -fy install && \
wget https://chromedriver.storage.googleapis.com/74.0.3729.6/chromedriver_linux64.zip && \
unzip chromedriver_linux64.zip && \
mv chromedriver /usr/local/bin/chromedriver && \
chmod +x /usr/local/bin/chromedriver

# Configure ImageMagick
COPY ./nolimit.xml /etc/ImageMagick-6/policy.xml

RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt-get install -y npm
RUN npm install -g yarn

# See https://github.com/instructure/canvas-lms/issues/1404#issuecomment-461023483 and
# https://github.com/publiclab/mapknitter/pull/803
RUN git config --global url."https://".insteadOf git://

# Install bundle of gems
# Add the Rails app
COPY . /app/
Expand Down
67 changes: 39 additions & 28 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,81 +1,92 @@
source "https://rubygems.org"
source 'https://rubygems.org'

ruby '2.4.6'
gem 'rails', '4.2.11.1'
gem 'rake', '~> 12.3.3'
gem 'rails', '~> 5.2.3'
gem 'rake', '~> 12.3.2'
gem 'tzinfo-data'
gem 'skylight'

gem "will_paginate", "3.1.7"
gem 'will_paginate-bootstrap4'
gem "friendly_id"
gem 'will_paginate', '3.1.7'
gem 'will_paginate-bootstrap4', '~> 0.2.2'
gem 'friendly_id'
gem 'popper_js', '~> 1.11', '>= 1.11.1'
gem 'protected_attributes'
gem 'paper_trail'

# dependencies
group :dependencies do
gem 'mysql2', '< 0.6'
gem "geokit-rails", "1.1.4"
gem 'geokit-rails', '1.1.4'
gem 'image_science', '1.3.0'
gem "recaptcha", :require => "recaptcha/rails"
gem "oa-openid", "0.3.2"
gem "ruby-openid", "~>2.5"
gem "open_id_authentication"
gem "RubyInline"
gem "paperclip", "~>4.3.7"
gem 'recaptcha', '~> 5.0.0', require: 'recaptcha/rails'
gem 'oa-openid', '0.3.2'
gem 'ruby-openid', '~>2.5'
gem 'open_id_authentication'
gem 'RubyInline', '~> 3.12.4'
gem 'paperclip', '~> 6.1.0'
gem 'bootsnap', '~> 1.4.4'
gem 'turbolinks', '~> 5'
gem 'mini_magick', '~> 4.8'

# if you use amazon s3 for warpable image storage
gem 'aws-sdk', '~> 1.5.7'

# for rake image migration tasks
# gem 'right_aws'
gem 'right_aws_api'
gem 'right_aws_api', '~> 0.3.5'

# compiling markdown to html
gem "rdiscount", "2.2.0.1"
gem 'rdiscount', '2.2.0.1'

# asset pipelining
gem 'bootstrap-sass'
gem 'sassc-rails'
gem 'jquery-rails'
gem "sprockets"
gem 'sprockets', '3.7.2'
gem "sprockets-rails"
gem "sass", :require => 'sass'
gem "autoprefixer-rails"
gem "uglifier"
gem 'sass', require: 'sass'
gem 'autoprefixer-rails', '~> 9.5.1.1'
gem 'uglifier', '~> 4.1.20'

end

group :test do
gem 'rubocop', '~> 0.52.0'
gem 'rubocop', '~> 0.70.0'
gem 'rubocop-performance'
gem 'ruby-prof'
gem 'rails-perftest'
gem 'rails-controller-testing'
gem 'simplecov', require: false
gem 'codecov', require: false
gem 'minitest'
gem 'minitest-reporters'
end

group :development, :test do
gem "byebug"
gem 'faker'
gem 'pry-rails'
gem 'capybara'
gem 'puma'
gem 'selenium-webdriver'
gem 'byebug', '~> 11.0.1', platforms: [:mri, :mingw, :x64_mingw]
gem 'faker', '~> 1.9.3'
gem 'pry-rails', '~> 0.3.9'
end

group :development do
gem "jshintrb"
gem "therubyracer"
gem 'jshintrb', '~> 0.3.0'
gem 'mini_racer', platforms: :ruby
gem 'listen', '~> 3.1.5'
gem 'web-console', '~> 3.3'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end

group :sqlite do
# if you decide to use sqlite3 as the database
gem "sqlite3"
gem 'sqlite3'
end

group :passenger do
# passenger server
gem "passenger"
gem 'passenger'
end

gem 'httparty'
Loading

0 comments on commit 27f8941

Please sign in to comment.