From: Matt Amos Date: Mon, 3 Nov 2014 11:08:13 +0000 (+0000) Subject: Merge remote-tracking branch 'upstream/master' into routing X-Git-Tag: live~5333^2~14^2 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/a3eb48385bcf1465339d473c0c1657e075cd507d?hp=bf5f842c23a469cf2098ae7953f1f8cd9534e361 Merge remote-tracking branch 'upstream/master' into routing Conflicts: app/assets/javascripts/index.js app/assets/javascripts/leaflet.map.js.erb config/environments/production.rb config/locales/de.yml --- diff --git a/.gitignore b/.gitignore index 837249e00..edfd387ab 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,7 @@ tmp .DS_Store *~ doc +.vagrant +.ruby-gemset +.ruby-version +.idea \ No newline at end of file diff --git a/CONFIGURE.md b/CONFIGURE.md index 8cae440bd..36c5586d8 100644 --- a/CONFIGURE.md +++ b/CONFIGURE.md @@ -6,7 +6,17 @@ After [installing](INSTALL.md) this software, you may need to carry out some of Your installation comes with no geographic data loaded. You can either create new data using one of the editors (Potlatch 2, iD, JOSM etc) or by loading an OSM extract. -* Use this [yet-to-be-written script](https://github.com/openstreetmap/openstreetmap-website/issues/282) +After installing but before creating any users or data, import an extract with [Osmosis](http://wiki.openstreetmap.org/wiki/Osmosis) and the [``--write-apidb``](http://wiki.openstreetmap.org/wiki/Osmosis/Detailed_Usage#--write-apidb_.28--wd.29) task. + +``` +osmosis --read-pbf greater-london-latest.osm.pbf \ + --write-apidb host="localhost" database="openstreetmap" \ + user="openstreetmap" password="" validateSchemaVersion="no" +``` + +Loading an apidb database with Osmosis is about **twenty** times slower than loading the equivalent data with osm2pgsql into a rendering database. [``--log-progress``](http://wiki.openstreetmap.org/wiki/Osmosis/Detailed_Usage#--log-progress_.28--lp.29) may be desirable for status updates. + +To be able to edit the data you have loaded, you will need to use this [yet-to-be-written script](https://github.com/openstreetmap/openstreetmap-website/issues/282). ## Managing Users @@ -115,3 +125,5 @@ If you want to deploy The Rails Port for production use, you'll need to make a f * Your production database will also need the extensions and functions installed - see [INSTALL.md](INSTALL.md) * The included version of the map call is quite slow and eats a lot of memory. You should consider using [CGIMap](https://github.com/zerebubuth/openstreetmap-cgimap) instead. * The included version of the GPX importer is slow and/or completely inoperable. You should consider using [the high-speed GPX importer](http://git.openstreetmap.org/gpx-import.git/). +* Make sure you precompile the production assets: `RAILS_ENV=production rake assets:precompile` +* Make sure the web server user as well as the rails user can read, write and create directories in `tmp/`. diff --git a/Gemfile b/Gemfile index d98a2a1fc..fd8e46b9f 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ -source 'http://rubygems.org' +source 'https://rubygems.org' # Require rails -gem 'rails', '4.0.3' +gem 'rails', '4.1.6' # Require things which have moved to gems in ruby 1.9 gem 'bigdecimal', "~> 1.1.0", :platforms => :ruby_19 @@ -16,7 +16,7 @@ gem 'json' gem 'pg' # Use SCSS for stylesheets -gem 'sass-rails', '~> 4.0.0' +gem 'sass-rails', '~> 4.0.3' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' @@ -34,6 +34,9 @@ gem 'jsonify-rails' # Use R2 for RTL conversion gem 'r2' +# Use autoprefixer to generate CSS prefixes +gem 'autoprefixer-rails' + # Load rails plugins gem 'rails-i18n', "~> 4.0.0" gem 'dynamic_form' @@ -41,7 +44,7 @@ gem 'rinku', '>= 1.2.2', :require => 'rails_rinku' gem 'oauth-plugin', '>= 0.5.1' gem 'open_id_authentication', '>= 1.1.0' gem 'validates_email_format_of', '>= 1.5.1' -gem 'composite_primary_keys', '>= 6.0.1' +gem 'composite_primary_keys', '~> 7.0.11' gem 'http_accept_language', '~> 2.0.0' gem 'paperclip', '~> 4.0' gem 'deadlock_retry', '>= 1.2.0' @@ -84,7 +87,7 @@ end # Gems needed for running tests group :test do gem 'timecop' - gem 'minitest', '~> 4.7.0', :platforms => [:ruby_19, :ruby_20] + gem 'minitest', '~> 5.1', :platforms => [:ruby_19, :ruby_20] end # Needed in development as well so rake can see konacha tasks diff --git a/Gemfile.lock b/Gemfile.lock index d477fcfca..48d6013bf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,38 +1,41 @@ GEM - remote: http://rubygems.org/ + remote: https://rubygems.org/ specs: SystemTimer (1.2.3) - actionmailer (4.0.3) - actionpack (= 4.0.3) - mail (~> 2.5.4) - actionpack (4.0.3) - activesupport (= 4.0.3) - builder (~> 3.1.0) - erubis (~> 2.7.0) + actionmailer (4.1.6) + actionpack (= 4.1.6) + actionview (= 4.1.6) + mail (~> 2.5, >= 2.5.4) + actionpack (4.1.6) + actionview (= 4.1.6) + activesupport (= 4.1.6) rack (~> 1.5.2) rack-test (~> 0.6.2) actionpack-page_caching (1.0.2) actionpack (>= 4.0.0, < 5) - activemodel (4.0.3) - activesupport (= 4.0.3) - builder (~> 3.1.0) - activerecord (4.0.3) - activemodel (= 4.0.3) - activerecord-deprecated_finders (~> 1.0.2) - activesupport (= 4.0.3) - arel (~> 4.0.0) - activerecord-deprecated_finders (1.0.3) - activesupport (4.0.3) - i18n (~> 0.6, >= 0.6.4) - minitest (~> 4.2) - multi_json (~> 1.3) + actionview (4.1.6) + activesupport (= 4.1.6) + builder (~> 3.1) + erubis (~> 2.7.0) + activemodel (4.1.6) + activesupport (= 4.1.6) + builder (~> 3.1) + activerecord (4.1.6) + activemodel (= 4.1.6) + activesupport (= 4.1.6) + arel (~> 5.0.0) + activesupport (4.1.6) + i18n (~> 0.6, >= 0.6.9) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) thread_safe (~> 0.1) - tzinfo (~> 0.3.37) - arel (4.0.2) - atomic (1.1.15) + tzinfo (~> 1.1) + arel (5.0.1.20140414130214) + autoprefixer-rails (3.1.1.20141001) + execjs bigdecimal (1.1.0) - builder (3.1.4) - capybara (2.2.1) + builder (3.2.2) + capybara (2.4.3) mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) @@ -41,32 +44,33 @@ GEM climate_control (0.0.3) activesupport (>= 3.0) cliver (0.3.2) - cocaine (0.5.3) + cocaine (0.5.4) climate_control (>= 0.0.3, < 1.0) coffee-rails (4.0.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.0) - coffee-script (2.2.0) + coffee-script (2.3.0) coffee-script-source execjs - coffee-script-source (1.7.0) - colorize (0.6.0) - composite_primary_keys (6.0.1) - activerecord (>= 4.0.0) - dalli (2.7.0) + coffee-script-source (1.8.0) + colorize (0.7.3) + composite_primary_keys (7.0.11) + activerecord (= 4.1.6) + crass (0.2.1) + dalli (2.7.2) deadlock_retry (1.2.0) dynamic_form (1.1.4) erubis (2.7.0) - execjs (2.0.2) + execjs (2.2.1) faraday (0.9.0) multipart-post (>= 1.2, < 3) hike (1.2.3) - htmlentities (4.3.1) - http_accept_language (2.0.1) - httpclient (2.3.4.1) - i18n (0.6.9) + htmlentities (4.3.2) + http_accept_language (2.0.2) + httpclient (2.4.0) + i18n (0.6.11) iconv (0.1) - jquery-rails (3.1.0) + jquery-rails (3.1.2) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) json (1.8.1) @@ -75,36 +79,36 @@ GEM jsonify-rails (0.3.2) actionpack jsonify (< 0.4.0) - jwt (0.1.11) - multi_json (>= 1.5) + jwt (1.0.0) kgio (2.9.2) - konacha (3.1.0) + konacha (3.2.4) actionpack (>= 3.1, < 5) capybara colorize railties (>= 3.1, < 5) sprockets libxml-ruby (2.7.0) - mail (2.5.4) - mime-types (~> 1.16) - treetop (~> 1.4.8) - mime-types (1.25.1) - mini_portile (0.5.2) - minitest (4.7.5) - multi_json (1.8.4) + mail (2.6.1) + mime-types (>= 1.16, < 3) + mime-types (2.4.1) + mini_portile (0.6.0) + minitest (5.4.2) + multi_json (1.10.1) multi_xml (0.5.5) multipart-post (2.0.0) - nokogiri (1.6.1) - mini_portile (~> 0.5.0) + nokogiri (1.6.3.1) + mini_portile (= 0.6.0) + nokogumbo (1.1.12) + nokogiri oauth (0.4.7) oauth-plugin (0.5.1) multi_json oauth (~> 0.4.4) oauth2 (>= 0.5.0) rack - oauth2 (0.9.3) + oauth2 (1.0.0) faraday (>= 0.8, < 0.10) - jwt (~> 0.1.8) + jwt (~> 1.0) multi_json (~> 1.3) multi_xml (~> 0.5) rack (~> 1.2) @@ -112,20 +116,19 @@ GEM rack-openid (~> 1.3) openstreetmap-i18n-js (3.0.0.rc5.3) i18n - paperclip (4.1.1) + paperclip (4.2.0) activemodel (>= 3.0.0) activesupport (>= 3.0.0) cocaine (~> 0.5.3) mime-types pg (0.17.1) - poltergeist (1.5.0) + poltergeist (1.5.1) capybara (~> 2.1) cliver (~> 0.3.1) multi_json (~> 1.0) websocket-driver (>= 0.2.0) - polyglot (0.3.4) - psych (2.0.4) - r2 (0.2.2) + psych (2.0.6) + r2 (0.2.5) rack (1.5.2) rack-cors (0.2.9) rack-openid (1.4.2) @@ -133,58 +136,61 @@ GEM ruby-openid (>= 2.1.8) rack-test (0.6.2) rack (>= 1.0) - rails (4.0.3) - actionmailer (= 4.0.3) - actionpack (= 4.0.3) - activerecord (= 4.0.3) - activesupport (= 4.0.3) + rails (4.1.6) + actionmailer (= 4.1.6) + actionpack (= 4.1.6) + actionview (= 4.1.6) + activemodel (= 4.1.6) + activerecord (= 4.1.6) + activesupport (= 4.1.6) bundler (>= 1.3.0, < 2.0) - railties (= 4.0.3) - sprockets-rails (~> 2.0.0) - rails-i18n (4.0.1) + railties (= 4.1.6) + sprockets-rails (~> 2.0) + rails-i18n (4.0.3) i18n (~> 0.6) - rails (~> 4.0) - railties (4.0.3) - actionpack (= 4.0.3) - activesupport (= 4.0.3) + railties (~> 4.0) + railties (4.1.6) + actionpack (= 4.1.6) + activesupport (= 4.1.6) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (10.1.1) - redcarpet (3.1.1) + rake (10.3.2) + redcarpet (3.1.2) rinku (1.7.3) ruby-openid (2.5.0) - sanitize (2.1.0) + sanitize (3.0.2) + crass (~> 0.2.0) nokogiri (>= 1.4.4) - sass (3.2.14) - sass-rails (4.0.1) + nokogumbo (= 1.1.12) + sass (3.2.19) + sass-rails (4.0.3) railties (>= 4.0.0, < 5.0) - sass (>= 3.1.10) - sprockets-rails (~> 2.0.0) + sass (~> 3.2.0) + sprockets (~> 2.8, <= 2.11.0) + sprockets-rails (~> 2.0) soap4r-ruby1.9 (2.0.5) sprockets (2.11.0) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.0.1) + sprockets-rails (2.1.4) actionpack (>= 3.0) activesupport (>= 3.0) sprockets (~> 2.8) - thor (0.18.1) - thread_safe (0.2.0) - atomic (>= 1.1.7, < 2) + thor (0.19.1) + thread_safe (0.3.4) tilt (1.4.1) timecop (0.7.1) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.38) - uglifier (2.4.0) + tzinfo (1.2.2) + thread_safe (~> 0.1) + uglifier (2.5.3) execjs (>= 0.3.0) json (>= 1.8.0) - validates_email_format_of (1.5.3) - vendorer (0.1.14) - websocket-driver (0.3.2) + validates_email_format_of (1.6.1) + i18n + vendorer (0.1.16) + websocket-driver (0.3.5) xpath (2.0.0) nokogiri (~> 1.3) @@ -194,9 +200,10 @@ PLATFORMS DEPENDENCIES SystemTimer (>= 1.1.3) actionpack-page_caching + autoprefixer-rails bigdecimal (~> 1.1.0) coffee-rails (~> 4.0.0) - composite_primary_keys (>= 6.0.1) + composite_primary_keys (~> 7.0.11) dalli deadlock_retry (>= 1.2.0) dynamic_form @@ -210,7 +217,7 @@ DEPENDENCIES kgio konacha libxml-ruby (>= 2.0.5) - minitest (~> 4.7.0) + minitest (~> 5.1) oauth-plugin (>= 0.5.1) open_id_authentication (>= 1.1.0) openstreetmap-i18n-js (>= 3.0.0.rc5.3) @@ -220,13 +227,13 @@ DEPENDENCIES psych r2 rack-cors - rails (= 4.0.3) + rails (= 4.1.6) rails-i18n (~> 4.0.0) redcarpet rinku (>= 1.2.2) ruby-openid (>= 2.2.0) sanitize - sass-rails (~> 4.0.0) + sass-rails (~> 4.0.3) soap4r-ruby1.9 timecop uglifier (>= 1.3.0) diff --git a/INSTALL.md b/INSTALL.md index 2f954d106..780ffdf07 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -3,11 +3,12 @@ These instructions are designed for setting up The Rails Port for development and testing. If you want to deploy the software for your own project, then see the notes at the end. +You can install the software directly on your machine, which is the traditional and probably best-bupported approach. However, there is an alternative which may be easier: Vagrant. This installs the software into a virtual machine, which makes it easier to get a consistent development environment and may avoid installation difficulties. For Vagrant instructions, see [VAGRANT.md](VAGRANT.md). + These instructions are based on Ubuntu 12.04 LTS, which is the platform used by the OSMF servers. The instructions also work, with only minor amendments, for all other current Ubuntu releases, Fedora and MacOSX -We don't recommend attempting to develop or deploy this software on Windows. If you need to use Windows, then -try developing this sofware using Ubuntu in a virtual machine. +We don't recommend attempting to develop or deploy this software on Windows. If you need to use Windows, then try developing this sofware using Ubuntu in a virtual machine, or use [Vagrant](VAGRANT.md). ## Dependencies @@ -32,7 +33,7 @@ sudo apt-get install ruby1.9.1 libruby1.9.1 ruby1.9.1-dev ri1.9.1 \ apache2 apache2-threaded-dev build-essential git-core \ postgresql postgresql-contrib libpq-dev postgresql-server-dev-all \ libsasl2-dev -gem1.9.1 install bundle +sudo gem1.9.1 install bundler ``` Note that the "1.9.1" Ubuntu packages do in fact contain ruby 1.9.3. diff --git a/VAGRANT.md b/VAGRANT.md new file mode 100644 index 000000000..0155a3383 --- /dev/null +++ b/VAGRANT.md @@ -0,0 +1,46 @@ +# Installing Vagrant + +On Ubuntu, it should be as simple as: + +``` +sudo apt-get install vagrant +``` + +Other Linux distributions should have similar installation instructions using `yum` or similar. + +Installers are available for Mac OS X and Windows, please see the [Vagrant project download page](http://www.vagrantup.com/downloads) for more information. + +# Setting up openstreetmap-website + +Once Vagrant has been installed, you can start an environment by checking out the openstreetmap-website code if you haven't already, then changing to the directory which contains the Vagrantfile by typing: + +``` +git clone git@github.com:openstreetmap/openstreetmap-website.git +cd openstreetmap-website +vagrant up +``` + +This will take a few minutes to download required software from the internet and set it up as a running system. Once it is complete, you should be able to log into the running VM by typing: + +``` +vagrant ssh +``` + +Within this login shell, you can do development, run the server or the tests. For example, to run the tests: + +``` +cd /srv/openstreetmap-website/ +rake test +``` + +To access the web pages you run the following commands then access the site in your [local browser](http://localhost:3000): + +``` +vagrant ssh +cd /srv/openstreetmap-website/ +rails server +``` + +You edit the code on your computer using the code editor you are used to using, then through shared folders the code is updated on the VM instantly. + +You should run the tests before submitting any patch or Pull Request back to the original repository. Please see [CONTRIBUTING.md](CONTRIBUTING.md) for more information. diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 000000000..5489192f4 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,16 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.box = "precise64" + config.vm.box_url = "http://files.vagrantup.com/precise64.box" + + # port forward for webrick on 3000 + config.vm.network :forwarded_port, guest: 3000, host: 3000 + + # set up synced folder to source in /srv/openstreetmap-website + config.vm.synced_folder ".", "/srv/openstreetmap-website" + + # provision using a simple shell script + config.vm.provision :shell, :path => "script/vagrant/setup/provision.sh" +end diff --git a/Vendorfile b/Vendorfile index 0cca4055c..c2267a6d8 100644 --- a/Vendorfile +++ b/Vendorfile @@ -11,13 +11,13 @@ folder 'vendor/assets' do end folder 'leaflet' do - file 'leaflet.js', 'http://cdn.leafletjs.com/leaflet-0.7.2/leaflet-src.js' - file 'leaflet.css', 'http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css' + file 'leaflet.js', 'http://cdn.leafletjs.com/leaflet-0.7.3/leaflet-src.js' + file 'leaflet.css', 'http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css' [ 'layers.png', 'layers-2x.png', 'marker-icon.png', 'marker-icon-2x.png', 'marker-shadow.png' ].each do |image| - file "images/#{image}", "http://cdn.leafletjs.com/leaflet-0.7.2/images/#{image}" + file "images/#{image}", "http://cdn.leafletjs.com/leaflet-0.7.3/images/#{image}" end from 'git://github.com/kajic/leaflet-locationfilter.git' do diff --git a/app/assets/images/browse/caravan_park.n.16.png b/app/assets/images/browse/caravan_park.n.16.png new file mode 100644 index 000000000..a4b35a433 Binary files /dev/null and b/app/assets/images/browse/caravan_park.n.16.png differ diff --git a/app/assets/images/browse/caravan_park.p.24.png b/app/assets/images/browse/caravan_park.p.24.png deleted file mode 100644 index 751f5204b..000000000 Binary files a/app/assets/images/browse/caravan_park.p.24.png and /dev/null differ diff --git a/app/assets/images/browse/parking.p.16.png b/app/assets/images/browse/parking.p.16.png index 5860900cf..51660458a 100644 Binary files a/app/assets/images/browse/parking.p.16.png and b/app/assets/images/browse/parking.p.16.png differ diff --git a/app/assets/images/sotm.png b/app/assets/images/sotm.png new file mode 100644 index 000000000..3df02876d Binary files /dev/null and b/app/assets/images/sotm.png differ diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 6ac398fc5..09ae367f4 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -22,19 +22,22 @@ var querystring = require('querystring-component'); function remoteEditHandler(bbox, object) { var loaded = false, - query = { - left: bbox.getWest() - 0.0001, - top: bbox.getNorth() + 0.0001, - right: bbox.getEast() + 0.0001, - bottom: bbox.getSouth() - 0.0001 - }; + url = document.location.protocol === "https:" ? + "https://127.0.0.1:8112/load_and_zoom?" : + "http://127.0.0.1:8111/load_and_zoom?", + query = { + left: bbox.getWest() - 0.0001, + top: bbox.getNorth() + 0.0001, + right: bbox.getEast() + 0.0001, + bottom: bbox.getSouth() - 0.0001 + }; if (object) query.select = object.type + object.id; var iframe = $('