diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..5cc1a98 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,52 @@ +name: build + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Install Ruby 3.0.0 + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.0.0 + + - name: Set up Code Climate test-reporter + run: | + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + chmod +x ./cc-test-reporter + ./cc-test-reporter before-build + + - name: Install bundler + run: | + gem install bundler + - name: Install Dependencies + run: bundle install + - name: Set up test database + env: + RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} + run: | + bundle exec rake db:setup + bundle exec rake db:create db:migrate + - name: run Cucumber tests and capture coverage + env: + RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} + run: | + bundle exec cucumber + ./cc-test-reporter format-coverage --output coverage/codeclimate.$SUITE.json --input-type simplecov + - name: run RSpec tests + env: + RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} + run: | + bundle exec rspec + ./cc-test-reporter format-coverage --output coverage/codeclimate.$SUITE.json --input-type simplecov + - name: Publish code coverage + run: | + export GIT_BRANCH="${GITHUB_REF/refs\/heads\//}" + ./cc-test-reporter sum-coverage coverage/codeclimate.*.json + ./cc-test-reporter upload-coverage --id ${{ secrets.CC_TEST_REPORTER_ID }} + ./cc-test-reporter after-build --id ${{ secrets.CC_TEST_REPORTER_ID }} + diff --git a/.gitignore b/.gitignore index 01702d1..4f83483 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,7 @@ # Ignore coverage /coverage coverage + +config/master.key +bin/rails +cc-test-reporter \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e6036df..0000000 --- a/.travis.yml +++ /dev/null @@ -1,33 +0,0 @@ -# multiple tests suites -# working example can be found at https://github.com/scottohara/loot - -language: ruby - -# Cache gems -cache: - bundler: true - -env: - global: - CC_TEST_REPORTER_ID=b2c51ead32a5ba146275df79c6929633c193991d3e902ef1ecde39c80e3fd5a6 - secure: "eqmcHAG2rN5I7L3rahSoEn4Wkciti5aE2NZMwCB5QJn6tDQxrhPP/0CVQM8wI2bqpyF2E9SZJSDj5fc9L64wv1fbUUw9NHyhHQnPIkR8cKnTF1xcm2GZIyPcJ+wGg61JJmwpgKlcf54poyNCXD55rVyVlJ9e3Qzx5YOsN9l18MxS2rNm5VuWiZ5jZBFhNDzPP7eu/zlt/y1FvrWr7nMia/40MxPGuiFlGYx4wQZIaBVR4fmbgUJoneUqGjGaaJyg5u6Ge6JpO6GOsklHh0K0L7vy1U+MCTuc1j4/ygnm4M5g60MrczRst7KkumY1wfMbPCwLHBYq7UVreDMnrKqCKoG/YJ7lVe1Xe/cnph0BO7mpiSL5nYzwAfVmmNTpZlTNfz5hx4lZYQVj0D+W1TUdqCk3npGZ83Wy5tZYSu/6XOIdCt6d+ucg2XJ2VuXG58YF5LP5cseZYYHVpmfK786QnZKlR/omWhviDDuTC/Ph6jN+NBPVUA0Iw8KUTJObO95yvpZvTRvLqmrnFJW+mCkyLqlIA8hsIdCmuQtXtCqy1TN5jAB2nJn4KGzxgyarJ6S/Ajm0qqCAvGBJ96VZKrvEEnTAsewC6PTNyiXGWJu+y6bgve9/h8h1UI1tDJ6vD5BwQkIJgQygjLnjOm7WIxNDhnyjosv9bqySdhgSaUJB2mE=" - -before_install: - - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - - chmod +x ./cc-test-reporter - - echo "$RAILS_MASTER_KEY" > config/master.key - -install: - - bundle install --without production --path=${BUNDLE_PATH:-vendor/bundle} # Install ruby gems, excluding production only gems such as unicorn (already present by default in Travis) - -# Setup the database -before_script: bundle exec rake db:create db:migrate - -# Run the test suites -script: - - bundle exec cucumber - - bundle exec rspec - -# Pipe the coverage data to Code Climate -after_script: - - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT diff --git a/Gemfile b/Gemfile index dde17bc..54b1b65 100644 --- a/Gemfile +++ b/Gemfile @@ -20,6 +20,8 @@ gem 'jbuilder', '~> 2.7' # gem 'image_processing', '~> 1.2' gem 'omniauth' +gem "omniauth-github" +gem "omniauth-rails_csrf_protection" gem 'octokit', '~> 4.0' # Reduces boot times through caching; required in config/boot.rb @@ -45,11 +47,12 @@ end group :test do gem 'rspec-rails' gem 'guard-rspec' - gem 'simplecov', :require => false + gem 'simplecov', '~> 0.22.0', :require => false + gem 'simplecov_json_formatter', :require => false gem 'cucumber-rails', :require => false gem 'cucumber-rails-training-wheels' # basic imperative step defs like "Then I should see..." gem 'database_cleaner' # required by Cucumber - gem 'simplecov', require: false + gem 'codeclimate-test-reporter', require: false end # make sure the following gems are in your production group: @@ -61,6 +64,7 @@ end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] -gem "omniauth-github" gem "active_type", "= 1.3.2" + +gem 'faraday-retry' diff --git a/Gemfile.lock b/Gemfile.lock index 4fcb77d..d25c5a1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,149 +1,149 @@ GEM remote: https://rubygems.org/ specs: - actioncable (6.1.3) - actionpack (= 6.1.3) - activesupport (= 6.1.3) + actioncable (6.1.7.2) + actionpack (= 6.1.7.2) + activesupport (= 6.1.7.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.3) - actionpack (= 6.1.3) - activejob (= 6.1.3) - activerecord (= 6.1.3) - activestorage (= 6.1.3) - activesupport (= 6.1.3) + actionmailbox (6.1.7.2) + actionpack (= 6.1.7.2) + activejob (= 6.1.7.2) + activerecord (= 6.1.7.2) + activestorage (= 6.1.7.2) + activesupport (= 6.1.7.2) mail (>= 2.7.1) - actionmailer (6.1.3) - actionpack (= 6.1.3) - actionview (= 6.1.3) - activejob (= 6.1.3) - activesupport (= 6.1.3) + actionmailer (6.1.7.2) + actionpack (= 6.1.7.2) + actionview (= 6.1.7.2) + activejob (= 6.1.7.2) + activesupport (= 6.1.7.2) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.1.3) - actionview (= 6.1.3) - activesupport (= 6.1.3) + actionpack (6.1.7.2) + actionview (= 6.1.7.2) + activesupport (= 6.1.7.2) rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.3) - actionpack (= 6.1.3) - activerecord (= 6.1.3) - activestorage (= 6.1.3) - activesupport (= 6.1.3) + actiontext (6.1.7.2) + actionpack (= 6.1.7.2) + activerecord (= 6.1.7.2) + activestorage (= 6.1.7.2) + activesupport (= 6.1.7.2) nokogiri (>= 1.8.5) - actionview (6.1.3) - activesupport (= 6.1.3) + actionview (6.1.7.2) + activesupport (= 6.1.7.2) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) active_type (1.3.2) activerecord (>= 3.2) - activejob (6.1.3) - activesupport (= 6.1.3) + activejob (6.1.7.2) + activesupport (= 6.1.7.2) globalid (>= 0.3.6) - activemodel (6.1.3) - activesupport (= 6.1.3) - activerecord (6.1.3) - activemodel (= 6.1.3) - activesupport (= 6.1.3) - activestorage (6.1.3) - actionpack (= 6.1.3) - activejob (= 6.1.3) - activerecord (= 6.1.3) - activesupport (= 6.1.3) - marcel (~> 0.3.1) - mimemagic (~> 0.3.2) - activesupport (6.1.3) + activemodel (6.1.7.2) + activesupport (= 6.1.7.2) + activerecord (6.1.7.2) + activemodel (= 6.1.7.2) + activesupport (= 6.1.7.2) + activestorage (6.1.7.2) + actionpack (= 6.1.7.2) + activejob (= 6.1.7.2) + activerecord (= 6.1.7.2) + activesupport (= 6.1.7.2) + marcel (~> 1.0) + mini_mime (>= 1.1.0) + activesupport (6.1.7.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) zeitwerk (~> 2.3) - addressable (2.7.0) - public_suffix (>= 2.0.2, < 5.0) + addressable (2.8.1) + public_suffix (>= 2.0.2, < 6.0) bindex (0.8.1) - bootsnap (1.7.2) - msgpack (~> 1.0) + bootsnap (1.16.0) + msgpack (~> 1.2) builder (3.2.4) byebug (11.1.3) - capybara (3.35.3) + capybara (3.38.0) addressable + matrix mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) + codeclimate-test-reporter (1.0.7) + simplecov coderay (1.1.3) - concurrent-ruby (1.1.8) + concurrent-ruby (1.2.2) crass (1.0.6) - cucumber (5.3.0) + cucumber (8.0.0) builder (~> 3.2, >= 3.2.4) - cucumber-core (~> 8.0, >= 8.0.1) - cucumber-create-meta (~> 2.0, >= 2.0.2) - cucumber-cucumber-expressions (~> 10.3, >= 10.3.0) - cucumber-gherkin (~> 15.0, >= 15.0.2) - cucumber-html-formatter (~> 9.0, >= 9.0.0) - cucumber-messages (~> 13.1, >= 13.1.0) - cucumber-wire (~> 4.0, >= 4.0.1) - diff-lcs (~> 1.4, >= 1.4.4) - multi_test (~> 0.1, >= 0.1.2) - sys-uname (~> 1.2, >= 1.2.1) - cucumber-core (8.0.1) - cucumber-gherkin (~> 15.0, >= 15.0.2) - cucumber-messages (~> 13.0, >= 13.0.1) - cucumber-tag-expressions (~> 2.0, >= 2.0.4) - cucumber-create-meta (2.0.4) - cucumber-messages (~> 13.1, >= 13.1.0) - sys-uname (~> 1.2, >= 1.2.1) - cucumber-cucumber-expressions (10.3.0) - cucumber-gherkin (15.0.2) - cucumber-messages (~> 13.0, >= 13.0.1) - cucumber-html-formatter (9.0.0) - cucumber-messages (~> 13.0, >= 13.0.1) - cucumber-messages (13.2.1) - protobuf-cucumber (~> 3.10, >= 3.10.8) - cucumber-rails (2.2.0) + cucumber-ci-environment (~> 9.0, >= 9.0.4) + cucumber-core (~> 11.0, >= 11.0.0) + cucumber-cucumber-expressions (~> 15.1, >= 15.1.1) + cucumber-gherkin (~> 23.0, >= 23.0.1) + cucumber-html-formatter (~> 19.1, >= 19.1.0) + cucumber-messages (~> 18.0, >= 18.0.0) + diff-lcs (~> 1.5, >= 1.5.0) + mime-types (~> 3.4, >= 3.4.1) + multi_test (~> 1.1, >= 1.1.0) + sys-uname (~> 1.2, >= 1.2.2) + cucumber-ci-environment (9.1.0) + cucumber-core (11.0.0) + cucumber-gherkin (~> 23.0, >= 23.0.1) + cucumber-messages (~> 18.0, >= 18.0.0) + cucumber-tag-expressions (~> 4.1, >= 4.1.0) + cucumber-cucumber-expressions (15.2.0) + cucumber-gherkin (23.0.1) + cucumber-messages (~> 18.0, >= 18.0.0) + cucumber-html-formatter (19.2.0) + cucumber-messages (~> 18.0, >= 18.0.0) + cucumber-messages (18.0.0) + cucumber-rails (2.6.1) capybara (>= 2.18, < 4) - cucumber (>= 3.0.2, < 6) - mime-types (~> 3.2) - nokogiri (~> 1.8) - rails (>= 5.0, < 7) + cucumber (>= 3.2, < 9) + mime-types (~> 3.3) + nokogiri (~> 1.10) + railties (>= 5.0, < 8) + rexml (~> 3.0) + webrick (~> 1.7) cucumber-rails-training-wheels (1.0.0) cucumber-rails (>= 1.1.1) - cucumber-tag-expressions (2.0.4) - cucumber-wire (4.0.1) - cucumber-core (~> 8.0, >= 8.0.1) - cucumber-cucumber-expressions (~> 10.3, >= 10.3.0) - cucumber-messages (~> 13.0, >= 13.0.1) + cucumber-tag-expressions (4.1.0) database_cleaner (2.0.1) database_cleaner-active_record (~> 2.0.0) - database_cleaner-active_record (2.0.0) + database_cleaner-active_record (2.0.1) activerecord (>= 5.a) database_cleaner-core (~> 2.0.0) database_cleaner-core (2.0.1) - diff-lcs (1.4.4) - docile (1.3.5) - erubi (1.10.0) - faraday (1.3.0) - faraday-net_http (~> 1.0) - multipart-post (>= 1.2, < 3) - ruby2_keywords - faraday-net_http (1.0.1) - ffi (1.14.2) - formatador (0.2.5) - globalid (0.4.2) - activesupport (>= 4.2.0) - guard (2.16.2) + date (3.3.3) + diff-lcs (1.5.0) + docile (1.4.0) + erubi (1.12.0) + faraday (2.7.4) + faraday-net_http (>= 2.0, < 3.1) + ruby2_keywords (>= 0.0.4) + faraday-net_http (3.0.2) + faraday-retry (2.0.0) + faraday (~> 2.0) + ffi (1.15.5) + formatador (1.1.0) + globalid (1.1.0) + activesupport (>= 5.0) + guard (2.18.0) formatador (>= 0.2.4) listen (>= 2.7, < 4.0) lumberjack (>= 1.0.12, < 2.0) nenv (~> 0.1) notiffany (~> 0.0) - pry (>= 0.9.12) + pry (>= 0.13.0) shellany (~> 0.0) thor (>= 0.18.1) guard-compat (1.2.1) @@ -151,138 +151,151 @@ GEM guard (~> 2.1) guard-compat (~> 1.1) rspec (>= 2.99.0, < 4.0) - hashie (4.1.0) - i18n (1.8.9) + hashie (5.0.0) + i18n (1.12.0) concurrent-ruby (~> 1.0) - jbuilder (2.11.2) + jbuilder (2.11.5) + actionview (>= 5.0.0) activesupport (>= 5.0.0) - jwt (2.2.2) - listen (3.4.1) + jwt (2.7.0) + listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.9.0) + loofah (2.19.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) lumberjack (1.2.8) - mail (2.7.1) + mail (2.8.1) mini_mime (>= 0.1.1) - marcel (0.3.3) - mimemagic (~> 0.3.2) + net-imap + net-pop + net-smtp + marcel (1.0.2) + matrix (0.4.2) method_source (1.0.0) - middleware (0.1.0) - mime-types (3.3.1) + mime-types (3.4.1) mime-types-data (~> 3.2015) - mime-types-data (3.2021.0212) - mini_mime (1.0.2) - minitest (5.14.3) - msgpack (1.4.2) - multi_json (1.15.0) - multi_test (0.1.2) + mime-types-data (3.2023.0218.1) + mini_mime (1.1.2) + minitest (5.17.0) + msgpack (1.6.0) + multi_test (1.1.0) multi_xml (0.6.0) - multipart-post (2.1.1) nenv (0.3.0) - nio4r (2.5.5) - nokogiri (1.11.1-x86_64-darwin) + net-imap (0.3.4) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.1) + timeout + net-smtp (0.3.3) + net-protocol + nio4r (2.5.8) + nokogiri (1.14.2-arm64-darwin) racc (~> 1.4) - nokogiri (1.11.1-x86_64-linux) + nokogiri (1.14.2-x86_64-linux) racc (~> 1.4) notiffany (0.1.3) nenv (~> 0.1) shellany (~> 0.0) - oauth2 (1.4.4) - faraday (>= 0.8, < 2.0) + oauth2 (2.0.9) + faraday (>= 0.17.3, < 3.0) jwt (>= 1.0, < 3.0) - multi_json (~> 1.3) multi_xml (~> 0.5) - rack (>= 1.2, < 3) - octokit (4.20.0) - faraday (>= 0.9) - sawyer (~> 0.8.0, >= 0.5.3) - omniauth (1.9.1) + rack (>= 1.2, < 4) + snaky_hash (~> 2.0) + version_gem (~> 1.1) + octokit (4.25.1) + faraday (>= 1, < 3) + sawyer (~> 0.9) + omniauth (2.1.1) hashie (>= 3.4.6) - rack (>= 1.6.2, < 3) - omniauth-github (1.4.0) - omniauth (~> 1.5) - omniauth-oauth2 (>= 1.4.0, < 2.0) - omniauth-oauth2 (1.7.1) - oauth2 (~> 1.4) - omniauth (>= 1.9, < 3) - pg (1.2.3) - protobuf-cucumber (3.10.8) - activesupport (>= 3.2) - middleware - thor - thread_safe - pry (0.14.0) + rack (>= 2.2.3) + rack-protection + omniauth-github (2.0.1) + omniauth (~> 2.0) + omniauth-oauth2 (~> 1.8) + omniauth-oauth2 (1.8.0) + oauth2 (>= 1.4, < 3) + omniauth (~> 2.0) + omniauth-rails_csrf_protection (1.0.1) + actionpack (>= 4.2) + omniauth (~> 2.0) + pg (1.4.6) + pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - public_suffix (4.0.6) - puma (5.2.1) + public_suffix (5.0.1) + puma (5.6.5) nio4r (~> 2.0) - racc (1.5.2) - rack (2.2.3) - rack-mini-profiler (2.3.1) + racc (1.6.2) + rack (2.2.6.3) + rack-mini-profiler (2.3.4) rack (>= 1.2.0) - rack-test (1.1.0) - rack (>= 1.0, < 3) - rails (6.1.3) - actioncable (= 6.1.3) - actionmailbox (= 6.1.3) - actionmailer (= 6.1.3) - actionpack (= 6.1.3) - actiontext (= 6.1.3) - actionview (= 6.1.3) - activejob (= 6.1.3) - activemodel (= 6.1.3) - activerecord (= 6.1.3) - activestorage (= 6.1.3) - activesupport (= 6.1.3) + rack-protection (3.0.5) + rack + rack-test (2.0.2) + rack (>= 1.3) + rails (6.1.7.2) + actioncable (= 6.1.7.2) + actionmailbox (= 6.1.7.2) + actionmailer (= 6.1.7.2) + actionpack (= 6.1.7.2) + actiontext (= 6.1.7.2) + actionview (= 6.1.7.2) + activejob (= 6.1.7.2) + activemodel (= 6.1.7.2) + activerecord (= 6.1.7.2) + activestorage (= 6.1.7.2) + activesupport (= 6.1.7.2) bundler (>= 1.15.0) - railties (= 6.1.3) + railties (= 6.1.7.2) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.3.0) - loofah (~> 2.3) + rails-html-sanitizer (1.5.0) + loofah (~> 2.19, >= 2.19.1) rails_12factor (0.0.3) rails_serve_static_assets rails_stdout_logging rails_serve_static_assets (0.0.5) rails_stdout_logging (0.0.5) - railties (6.1.3) - actionpack (= 6.1.3) - activesupport (= 6.1.3) + railties (6.1.7.2) + actionpack (= 6.1.7.2) + activesupport (= 6.1.7.2) method_source - rake (>= 0.8.7) + rake (>= 12.2) thor (~> 1.0) - rake (13.0.3) - rb-fsevent (0.10.4) + rake (13.0.6) + rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) - regexp_parser (2.0.3) - rspec (3.10.0) - rspec-core (~> 3.10.0) - rspec-expectations (~> 3.10.0) - rspec-mocks (~> 3.10.0) - rspec-core (3.10.1) - rspec-support (~> 3.10.0) - rspec-expectations (3.10.1) + regexp_parser (2.7.0) + rexml (3.2.5) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-core (3.12.1) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.2) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) - rspec-mocks (3.10.2) + rspec-support (~> 3.12.0) + rspec-mocks (3.12.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) - rspec-rails (4.0.2) - actionpack (>= 4.2) - activesupport (>= 4.2) - railties (>= 4.2) - rspec-core (~> 3.10) - rspec-expectations (~> 3.10) - rspec-mocks (~> 3.10) - rspec-support (~> 3.10) - rspec-support (3.10.2) - ruby2_keywords (0.0.4) + rspec-support (~> 3.12.0) + rspec-rails (6.0.1) + actionpack (>= 6.1) + activesupport (>= 6.1) + railties (>= 6.1) + rspec-core (~> 3.11) + rspec-expectations (~> 3.11) + rspec-mocks (~> 3.11) + rspec-support (~> 3.11) + rspec-support (3.12.0) + ruby2_keywords (0.0.5) sass-rails (6.0.0) sassc-rails (~> 2.1, >= 2.1.1) sassc (2.4.0) @@ -293,61 +306,69 @@ GEM sprockets (> 3.0) sprockets-rails tilt - sawyer (0.8.2) + sawyer (0.9.2) addressable (>= 2.3.5) - faraday (> 0.8, < 2.0) + faraday (>= 0.17.3, < 3) shellany (0.0.1) - simplecov (0.21.2) + simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) - simplecov_json_formatter (0.1.2) - sprockets (4.0.2) + simplecov_json_formatter (0.1.4) + snaky_hash (2.0.1) + hashie + version_gem (~> 1.1, >= 1.1.1) + sprockets (4.2.0) concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.2.2) - actionpack (>= 4.0) - activesupport (>= 4.0) + rack (>= 2.2.4, < 4) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) sprockets (>= 3.0.0) - sqlite3 (1.4.2) + sqlite3 (1.6.1-arm64-darwin) + sqlite3 (1.6.1-x86_64-linux) sys-uname (1.2.2) ffi (~> 1.1) - thor (1.1.0) - thread_safe (0.3.6) - tilt (2.0.10) - tzinfo (2.0.4) + thor (1.2.1) + tilt (2.1.0) + timeout (0.3.2) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) - web-console (4.1.0) + version_gem (1.1.1) + web-console (4.2.0) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - websocket-driver (0.7.3) + webrick (1.8.1) + websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.4.2) + zeitwerk (2.6.7) PLATFORMS - x86_64-darwin-19 - x86_64-darwin-20 + arm64-darwin-21 x86_64-linux DEPENDENCIES active_type (= 1.3.2) bootsnap (>= 1.4.4) byebug + codeclimate-test-reporter cucumber-rails cucumber-rails-training-wheels database_cleaner + faraday-retry guard-rspec jbuilder (~> 2.7) listen (~> 3.3) octokit (~> 4.0) omniauth omniauth-github + omniauth-rails_csrf_protection pg puma (~> 5.0) rack-mini-profiler (~> 2.0) @@ -355,7 +376,8 @@ DEPENDENCIES rails_12factor rspec-rails sass-rails (>= 6) - simplecov + simplecov (~> 0.22.0) + simplecov_json_formatter sqlite3 (~> 1.4) tzinfo-data web-console (>= 4.1.0) diff --git a/README.md b/README.md index 79c7716..5ecb829 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,13 @@ [![Bluejay Dashboard](https://img.shields.io/badge/Bluejay-Dashboard_9-blue.svg)](http://dashboard.bluejay.governify.io/dashboard/script/dashboardLoader.js?dashboardURL=https://reporter.bluejay.governify.io/api/v4/dashboards/tpa-CS169L-GH-fshamji_PrairieLearn-EECS/main) +#sp23 + + + +![build](https://github.com/cs169/PrairieLearn-EECS/actions/workflows/ci.yml/badge.svg) + +[![Bluejay Dashboard](https://img.shields.io/badge/Bluejay-Dashboard_01-blue.svg)](http://dashboard.bluejay.governify.io/dashboard/script/dashboardLoader.js?dashboardURL=https://reporter.bluejay.governify.io/api/v4/dashboards/tpa-CS169L-23-GH-cs169_PrairieLearn-EECS/main) --- ## Description @@ -63,7 +70,7 @@ For more information regarding PrairieLearn, go to https://prairielearn.readthed - Go to https://prairielearn-eecs.herokuapp.com - Login to GitHub via 3rd party authentication -- Select a repository you would like to synchronize from the list and click 'Synchronize'; This might take a couple minutes so sit back and relax +- Select a repository you would like to synchronize from the list (only private repositories will show up). Also, make sure there is a directory called 'questions' in your repo that contains all of the questions subdirectories. Then click 'Synchronize'; This might take a couple minutes so sit back and relax - Configure your assessment via the column on the right with all its metadata - Drag-and-drop questions from the left column to the middle column and set the points for each questions. - Click 'Export' to download your JSON file diff --git a/app/controllers/login_controller.rb b/app/controllers/login_controller.rb index 6a4411b..4c6bce6 100644 --- a/app/controllers/login_controller.rb +++ b/app/controllers/login_controller.rb @@ -2,9 +2,6 @@ class LoginController < ApplicationController before_action :already_logged_in, except: [:logout] - # Commenting this out since it is not used. Delete later. - # def login; end - def github create_session(:create_github_user) end diff --git a/app/controllers/repo_controller.rb b/app/controllers/repo_controller.rb index 469e37e..a00d466 100644 --- a/app/controllers/repo_controller.rb +++ b/app/controllers/repo_controller.rb @@ -1,5 +1,7 @@ # controller to get a list of repos and questions from repo require 'octokit' +require 'json' +require "base64" class RepoController < ApplicationController # All method require authenticated user @@ -78,7 +80,14 @@ def addQuestions(client, repo, path) # If .JSON file is found, keep the path if file.name == "info.json" question_name = file.path.partition('/')[2].rpartition('/')[0] - Question.create(title: question_name, repo: repo) + + path_str = path+"/info.json" + + contentsJsonInfobase64 = client.contents(repo, path: path_str) + + descriptive_title = JSON.parse(Base64.decode64(contentsJsonInfobase64[:content]))["title"] + + Question.create(title: question_name, descriptivetitle: descriptive_title, repo: repo) end # Recursively call the helper method if current file is a folder if file.type == 'dir' diff --git a/app/views/login/home.html.erb b/app/views/login/home.html.erb index c085a20..78e2896 100644 --- a/app/views/login/home.html.erb +++ b/app/views/login/home.html.erb @@ -25,13 +25,14 @@
-Welcome!
To start creating a new assessment, please login.
- <%= link_to 'Login to Github', :github_login, :class => 'btn btn-primary' %> + <%= form_tag('/auth/github', method: 'post', data: {turbo: false}) do %> + + <% end %>