diff --git a/.babelrc b/.babelrc new file mode 100644 index 000000000..638d54797 --- /dev/null +++ b/.babelrc @@ -0,0 +1,27 @@ +{ + "plugins": [ + "transform-decorators-legacy", + "syntax-dynamic-import", + "transform-object-rest-spread", + ["transform-class-properties", { + "spec": true + }] + ], + "presets": [ + ["env", { + "modules": false, + "targets": { + "browsers": "> 1%", + "uglify": true + }, + "useBuiltIns": true + }], + "react" + ], + "env": { + "testing": { + "plugins": ["transform-decorators-legacy"], + "presets": ["es2015", "react", "stage-0"] + } + } +} \ No newline at end of file diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..b429316bb --- /dev/null +++ b/.editorconfig @@ -0,0 +1,2 @@ +[*] +indent_size = 2 diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 000000000..9c1755c6e --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,43 @@ +{ + "env": { + "browser": true, + "es6": true + }, + "extends": [ + "eslint:recommended", + "plugin:react/recommended" + ], + "parser": "babel-eslint", + "parserOptions": { + "ecmaFeatures": { + "jsx": true, + "legacyDecorators": true + }, + "ecmaVersion": 2018, + "sourceType": "module" + }, + "plugins": [ + "react" + ], + "rules": { + "no-console": 0, + "indent": [ + "error", + 2, { + "SwitchCase": 1 + } + ], + "linebreak-style": [ + "error", + "unix" + ], + "quotes": [ + "error", + "single" + ], + "semi": [ + "error", + "never" + ] + } +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index a12021a0b..49098580f 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,9 @@ g#---------------------------------------------------------------------------- # background image which changes based on which project is loaded public/background.jpg +# pre-compiled assets +public/assets + # bundler state /.bundle /vendor/bundle/ @@ -87,3 +90,8 @@ node_modules #dump dump +/public/packs +/public/packs-test +/node_modules +yarn-debug.log* +.yarn-integrity diff --git a/.postcssrc.yml b/.postcssrc.yml new file mode 100644 index 000000000..150dac3c6 --- /dev/null +++ b/.postcssrc.yml @@ -0,0 +1,3 @@ +plugins: + postcss-import: {} + postcss-cssnext: {} diff --git a/.ruby-version b/.ruby-version index d427c89b6..02a9ab271 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-2.1.5 +ruby-2.2.10 diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..8b8ab6508 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +language: ruby +rvm: + - 2.2.10 +services: + - mongodb +before_install: + - npm install +script: + - npm run test +env: + - DEVISE_SECRET_TOKEN='99559c613539cd802d0be074b8f8ab746838af9625c147740702aa2a81517cb1f33bf2e306df977055c8e4aaae0e461c88ffa8a05cd2082455063030ac210e19' + - SECRET_KEY_BASE_TOKEN='cQY9MhkWgBcGkMG8qXCZErHghyuvF4' diff --git a/Dockerfile b/Dockerfile index e356a7d33..6a2d3557b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,8 @@ WORKDIR /src/ RUN bundle install +RUN npm conf set strict-ssl false + RUN npm install EXPOSE 80 diff --git a/Gemfile b/Gemfile index 70b8a49fb..c9888ae94 100644 --- a/Gemfile +++ b/Gemfile @@ -1,29 +1,23 @@ source 'https://rubygems.org' -ruby '2.1.5' +ruby '2.2.10' -gem 'rails', '4.0.13' -gem 'sass-rails', '~> 4.0.0' -gem 'uglifier', '>= 1.3.0' -gem 'coffee-rails', '~> 4.0.0' -gem 'jquery-rails' +gem 'rails', '~> 4.2.6' +gem 'sass-rails' +gem 'webpacker', '~> 3.5' gem 'turbolinks' gem 'jbuilder', '~> 1.2' -gem 'devise' +gem 'devise', '3.4.0' gem 'omniauth-facebook' gem "omniauth-google-oauth2" gem 'omniauth-zooniverse', '~> 0.0.3' -gem 'mongoid', '~> 4.0.2' +gem 'mongoid', '~> 5.4.0' gem 'active_model_serializers' gem 'mongoid-serializer' gem 'rack-cors', :require => 'rack/cors' gem "bson" gem "moped" -gem 'sprockets-coffee-react' -gem 'stylus', '~> 1.0.1' -gem 'browserify-rails', '~> 0.9.1' -gem 'react-rails', '~> 1.0.0.pre', github: 'reactjs/react-rails' gem 'rack-streaming-proxy', '~> 2.0.1' gem 'kaminari' @@ -47,21 +41,16 @@ group :development, :production do gem 'binding_of_caller', :platforms=>[:mri_19, :mri_20, :rbx] gem 'quiet_assets' gem 'rails_layout' - gem 'pry' -end - -group :assets do - gem 'jquery-ui-sass-rails' end group :test do gem 'capybara' gem 'cucumber-rails', :require=>false gem 'database_cleaner', '1.0.1' - gem 'rspec-rails', '~> 3.0' + gem 'rspec-rails', '~> 3.6' gem 'shoulda-matchers' gem 'email_spec' gem 'launchy' gem 'factory_girl' - gem 'mongoid-rspec', '>= 1.6.0', :github=>"mongoid-rspec/mongoid-rspec" + gem 'mongoid-rspec', '3.0.0' end diff --git a/Gemfile.lock b/Gemfile.lock index 3e0d64527..640902260 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,303 +1,316 @@ -GIT - remote: git://github.com/mongoid-rspec/mongoid-rspec.git - revision: 32d2ed925f662b55a20e83e257de6a484106dbfd - specs: - mongoid-rspec (2.2.0) - mongoid (~> 4.0.0) - rake - rspec (~> 3.1) - -GIT - remote: git://github.com/reactjs/react-rails.git - revision: ff564e82f6df668d3979b6ba7747a199f6f01a45 - specs: - react-rails (1.0.0) - coffee-script-source (~> 1.8) - connection_pool - execjs - rails (>= 3.1) - react-source (~> 0.13) - GEM remote: https://rubygems.org/ specs: - actionmailer (4.0.13) - actionpack (= 4.0.13) + actionmailer (4.2.11) + actionpack (= 4.2.11) + actionview (= 4.2.11) + activejob (= 4.2.11) mail (~> 2.5, >= 2.5.4) - actionpack (4.0.13) - activesupport (= 4.0.13) - builder (~> 3.1.0) - erubis (~> 2.7.0) - rack (~> 1.5.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.11) + actionview (= 4.2.11) + activesupport (= 4.2.11) + rack (~> 1.6) rack-test (~> 0.6.2) - actionpack-action_caching (1.1.1) - actionpack (>= 4.0.0, < 5.0) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionpack-action_caching (1.2.0) + actionpack (>= 4.0.0, < 6) + actionview (4.2.11) + activesupport (= 4.2.11) + builder (~> 3.1) + erubis (~> 2.7.0) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.3) active_model-shaz (0.0.1) - active_model_serializers (0.9.3) - activemodel (>= 3.2) - activemodel (4.0.13) - activesupport (= 4.0.13) - builder (~> 3.1.0) - activerecord (4.0.13) - activemodel (= 4.0.13) - activerecord-deprecated_finders (~> 1.0.2) - activesupport (= 4.0.13) - arel (~> 4.0.0) - activerecord-deprecated_finders (1.0.4) - activesupport (4.0.13) - i18n (~> 0.6, >= 0.6.9) - minitest (~> 4.2) - multi_json (~> 1.3) - thread_safe (~> 0.1) - tzinfo (~> 0.3.37) - addressable (2.3.8) - arel (4.0.2) + active_model_serializers (0.10.9) + actionpack (>= 4.1, < 6) + activemodel (>= 4.1, < 6) + case_transform (>= 0.2) + jsonapi-renderer (>= 0.1.1.beta1, < 0.3) + activejob (4.2.11) + activesupport (= 4.2.11) + globalid (>= 0.3.0) + activemodel (4.2.11) + activesupport (= 4.2.11) + builder (~> 3.1) + activerecord (4.2.11) + activemodel (= 4.2.11) + activesupport (= 4.2.11) + arel (~> 6.0) + activesupport (4.2.11) + i18n (~> 0.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + addressable (2.6.0) + public_suffix (>= 2.0.2, < 4.0) + arel (6.0.4) + backports (3.12.0) bcrypt (3.1.12) - better_errors (2.1.1) + better_errors (2.5.1) coderay (>= 1.0.0) - erubis (>= 2.6.6) + erubi (>= 1.0.0) rack (>= 0.9.0) - binding_of_caller (0.7.2) + binding_of_caller (0.8.0) debug_inspector (>= 0.0.1) - browserify-rails (0.9.3) - sprockets (~> 2.2) - bson (2.3.0) - builder (3.1.4) - capybara (2.4.4) - mime-types (>= 1.16) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - xpath (~> 2.0) - coderay (1.1.0) - coffee-rails (4.0.1) - coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.0) - coffee-react (3.0.1) - execjs - coffee-script (2.4.1) - coffee-script-source - execjs - coffee-script-source (1.9.1) + bson (4.4.2) + builder (3.2.3) + capybara (3.1.1) + addressable + mini_mime (>= 0.1.3) + nokogiri (~> 1.8) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + xpath (~> 3.0) + case_transform (0.2) + activesupport + coderay (1.1.2) concurrent-ruby (1.1.4) - connection_pool (2.1.3) - cucumber (1.3.19) + crass (1.0.4) + cucumber (3.1.2) builder (>= 2.1.2) - diff-lcs (>= 1.1.3) - gherkin (~> 2.12) + cucumber-core (~> 3.2.0) + cucumber-expressions (~> 6.0.1) + cucumber-wire (~> 0.0.1) + diff-lcs (~> 1.3) + gherkin (~> 5.1.0) multi_json (>= 1.7.5, < 2.0) multi_test (>= 0.1.2) - cucumber-rails (1.4.2) - capybara (>= 1.1.2, < 3) - cucumber (>= 1.3.8, < 2) - mime-types (>= 1.16, < 3) - nokogiri (~> 1.5) - rails (>= 3, < 5) + cucumber-core (3.2.1) + backports (>= 3.8.0) + cucumber-tag_expressions (~> 1.1.0) + gherkin (~> 5.0) + cucumber-expressions (6.0.1) + cucumber-rails (1.6.0) + capybara (>= 1.1.2, < 4) + cucumber (>= 3.0.2, < 4) + mime-types (>= 1.17, < 4) + nokogiri (~> 1.8) + railties (>= 4, < 6) + cucumber-tag_expressions (1.1.1) + cucumber-wire (0.0.1) database_cleaner (1.0.1) - debug_inspector (0.0.2) - delayed_job (4.0.6) - activesupport (>= 3.0, < 5.0) - devise (3.5.10) + debug_inspector (0.0.3) + devise (3.4.0) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 3.2.6, < 5) responders thread_safe (~> 0.1) warden (~> 1.2.3) - diff-lcs (1.2.5) - dotenv (2.0.1) - dotenv-rails (2.0.1) - dotenv (= 2.0.1) - email_spec (1.6.0) + diff-lcs (1.3) + dotenv (2.7.1) + dotenv-rails (2.7.1) + dotenv (= 2.7.1) + railties (>= 3.2, < 6.1) + email_spec (2.2.0) + htmlentities (~> 4.3.3) launchy (~> 2.1) - mail (~> 2.2) + mail (~> 2.7) + erubi (1.8.0) erubis (2.7.0) - execjs (2.5.0) - factory_girl (4.5.0) + factory_girl (4.9.0) activesupport (>= 3.0.0) - faraday (0.9.1) + faraday (0.15.4) multipart-post (>= 1.2, < 3) fastimage (1.7.0) addressable (~> 2.3, >= 2.3.5) - gherkin (2.12.2) - multi_json (~> 1.3) - hashie (3.4.1) - hike (1.2.3) + ffi (1.10.0) + gherkin (5.1.0) + globalid (0.4.2) + activesupport (>= 4.2.0) + hashie (3.6.0) + htmlentities (4.3.4) i18n (0.9.5) concurrent-ruby (~> 1.0) jbuilder (1.5.3) activesupport (>= 3.0.0) multi_json (>= 1.2.0) - jquery-rails (3.1.2) - railties (>= 3.0, < 5.0) - thor (>= 0.14, < 2.0) - jquery-ui-rails (4.0.3) - jquery-rails - railties (>= 3.1.0) - jquery-ui-sass-rails (4.0.3.0) - jquery-rails - jquery-ui-rails (= 4.0.3) - railties (>= 3.1.0) - json (1.8.2) - jwt (1.4.1) - kaminari (0.16.3) - actionpack (>= 3.0.0) - activesupport (>= 3.0.0) + jsonapi-renderer (0.2.0) + jwt (1.5.6) + kaminari (1.1.1) + activesupport (>= 4.1.0) + kaminari-actionview (= 1.1.1) + kaminari-activerecord (= 1.1.1) + kaminari-core (= 1.1.1) + kaminari-actionview (1.1.1) + actionview + kaminari-core (= 1.1.1) + kaminari-activerecord (1.1.1) + activerecord + kaminari-core (= 1.1.1) + kaminari-core (1.1.1) launchy (2.4.3) addressable (~> 2.3) logstash-event (1.2.02) - logstasher (0.8.0) + logstasher (0.9.0) activerecord (>= 3.0) activesupport (>= 3.0) - delayed_job (~> 4.0.2) logstash-event (~> 1.2.0) request_store - mail (2.6.3) - mime-types (>= 1.16, < 3) - method_source (0.8.2) - mime-types (2.6.2) - mini_portile (0.6.2) - minitest (4.7.5) - mongoid (4.0.2) + loofah (2.2.3) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.7.1) + mini_mime (>= 0.1.1) + mime-types (3.2.2) + mime-types-data (~> 3.2015) + mime-types-data (3.2018.0812) + mini_mime (1.0.1) + mini_portile2 (2.4.0) + minitest (5.11.3) + mongo (2.7.1) + bson (>= 4.4.2, < 5.0.0) + mongoid (5.4.0) activemodel (~> 4.0) - moped (~> 2.0.0) - origin (~> 2.1) + mongo (>= 2.5.1, < 3.0.0) + origin (~> 2.3) tzinfo (>= 0.3.37) + mongoid-rspec (3.0.0) + mongoid (~> 5.0) + rake + rspec (~> 3.3) mongoid-serializer (0.0.5) active_model-shaz mongoid (>= 3.0) - moped (2.0.4) - bson (~> 2.2) - connection_pool (~> 2.0) - optionable (~> 0.2.0) + moped (1.5.3) multi_json (1.13.1) multi_test (0.1.2) - multi_xml (0.5.5) + multi_xml (0.6.0) multipart-post (2.0.0) - newrelic_moped (1.0.1) - moped - newrelic_rpm (~> 3.11) - newrelic_rpm (3.13.2.302) - nokogiri (1.6.6.2) - mini_portile (~> 0.6.0) - oauth2 (1.0.0) - faraday (>= 0.8, < 0.10) - jwt (~> 1.0) + newrelic_moped (0.0.3) + newrelic_rpm (6.1.0.352) + nokogiri (1.9.1) + mini_portile2 (~> 2.4.0) + oauth2 (1.4.1) + faraday (>= 0.8, < 0.16.0) + jwt (>= 1.0, < 3.0) multi_json (~> 1.3) multi_xml (~> 0.5) - rack (~> 1.2) - omniauth (1.2.2) - hashie (>= 1.2, < 4) - rack (~> 1.0) - omniauth-facebook (2.0.1) + rack (>= 1.2, < 3) + omniauth (1.9.0) + hashie (>= 3.4.6, < 3.7.0) + rack (>= 1.6.2, < 3) + omniauth-facebook (5.0.0) omniauth-oauth2 (~> 1.2) - omniauth-google-oauth2 (0.2.6) - omniauth (> 1.0) - omniauth-oauth2 (~> 1.1) - omniauth-oauth2 (1.2.0) - faraday (>= 0.8, < 0.10) + omniauth-google-oauth2 (0.5.2) + jwt (~> 1.5) multi_json (~> 1.3) + omniauth (>= 1.1.1) + omniauth-oauth2 (>= 1.3.1) + omniauth-oauth2 (1.3.1) oauth2 (~> 1.0) omniauth (~> 1.2) - omniauth-zooniverse (0.0.3) - optionable (0.2.0) - origin (2.1.1) + omniauth-zooniverse (0.0.4) + omniauth-oauth2 (= 1.3.1) + origin (2.3.1) orm_adapter (0.5.0) - pry (0.10.1) - coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) + public_suffix (3.0.3) puma (2.14.0) quiet_assets (1.1.0) railties (>= 3.1, < 5.0) - rack (1.5.5) - rack-cors (0.3.1) - rack-streaming-proxy (2.0.1) + rack (1.6.11) + rack-cors (1.0.2) + rack-proxy (0.6.5) + rack + rack-streaming-proxy (2.0.2) rack (>= 1.4) servolux (~> 0.10) rack-test (0.6.3) rack (>= 1.0) - rails (4.0.13) - actionmailer (= 4.0.13) - actionpack (= 4.0.13) - activerecord (= 4.0.13) - activesupport (= 4.0.13) + rails (4.2.11) + actionmailer (= 4.2.11) + actionpack (= 4.2.11) + actionview (= 4.2.11) + activejob (= 4.2.11) + activemodel (= 4.2.11) + activerecord (= 4.2.11) + activesupport (= 4.2.11) bundler (>= 1.3.0, < 2.0) - railties (= 4.0.13) - sprockets-rails (~> 2.0) - rails_layout (1.0.25) - railties (4.0.13) - actionpack (= 4.0.13) - activesupport (= 4.0.13) + railties (= 4.2.11) + sprockets-rails + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.9) + activesupport (>= 4.2.0, < 5.0) + nokogiri (~> 1.6) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.0.4) + loofah (~> 2.2, >= 2.2.2) + rails_layout (1.0.42) + railties (4.2.11) + actionpack (= 4.2.11) + activesupport (= 4.2.11) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (12.3.2) - react-source (0.13.1) - request_store (1.2.0) - responders (1.1.2) - railties (>= 3.2, < 4.2) - rspec (3.2.0) - rspec-core (~> 3.2.0) - rspec-expectations (~> 3.2.0) - rspec-mocks (~> 3.2.0) - rspec-core (3.2.3) - rspec-support (~> 3.2.0) - rspec-expectations (3.2.1) + rb-fsevent (0.10.3) + rb-inotify (0.10.0) + ffi (~> 1.0) + request_store (1.4.1) + rack (>= 1.4) + responders (2.4.1) + actionpack (>= 4.2.0, < 6.0) + railties (>= 4.2.0, < 6.0) + rspec (3.8.0) + rspec-core (~> 3.8.0) + rspec-expectations (~> 3.8.0) + rspec-mocks (~> 3.8.0) + rspec-core (3.8.0) + rspec-support (~> 3.8.0) + rspec-expectations (3.8.2) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.2.0) - rspec-mocks (3.2.1) + rspec-support (~> 3.8.0) + rspec-mocks (3.8.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.2.0) - rspec-rails (3.2.1) - actionpack (>= 3.0, < 4.3) - activesupport (>= 3.0, < 4.3) - railties (>= 3.0, < 4.3) - rspec-core (~> 3.2.0) - rspec-expectations (~> 3.2.0) - rspec-mocks (~> 3.2.0) - rspec-support (~> 3.2.0) - rspec-support (3.2.2) - sass (3.2.19) - sass-rails (4.0.5) - railties (>= 4.0.0, < 5.0) - sass (~> 3.2.2) - sprockets (~> 2.8, < 3.0) - sprockets-rails (~> 2.0) - servolux (0.10.0) - shoulda-matchers (2.8.0) - activesupport (>= 3.0.0) - slop (3.6.0) - sprockets (2.12.5) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sprockets-coffee-react (3.0.1) - coffee-react (>= 3.0.1) - coffee-script - sprockets - tilt - sprockets-rails (2.3.3) + rspec-support (~> 3.8.0) + rspec-rails (3.8.2) actionpack (>= 3.0) activesupport (>= 3.0) + railties (>= 3.0) + rspec-core (~> 3.8.0) + rspec-expectations (~> 3.8.0) + rspec-mocks (~> 3.8.0) + rspec-support (~> 3.8.0) + rspec-support (3.8.0) + sass (3.7.3) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + sass-rails (5.0.7) + railties (>= 4.0.0, < 6) + sass (~> 3.1) sprockets (>= 2.8, < 4.0) - stylus (1.0.1) - execjs - stylus-source - stylus-source (0.49.3) + sprockets-rails (>= 2.0, < 4.0) + tilt (>= 1.1, < 3) + servolux (0.13.0) + shoulda-matchers (4.0.1) + activesupport (>= 4.2.0) + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.1) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) thor (0.20.3) thread_safe (0.3.6) - tilt (1.4.1) - turbolinks (2.5.3) - coffee-rails - tzinfo (0.3.55) - uglifier (2.7.1) - execjs (>= 0.3.0) - json (>= 1.8.0) + tilt (2.0.9) + turbolinks (5.2.0) + turbolinks-source (~> 5.2) + turbolinks-source (5.2.0) + tzinfo (1.2.5) + thread_safe (~> 0.1) warden (1.2.7) rack (>= 1.0) - xpath (2.0.0) - nokogiri (~> 1.3) + webpacker (3.5.5) + activesupport (>= 4.2) + rack-proxy (>= 0.6.1) + railties (>= 4.2) + xpath (3.1.0) + nokogiri (~> 1.8) PLATFORMS ruby @@ -307,25 +320,21 @@ DEPENDENCIES active_model_serializers better_errors binding_of_caller - browserify-rails (~> 0.9.1) bson capybara - coffee-rails (~> 4.0.0) cucumber-rails database_cleaner (= 1.0.1) - devise + devise (= 3.4.0) dotenv-rails email_spec factory_girl fastimage (= 1.7.0) jbuilder (~> 1.2) - jquery-rails - jquery-ui-sass-rails kaminari launchy logstasher (~> 0.6) - mongoid (~> 4.0.2) - mongoid-rspec (>= 1.6.0)! + mongoid (~> 5.4.0) + mongoid-rspec (= 3.0.0) mongoid-serializer moped newrelic_moped @@ -333,18 +342,20 @@ DEPENDENCIES omniauth-facebook omniauth-google-oauth2 omniauth-zooniverse (~> 0.0.3) - pry puma (~> 2.14.0) quiet_assets rack-cors rack-streaming-proxy (~> 2.0.1) - rails (= 4.0.13) + rails (~> 4.2.6) rails_layout - react-rails (~> 1.0.0.pre)! - rspec-rails (~> 3.0) - sass-rails (~> 4.0.0) + rspec-rails (~> 3.6) + sass-rails shoulda-matchers - sprockets-coffee-react - stylus (~> 1.0.1) turbolinks - uglifier (>= 1.3.0) + webpacker (~> 3.5) + +RUBY VERSION + ruby 2.2.10p489 + +BUNDLED WITH + 1.16.2 diff --git a/Procfile b/Procfile new file mode 100644 index 000000000..69286bdb0 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development} diff --git a/README.md b/README.md index 5fd0855dc..47d4e31c8 100644 --- a/README.md +++ b/README.md @@ -30,5 +30,59 @@ We are launching Scribe with three very different projects by [Zooniverse](https * [Measuring the Anzacs (Zooniverse)](http://measuringtheanzacs.org) * [Old Weather: Whaling (Zooniverse)](http://whaling.oldweather.org) +## Changes to get running on Heroku (July 2017) + +### Software versions + +* There seem to be compatibility problems with Node versions greater than 6. I edited `package.json` to pin Node at 6.11.1, as recommended by the [Heroku documentation](https://devcenter.heroku.com/articles/nodejs-support). You might need to [use n](https://github.com/tj/n) to install and activate a specific version of Node for development. + +* Heroku [no longer supports](https://devcenter.heroku.com/articles/ruby-support) 2.1.* versions of Ruby. I changed Gemfile to specify `ruby '2.2.7'`, which is the earliest supported version. I also changed `.ruby-version` accordingly. + +* MLab databases now use MongoDB 3, but Mongoid 4 doesn't seem able to authenticate with MongoDB 3 urls. So I changed the `Gemfile` and `Gemfile.lock` to set Mongoid at 5.2.1. + +* The mongoid change also meant I had to update `mongoid-rspec`, `rspec-rails`, `bson`, and `origin`. I also removed the `bson` requirement from `moped`. + +### Code changes + +* In `config/mongoid.yml` changed `sessions` to `clients`. +* In `app/models/classification.rb` changed `find_and_modify` mthod to `find_one_and_update`. + +### Environment variables -- Development + +This isn't really mentioned in the [ScribeAPI wiki](https://github.com/zooniverse/scribeAPI/wiki): + +* Create a file in the root of the project called `.env`. +* Use `rake secret` to create a secret key. +* Add `DEVISE_SECRET_TOKEN=yournewkey` to `.env`. +* Repeat to add `SECRET_KEY_BASE_TOKEN=anothernewkey` to `.env`. +* To specify the name of the Mongo database you want to create, set `MONGO_DB=yourdbname` +* If you're going to start up the Puma web server (see below), add `RACK_ENV=development` and `PORT=3000` + +Also add your OAUTH keys to `.env` as mentioned [in the wiki](https://github.com/zooniverse/scribeAPI/wiki/Setting-up-OAuth-%26-Deploying). + +### Deployment to Heroku + +After creating your Heroku app and database as described [in the wiki](https://github.com/zooniverse/scribeAPI/wiki/Setting-up-OAuth-%26-Deploying): + +* Add `DEVISE_SECRET_TOKEN` and `SECRET_KEY_BASE_TOKEN` to Heroku's environment variables, eg: `heroku config:set "DEVISE_SECRET_TOKEN=yournewkey"` +* Add your `MONGOLAB_URI` and OAUTH credentials as described in the wiki. + +The information about buildpacks in the wiki is out of date. Ignore the section about `BUILDPACK_URL` but before you deploy to Heroku run the following commands: + +* `heroku buildpacks:add --index 1 heroku/nodejs` +* `heroku buildpacks:add --index 2 heroku/ruby` + +The index values are important as Node needs to be built first, otherwise the Ruby build will fail complaining about Browserify. + +### Procfile + +The original repo had a non-functional `procfile` -- capitalisation matters to Heroku, so I've renamed it `Procfile`. Heroku recommends running the [Puma web server](https://devcenter.heroku.com/articles/getting-started-with-rails4#webserver), so I've just followed their instructions on what to include in the `Procfile`. If you want to test the config in your development environment, make sure you set the `RACK_ENV` and `PORT` values in your `.env` file and then use Foreman -- `foreman start`. + + + + + + + diff --git a/app/assets/.js.coffee.cjsx b/app/assets/.js.coffee.cjsx deleted file mode 100644 index e69de29bb..000000000 diff --git a/app/assets/images/anzac/1_part_att_q.gif b/app/assets/images/anzac/1_part_att_q.gif new file mode 100644 index 000000000..d6b55b069 Binary files /dev/null and b/app/assets/images/anzac/1_part_att_q.gif differ diff --git a/app/assets/images/anzac/att_chest_mesurement.gif b/app/assets/images/anzac/att_chest_mesurement.gif new file mode 100644 index 000000000..f4543e8cd Binary files /dev/null and b/app/assets/images/anzac/att_chest_mesurement.gif differ diff --git a/app/assets/images/anzac/att_hearing.gif b/app/assets/images/anzac/att_hearing.gif new file mode 100644 index 000000000..dc0d805e8 Binary files /dev/null and b/app/assets/images/anzac/att_hearing.gif differ diff --git a/app/assets/images/anzac/att_height.gif b/app/assets/images/anzac/att_height.gif new file mode 100644 index 000000000..58fba8f93 Binary files /dev/null and b/app/assets/images/anzac/att_height.gif differ diff --git a/app/assets/images/anzac/att_sight.gif b/app/assets/images/anzac/att_sight.gif new file mode 100644 index 000000000..16e4e2801 Binary files /dev/null and b/app/assets/images/anzac/att_sight.gif differ diff --git a/app/assets/images/anzac/background.png b/app/assets/images/anzac/background.png new file mode 100644 index 000000000..242a2d73a Binary files /dev/null and b/app/assets/images/anzac/background.png differ diff --git a/app/assets/images/anzac/hs_mark_help.gif b/app/assets/images/anzac/hs_mark_help.gif new file mode 100644 index 000000000..34abdc34a Binary files /dev/null and b/app/assets/images/anzac/hs_mark_help.gif differ diff --git a/app/assets/images/anzac/hs_transfer_row.gif b/app/assets/images/anzac/hs_transfer_row.gif new file mode 100644 index 000000000..b2d28b381 Binary files /dev/null and b/app/assets/images/anzac/hs_transfer_row.gif differ diff --git a/app/assets/images/anzac/logo.png b/app/assets/images/anzac/logo.png new file mode 100644 index 000000000..821cacfad Binary files /dev/null and b/app/assets/images/anzac/logo.png differ diff --git a/app/assets/images/anzac/logo.svg b/app/assets/images/anzac/logo.svg new file mode 100644 index 000000000..eeba747f9 --- /dev/null +++ b/app/assets/images/anzac/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/assets/images/anzac/sa_att_ex.jpeg b/app/assets/images/anzac/sa_att_ex.jpeg new file mode 100644 index 000000000..04dcd3214 Binary files /dev/null and b/app/assets/images/anzac/sa_att_ex.jpeg differ diff --git a/app/assets/javascripts/__tests__/action-button-test.cjsx b/app/assets/javascripts/__tests__/action-button-test.cjsx deleted file mode 100644 index 2ebe94e3f..000000000 --- a/app/assets/javascripts/__tests__/action-button-test.cjsx +++ /dev/null @@ -1,18 +0,0 @@ -jest - .dontMock '../components/action-button' - - describe 'ActionButton', -> - React = require 'react/addons' - {renderIntoDocument, Simulate} = React.addons.TestUtils - - ActionButton = require '../components/action-button' - - it 'should grab the action-button code', -> - expect(ActionButton).toBeTruthy() - - actionButton = renderIntoDocument() - - - - - diff --git a/app/assets/javascripts/__tests__/action-button-test.jsx b/app/assets/javascripts/__tests__/action-button-test.jsx new file mode 100644 index 000000000..f95fa7a38 --- /dev/null +++ b/app/assets/javascripts/__tests__/action-button-test.jsx @@ -0,0 +1,12 @@ +import React from 'react' +import ReactTestUtils from 'react-dom/test-utils' +import ActionButton from '../components/action-button.jsx' + +describe('ActionButton', function () { + let actionButton + + actionButton = ReactTestUtils.renderIntoDocument() + + it('should grab the action-button code', () => + expect(actionButton).toBeTruthy()) +}) diff --git a/app/assets/javascripts/__tests__/generic-tests.cjsx b/app/assets/javascripts/__tests__/generic-tests.cjsx deleted file mode 100644 index 40d867816..000000000 --- a/app/assets/javascripts/__tests__/generic-tests.cjsx +++ /dev/null @@ -1,12 +0,0 @@ -jest - .dontMock '../components/core-tools/generic' - - describe "GenericTask", -> - React = require 'react/addons' - {renderIntoDocument, Simulate} = React.addons.TestUtils - - GenericTask = require '../components/core-tools/generic' - it 'should grab the GenericTask code', -> - expect(GenericTask).toBeTruthy() - # this isn't working becuase the props.answers is an array of react elements from the parent core-tool - # genericTask = renderIntoDocument() \ No newline at end of file diff --git a/app/assets/javascripts/__tests__/generic-tests.jsx b/app/assets/javascripts/__tests__/generic-tests.jsx new file mode 100644 index 000000000..20c3a533a --- /dev/null +++ b/app/assets/javascripts/__tests__/generic-tests.jsx @@ -0,0 +1,7 @@ +import GenericTask from '../components/core-tools/generic.jsx' +describe('GenericTask', function () { + it('should grab the GenericTask code', () => + expect(GenericTask).toBeTruthy()) +}) +// this isn't working because the props.answers is an array of react elements from the parent core-tool +// genericTask = renderIntoDocument() diff --git a/app/assets/javascripts/__tests__/pick-one-test.cjsx b/app/assets/javascripts/__tests__/pick-one-test.cjsx deleted file mode 100644 index 4f7d4c0b6..000000000 --- a/app/assets/javascripts/__tests__/pick-one-test.cjsx +++ /dev/null @@ -1,83 +0,0 @@ -jest - .dontMock '../components/core-tools/pick-one' - -jest - .dontMock '../components/core-tools/generic' - - describe 'SingleChoiceTask/pickOne', -> - React = require 'react/addons' - - { - renderIntoDocument, - scryRenderedComponentsWithType, - scryRenderedDOMComponentsWithClass, - scryRenderedDOMComponentsWithTag, - createRenderer, - Simulate - } = React.addons.TestUtils - - task_object = { - generates_subject_type: null, - instruction: "Do you have a favorite ice cream flavour?", - key: "pick_page_type", - next_task: null, - tool: "pickOne" - tool_config: { - options: { - yes: { - label: "yes", - next_task: null - }, - no: { - label: "no", - next_task: null - } - } - } - } - - # mock of the props.onChange from subject-viewer - clickRecord = jest.genMockFunction() - - PickOne = require '../components/core-tools/pick-one' - GenericTask = require '../components/core-tools/generic' - - shallowRenderer = React.addons.TestUtils.createRenderer() - shallowRenderer.render() - result = shallowRenderer.getRenderOutput() - - it 'should load the SingleChoiceTask/pickOne', -> - expect(PickOne).toBeTruthy() - - # this seems like it could be improved. not sure that this is an effective use of shallowRender - it "should render a function with the displayName GenericTask", -> - expect(result.type.displayName).toBe("GenericTask") - expect(result.type.defaultProps.question).toBe('') - expect(result.type.defaultProps.answers).toBe('') - expect(result.type.defaultProps.help).toBe('') - - it "should create 2