modsulator 1.3.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d919f061e61679be249145800d5854f129164a995ec0f4e24de12b65af323d8e
4
- data.tar.gz: dfee74e48ac27d66ae748eff40b38cc3af99ced8530fadc17194a04ccb93ab00
3
+ metadata.gz: 02c82a3c015b15fa442a3c5e7fb44cc8cc2a6fd7aec0065343850d1dbdae8f5e
4
+ data.tar.gz: 229b82a390cf791610e9d8b179cf6ded1f6e3ec6d585277615150e59a926241f
5
5
  SHA512:
6
- metadata.gz: 4113eeba77103b91e02f76266d3e98c200edc5b38561c5961eda60658c9bb639fac8fa84763c5985faeecacca61178212890c092168d290c744aab0b02541591
7
- data.tar.gz: dc5de2130ca399902ad086a55e8a510490cdc5643333e563396be84c8f20f54a5a4711d010ff3ee571ed4122d0414954bca8ebf8d397962c01a8e917adbc84c8
6
+ metadata.gz: b34f3f166332f8e75f0d4337ada4e1e4f8ed311856e7b81c36577b60e36f84f9767a53f1ee7c4a219e54bb1082a846472c8b00bfb988a5ec4475c226161e1220
7
+ data.tar.gz: 7882f6d3c20a018463c3fadde0081131f3eb22cc982fd90da7d7b7d933c80e10be317ff0f7bd6f62a6c2388beb0ef81456dc27ec0ef826cd9d8b4e34ae268262
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Apache License
1
+ Apache License
2
2
  Version 2.0, January 2004
3
3
  http://www.apache.org/licenses/
4
4
 
@@ -199,4 +199,3 @@ Apache License
199
199
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
200
  See the License for the specific language governing permissions and
201
201
  limitations under the License.
202
-
data/README.md CHANGED
@@ -1,11 +1,32 @@
1
- [![Build Status](https://travis-ci.org/sul-dlss/modsulator.svg?branch=master)](https://travis-ci.org/sul-dlss/modsulator) [![Coverage Status](https://coveralls.io/repos/sul-dlss/modsulator/badge.png)](https://coveralls.io/r/sul-dlss/modsulator) [![Gem Version](https://badge.fury.io/rb/modsulator.svg)](http://badge.fury.io/rb/modsulator) [![Code Climate](https://codeclimate.com/github/sul-dlss/modsulator/badges/gpa.svg)](https://codeclimate.com/github/sul-dlss/modsulator)
1
+ [![Build Status](https://travis-ci.org/sul-dlss/modsulator-app-rails.svg?branch=master)](https://travis-ci.org/sul-dlss/modsulator-app-rails)
2
+ [![Coverage Status](https://coveralls.io/repos/sul-dlss/modsulator-app-rails/badge.svg)](https://coveralls.io/r/sul-dlss/modsulator-app-rails)
3
+ [![GitHub version](https://badge.fury.io/gh/sul-dlss%2Fmodsulator-app-rails.svg)](https://badge.fury.io/gh/sul-dlss%2Fmodsulator-app-rails)
2
4
 
3
- # modsulator
4
- Produce Stanford MODS from spreadsheets.
5
+ # modsulator-app-rails
5
6
 
6
- Note that only .xlsx and .csv formats work with the latest template, which has more columns than
7
- .xls allows (> 256).
7
+ A Rails API for the [MODSulator](https://github.com/sul-dlss/modsulator). This API is used by Argo for spreadsheet bulk upload.
8
8
 
9
- # Running on the console
10
9
 
11
- bin/console
10
+ Provides the following endpoints:
11
+
12
+ ```
13
+ GET /v1/spreadsheet
14
+ POST /v1/modsulator
15
+ POST /v1/normalizer
16
+ ```
17
+
18
+
19
+ ## Installing
20
+
21
+ ```shell
22
+ git checkout https://github.com/sul-dlss/modsulator-app-rails.git
23
+ cd modsulator-rails-app
24
+ bundle install
25
+ ```
26
+
27
+ ## Command line tool
28
+
29
+ You can transform a spreadsheet using the command line tool by doing:
30
+ ```shell
31
+ ./bin/modsulator spec/fixtures/M1463_AV_manifest.xlsx > output.xml
32
+ ```
data/Rakefile CHANGED
@@ -1,43 +1,17 @@
1
- require 'rspec/core/rake_task'
2
- require 'yard'
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
3
 
4
- RSpec::Core::RakeTask.new(:spec) do |spec|
5
- spec.pattern = 'spec/**/*_spec.rb'
6
- spec.exclude_pattern = 'spec/integration_tests/**/*_spec.rb'
7
- end
8
-
9
-
10
- # Larger integration/acceptance style tests (take several minutes to complete)
11
- RSpec::Core::RakeTask.new(:integration_tests) do |spec|
12
- spec.pattern = 'spec/integration_tests/**/*_spec.rb'
13
- end
14
-
15
-
16
- YARD::Rake::YardocTask.new(:yard) do |t|
17
- t.files = ['lib/**/*.rb'] # optional
18
- t.stats_options = ['--list-undoc'] # optional
19
- end
4
+ require_relative 'config/application'
20
5
 
21
- task :lint do
22
- sh "ruby-lint lib/ bin/"
23
- end
6
+ Rails.application.load_tasks
24
7
 
25
- task :default => :spec # Default task is to just run shorter (unit) tests
8
+ Rake::Task['spec'].clear
9
+ RSpec::Core::RakeTask.new(:spec) do |t|
10
+ t.pattern = 'spec/**/*_spec.rb'
26
11
 
27
- task :all do
28
- Rake::Task["spec"].invoke
29
- Rake::Task["yard"].invoke
30
- Rake::Task["integration_tests"].invoke
31
- Rake::Task["lint"].invoke
12
+ # The modsulator integration_tests are very slow
13
+ t.exclude_pattern = 'spec/integration_tests/*_spec.rb'
32
14
  end
33
15
 
34
-
35
-
36
-
37
- # Set up default Rake tasks for cutting gems etc.
38
- begin
39
- require 'bundler/setup'
40
- rescue LoadError
41
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
42
- end
16
+ # This gives us task for managing the gem (e.g.: rake release)
43
17
  Bundler::GemHelper.install_tasks
@@ -0,0 +1,6 @@
1
+ class AboutController < ApplicationController
2
+ def index
3
+ @version ||= IO.readlines('VERSION').first
4
+ render plain: "modsulator-api version #{@version}"
5
+ end
6
+ end
@@ -0,0 +1,2 @@
1
+ class ApplicationController < ActionController::API
2
+ end
@@ -0,0 +1,10 @@
1
+ class ModsulatorController < ApplicationController
2
+ def create
3
+ mods_converter = Modsulator.new(File.new(params[:file].tempfile), params[:filename])
4
+ render xml: mods_converter.convert_rows()
5
+ end
6
+
7
+ def version
8
+ render plain: '2.0.0'
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ class NormalizerController < ApplicationController
2
+ def create
3
+ input_file = File.open(File.new(params[:file].tempfile))
4
+ xml = input_file.read
5
+ input_file.close
6
+ normalizer = Stanford::Mods::Normalizer.new
7
+ render xml: normalizer.normalize_xml_string(xml)
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ class SpreadsheetController < ApplicationController
2
+ def index
3
+ send_file Modsulator.template_spreadsheet_path
4
+ end
5
+ end
@@ -1,5 +1,3 @@
1
- require 'nokogiri'
2
-
3
1
  # Validates XML against the MODSulator schema.
4
2
  class Validator
5
3
  # The Nokogiri::XML::Schema instance used for validation.
@@ -13,7 +11,7 @@ class Validator
13
11
  @schema = Nokogiri::XML::Schema(File.open(schema_file))
14
12
  end
15
13
 
16
-
14
+
17
15
  # Validates an XML string.
18
16
  #
19
17
  # @param xml An XML document as a string.
@@ -23,7 +21,7 @@ class Validator
23
21
  return validate_xml_doc(xml_doc)
24
22
  end
25
23
 
26
-
24
+
27
25
  # Validates an XML document.
28
26
  #
29
27
  # @param doc An instance of Nokogiri::XML::Document
@@ -1,16 +1,13 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # This is a command line script that generates <xmlDocs> using the modsulator methods.
4
-
5
- require 'modsulator'
6
-
7
- abort 'Usage: modsulator <spreadsheet>' unless ARGV.length == 1
4
+ abort 'Usage: bin/modsulator <spreadsheet>' unless ARGV.length == 1
8
5
 
9
6
  unless File.exist?(ARGV[0]) && File.readable?(ARGV[0])
10
7
  abort "*** The file #{ARGV[0]} does not exist or is not readable to the current user? - Terminating."
11
8
  end
12
9
 
13
- modsulator = Modsulator.new(File.new(ARGV[0]), File.basename(ARGV[0]))
14
- xml_string = modsulator.convert_rows()
10
+ require_relative '../config/environment'
15
11
 
16
- puts xml_string
12
+ modsulator = Modsulator.new(File.new(ARGV[0]), File.basename(ARGV[0]))
13
+ puts modsulator.convert_rows
@@ -1,15 +1,6 @@
1
1
  # File "modsulator.rb" - defines the Modsulator class, providing the main part of the API that lets you work
2
2
  # with metadata spreadsheets and MODS XML.
3
3
 
4
- require 'active_support/core_ext/hash/indifferent_access' # Required for indifferent access to hashes
5
- require 'active_support/core_ext/object/blank' # Required for template calls to blank?()
6
- require 'erb' # Rails templating engine
7
- require 'nokogiri'
8
- require 'roo'
9
- require 'stanford/mods/normalizer'
10
- require 'modsulator/modsulator_sheet'
11
- require 'deprecation'
12
-
13
4
  # The main class for the MODSulator API, which lets you work with metadata spreadsheets and MODS XML.
14
5
  # @see https://consul.stanford.edu/display/chimera/MODS+bulk+loading Requirements (Stanford Consul page)
15
6
  class Modsulator
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+ require 'rails_helper'
3
+
4
+ RSpec.describe AboutController, type: :controller do
5
+
6
+ describe 'GET #index' do
7
+ it 'handles simple ping requests to /about' do
8
+ get :index
9
+ expect(response).to have_http_status(:success)
10
+ expected_version = File.read(File.expand_path('../../../VERSION', __FILE__))
11
+ expect(response.body).to eq(String.new('modsulator-api version ' + expected_version))
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+ require 'rails_helper'
3
+
4
+ RSpec.describe ModsulatorController, type: :controller do
5
+
6
+ describe 'GET #version' do
7
+ it 'returns http success' do
8
+ get :version
9
+ expect(response).to have_http_status(:success)
10
+ expect(response.body).to match(/\d.\d.\d$/)
11
+ end
12
+ end
13
+
14
+ describe 'POST #create' do
15
+ it 'returns the response with an xml content type' do
16
+ post :create, params: {file: Rack::Test::UploadedFile.new(File.join(FIXTURES_DIR, 'crowdsourcing_bridget_1.xlsx'), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"), filename: 'crowdsourcing_bridget_1.xlsx' }
17
+ expect(response.headers['Content-Type']).to eq 'application/xml; charset=utf-8'
18
+ expect(response).to have_http_status(:success)
19
+ end
20
+
21
+ it 'returns correct XML for a known spreadsheet' do
22
+ post :create, params: { file: Rack::Test::UploadedFile.new(File.join(FIXTURES_DIR, 'crowdsourcing_bridget_1.xlsx'), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"), filename: 'crowdsourcing_bridget_1.xlsx' }
23
+ returned_xml = Nokogiri::XML(response.body)
24
+ expected_xml = Nokogiri::XML(File.read(File.join(FIXTURES_DIR, 'crowdsourcing_bridget_1.xml')))
25
+ expect(EquivalentXml.equivalent?(returned_xml, expected_xml, opts = { :ignore_attr_values => 'datetime'})).to be_truthy
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,19 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe NormalizerController, type: :controller do
4
+
5
+ describe 'POST #create' do
6
+ it 'returns the response with an xml content type' do
7
+ post :create, params: { file: Rack::Test::UploadedFile.new(File.join(FIXTURES_DIR, 'denormalized.xml')) }
8
+ expect(response.headers['Content-Type']).to eq 'application/xml; charset=utf-8'
9
+ expect(response).to have_http_status(:success)
10
+ end
11
+
12
+ it 'returns normalized MODS XML given ugly MODS XML' do
13
+ post :create, params: {file: Rack::Test::UploadedFile.new(File.join(FIXTURES_DIR, 'denormalized.xml')) }
14
+ returned_xml = response.body
15
+ expected_xml = File.read(File.join(FIXTURES_DIR, 'normalized.xml'))
16
+ expect(returned_xml.to_s).to eq(expected_xml.to_s)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,16 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe SpreadsheetController, type: :controller do
4
+
5
+ describe 'GET #index' do
6
+ before do
7
+ allow(Modsulator).to receive(:template_spreadsheet_path).and_return('send/file.xlsx')
8
+ end
9
+
10
+ it 'returns the spreadsheet template' do
11
+ expect(controller).to receive(:send_file).with('send/file.xlsx')
12
+ get :index
13
+ expect(response).to have_http_status(:success)
14
+ end
15
+ end
16
+ end
@@ -1,11 +1,4 @@
1
1
  RSpec.describe Modsulator do
2
- before :all do
3
- # Create common variables shared across tests and clear out temp directory
4
- @tmp_dir = File.expand_path("../../../tmp", __FILE__)
5
- Dir.mkdir(@tmp_dir) unless Dir.exist?(@tmp_dir)
6
- Dir.foreach(@tmp_dir) {|f| fn = File.join(@tmp_dir, f); File.delete(fn) if f != '.' && f != '..' && !File.directory?(fn)}
7
- end
8
-
9
2
  describe "initialized" do
10
3
  {
11
4
  'edition_physLoc_intmediatype.xlsx' => 'Excel Workbook',
@@ -18,8 +11,4 @@ RSpec.describe Modsulator do
18
11
  end
19
12
  end
20
13
  end
21
-
22
- after :all do
23
- Dir.foreach(@tmp_dir) {|f| File.delete(File.join(@tmp_dir, f)) if f != '.' && f != '..' && !File.directory?(f)}
24
- end
25
14
  end
@@ -1,9 +1,12 @@
1
+ require 'rails_helper'
2
+
1
3
  RSpec.describe Validator do
4
+ let(:service_path) { Rails.root.join('app', 'services') }
2
5
  describe "initialize" do
3
6
  it "validates a valid XML file using the internal XML Schema Definition file" do
4
7
 
5
8
  # Nokogiri won't load the imported schema unless we explicitly set the current dir. This only seems to be a problem from within RSpec, though.
6
- Dir.chdir(File.expand_path("lib/modsulator/")) do
9
+ Dir.chdir(service_path) do
7
10
  validator = Validator.new("modsulator.xsd")
8
11
  error_list = validator.validate_xml_string(File.read(File.join(FIXTURES_DIR, 'crowdsourcing_bridget_1.xml')))
9
12
  expect(error_list).to be_empty()
@@ -11,7 +14,7 @@ RSpec.describe Validator do
11
14
  end
12
15
 
13
16
  it "lists errors for an invalid XML file using the internal XML Schema Definition file" do
14
- Dir.chdir(File.expand_path("lib/modsulator/")) do
17
+ Dir.chdir(service_path) do
15
18
  validator = Validator.new("modsulator.xsd")
16
19
  error_list = validator.validate_xml_string(File.read(File.join(FIXTURES_DIR, 'invalid_crowdsourcing_bridget_1.xml')))
17
20
  expect(error_list.length()).to eq(3)
@@ -21,7 +24,7 @@ RSpec.describe Validator do
21
24
  it "validates a valid XML file by automatically picking up the internal XML Schema Definition file" do
22
25
 
23
26
  # Nokogiri won't load the imported schema unless we explicitly set the current dir. This only seems to be a problem from within RSpec, though.
24
- Dir.chdir(File.expand_path("lib/modsulator/")) do
27
+ Dir.chdir(service_path) do
25
28
  validator = Validator.new()
26
29
  error_list = validator.validate_xml_string(File.read(File.join(FIXTURES_DIR, 'crowdsourcing_bridget_1.xml')))
27
30
  expect(error_list).to be_empty()
@@ -29,12 +32,12 @@ RSpec.describe Validator do
29
32
  end
30
33
 
31
34
  it "lists errors for an invalid XML file when automatically picking up the internal XML Schema Definition file" do
32
- Dir.chdir(File.expand_path("lib/modsulator/")) do
35
+ Dir.chdir(service_path) do
33
36
  validator = Validator.new("modsulator.xsd")
34
37
  error_list = validator.validate_xml_string(File.read(File.join(FIXTURES_DIR, 'invalid_crowdsourcing_bridget_1.xml')))
35
38
  expect(error_list.length()).to eq(3)
36
39
  end
37
40
  end
38
-
41
+
39
42
  end
40
43
  end
@@ -0,0 +1,26 @@
1
+ <?xml version="1.0"?>
2
+ <mods xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.loc.gov/mods/v3" version="3.5" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-5.xsd">
3
+ <titleInfo>
4
+ <title> Cesar Chavez at various rallies and marches 1972-1973</title>
5
+ </titleInfo>
6
+ <name authority=" ">
7
+ <namePart>Fitch, Bob </namePart>
8
+ <role>
9
+ <roleTerm type="text">creator</roleTerm>
10
+ </role>
11
+ </name>
12
+ <typeOfResource>still image</typeOfResource>
13
+ <typeOfResource> </typeOfResource>
14
+ <originInfo>
15
+ <dateCreated keyDate="yes" point="start">1972</dateCreated>
16
+ <dateIssued keyDate="yes" point="start">1976</dateIssued>
17
+ </originInfo>
18
+ <language>
19
+ <languageTerm type="text">English</languageTerm>
20
+ </language>
21
+ <subject>
22
+ <name authority="http://lccn.loc.gov/n50038304">
23
+ <namePart>Chavez, Cesar, 1927-1993</namePart>
24
+ </name>
25
+ </subject>
26
+ </mods>
@@ -0,0 +1,25 @@
1
+ <?xml version="1.0"?>
2
+ <mods xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.loc.gov/mods/v3" version="3.5" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-5.xsd">
3
+ <titleInfo>
4
+ <title>Cesar Chavez at various rallies and marches 1972-1973</title>
5
+ </titleInfo>
6
+ <name>
7
+ <namePart>Fitch, Bob</namePart>
8
+ <role>
9
+ <roleTerm type="text">creator</roleTerm>
10
+ </role>
11
+ </name>
12
+ <typeOfResource>still image</typeOfResource>
13
+ <originInfo>
14
+ <dateCreated keyDate="yes" point="start">1972</dateCreated>
15
+ <dateIssued keyDate="yes" point="start">1976</dateIssued>
16
+ </originInfo>
17
+ <language>
18
+ <languageTerm type="text">English</languageTerm>
19
+ </language>
20
+ <subject>
21
+ <name authority="http://lccn.loc.gov/n50038304">
22
+ <namePart>Chavez, Cesar, 1927-1993</namePart>
23
+ </name>
24
+ </subject>
25
+ </mods>
@@ -1,10 +1,6 @@
1
- RSpec.describe Modsulator do
2
- before :all do
3
- @tmp_dir = File.expand_path("../../../tmp", __FILE__)
4
- Dir.mkdir(@tmp_dir) unless Dir.exist?(@tmp_dir)
5
- Dir.foreach(@tmp_dir) {|f| fn = File.join(@tmp_dir, f); File.delete(fn) if f != '.' && f != '..' && !File.directory?(fn)}
6
- end
1
+ require 'rails_helper'
7
2
 
3
+ RSpec.describe Modsulator do
8
4
  describe "generates and validates" do
9
5
  {
10
6
  'Fitch_Chavez.xlsx' => 'Fitch_Chavez.xml',
@@ -26,8 +22,9 @@ RSpec.describe Modsulator do
26
22
  }.each do |testfile, results_file|
27
23
  puts '.'
28
24
  generated_xml_string = Modsulator.new(File.join(FIXTURES_DIR, testfile), testfile).convert_rows()
25
+
29
26
  it "converts #{testfile} to valid XML" do
30
- error_list = Validator.new(File.expand_path("lib/modsulator/modsulator.xsd")).validate_xml_string(generated_xml_string)
27
+ error_list = Validator.new(Rails.root.join('app', 'services', 'modsulator.xsd')).validate_xml_string(generated_xml_string)
31
28
  expect(error_list.length()).to eq(0)
32
29
  end
33
30
  it "generates same XML from #{testfile} as previous modsulator version" do
@@ -37,8 +34,4 @@ RSpec.describe Modsulator do
37
34
  end
38
35
  end
39
36
  end
40
-
41
- after :all do
42
- Dir.foreach(@tmp_dir) {|f| File.delete(File.join(@tmp_dir, f)) if f != '.' && f != '..' && !File.directory?(f)}
43
- end
44
37
  end
@@ -0,0 +1,53 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV['RAILS_ENV'] ||= 'test'
3
+ require File.expand_path('../../config/environment', __FILE__)
4
+ # Prevent database truncation if the environment is production
5
+ abort("The Rails environment is running in production mode!") if Rails.env.production?
6
+ require 'spec_helper'
7
+ require 'rspec/rails'
8
+ # Add additional requires below this line. Rails is not loaded until this point!
9
+
10
+ # Requires supporting ruby files with custom matchers and macros, etc, in
11
+ # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
12
+ # run as spec files by default. This means that files in spec/support that end
13
+ # in _spec.rb will both be required and run as specs, causing the specs to be
14
+ # run twice. It is recommended that you do not name files matching this glob to
15
+ # end with _spec.rb. You can configure this pattern with the --pattern
16
+ # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
17
+ #
18
+ # The following line is provided for convenience purposes. It has the downside
19
+ # of increasing the boot-up time by auto-requiring all files in the support
20
+ # directory. Alternatively, in the individual `*_spec.rb` files, manually
21
+ # require only the support files necessary.
22
+ #
23
+ # Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
24
+
25
+ RSpec.configure do |config|
26
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
27
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
28
+
29
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
30
+ # examples within a transaction, remove the following line or assign false
31
+ # instead of true.
32
+ config.use_transactional_fixtures = true
33
+
34
+ # RSpec Rails can automatically mix in different behaviours to your tests
35
+ # based on their file location, for example enabling you to call `get` and
36
+ # `post` in specs under `spec/controllers`.
37
+ #
38
+ # You can disable this behaviour by removing the line below, and instead
39
+ # explicitly tag your specs with their type, e.g.:
40
+ #
41
+ # RSpec.describe UsersController, :type => :controller do
42
+ # # ...
43
+ # end
44
+ #
45
+ # The different available types are documented in the features, such as in
46
+ # https://relishapp.com/rspec/rspec-rails/docs
47
+ config.infer_spec_type_from_file_location!
48
+
49
+ # Filter lines from Rails gems in backtraces.
50
+ config.filter_rails_from_backtrace!
51
+ # arbitrary gems may also be filtered via:
52
+ # config.filter_gems_from_backtrace("gem name")
53
+ end
@@ -1,34 +1,28 @@
1
- # This file was generated by the `rspec --init` command. Conventionally, all
1
+ # This file was generated by the `rails generate rspec:install` command. Conventionally, all
2
2
  # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
- # The generated `.rspec` file contains `--require spec_helper` which will cause this
4
- # file to always be loaded, without a need to explicitly require it in any files.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
5
6
  #
6
7
  # Given that it is always loaded, you are encouraged to keep this file as
7
8
  # light-weight as possible. Requiring heavyweight dependencies from this file
8
9
  # will add to the boot time of your test suite on EVERY test run, even for an
9
10
  # individual file that may not need all of that loaded. Instead, consider making
10
11
  # a separate helper file that requires the additional dependencies and performs
11
- # the additional setup, and require it from the spec files that actually need it.
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
12
14
  #
13
15
  # The `.rspec` file also contains a few flags that are not defaults but that
14
16
  # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
+
20
+ FIXTURES_DIR = File.expand_path("../fixtures", __FILE__)
15
21
 
16
22
  require 'coveralls'
17
23
  Coveralls.wear!
18
-
19
- require 'rspec'
20
-
21
- require 'modsulator'
22
- require "modsulator/validator"
23
-
24
- require 'equivalent-xml'
25
24
  require 'equivalent-xml/rspec_matchers'
26
25
 
27
- FIXTURES_DIR = File.expand_path('fixtures', __dir__)
28
-
29
-
30
- #
31
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
32
26
  RSpec.configure do |config|
33
27
  # rspec-expectations config goes here. You can use an alternate
34
28
  # assertion/expectation library such as wrong or the stdlib/minitest
@@ -37,10 +31,10 @@ RSpec.configure do |config|
37
31
  # This option will default to `true` in RSpec 4. It makes the `description`
38
32
  # and `failure_message` of custom matchers include text for helper methods
39
33
  # defined using `chain`, e.g.:
40
- # be_bigger_than(2).and_smaller_than(4).description
41
- # # => "be bigger than 2 and smaller than 4"
34
+ # be_bigger_than(2).and_smaller_than(4).description
35
+ # # => "be bigger than 2 and smaller than 4"
42
36
  # ...rather than:
43
- # # => "be bigger than 2"
37
+ # # => "be bigger than 2"
44
38
  expectations.include_chain_clauses_in_custom_matcher_descriptions = true
45
39
  end
46
40
 
@@ -53,27 +47,35 @@ RSpec.configure do |config|
53
47
  mocks.verify_partial_doubles = true
54
48
  end
55
49
 
56
- # The settings below are suggested to provide a good initial experience
57
- # with RSpec, but feel free to customize to your heart's content.
58
-
59
- # These two settings work together to allow you to limit a spec run
60
- # to individual examples or groups you care about by tagging them with
61
- # `:focus` metadata. When nothing is tagged with `:focus`, all examples
62
- # get run.
63
- config.filter_run :focus
64
- config.run_all_when_everything_filtered = true
65
-
66
- # Limits the available syntax to the non-monkey patched syntax that is recommended.
67
- # For more details, see:
68
- # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
69
- # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
70
- # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
50
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
51
+ # have no way to turn it off -- the option exists only for backwards
52
+ # compatibility in RSpec 3). It causes shared context metadata to be
53
+ # inherited by the metadata hash of host groups and examples, rather than
54
+ # triggering implicit auto-inclusion in groups with matching metadata.
55
+ config.shared_context_metadata_behavior = :apply_to_host_groups
56
+
57
+ # The settings below are suggested to provide a good initial experience
58
+ # with RSpec, but feel free to customize to your heart's content.
59
+ =begin
60
+ # This allows you to limit a spec run to individual examples or groups
61
+ # you care about by tagging them with `:focus` metadata. When nothing
62
+ # is tagged with `:focus`, all examples get run. RSpec also provides
63
+ # aliases for `it`, `describe`, and `context` that include `:focus`
64
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
65
+ config.filter_run_when_matching :focus
66
+
67
+ # Allows RSpec to persist some state between runs in order to support
68
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
69
+ # you configure your source control system to ignore this file.
70
+ config.example_status_persistence_file_path = "spec/examples.txt"
71
+
72
+ # Limits the available syntax to the non-monkey patched syntax that is
73
+ # recommended. For more details, see:
74
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
75
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
76
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
71
77
  config.disable_monkey_patching!
72
78
 
73
- # This setting enables warnings. It's recommended, but in some cases may
74
- # be too noisy due to issues in dependencies.
75
- config.warnings = true
76
-
77
79
  # Many RSpec users commonly either run the entire suite or an individual
78
80
  # file, and it's useful to allow more verbose output when running an
79
81
  # individual spec file.
@@ -100,4 +102,5 @@ RSpec.configure do |config|
100
102
  # test failures related to randomization by passing the same `--seed` value
101
103
  # as the one that triggered the failure.
102
104
  Kernel.srand config.seed
105
+ =end
103
106
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modsulator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tommy Ingulfsen
8
+ - Justin Coyne
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2018-10-29 00:00:00.000000000 Z
12
+ date: 2018-11-15 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: roo
@@ -42,30 +43,30 @@ dependencies:
42
43
  name: nokogiri
43
44
  requirement: !ruby/object:Gem::Requirement
44
45
  requirements:
45
- - - ">="
46
+ - - "~>"
46
47
  - !ruby/object:Gem::Version
47
- version: '0'
48
+ version: '1.8'
48
49
  type: :runtime
49
50
  prerelease: false
50
51
  version_requirements: !ruby/object:Gem::Requirement
51
52
  requirements:
52
- - - ">="
53
+ - - "~>"
53
54
  - !ruby/object:Gem::Version
54
- version: '0'
55
+ version: '1.8'
55
56
  - !ruby/object:Gem::Dependency
56
57
  name: activesupport
57
58
  requirement: !ruby/object:Gem::Requirement
58
59
  requirements:
59
- - - ">="
60
+ - - "~>"
60
61
  - !ruby/object:Gem::Version
61
- version: '0'
62
+ version: '5.0'
62
63
  type: :runtime
63
64
  prerelease: false
64
65
  version_requirements: !ruby/object:Gem::Requirement
65
66
  requirements:
66
- - - ">="
67
+ - - "~>"
67
68
  - !ruby/object:Gem::Version
68
- version: '0'
69
+ version: '5.0'
69
70
  - !ruby/object:Gem::Dependency
70
71
  name: stanford-mods-normalizer
71
72
  requirement: !ruby/object:Gem::Requirement
@@ -94,78 +95,8 @@ dependencies:
94
95
  - - "~>"
95
96
  - !ruby/object:Gem::Version
96
97
  version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: rake
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: rspec
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '3.0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '3.0'
125
- - !ruby/object:Gem::Dependency
126
- name: yard
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: coveralls
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: '0'
153
- - !ruby/object:Gem::Dependency
154
- name: ruby-lint
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
98
  description: Tools and libraries for working with metadata spreadsheets and MODS.
168
- email: tommyi@stanford.edu
99
+ email: jcoyne85@stanford.edu
169
100
  executables:
170
101
  - modsulator
171
102
  extensions: []
@@ -174,14 +105,23 @@ files:
174
105
  - LICENSE
175
106
  - README.md
176
107
  - Rakefile
108
+ - app/controllers/about_controller.rb
109
+ - app/controllers/application_controller.rb
110
+ - app/controllers/modsulator_controller.rb
111
+ - app/controllers/normalizer_controller.rb
112
+ - app/controllers/spreadsheet_controller.rb
113
+ - app/models/modsulator_sheet.rb
114
+ - app/services/mods-3-6.xsd
115
+ - app/services/modsulator.xsd
116
+ - app/services/validator.rb
177
117
  - bin/modsulator
178
118
  - lib/modsulator.rb
179
- - lib/modsulator/mods-3-6.xsd
180
- - lib/modsulator/modsulator.xsd
181
- - lib/modsulator/modsulator_sheet.rb
182
119
  - lib/modsulator/modsulator_template.xlsx
183
120
  - lib/modsulator/modsulator_template.xml
184
- - lib/modsulator/validator.rb
121
+ - spec/controllers/about_controller_spec.rb
122
+ - spec/controllers/modsulator_controller_spec.rb
123
+ - spec/controllers/normalizer_controller_spec.rb
124
+ - spec/controllers/spreadsheet_controller_spec.rb
185
125
  - spec/features/modsulator_sheet_unit_spec.rb
186
126
  - spec/features/process_template_spec.rb
187
127
  - spec/features/validator_unit_spec.rb
@@ -222,6 +162,7 @@ files:
222
162
  - spec/fixtures/crowdsourcing_bridget_1.xml
223
163
  - spec/fixtures/crowdsourcing_bridget_2.xlsx
224
164
  - spec/fixtures/crowdsourcing_bridget_2.xml
165
+ - spec/fixtures/denormalized.xml
225
166
  - spec/fixtures/edition_physLoc_intmediatype.xlsx
226
167
  - spec/fixtures/edition_physLoc_intmediatype.xml
227
168
  - spec/fixtures/filled_template_20160711.xlsx
@@ -231,6 +172,7 @@ files:
231
172
  - spec/fixtures/location_url.xml
232
173
  - spec/fixtures/manifest_v0174.csv
233
174
  - spec/fixtures/manifest_v0174.xml
175
+ - spec/fixtures/normalized.xml
234
176
  - spec/fixtures/point_coord_test.xlsx
235
177
  - spec/fixtures/point_coord_test.xml
236
178
  - spec/fixtures/roman_coins_mods.xlsx
@@ -239,8 +181,9 @@ files:
239
181
  - spec/fixtures/test_002.xlsx
240
182
  - spec/integration_tests/integration_spec.rb
241
183
  - spec/lib/modsulator_spec.rb
184
+ - spec/rails_helper.rb
242
185
  - spec/spec_helper.rb
243
- homepage: https://github.com/sul-dlss/modsulator
186
+ homepage: https://github.com/sul-dlss/modsulator-app-rails
244
187
  licenses:
245
188
  - Apache-2.0
246
189
  metadata: {}
@@ -285,12 +228,14 @@ test_files:
285
228
  - spec/fixtures/crowdsourcing_bridget_2.xml
286
229
  - spec/fixtures/36_Matter_manifest.xml
287
230
  - spec/fixtures/Fitch_King.xlsx
231
+ - spec/fixtures/normalized.xml
288
232
  - spec/fixtures/36_filled_template_20160711.xml
289
233
  - spec/fixtures/manifest_v0174.csv
290
234
  - spec/fixtures/crowdsourcing_bridget_1.xml
291
235
  - spec/fixtures/M1463_AV_manifest.xml
292
236
  - spec/fixtures/roman_coins_mods.xlsx
293
237
  - spec/fixtures/36_Fitch_King.xml
238
+ - spec/fixtures/denormalized.xml
294
239
  - spec/fixtures/Fitch_Chavez.xml
295
240
  - spec/fixtures/36_point_coord_test.xml
296
241
  - spec/fixtures/ars0056_manifest.xml
@@ -323,3 +268,8 @@ test_files:
323
268
  - spec/fixtures/Matter_manifest.xml
324
269
  - spec/fixtures/crowdsourcing_bridget_1.xlsx
325
270
  - spec/fixtures/point_coord_test.xlsx
271
+ - spec/controllers/spreadsheet_controller_spec.rb
272
+ - spec/controllers/about_controller_spec.rb
273
+ - spec/controllers/modsulator_controller_spec.rb
274
+ - spec/controllers/normalizer_controller_spec.rb
275
+ - spec/rails_helper.rb