Skip to content

Commit 294a9f2

Browse files
author
Collier
committed
Initial commit for Samvera sword
0 parents  commit 294a9f2

File tree

94 files changed

+1311
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+1311
-0
lines changed

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.bundle/
2+
log/*.log
3+
pkg/
4+
test/dummy/db/*.sqlite3
5+
test/dummy/db/*.sqlite3-journal
6+
test/dummy/log/*.log
7+
test/dummy/tmp/

Gemfile

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
source 'https://rubygems.org'
2+
3+
# Declare your gem's dependencies in sword.gemspec.
4+
# Bundler will treat runtime dependencies like base dependencies, and
5+
# development dependencies will be added by default to the :development group.
6+
gemspec
7+
8+
# Declare any dependencies that are still in development here instead of in
9+
# your gemspec. These might include edge Rails or gems from your path or
10+
# Git. Remember to move these dependencies to your gemspec before releasing
11+
# your gem to rubygems.org.
12+
13+
# To use a debugger
14+
# gem 'byebug', group: [:development, :test]

Gemfile.lock

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
PATH
2+
remote: .
3+
specs:
4+
sword (0.1.0)
5+
rails (~> 5.0.3)
6+
7+
GEM
8+
remote: https://rubygems.org/
9+
specs:
10+
actioncable (5.0.3)
11+
actionpack (= 5.0.3)
12+
nio4r (>= 1.2, < 3.0)
13+
websocket-driver (~> 0.6.1)
14+
actionmailer (5.0.3)
15+
actionpack (= 5.0.3)
16+
actionview (= 5.0.3)
17+
activejob (= 5.0.3)
18+
mail (~> 2.5, >= 2.5.4)
19+
rails-dom-testing (~> 2.0)
20+
actionpack (5.0.3)
21+
actionview (= 5.0.3)
22+
activesupport (= 5.0.3)
23+
rack (~> 2.0)
24+
rack-test (~> 0.6.3)
25+
rails-dom-testing (~> 2.0)
26+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
27+
actionview (5.0.3)
28+
activesupport (= 5.0.3)
29+
builder (~> 3.1)
30+
erubis (~> 2.7.0)
31+
rails-dom-testing (~> 2.0)
32+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
33+
activejob (5.0.3)
34+
activesupport (= 5.0.3)
35+
globalid (>= 0.3.6)
36+
activemodel (5.0.3)
37+
activesupport (= 5.0.3)
38+
activerecord (5.0.3)
39+
activemodel (= 5.0.3)
40+
activesupport (= 5.0.3)
41+
arel (~> 7.0)
42+
activesupport (5.0.3)
43+
concurrent-ruby (~> 1.0, >= 1.0.2)
44+
i18n (~> 0.7)
45+
minitest (~> 5.1)
46+
tzinfo (~> 1.1)
47+
arel (7.1.4)
48+
builder (3.2.3)
49+
concurrent-ruby (1.0.5)
50+
erubis (2.7.0)
51+
globalid (0.4.0)
52+
activesupport (>= 4.2.0)
53+
i18n (0.8.4)
54+
loofah (2.0.3)
55+
nokogiri (>= 1.5.9)
56+
mail (2.6.5)
57+
mime-types (>= 1.16, < 4)
58+
method_source (0.8.2)
59+
mime-types (3.1)
60+
mime-types-data (~> 3.2015)
61+
mime-types-data (3.2016.0521)
62+
mini_portile2 (2.2.0)
63+
minitest (5.10.2)
64+
nio4r (2.1.0)
65+
nokogiri (1.8.0)
66+
mini_portile2 (~> 2.2.0)
67+
rack (2.0.3)
68+
rack-test (0.6.3)
69+
rack (>= 1.0)
70+
rails (5.0.3)
71+
actioncable (= 5.0.3)
72+
actionmailer (= 5.0.3)
73+
actionpack (= 5.0.3)
74+
actionview (= 5.0.3)
75+
activejob (= 5.0.3)
76+
activemodel (= 5.0.3)
77+
activerecord (= 5.0.3)
78+
activesupport (= 5.0.3)
79+
bundler (>= 1.3.0, < 2.0)
80+
railties (= 5.0.3)
81+
sprockets-rails (>= 2.0.0)
82+
rails-dom-testing (2.0.3)
83+
activesupport (>= 4.2.0)
84+
nokogiri (>= 1.6)
85+
rails-html-sanitizer (1.0.3)
86+
loofah (~> 2.0)
87+
railties (5.0.3)
88+
actionpack (= 5.0.3)
89+
activesupport (= 5.0.3)
90+
method_source
91+
rake (>= 0.8.7)
92+
thor (>= 0.18.1, < 2.0)
93+
rake (12.0.0)
94+
sprockets (3.7.1)
95+
concurrent-ruby (~> 1.0)
96+
rack (> 1, < 3)
97+
sprockets-rails (3.2.0)
98+
actionpack (>= 4.0)
99+
activesupport (>= 4.0)
100+
sprockets (>= 3.0.0)
101+
sqlite3 (1.3.13)
102+
thor (0.19.4)
103+
thread_safe (0.3.6)
104+
tzinfo (1.2.3)
105+
thread_safe (~> 0.1)
106+
websocket-driver (0.6.5)
107+
websocket-extensions (>= 0.1.0)
108+
websocket-extensions (0.1.2)
109+
110+
PLATFORMS
111+
ruby
112+
113+
DEPENDENCIES
114+
sqlite3
115+
sword!
116+
117+
BUNDLED WITH
118+
1.14.6

MIT-LICENSE

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright 2017
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Sword
2+
Short description and motivation.
3+
4+
## Usage
5+
How to use my plugin.
6+
7+
## Installation
8+
Add this line to your application's Gemfile:
9+
10+
```ruby
11+
gem 'sword'
12+
```
13+
14+
And then execute:
15+
```bash
16+
$ bundle
17+
```
18+
19+
Or install it yourself as:
20+
```bash
21+
$ gem install sword
22+
```
23+
24+
## Contributing
25+
Contribution directions go here.
26+
27+
## License
28+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

Rakefile

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
begin
2+
require 'bundler/setup'
3+
rescue LoadError
4+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5+
end
6+
7+
require 'rdoc/task'
8+
9+
RDoc::Task.new(:rdoc) do |rdoc|
10+
rdoc.rdoc_dir = 'rdoc'
11+
rdoc.title = 'Sword'
12+
rdoc.options << '--line-numbers'
13+
rdoc.rdoc_files.include('README.md')
14+
rdoc.rdoc_files.include('lib/**/*.rb')
15+
end
16+
17+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
18+
load 'rails/tasks/engine.rake'
19+
20+
21+
load 'rails/tasks/statistics.rake'
22+
23+
24+
25+
require 'bundler/gem_tasks'
26+
27+
require 'rake/testtask'
28+
29+
Rake::TestTask.new(:test) do |t|
30+
t.libs << 'lib'
31+
t.libs << 'test'
32+
t.pattern = 'test/**/*_test.rb'
33+
t.verbose = false
34+
end
35+
36+
37+
task default: :test

app/assets/config/sword_manifest.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
//= link_directory ../javascripts/sword .js
2+
//= link_directory ../stylesheets/sword .css

app/assets/images/sword/.keep

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// This is a manifest file that'll be compiled into application.js, which will include all the files
2+
// listed below.
3+
//
4+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6+
//
7+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
9+
//
10+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11+
// about supported directives.
12+
//
13+
//= require_tree .
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Place all the behaviors and hooks related to the matching controller here.
2+
// All this logic will automatically be available in application.js.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Place all the behaviors and hooks related to the matching controller here.
2+
// All this logic will automatically be available in application.js.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* This is a manifest file that'll be compiled into application.css, which will include all the files
3+
* listed below.
4+
*
5+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7+
*
8+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
9+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10+
* files in this directory. Styles in this file should be added after the last require_* statement.
11+
* It is generally better to create a new file per style scope.
12+
*
13+
*= require_tree .
14+
*= require_self
15+
*/
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/*
2+
Place all the styles related to the matching controller here.
3+
They will automatically be included in application.css.
4+
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/*
2+
Place all the styles related to the matching controller here.
3+
They will automatically be included in application.css.
4+
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module Sword
2+
class ApplicationController < ActionController::Base
3+
protect_from_forgery with: :exception
4+
end
5+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
require_dependency "sword/application_controller"
2+
3+
module Sword
4+
class DepositController < ApplicationController
5+
6+
skip_before_filter :verify_authenticity_token
7+
8+
def index
9+
puts request.body.read
10+
end
11+
12+
def create
13+
render :text => "#{request.params}"
14+
File.open("/tmp/upload.zip", "wb") do |f|
15+
f.write(request.raw_post)
16+
end
17+
end
18+
end
19+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
require_dependency "sword/application_controller"
2+
3+
module Sword
4+
class ServicedocumentController < ApplicationController
5+
6+
attr_reader :user
7+
8+
before_filter :http_authenticate
9+
10+
# before_action :authenticate_user!
11+
12+
def index
13+
admin_sets_for_user
14+
render "index.xml.erb"
15+
end
16+
17+
protected
18+
19+
def http_authenticate
20+
authenticate_or_request_with_http_basic do |username, password|
21+
@user ||= User.find_by_user_key(username)
22+
!user.nil? && user.valid_password?(password)
23+
end
24+
warden.custom_failure! if performed?
25+
end
26+
27+
def admin_sets_for_user
28+
@admin_sets_for_user ||= @user.ability.admin_set_ids_for_deposit
29+
end
30+
31+
end
32+
end
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module Sword
2+
module ApplicationHelper
3+
end
4+
end

app/helpers/sword/deposit_helper.rb

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module Sword
2+
module DepositHelper
3+
end
4+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module Sword
2+
module ServiceDocumentHelper
3+
end
4+
end

app/jobs/sword/application_job.rb

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module Sword
2+
class ApplicationJob < ActiveJob::Base
3+
end
4+
end
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module Sword
2+
class ApplicationMailer < ActionMailer::Base
3+
default from: '[email protected]'
4+
layout 'mailer'
5+
end
6+
end
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module Sword
2+
class ApplicationRecord < ActiveRecord::Base
3+
self.abstract_class = true
4+
end
5+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Sword</title>
5+
<%= stylesheet_link_tag "sword/application", media: "all" %>
6+
<%= javascript_include_tag "sword/application" %>
7+
<%= csrf_meta_tags %>
8+
</head>
9+
<body>
10+
11+
<%= yield %>
12+
13+
</body>
14+
</html>

app/views/sword/deposit/index.html.erb

Whitespace-only changes.

0 commit comments

Comments
 (0)