zizia 2.1.0.alpha.07 → 2.1.0.alpha.08

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c78e4790d57deee047c384436ceea43c4ff56dc93307adcd24bc0b34b0f6dcc5
4
- data.tar.gz: 79a5c8be373e2e30093c15cc08c9e7661a9c5286b878341d44572227466b7288
3
+ metadata.gz: f01e21a72b0a90ff796529c072cf9c5a68d5509d054e125112bb43cd30544699
4
+ data.tar.gz: f251b98deed66733a0a2b1634fac07b330dac06c7c781a28ee5ce39ad369150a
5
5
  SHA512:
6
- metadata.gz: c73583b3b12b5688e06ba3d305a4ce644761c279f1b8647965d35fc09086cfd8051756c930ee0b38469451ee2ff3d99217470ff4819fcb3911cb84ecaef3507a
7
- data.tar.gz: 43882530f5ecdfc1c4e8a45c642436116a4fa81c537ba04d820f3ee46def8fc3d228f8cc446c0fd0b3800cab7e30b72f693696b3633e259b162b1e2459897b0b
6
+ metadata.gz: 300027bae9529295cbedfb3802a07321ce31a56c8af99293d72b009c6f44b04d231c6ae7446d461455d923d606e84ec20b7ae5fa7069ca553941849e9a04d1e7
7
+ data.tar.gz: 51f2ae499e189a88ab984d59e80f59ff6763680f2c8fbc71c4ba73f358e168aa421b38116218493764beaadfa75d4c3c39bc9c66f4b45ecc34392cc73a005dc7
@@ -5,8 +5,7 @@ module Zizia
5
5
  def guide; end
6
6
 
7
7
  def csv
8
- return unless File.exist?(Rails.root.join('app', 'assets', 'csv', 'import_manifest.csv'))
9
- send_file Rails.root.join('app', 'assets', 'csv', 'import_manifest.csv'), type: 'text/csv; charset=utf-8', disposition: 'attachment', filename: 'import_manifest.csv'
8
+ send_data Zizia::CsvTemplate.new.to_s, type: 'text/csv; charset=utf-8', disposition: 'attachment', filename: 'import_manifest.csv'
10
9
  end
11
10
  end
12
11
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Zizia
4
+ class CsvTemplate
5
+ def to_s
6
+ Zizia.config.metadata_mapper_class.new.fields.join(',')
7
+ end
8
+ end
9
+ end
data/lib/zizia/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Zizia
4
- VERSION = '2.1.0.alpha.07'
4
+ VERSION = '2.1.0.alpha.08'
5
5
  end
data/lib/zizia.rb CHANGED
@@ -48,6 +48,7 @@ module Zizia
48
48
  require 'zizia/validators/csv_format_validator'
49
49
  require 'zizia/validators/title_validator'
50
50
  require 'zizia/parser'
51
+ require 'zizia/csv_template'
51
52
 
52
53
  ##
53
54
  # Module-wide options for `Zizia`.
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe Zizia::CsvTemplate do
6
+ let(:csv_template) { described_class.new }
7
+
8
+ it 'retruns a CSV string based on the headers in the Hyrax mapper' do
9
+ expect(csv_template.to_s).to eq(Zizia::HyraxBasicMetadataMapper.new.fields.join(','))
10
+ end
11
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zizia
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.alpha.07
4
+ version: 2.1.0.alpha.08
5
5
  platform: ruby
6
6
  authors:
7
7
  - Data Curation Experts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-07 00:00:00.000000000 Z
11
+ date: 2019-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active-fedora
@@ -322,6 +322,7 @@ files:
322
322
  - docs/index.md
323
323
  - lib/zizia.rb
324
324
  - lib/zizia/always_invalid_validator.rb
325
+ - lib/zizia/csv_template.rb
325
326
  - lib/zizia/engine.rb
326
327
  - lib/zizia/hash_mapper.rb
327
328
  - lib/zizia/hyrax_basic_metadata_mapper.rb
@@ -460,6 +461,7 @@ files:
460
461
  - spec/views/zizia/importer_documentation/guide.html.erb_spec.rb
461
462
  - spec/zizia/csv_format_validator_spec.rb
462
463
  - spec/zizia/csv_parser_spec.rb
464
+ - spec/zizia/csv_template_spec.rb
463
465
  - spec/zizia/formatted_message_stream_spec.rb
464
466
  - spec/zizia/hash_mapper_spec.rb
465
467
  - spec/zizia/hyrax_basic_metadata_mapper_spec.rb