From 8bd15154ceda665d5a222901905ff19f8f78d007 Mon Sep 17 00:00:00 2001 From: Jeremy Prevost Date: Fri, 27 May 2016 11:02:17 -0400 Subject: [PATCH 1/2] Document minimal viable env --- .yardopts | 2 ++ README.md | 20 +++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 .yardopts diff --git a/.yardopts b/.yardopts new file mode 100644 index 0000000..fcb8088 --- /dev/null +++ b/.yardopts @@ -0,0 +1,2 @@ +- +LICENSE.md diff --git a/README.md b/README.md index 7013936..573e849 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,25 @@ To prevent using a real S3 service in testing (and development if you prefer), you can use the provided rake tasks `rake fakes3:start` and `rake fakes3:stop` to spin up a fake of the service. -## Required Environment Variables +## Minimum Environment Variables for development + +You can copy these into a .env file and use `heroku local` (included with the + [Heroku Toolbelt](https://toolbelt.heroku.com)) to launch the application. + You may want to remove the second line of Profile to disable processing of + the job queue depending on what portions of the application you are working + on. + +`FAKE_AUTH_ENABLED=true` see Optional Environment Variables + +`S3_BUCKET=fakebucket` see Environment Variables + +`AWS_ACCESS_KEY_ID=12345` see Environment Variables + +`AWS_SECRET_ACCESS_KEY=12345` see Environment Variables + +NOTE: You'll need to add the 3 SWORD_* variables if you want to deliver packages in development + +## Environment Variables `EMAIL_FROM`: this is the default email address messages will be sent from From efc8b3b30debdace12795ea24fa6578701d46227 Mon Sep 17 00:00:00 2001 From: Jeremy Prevost Date: Fri, 27 May 2016 11:09:10 -0400 Subject: [PATCH 2/2] update deps and apply new rubocop rule --- Gemfile.lock | 66 +++++++++++------------ app/controllers/submissions_controller.rb | 3 +- app/models/epdcx.rb | 3 +- app/models/mets.rb | 3 +- app/models/sword.rb | 6 ++- test/lib/submission_cleanup_test.rb | 3 +- test/models/s3_test.rb | 6 ++- 7 files changed, 49 insertions(+), 41 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7efa553..8fb023e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -44,22 +44,22 @@ GEM thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) addressable (2.4.0) - annotate (2.7.0) + annotate (2.7.1) activerecord (>= 3.2, < 6.0) - rake (~> 10.4) + rake (>= 10.4, < 12.0) ansi (1.5.0) arel (6.0.3) ast (2.2.0) - aws-sdk (2.3.2) - aws-sdk-resources (= 2.3.2) - aws-sdk-core (2.3.2) + aws-sdk (2.3.9) + aws-sdk-resources (= 2.3.9) + aws-sdk-core (2.3.9) jmespath (~> 1.0) - aws-sdk-resources (2.3.2) - aws-sdk-core (= 2.3.2) + aws-sdk-resources (2.3.9) + aws-sdk-core (= 2.3.9) bcrypt (3.1.11) builder (3.2.2) - byebug (8.2.5) - cancancan (1.13.1) + byebug (9.0.4) + cancancan (1.14.0) capybara (2.7.1) addressable mime-types (>= 1.16) @@ -80,12 +80,12 @@ GEM safe_yaml (~> 1.0.0) database_cleaner (1.5.3) debug_inspector (0.0.2) - delayed_job (4.1.1) - activesupport (>= 3.0, < 5.0) - delayed_job_active_record (4.1.0) - activerecord (>= 3.0, < 5) + delayed_job (4.1.2) + activesupport (>= 3.0, < 5.1) + delayed_job_active_record (4.1.1) + activerecord (>= 3.0, < 5.1) delayed_job (>= 3.0, < 5) - devise (4.1.0) + devise (4.1.1) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0, < 5.1) @@ -95,7 +95,7 @@ GEM domain_name (0.5.20160310) unf (>= 0.0.5, < 1.0.0) erubis (2.7.0) - execjs (2.6.0) + execjs (2.7.0) fakes3 (0.2.4) builder thor @@ -134,29 +134,29 @@ GEM nokogiri (>= 1.5.9) mail (2.6.4) mime-types (>= 1.16, < 4) - mime-types (2.99.1) + mime-types (2.99.2) mini_portile2 (2.0.0) - minitest (5.8.4) - minitest-capybara (0.7.2) + minitest (5.9.0) + minitest-capybara (0.8.2) capybara (~> 2.2) minitest (~> 5.0) rake - minitest-metadata (0.5.3) + minitest-metadata (0.6.0) minitest (>= 4.7, < 6.0) - minitest-rails (2.2.0) + minitest-rails (2.2.1) minitest (~> 5.7) railties (~> 4.1) - minitest-rails-capybara (2.1.1) - capybara (~> 2.0) - minitest-capybara (~> 0.7.0) - minitest-metadata (~> 0.5.0) + minitest-rails-capybara (2.1.2) + capybara (~> 2.7) + minitest-capybara (~> 0.8) + minitest-metadata (~> 0.6) minitest-rails (~> 2.1) minitest-reporters (1.1.9) ansi builder minitest (>= 5.0) ruby-progressbar - multi_json (1.12.0) + multi_json (1.12.1) multi_xml (0.5.5) multipart-post (2.0.0) netrc (0.11.0) @@ -220,7 +220,7 @@ GEM rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (2.1.0) - rake (10.5.0) + rake (11.1.2) ref (2.0.0) responders (2.2.0) railties (>= 4.2.0, < 5.1) @@ -228,15 +228,15 @@ GEM http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 3.0) netrc (~> 0.7) - rollbar (2.11.2) + rollbar (2.11.3) multi_json - rubocop (0.39.0) - parser (>= 2.3.0.7, < 3.0) + rubocop (0.40.0) + parser (>= 2.3.1.0, < 3.0) powerpack (~> 0.1) rainbow (>= 1.99.1, < 3.0) ruby-progressbar (~> 1.7) unicode-display_width (~> 1.0, >= 1.0.1) - ruby-progressbar (1.8.0) + ruby-progressbar (1.8.1) rubyzip (1.2.0) safe_yaml (1.0.4) sass (3.4.22) @@ -262,7 +262,7 @@ GEM ref thor (0.19.1) thread_safe (0.3.5) - tilt (2.0.2) + tilt (2.0.4) timecop (0.8.1) tins (1.6.0) twitter-bootstrap-rails (3.2.2) @@ -278,7 +278,7 @@ GEM unf_ext unf_ext (0.0.7.2) unicode-display_width (1.0.5) - vcr (3.0.1) + vcr (3.0.3) warden (1.2.6) rack (>= 1.0) web-console (3.1.1) @@ -289,7 +289,7 @@ GEM addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff - websocket-driver (0.6.3) + websocket-driver (0.6.4) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.2) xpath (2.0.0) diff --git a/app/controllers/submissions_controller.rb b/app/controllers/submissions_controller.rb index 23c983d..2f1aebe 100644 --- a/app/controllers/submissions_controller.rb +++ b/app/controllers/submissions_controller.rb @@ -93,7 +93,8 @@ def set_s3_direct_post @s3_direct_post = S3_BUCKET.presigned_post( key: "uploads/#{SecureRandom.uuid}/${filename}", success_action_status: '201', - acl: 'public-read') + acl: 'public-read' + ) end def callback_uri diff --git a/app/models/epdcx.rb b/app/models/epdcx.rb index ae4aae3..46eb6f2 100644 --- a/app/models/epdcx.rb +++ b/app/models/epdcx.rb @@ -17,7 +17,8 @@ def initialize(xml, submission, callback_uri) @xml = xml @callback_uri = callback_uri @xml['epdcx'].descriptionSet( - 'xmlns:epdcx' => 'http://purl.org/eprint/epdcx/2006-11-16/') do + 'xmlns:epdcx' => 'http://purl.org/eprint/epdcx/2006-11-16/' + ) do work(submission) entity(submission) end diff --git a/app/models/mets.rb b/app/models/mets.rb index 2a1bd8a..cdb4582 100644 --- a/app/models/mets.rb +++ b/app/models/mets.rb @@ -28,7 +28,8 @@ def xml_builder 'xmlns:mets' => 'http://www.loc.gov/METS/', 'xmlns:xlink' => 'http://www.w3.org/1999/xlink', 'xmlns:epdcx' => 'http://purl.org/eprint/epdcx/2006-11-16/', - 'PROFILE' => 'DSpace METS SIP Profile 1.0') do + 'PROFILE' => 'DSpace METS SIP Profile 1.0' + ) do overall_structure(xml) end end diff --git a/app/models/sword.rb b/app/models/sword.rb index 79bcca5..b7612e8 100644 --- a/app/models/sword.rb +++ b/app/models/sword.rb @@ -7,7 +7,8 @@ def initialize(submission, callback_uri) @sword_server = RestClient::Resource.new( Rails.application.secrets.sword_endpoint, user: Rails.application.secrets.sword_username, - password: Rails.application.secrets.sword_password) + password: Rails.application.secrets.sword_password + ) end def deposit @@ -15,7 +16,8 @@ def deposit @response = @sword_server.post( File.read(@submission.sword_path), content_type: 'application/zip', - x_packaging: 'http://purl.org/net/sword-types/METSDSpaceSIP') + x_packaging: 'http://purl.org/net/sword-types/METSDSpaceSIP' + ) end def handle diff --git a/test/lib/submission_cleanup_test.rb b/test/lib/submission_cleanup_test.rb index a67bf67..35b16cd 100644 --- a/test/lib/submission_cleanup_test.rb +++ b/test/lib/submission_cleanup_test.rb @@ -27,7 +27,8 @@ def create_subs(title, status) funders: ['Department of Energy (DOE)'], pub_date: 1.year.ago, status: status, - handle: 'http://example.com') + handle: 'http://example.com' + ) end test 'submissions with approved and older than 1 month are deleted' do diff --git a/test/models/s3_test.rb b/test/models/s3_test.rb index 5b77f3c..8faba01 100644 --- a/test/models/s3_test.rb +++ b/test/models/s3_test.rb @@ -26,7 +26,8 @@ def teardown funders: ['Department of Energy (DOE)'], pub_date: 1.year.ago, status: 'status', - handle: 'http://example.com') + handle: 'http://example.com' + ) assert_equal(['uploads/45678', 'uploads/asdfa'], S3.abandoned_keys) end @@ -38,7 +39,8 @@ def teardown funders: ['Department of Energy (DOE)'], pub_date: 1.year.ago, status: 'status', - handle: 'http://example.com') + handle: 'http://example.com' + ) assert_equal(['uploads/45678', 'uploads/asdfa'], S3.abandoned_keys) S3.remove_abandoned_content assert_equal([], S3.abandoned_keys)