From a0aed1a54268ac210c9aea192ee7aedcb05b2d8a Mon Sep 17 00:00:00 2001 From: Alax Alves Date: Wed, 27 Feb 2019 08:43:33 -0300 Subject: [PATCH 01/32] Shortening docker image in ~30% --- Dockerfile | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6f1a4153d..328fd1f5f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,27 +1,26 @@ # Dockerfile # Mapknitter # https://github.com/publiclab/mapknitter/ +# This image deploys Mapknitter! FROM ruby:2.4.4-stretch -MAINTAINER Sebastian Silva "sebastian@fuentelibre.org" - -LABEL This image deploys Mapknitter! # Set correct environment variables. -RUN mkdir -p /app ENV HOME /root # Install dependencies RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - -RUN apt-get update -qq && apt-get install -y bundler default-libmysqlclient-dev ruby-rmagick libfreeimage3 libfreeimage-dev ruby-dev gdal-bin python-gdal curl libcurl4-openssl-dev libssl-dev zip nodejs ##ALSO TRIED: ruby-pg -RUN npm install -g bower +RUN apt-get update -qq && apt-get install -y default-libmysqlclient-dev \ + ruby-rmagick libfreeimage3 \ + libfreeimage-dev ruby-dev \ + gdal-bin python-gdal curl \ + libcurl4-openssl-dev libssl-dev \ + zip nodejs ##ALSO TRIED: ruby-pg -# Install bundle of gems -WORKDIR /tmp -ADD Gemfile /tmp/Gemfile -ADD Gemfile.lock /tmp/Gemfile.lock -RUN bundle install +RUN npm install -g bower -# Add the Rails app WORKDIR /app -ADD . /app -RUN bower install --allow-root +COPY Gemfile /app/Gemfile +COPY Gemfile.lock /app/Gemfile.lock +COPY start.sh /app/start.sh + +CMD [ "sh", "start.sh" ] From bad2af5ec72fe7ff4d25625863ef4d64c9177660 Mon Sep 17 00:00:00 2001 From: Alax Alves Date: Wed, 27 Feb 2019 08:45:49 -0300 Subject: [PATCH 02/32] Caching bundle, gathering env variables and using newer sintax --- docker-compose.yml | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 0bef45e1e..e38cb8870 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,20 +1,24 @@ -db: - image: mysql:5.6 - environment: - - MYSQL_DATABASE=mapknitter - - MYSQL_USER=mapknitter - - MYSQL_PASSWORD=mapknitter - - MYSQL_RANDOM_ROOT_PASSWORD=true - volumes: - - /srv/mapknitter_priv1/mk1_database:/var/lib/mysql -web: - build: . - command: /bin/bash -c "sleep 5 && bundle exec rails s -p 3000 -b '0.0.0.0'" - environment: - - RAILS_ENV=production - volumes: - - ./:/app - ports: - - "127.0.0.1:3000:3000" - links: - - db +version: '3.5' +services: + db: + container_name: db + image: mysql:5.6 + env_file: + - mapknitter.env + volumes: + - /srv/mapknitter_priv1/mk1_database:/var/lib/mysql + web: + container_name: web + build: . + env_file: + - mapknitter.env + volumes: + - .:/app + - bundle_cache:/usr/local/bundle + ports: + - 3000:3000 + depends_on: + - db + +volumes: + bundle_cache: From a43d22b0cb1d23aa3260c7c9db518a9b7afa1c1c Mon Sep 17 00:00:00 2001 From: Alax Alves Date: Wed, 27 Feb 2019 08:46:21 -0300 Subject: [PATCH 03/32] Creating startup script and env file --- docker-compose.yml | 2 +- mapknitter.env | 5 +++++ start.sh | 13 +++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 mapknitter.env create mode 100755 start.sh diff --git a/docker-compose.yml b/docker-compose.yml index e38cb8870..6097447c2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: '3.5' +version: '3.3' services: db: container_name: db diff --git a/mapknitter.env b/mapknitter.env new file mode 100644 index 000000000..8b17bf30b --- /dev/null +++ b/mapknitter.env @@ -0,0 +1,5 @@ +MYSQL_DATABASE=mapknitter +MYSQL_USER=mapknitter +MYSQL_PASSWORD=mapknitter +MYSQL_RANDOM_ROOT_PASSWORD=true +RAILS_ENV=production \ No newline at end of file diff --git a/start.sh b/start.sh new file mode 100755 index 000000000..9bcef1bae --- /dev/null +++ b/start.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +pidfile=/app/tmp/pids/server.pid + +bundle check || bundle install +bower install --allow-root + +if [ -f $pidfile ] ; then + >&2 echo 'Server PID file already exists. Removing it...'; + rm $pidfile; +fi + +bundle exec rails s -p 3000 -b '0.0.0.0' From c59753bc40af259278bde86ec9f498d570639728 Mon Sep 17 00:00:00 2001 From: Alax Alves Date: Wed, 27 Feb 2019 09:09:08 -0300 Subject: [PATCH 04/32] Improving travis CI configuration --- .travis.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8444c0721..e8fb770dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,11 +6,9 @@ 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 - - docker-compose build - - docker-compose run web sleep 10 - - docker-compose run web bash -c "rake db:setup" - - docker-compose run web bash -c "rake db:migrate" - - docker-compose run web bower install --allow-root + - docker-compose up -d --build + - docker-compose exec web bundle install + - docker-compose exec web /bin/bash -lc "rake db:setup || rake db:migrate" script: - - docker-compose run web bash -c "rake test" + - docker-compose exec web rake test From e7c5015fbacb9a29cd3be389ef572a1b21590b32 Mon Sep 17 00:00:00 2001 From: Alax Alves Date: Tue, 5 Mar 2019 17:44:34 -0300 Subject: [PATCH 05/32] Loading assets in production env --- app/assets/javascripts/application.js | 2 -- app/assets/javascripts/maps.js | 1 - app/assets/stylesheets/maps.css.scss | 1 - config/environments/production.rb | 6 ++++-- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 79057b5d1..068faeff6 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -20,8 +20,6 @@ //= require leaflet-providers/leaflet-providers.js //= require leaflet-toolbar/dist/leaflet.toolbar.js //= require leaflet-distortableimage/dist/leaflet.distortableimage.js -//= require leaflet-easybutton/src/easy-button.js -//= require leaflet-google/index.js //= require sparklines/source/sparkline.js //= require annotations-legacy.js //= require glfx-js/dist/glfx.js diff --git a/app/assets/javascripts/maps.js b/app/assets/javascripts/maps.js index 291f25edc..90a586db6 100644 --- a/app/assets/javascripts/maps.js +++ b/app/assets/javascripts/maps.js @@ -2,7 +2,6 @@ //= require knitter //= require exif-js/exif.js //= require mapknitter -//= require seiyria-bootstrap-slider/dist/bootstrap-slider.min.js /* Move navbar links into dropdown if nav is inside the sidebar. */ jQuery(document).ready(function($) { diff --git a/app/assets/stylesheets/maps.css.scss b/app/assets/stylesheets/maps.css.scss index 8d2f65b2a..21502bc1f 100644 --- a/app/assets/stylesheets/maps.css.scss +++ b/app/assets/stylesheets/maps.css.scss @@ -1,5 +1,4 @@ /* - *= require seiyria-bootstrap-slider/dist/css/bootstrap-slider.min.css *= require jquery-ui/themes/overcast/jquery-ui.min.css */ /* Variables */ diff --git a/config/environments/production.rb b/config/environments/production.rb index d62f32c3c..aec63e513 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -9,13 +9,15 @@ config.action_controller.perform_caching = true # Disable Rails's static asset server (Apache or nginx will already do this) - config.serve_static_assets = false + config.serve_static_assets = true # Compress JavaScripts and CSS config.assets.compress = true # Don't fallback to assets pipeline if a precompiled asset is missed - config.assets.compile = false + config.assets.compile = true + + config.assets.js_compressor = :uglifier # Generate digests for assets URLs config.assets.digest = true From 5a642244b0df142bfe759c9a7dd1df26eb052bf8 Mon Sep 17 00:00:00 2001 From: Alax Alves Date: Tue, 5 Mar 2019 19:58:36 -0300 Subject: [PATCH 06/32] Allow uglifier to interpret ES6 --- config/environments/production.rb | 4 +++- docker-compose.yml | 2 ++ mapknitter.env | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index aec63e513..43ace49a3 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,3 +1,5 @@ +require 'uglifier' + Mapknitter::Application.configure do # Settings specified here will take precedence over those in config/application.rb @@ -17,7 +19,7 @@ # Don't fallback to assets pipeline if a precompiled asset is missed config.assets.compile = true - config.assets.js_compressor = :uglifier + config.assets.js_compressor = Uglifier.new(:harmony => true) # Generate digests for assets URLs config.assets.digest = true diff --git a/docker-compose.yml b/docker-compose.yml index 6097447c2..6ab18679f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,6 +15,7 @@ services: volumes: - .:/app - bundle_cache:/usr/local/bundle + - bower_cache:/app/public/lib ports: - 3000:3000 depends_on: @@ -22,3 +23,4 @@ services: volumes: bundle_cache: + bower_cache: diff --git a/mapknitter.env b/mapknitter.env index 8b17bf30b..eb1a7a8ca 100644 --- a/mapknitter.env +++ b/mapknitter.env @@ -2,4 +2,4 @@ MYSQL_DATABASE=mapknitter MYSQL_USER=mapknitter MYSQL_PASSWORD=mapknitter MYSQL_RANDOM_ROOT_PASSWORD=true -RAILS_ENV=production \ No newline at end of file +RAILS_ENV=production From a3bf9f6369cce5b682b07fbed5cbb918e1fdd605 Mon Sep 17 00:00:00 2001 From: Sasha Boginsky <41092741+sashadev-sky@users.noreply.github.com> Date: Mon, 11 Mar 2019 18:24:01 -0400 Subject: [PATCH 07/32] Upgrade to mySQL5.7, Ruby warning reductions, .md file updates (#355) * delete old rails configurations * update pr template * update readme and docker image name * add a mysql setup file * update broken recaptcha link * use File.exist? instead * bump mysql2 * control mysql2 gem * add custom rake test functions to provide option to suppress warnings * small edit to mysql.md * another one * add rake task for total tests * add a require for sass gem * update deprecated URI.encode * undo a comment on Rakefile I made * ensure consistency for rake task names * migrate rake tasks to new branch * update readme * update encoding method --- Gemfile | 4 +- Gemfile.lock | 8 +- MYSQL.md | 149 ++++++++++++++++++++++ PULL_REQUEST_TEMPLATE.md | 2 + README.md | 4 +- Rakefile | 3 +- app/controllers/application_controller.rb | 2 +- app/helpers/application_helper.rb | 2 +- app/models/map.rb | 6 +- app/models/user.rb | 2 +- app/models/warpable.rb | 4 +- config/boot.rb | 2 +- config/initializers/new_rails_defaults.rb | 17 --- docker-compose.yml | 2 +- lib/cartagen.rb | 3 +- lib/gdal.rb | 5 +- libmysqlclient.18.dylib | 1 + 17 files changed, 176 insertions(+), 40 deletions(-) create mode 100644 MYSQL.md delete mode 100644 config/initializers/new_rails_defaults.rb create mode 120000 libmysqlclient.18.dylib diff --git a/Gemfile b/Gemfile index 9c5d82a88..59e5abcbe 100644 --- a/Gemfile +++ b/Gemfile @@ -10,7 +10,7 @@ gem "friendly_id" # dependencies group :dependencies do - gem 'mysql2', '~> 0.3.20' + gem 'mysql2', '< 0.4' gem "geokit-rails", "1.1.4" gem "image_science", "1.2.6" gem "recaptcha", :require => "recaptcha/rails" @@ -31,7 +31,7 @@ group :dependencies do # asset pipelining gem "sprockets"#, "2.12.1" - gem "sass" + gem "sass", :require => 'sass' gem "autoprefixer-rails" gem "uglifier" diff --git a/Gemfile.lock b/Gemfile.lock index 8c16dde90..90cd66493 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -32,7 +32,7 @@ GEM i18n (~> 0.6, >= 0.6.4) multi_json (~> 1.0) arel (3.0.3) - autoprefixer-rails (9.4.7) + autoprefixer-rails (9.4.8) execjs aws-sdk (1.5.8) httparty (~> 0.7) @@ -160,7 +160,7 @@ GEM execjs (>= 0.3.0, < 3) uuidtools (2.1.5) will_paginate (3.1.6) - will_paginate-bootstrap (1.0.1) + will_paginate-bootstrap (1.0.2) will_paginate (>= 3.0.3) PLATFORMS @@ -174,7 +174,7 @@ DEPENDENCIES geokit-rails (= 1.1.4) image_science (= 1.2.6) jshintrb - mysql2 (~> 0.3.20) + mysql2 (< 0.4) oa-openid (= 0.3.2) open_id_authentication paperclip (~> 4.2.2) @@ -198,4 +198,4 @@ RUBY VERSION ruby 2.4.4p296 BUNDLED WITH - 1.16.2 + 1.17.1 diff --git a/MYSQL.md b/MYSQL.md new file mode 100644 index 000000000..711b3f960 --- /dev/null +++ b/MYSQL.md @@ -0,0 +1,149 @@ +# installation troubleshooting & instructions + +## System Agnostic + +- bundler skipping over **mysql2** gem? + +```Bash + +$ rm .bundle/config + +$ bundle exec bundle install + +``` + + + +## MacOS + +**Homebrew setup:** + +(Note: alternative to Homebrew is [mySQL community server](https://dev.mysql.com/downloads/mysql/5.7.html#downloads) - available for all systems) + +Dependencies: + +- `cmake` + +- `openssl` + +```Bash + +$ brew install cmake + +$ brew install openssl + +``` + +Installation: + +```Bash + +#make sure you don't have any other versions of mysql installed +$ brew list + +#if you do +$ brew uninstall +$ brew unlink + +#install 5.7 +$ brew install mysql@5.7 + +$ brew link mysql@5.7 --force +``` + +Test Usage: + +```Bash + +# install brew services +$ brew tap homebrew/services + +# cmd to run always - suggest aliasing this in your bash profile +$ brew services start mysql@5.7 + +#confirm its running +$ brew services list + +# cmd to stop running +$ brew services stop mysql@5.7 + +``` + +Update Permissions + +```Bash +# check for right permissions to the PIDs +$ ls -laF /usr/local/var/mysql/ + +# if the owner is root you should change it to mysql or username +$ sudo chown -R /usr/local/var/mysql/ + +# confirm updated permissions +$ ls -laF /usr/local/var/mysql/ + +``` + +Account Setup + +```Bash +# secure your account +$ mysql_secure_installation + +# set password +$ mysqladmin -u root password +# login -- not root anymore +$ mysql -u -p + +``` + +Permission issues above? + +(note these commands also fix the error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)) + +```Bash + +$ mysql.server stop + +#unset the temporary directory +$ echo $TMPDIR +$ unset TMPDIR +$ echo $TMPDIR + +$ whoami + +$ mysqld -initialize --verbose --user=$(whoami) --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp + +#restart mysql +$ mysql.server restart + + +$ mysql -u root + +#You should now be in the mysql command line shell +mysql> SELECT User, Host, authentication_string FROM mysql.user; + +mysql> rename user 'root'@'localhost' to ''@'localhost'; + +#confirm +mysql> SELECT User, Host, authentication_string FROM mysql.user; + +mysql> flush privileges; + +mysql> exit + +``` + +Reconfirm Access + +(whenever want to access the mysql db locally, need to run this login first - suggest aliasing in bash profile) + +```Bash + +$ mysql -u -p + +``` + + + +## Pending: please add instructions for your respective system + diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index 9e326e5bd..0198120c9 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -1,3 +1,5 @@ +References \#0000 (\<=== Add issue number here) + Make sure these boxes are checked before your pull request is ready to be reviewed and merged. Thanks! * [ ] tests pass -- `rake test` diff --git a/README.md b/README.md index b6da44829..6909011dd 100644 --- a/README.md +++ b/README.md @@ -88,14 +88,14 @@ Once NPM is installed, you should be able to run: ## Installation -You'll need at least Ruby v1.9.3 (**v2.1.x** preferred) +You'll need Ruby v2.4.4 (use your local ruby version management system - RVM / rbenv / etc. - to install and set locally) 1. Download a copy of the source with `git clone https://github.com/publiclab/mapknitter.git` 2. Install gems with `bundle install` from the rails root folder. You may need to run `bundle update` if you have older gems in your environment. 3. Copy and configure config/database.yml from config/database.yml.example, using a new empty database you've created 4. Copy and configure config/config.yml from config/config.yml.example (for now, this is only for the [Google Maps API Key, which is optional](http://stackoverflow.com/questions/2769148/whats-the-api-key-for-in-google-maps-api-v3)) 5. Initialize database with `bundle exec rake db:setup` -6. Enter ReCaptcha public and private keys in config/initializers/recaptcha.rb, copied from recaptcha.rb.example. To get keys, visit https://google.com/recaptcha/admin +6. Enter ReCaptcha public and private keys in config/initializers/recaptcha.rb, copied from recaptcha.rb.example. To get keys, visit https://www.google.com/recaptcha/admin/create 7. Install static assets (like external javascript libraries, fonts) with `bower install` 8. Start rails with `bundle exec passenger start` from the Rails root and open http://localhost:3000 in a web browser. (For some, just `passenger start` will work; adding `bundle exec` ensures you're using the version of passenger you just installed with Bundler.) diff --git a/Rakefile b/Rakefile index 8708a7df0..b6446b5e1 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,6 @@ #!/usr/bin/env rake # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. - require File.expand_path('../config/application', __FILE__) -Mapknitter::Application.load_tasks +Mapknitter::Application.load_tasks \ No newline at end of file diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d81450d1f..af72c8d3e 100755 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -34,7 +34,7 @@ def require_login unless logged_in? path_info = request.env['PATH_INFO'] flash[:warning] = "You must be logged in to access this section" - redirect_to '/login?back_to=' + URI.encode(path_info) # halts request cycle + redirect_to '/login?back_to=' + path_info.to_param # halts request cycle end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c4790d45d..2122d43c4 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -47,6 +47,6 @@ def csrf_meta_tags out % [ Rack::Utils.escape_html(request_forgery_protection_token), Rack::Utils.escape_html(form_authenticity_token) ] end - end + end end diff --git a/app/models/map.rb b/app/models/map.rb index 398a0dff3..a55e6a8ea 100755 --- a/app/models/map.rb +++ b/app/models/map.rb @@ -163,8 +163,8 @@ def average_cm_per_pixel res = 1 if res == 0 # let's not ever try to go for infinite resolution scales << res unless res == nil end - sum = (scales.inject {|sum, n| sum + n }) if scales - average = sum/count if sum + total_sum = (scales.inject {|sum, n| sum + n }) if scales + average = total_sum/count if total_sum average else 0 @@ -384,7 +384,7 @@ def has_tag(tagname) def add_tag(tagname, user) tagname = tagname.downcase unless self.has_tag(tagname) - tag = self.tags.create({ + self.tags.create({ :name => tagname, :user_id => user.id, :map_id => self.id diff --git a/app/models/user.rb b/app/models/user.rb index 1fb0572f6..0c7d0b952 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -42,7 +42,7 @@ def email=(value) end def last_action - map = self.maps.order('updated_at DESC').limit(1).first.updated_at + self.maps.order('updated_at DESC').limit(1).first.updated_at end # Permissions for editing and deleting resources diff --git a/app/models/warpable.rb b/app/models/warpable.rb index cb5da2182..82c77eb44 100755 --- a/app/models/warpable.rb +++ b/app/models/warpable.rb @@ -148,11 +148,11 @@ def generate_perspectival_distort(pxperm,path) # everything in -working/ can be deleted; # this is just so we can use the files locally outside of s3 working_directory = self.working_directory(path) - Dir.mkdir(working_directory) unless (File.exists?(working_directory) && File.directory?(working_directory)) + Dir.mkdir(working_directory) unless (File.exist?(working_directory) && File.directory?(working_directory)) local_location = working_directory+self.id.to_s+'-'+self.image_file_name.to_s directory = self.warps_directory(path) - Dir.mkdir(directory) unless (File.exists?(directory) && File.directory?(directory)) + Dir.mkdir(directory) unless (File.exist?(directory) && File.directory?(directory)) completed_local_location = directory+self.id.to_s+'.png' # everything -masked.png can be deleted diff --git a/config/boot.rb b/config/boot.rb index 4489e5868..f2830ae31 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -3,4 +3,4 @@ # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) -require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) +require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) diff --git a/config/initializers/new_rails_defaults.rb b/config/initializers/new_rails_defaults.rb deleted file mode 100644 index 78e0117cc..000000000 --- a/config/initializers/new_rails_defaults.rb +++ /dev/null @@ -1,17 +0,0 @@ -# These settings change the behavior of Rails 2 apps and will be defaults -# for Rails 3. You can remove this initializer when Rails 3 is released. - -if defined?(ActiveRecord) - # Include Active Record class name as root for JSON serialized output. - ActiveRecord::Base.include_root_in_json = true - - # Store the full class name (including module namespace) in STI type column. - ActiveRecord::Base.store_full_sti_class = true -end - -# Use ISO 8601 format for JSON serialized times and dates. -ActiveSupport.use_standard_json_time_format = true - -# Don't escape HTML entities in JSON, leave that for the #json_escape helper. -# if you're including raw json in an HTML page. -ActiveSupport.escape_html_entities_in_json = false \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 0bef45e1e..4ac38994c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,5 @@ db: - image: mysql:5.6 + image: mysql:5.7 environment: - MYSQL_DATABASE=mapknitter - MYSQL_USER=mapknitter diff --git a/lib/cartagen.rb b/lib/cartagen.rb index c910831c6..fd5496a92 100644 --- a/lib/cartagen.rb +++ b/lib/cartagen.rb @@ -20,7 +20,7 @@ def self.spherical_mercator_lat_to_y(lat,scale=10000) y * scale / 180 end - def self.spherical_mercator_y_to_lat(y,scale=10000) + def self.spherical_mercator_y_to_lat(y,scale=10000) #180/Math::PI * (2 * Math.atan(Math.exp(y/scale_factor*Math::PI/180)) - Math::PI/2) lat = (y / scale) * 180 180/Math::PI * (2 * Math.atan(Math.exp(lat * Math::PI / 180)) - Math::PI / 2) @@ -29,6 +29,7 @@ def self.spherical_mercator_y_to_lat(y,scale=10000) # collects coastline ways into collected_way relations; # see http://wiki.openstreetmap.org/wiki/Relations/Proposed/Collected_Ways def self.collect_ways(features) + # collected_ways variable unused review this function collected_ways = [] nodes = {} features['osm']['node'].each do |node| diff --git a/lib/gdal.rb b/lib/gdal.rb index d7b50b247..92109f803 100755 --- a/lib/gdal.rb +++ b/lib/gdal.rb @@ -9,10 +9,11 @@ def self.ulimit end def self.raw(cmd,verbose) + # unused variable stdin review this function stdin, stdout, stderr = Open3.popen3(self.ulimit+cmd) if verbose - puts stderr.readlines - puts stdout.readlines + puts stderr.readlines + puts stdout.readlines end end diff --git a/libmysqlclient.18.dylib b/libmysqlclient.18.dylib new file mode 120000 index 000000000..a488c8c50 --- /dev/null +++ b/libmysqlclient.18.dylib @@ -0,0 +1 @@ +/usr/local/mysql/lib/libmysqlclient.18.dylib \ No newline at end of file From 3b7ca3032d39945b2689634766a8e2cd7ad87e63 Mon Sep 17 00:00:00 2001 From: Govind Jeevan Date: Wed, 13 Mar 2019 05:04:02 +0530 Subject: [PATCH 08/32] Spam button with "ban" icon (#398) --- app/views/map/_list.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/map/_list.html.erb b/app/views/map/_list.html.erb index 05277cfbf..645201edc 100644 --- a/app/views/map/_list.html.erb +++ b/app/views/map/_list.html.erb @@ -13,7 +13,7 @@ <% if map.archived %>Archived | <% end %> View | <% if APP_CONFIG["deletion_active"] && params[:password] && params[:password] == APP_CONFIG["password"] %>">Delete | <% end %> - <% if params[:password] && params[:password] == APP_CONFIG["password"] %>">Archive/Spam | <% end %> + <% if params[:password] && params[:password] == APP_CONFIG["password"] %>"> <% end %> Updated <%= map.updated_at.to_s(:short) %> | <%= map.warpables.length %> images

From c0a2c5593d07c26992403e0443b41c22a6f8a77d Mon Sep 17 00:00:00 2001 From: Stefanni Date: Tue, 12 Mar 2019 17:16:32 -0700 Subject: [PATCH 09/32] Fix navbar medium screen sizes collapse behavior + change color (#399) --- app/assets/stylesheets/header.css.scss | 51 +++++++++++++++++++++++++- app/views/layouts/_header.html.erb | 2 +- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/header.css.scss b/app/assets/stylesheets/header.css.scss index 131e95589..49e9631a6 100644 --- a/app/assets/stylesheets/header.css.scss +++ b/app/assets/stylesheets/header.css.scss @@ -1 +1,50 @@ -body { padding-top: 65px; } \ No newline at end of file +body { + padding-top: 60px; +} + +/* override Bootstrap 3 navbar collapse for medium screen sizes */ +@media (max-width: 1200px) { + .navbar-header { + float: none; + } + + .navbar-left,.navbar-right { + float: none !important; + } + + .navbar-toggle { + display: block; + } + + .navbar-collapse { + border-top: 1px solid transparent; + box-shadow: inset 0 1px 0 rgba(255,255,255,0.1); + } + + .navbar-fixed-top { + top: 0; + border-width: 0 0 1px; + } + + .navbar-collapse.collapse { + display: none !important; + } + + .navbar-nav { + float: none !important; + margin-top: 7.5px; + } + + .navbar-nav > li { + float: none; + } + + .navbar-nav > li > a { + padding-top: 10px; + padding-bottom: 10px; + } + + .collapse.in{ + display:block !important; + } +} \ No newline at end of file diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 2e60bd342..a33847a41 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -1,4 +1,4 @@ -