Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Commit

Permalink
Merge efc8b3b into 05500ae
Browse files Browse the repository at this point in the history
  • Loading branch information
JPrevost committed May 27, 2016
2 parents 05500ae + efc8b3b commit 535b97a
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 42 deletions.
2 changes: 2 additions & 0 deletions .yardopts
@@ -0,0 +1,2 @@
-
LICENSE.md
66 changes: 33 additions & 33 deletions Gemfile.lock
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -220,23 +220,23 @@ 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)
rest-client (1.8.0)
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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
20 changes: 19 additions & 1 deletion README.md
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion app/controllers/submissions_controller.rb
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion app/models/epdcx.rb
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion app/models/mets.rb
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions app/models/sword.rb
Expand Up @@ -7,15 +7,17 @@ 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
@submission.to_sword_package(@callback_uri)
@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
Expand Down
3 changes: 2 additions & 1 deletion test/lib/submission_cleanup_test.rb
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions test/models/s3_test.rb
Expand Up @@ -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

Expand All @@ -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)
Expand Down

0 comments on commit 535b97a

Please sign in to comment.