diff --git a/.gitignore b/.gitignore index ea86fec..e51e042 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ config/morph.yml /coverage .vagrant +/node_modules diff --git a/.travis.yml b/.travis.yml index 36dbd57..73cfa9f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ cache: bundler services: - docker - + script: - docker-compose run web rake db:setup - - docker-compose run -e CI=true -e TRAVIS=true -e TRAVIS_BRANCH=$TRAVIS_BRANCH -e TRAVIS_COMMIT=$TRAVIS_COMMIT -e TRAVIS_JOB_NUMBER=$TRAVIS_JOB_NUMBER -e TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST -e TRAVIS_JOB_ID=$TRAVIS_JOB_ID -e TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG web rspec + - docker-compose run -e CI=true -e TRAVIS=true -e TRAVIS_BRANCH=$TRAVIS_BRANCH -e TRAVIS_COMMIT=$TRAVIS_COMMIT -e TRAVIS_JOB_NUMBER=$TRAVIS_JOB_NUMBER -e TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST -e TRAVIS_JOB_ID=$TRAVIS_JOB_ID -e TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG web bin/run-tests diff --git a/Dockerfile b/Dockerfile index b3a2332..850d4d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ FROM ruby:2.2 -RUN apt-get update && apt-get install -y build-essential zlib1g-dev libsqlite3-dev nodejs nodejs-legacy npm - -RUN npm install phantomjs-prebuilt -RUN ln -sf /node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs /usr/local/bin/ +RUN apt-get update && \ + apt-get install -y build-essential zlib1g-dev libsqlite3-dev nodejs nodejs-legacy npm \ + libxml2-dev libxslt1-dev pkg-config \ + libqt4-webkit libqt4-dev xvfb RUN mkdir -p /app @@ -10,6 +10,7 @@ WORKDIR /tmp COPY Gemfile Gemfile COPY Gemfile.lock Gemfile.lock +RUN bundle config build.nokogiri --use-system-libraries RUN bundle install ADD . /app diff --git a/Gemfile b/Gemfile index 3e28add..ef65fc5 100644 --- a/Gemfile +++ b/Gemfile @@ -22,7 +22,7 @@ gem 'jquery-rails' # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks gem 'turbolinks' # Assets -gem 'foundation-rails' +gem 'foundation-rails', '~> 5.5' gem 'validate_url' @@ -44,7 +44,7 @@ group :development do gem 'spring-commands-rspec' gem 'quiet_assets' gem 'awesome_print' - gem 'guard-rspec', require: false + # gem 'guard-rspec', require: false # gem 'terminal-notifier-guard' # FIXME cross-platform end @@ -64,7 +64,7 @@ group :test do gem 'test_after_commit' # TODO remove when moving to rails 5 gem 'database_cleaner' gem 'coveralls', require: false - gem 'poltergeist' + gem 'capybara-webkit' end # Use ActiveModel has_secure_password diff --git a/Gemfile.lock b/Gemfile.lock index 8d8f4d7..570497e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,253 +1,216 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.1) - actionpack (= 4.2.1) - actionview (= 4.2.1) - activejob (= 4.2.1) + actionmailer (4.2.6) + actionpack (= 4.2.6) + actionview (= 4.2.6) + activejob (= 4.2.6) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.1) - actionview (= 4.2.1) - activesupport (= 4.2.1) + actionpack (4.2.6) + actionview (= 4.2.6) + activesupport (= 4.2.6) rack (~> 1.6) rack-test (~> 0.6.2) rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.1) - actionview (4.2.1) - activesupport (= 4.2.1) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (4.2.6) + activesupport (= 4.2.6) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.1) - activejob (4.2.1) - activesupport (= 4.2.1) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + activejob (4.2.6) + activesupport (= 4.2.6) globalid (>= 0.3.0) - activemodel (4.2.1) - activesupport (= 4.2.1) + activemodel (4.2.6) + activesupport (= 4.2.6) builder (~> 3.1) - activerecord (4.2.1) - activemodel (= 4.2.1) - activesupport (= 4.2.1) + activerecord (4.2.6) + activemodel (= 4.2.6) + activesupport (= 4.2.6) arel (~> 6.0) - activesupport (4.2.1) + activesupport (4.2.6) i18n (~> 0.7) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - addressable (2.3.8) - arel (6.0.0) + addressable (2.4.0) + arel (6.0.3) awesome_print (1.6.1) builder (3.2.2) - capybara (2.4.4) + capybara (2.7.1) + addressable mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (~> 2.0) - cliver (0.3.2) - coderay (1.1.0) - coffee-rails (4.1.0) + capybara-webkit (1.11.1) + capybara (>= 2.3.0, < 2.8.0) + json + coderay (1.1.1) + coffee-rails (4.1.1) coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.0) + railties (>= 4.0.0, < 5.1.x) coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.9.1.1) + coffee-script-source (1.10.0) + concurrent-ruby (1.0.2) coveralls (0.8.13) json (~> 1.8) simplecov (~> 0.11.0) term-ansicolor (~> 1.3) thor (~> 0.19.1) tins (~> 1.6.0) - database_cleaner (1.5.1) + database_cleaner (1.5.3) diff-lcs (1.2.5) docile (1.1.5) - elasticsearch (1.0.8) - elasticsearch-api (= 1.0.7) - elasticsearch-transport (= 1.0.7) - elasticsearch-api (1.0.7) + elasticsearch (1.0.17) + elasticsearch-api (= 1.0.17) + elasticsearch-transport (= 1.0.17) + elasticsearch-api (1.0.17) multi_json - elasticsearch-dsl (0.1.0) - elasticsearch-model (0.1.7) + elasticsearch-dsl (0.1.3) + elasticsearch-model (0.1.8) activesupport (> 3) elasticsearch (> 0.4) hashie - elasticsearch-transport (1.0.7) + elasticsearch-transport (1.0.17) faraday multi_json erubis (2.7.0) - execjs (2.5.2) - factory_girl (4.5.0) + execjs (2.6.0) + factory_girl (4.7.0) activesupport (>= 3.0.0) - factory_girl_rails (4.5.0) - factory_girl (~> 4.5.0) + factory_girl_rails (4.7.0) + factory_girl (~> 4.7.0) railties (>= 3.0.0) - faker (1.4.3) + faker (1.6.3) i18n (~> 0.5) - faraday (0.9.1) + faraday (0.9.2) multipart-post (>= 1.2, < 3) - ffi (1.9.10) - ffi (1.9.10-x64-mingw32) - formatador (0.2.5) - foundation-rails (5.5.1.2) + foundation-rails (5.5.3.2) railties (>= 3.1.0) sass (>= 3.3.0, < 3.5) - globalid (0.3.5) + globalid (0.3.6) activesupport (>= 4.1.0) - guard (2.13.0) - formatador (>= 0.2.4) - listen (>= 2.7, <= 4.0) - lumberjack (~> 1.0) - nenv (~> 0.1) - notiffany (~> 0.0) - pry (>= 0.9.12) - shellany (~> 0.0) - thor (>= 0.18.1) - guard-compat (1.2.1) - guard-rspec (4.6.4) - guard (~> 2.1) - guard-compat (~> 1.1) - rspec (>= 2.99.0, < 4.0) - hashie (3.4.1) + hashie (3.4.4) i18n (0.7.0) - jquery-rails (4.0.3) - rails-dom-testing (~> 1.0) + jquery-rails (4.1.1) + rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - json (1.8.2) + json (1.8.3) kaminari (0.16.3) actionpack (>= 3.0.0) activesupport (>= 3.0.0) - kaminari-i18n (0.3.2) + kaminari-i18n (0.4.0) kaminari rails launchy (2.4.3) addressable (~> 2.3) - listen (3.0.6) - rb-fsevent (>= 0.9.3) - rb-inotify (>= 0.9.7) - loofah (2.0.1) + loofah (2.0.3) nokogiri (>= 1.5.9) - lumberjack (1.0.10) - mail (2.6.3) - mime-types (>= 1.16, < 3) + mail (2.6.4) + mime-types (>= 1.16, < 4) method_source (0.8.2) - mime-types (2.5) - mini_portile (0.6.2) - minitest (5.6.0) - multi_json (1.11.0) + mime-types (3.0) + mime-types-data (~> 3.2015) + mime-types-data (3.2016.0221) + mini_portile2 (2.0.0) + minitest (5.8.4) + multi_json (1.12.0) multipart-post (2.0.0) - nenv (0.3.0) - nokogiri (1.6.6.2) - mini_portile (~> 0.6.0) - nokogiri (1.6.6.2-x64-mingw32) - mini_portile (~> 0.6.0) - notiffany (0.0.8) - nenv (~> 0.1) - shellany (~> 0.0) - omniauth (1.2.2) + nokogiri (1.6.7.2) + mini_portile2 (~> 2.0.0.rc2) + nokogiri (1.6.7.2-x64-mingw32) + mini_portile2 (~> 2.0.0.rc2) + omniauth (1.3.1) hashie (>= 1.2, < 4) - rack (~> 1.0) + rack (>= 1.0, < 3) omniauth-browserid (0.0.1) faraday multi_json omniauth (~> 1.0) - poltergeist (1.9.0) - capybara (~> 2.1) - cliver (~> 0.3.1) - multi_json (~> 1.0) - websocket-driver (>= 0.2.0) - pry (0.10.1) + pry (0.10.3) coderay (~> 1.1.0) method_source (~> 0.8.1) slop (~> 3.4) - pry (0.10.1-x64-mingw32) - coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) - win32console (~> 1.3) pry-rails (0.3.4) pry (>= 0.9.10) quiet_assets (1.1.0) railties (>= 3.1, < 5.0) - rack (1.6.0) + rack (1.6.4) rack-test (0.6.3) rack (>= 1.0) - rails (4.2.1) - actionmailer (= 4.2.1) - actionpack (= 4.2.1) - actionview (= 4.2.1) - activejob (= 4.2.1) - activemodel (= 4.2.1) - activerecord (= 4.2.1) - activesupport (= 4.2.1) + rails (4.2.6) + actionmailer (= 4.2.6) + actionpack (= 4.2.6) + actionview (= 4.2.6) + activejob (= 4.2.6) + activemodel (= 4.2.6) + activerecord (= 4.2.6) + activesupport (= 4.2.6) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.1) + railties (= 4.2.6) sprockets-rails rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.6) + rails-dom-testing (1.0.7) activesupport (>= 4.2.0.beta, < 5.0) nokogiri (~> 1.6.0) rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.0.2) + rails-html-sanitizer (1.0.3) loofah (~> 2.0) - rails-i18n (4.0.4) - i18n (~> 0.6) + rails-i18n (4.0.8) + i18n (~> 0.7) railties (~> 4.0) - railties (4.2.1) - actionpack (= 4.2.1) - activesupport (= 4.2.1) + railties (4.2.6) + actionpack (= 4.2.6) + activesupport (= 4.2.6) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (10.4.2) - rb-fsevent (0.9.7) - rb-inotify (0.9.7) - ffi (>= 0.5.0) - rdoc (4.2.0) + rake (11.1.2) + rdoc (4.2.2) json (~> 1.4) - rspec (3.3.0) - rspec-core (~> 3.3.0) - rspec-expectations (~> 3.3.0) - rspec-mocks (~> 3.3.0) - rspec-core (3.3.2) - rspec-support (~> 3.3.0) - rspec-expectations (3.3.1) + rspec-core (3.4.4) + rspec-support (~> 3.4.0) + rspec-expectations (3.4.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.3.0) - rspec-mocks (3.3.2) + rspec-support (~> 3.4.0) + rspec-mocks (3.4.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.3.0) - rspec-rails (3.3.3) + rspec-support (~> 3.4.0) + rspec-rails (3.4.2) actionpack (>= 3.0, < 4.3) activesupport (>= 3.0, < 4.3) railties (>= 3.0, < 4.3) - rspec-core (~> 3.3.0) - rspec-expectations (~> 3.3.0) - rspec-mocks (~> 3.3.0) - rspec-support (~> 3.3.0) - rspec-support (3.3.0) - sass (3.4.13) - sass-rails (5.0.3) + rspec-core (~> 3.4.0) + rspec-expectations (~> 3.4.0) + rspec-mocks (~> 3.4.0) + rspec-support (~> 3.4.0) + rspec-support (3.4.1) + sass (3.4.22) + sass-rails (5.0.4) railties (>= 4.0.0, < 5.0) sass (~> 3.1) sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) - tilt (~> 1.1) + tilt (>= 1.1, < 3) sdoc (0.4.1) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) - shellany (0.0.1) shoulda-matchers (3.1.1) activesupport (>= 4.0.0) - simplecov (0.11.1) + simplecov (0.11.2) docile (~> 1.1.0) json (~> 1.8) simplecov-html (~> 0.10.0) simplecov-html (0.10.0) - slim (3.0.3) + slim (3.0.6) temple (~> 0.7.3) tilt (>= 1.3.3, < 2.1) slim-rails (3.0.1) @@ -257,42 +220,38 @@ GEM railties (>= 3.1, < 5.0) slim (~> 3.0) slop (3.6.0) - spring (1.6.4) + spring (1.7.1) spring-commands-rspec (1.0.4) spring (>= 0.9.1) - sprockets (3.0.2) - rack (~> 1.0) - sprockets-rails (2.2.4) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (>= 2.8, < 4.0) - sqlite3 (1.3.10) - sqlite3 (1.3.10-x64-mingw32) - temple (0.7.5) + sprockets (3.6.0) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.0.4) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sqlite3 (1.3.11) + sqlite3 (1.3.11-x64-mingw32) + temple (0.7.6) term-ansicolor (1.3.2) tins (~> 1.0) - test_after_commit (0.4.2) + test_after_commit (1.0.0) activerecord (>= 3.2) thor (0.19.1) thread_safe (0.3.5) - tilt (1.4.1) + tilt (2.0.2) tins (1.6.0) turbolinks (2.5.3) coffee-rails tzinfo (1.2.2) thread_safe (~> 0.1) - tzinfo-data (1.2015.7) + tzinfo-data (1.2016.4) tzinfo (>= 1.0.0) - uglifier (2.7.1) - execjs (>= 0.3.0) - json (>= 1.8.0) + uglifier (3.0.0) + execjs (>= 0.3.0, < 3) validate_url (1.0.2) activemodel (>= 3.0.0) addressable - websocket-driver (0.6.3) - websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.2) - win32console (1.3.2) xpath (2.0.0) nokogiri (~> 1.3) @@ -303,6 +262,7 @@ PLATFORMS DEPENDENCIES awesome_print capybara + capybara-webkit coffee-rails coveralls database_cleaner @@ -311,15 +271,13 @@ DEPENDENCIES elasticsearch-model factory_girl_rails faker - foundation-rails - guard-rspec + foundation-rails (~> 5.5) jquery-rails kaminari kaminari-i18n launchy omniauth omniauth-browserid - poltergeist pry pry-rails quiet_assets @@ -339,3 +297,6 @@ DEPENDENCIES tzinfo-data uglifier validate_url + +BUNDLED WITH + 1.11.2 diff --git a/README.md b/README.md index 1fa8178..14303d8 100644 --- a/README.md +++ b/README.md @@ -6,24 +6,24 @@ ## Usage / Features -The Stadtratmonitor Leipzig is a lightweight user interface for performing full text searches against paper contents issued to the city council of Leipzig. Note, this solution uses the data from [Ratsinformationssystem Leipzig](https://ratsinfo.leipzig.de/bi/allris.net.asp) that also offers [text search capabilities](https://ratsinfo.leipzig.de/bi/yw010.asp). +The Stadtratmonitor Leipzig is a lightweight user interface for performing full text searches against paper contents issued to the city council of Leipzig. Note, this solution uses the data from [Ratsinformationssystem Leipzig](https://ratsinfo.leipzig.de/bi/allris.net.asp) that also offers [text search capabilities](https://ratsinfo.leipzig.de/bi/yw010.asp). ### Sorting * Sort by date, paper was issued - + ![Papers sorted by publishing date](https://cloud.githubusercontent.com/assets/994131/14060246/b29c0356-f35e-11e5-837a-2106dd274694.JPG) * Sort by relevance, e.g. how often the search keyword appears inside the title resp. the content of the paper - + ![Papers sorted by relevance](https://cloud.githubusercontent.com/assets/994131/14060257/f7491002-f35e-11e5-9d39-f36b81c35c33.JPG) ### Filtering * By paper type - + ![Filter by paper type](https://cloud.githubusercontent.com/assets/994131/14060263/28c9d800-f35f-11e5-8c56-e8d208d85916.JPG) * By originator - + ![Filter by originator](https://cloud.githubusercontent.com/assets/994131/14060267/4fa539a6-f35f-11e5-981e-2467daf2dee2.JPG) ### Staying up-to-date @@ -38,7 +38,7 @@ The Stadtratmonitor Leipzig is a lightweight user interface for performing full #### Example using Firefox and RSSOWL Click on the newsfeed icon in the address bar -![Abonnieren mit Firefox](https://cloud.githubusercontent.com/assets/994131/14060508/fe7f4514-f366-11e5-85ae-2fa2e50b91ea.JPG) +![Abonnieren mit Firefox](https://cloud.githubusercontent.com/assets/994131/14060508/fe7f4514-f366-11e5-85ae-2fa2e50b91ea.JPG) Copy the URL from the address bar ![RSS URL in Firefox](https://cloud.githubusercontent.com/assets/994131/14060515/30140e98-f367-11e5-9c77-86ba626e3c1b.JPG) @@ -76,3 +76,9 @@ docker. Edit the morph.yml file and insert the Morph API key 1. Import the data from our scraper: `docker-compose run web rake import_papers` 1. Build the elasticsearch index: `docker-compose run web rake index:rebuild` + +### Running tests + +Assuming docker and docker-compose is installed: + +1. `docker-compose run web bin/run-tests` diff --git a/bin/run-tests b/bin/run-tests new file mode 100755 index 0000000..0e63669 --- /dev/null +++ b/bin/run-tests @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +xvfb-run bundle exec rspec diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb index bbcfd25..27d05a8 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -1,2 +1 @@ -require 'capybara/poltergeist' -Capybara.javascript_driver = :poltergeist +Capybara.javascript_driver = :webkit