hyrax-active_encode 0.1.1 → 0.2.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
- SHA1:
3
- metadata.gz: 34ece920ad0628dac4dc89e5036fcc9fab4456b6
4
- data.tar.gz: 15e14410451f633c4de5153969899f75fe98fa7e
2
+ SHA256:
3
+ metadata.gz: 73154bcb27bea0f2301baba32d6e17ccd449952095b2f7f9a30aa22b7b62f3e1
4
+ data.tar.gz: a363e2428af93983a0fc555f17bf33db0ba86d4e36dc787403f89634e4c283d9
5
5
  SHA512:
6
- metadata.gz: 5f953f2a34f1cfe253bc82bb1e01cbddcf5a8341118aadecca634b258cdfe6fdef3adf75f4a970b5388561938f47782789b17676408eadde8a81bf1f2cf2f3dc
7
- data.tar.gz: fe90475f0891d184bd569891d7a60abbec0b3d29fa8a36e20f0083720af2febbcd7f6dcb224d5a885891f0cd41e8e2d4dd10afde1e8c64c7958588b532851c80
6
+ metadata.gz: 876b31f68a51ad973e5e849cb73c794f0e6ae342e120e2e5e0deabc006f8dc90b7758776e556d625bcee4097d6bcce7dfa842bfcc2b6a16b9bdb682e5fd1a179
7
+ data.tar.gz: b06c533c0d0cac3ff136cf47df067b7e845aad4628509d7f79d634bd878dad9a92bafaa2b606176a681370e385ab799ca3784e8710bcf73b8b9bf73fa6386314
@@ -30,7 +30,7 @@ jobs:
30
30
  BUNDLE_JOBS: 4
31
31
  BUNDLE_RETRY: 3
32
32
  NOKOGIRI_USE_SYSTEM_LIBRARIES: true
33
- ENGINE_CART_RAILS_OPTIONS: --skip-git --skip-bundle --skip-listen --skip-spring --skip-yarn --skip-keeps --skip-coffee --skip-puma --skip-test
33
+ ENGINE_CART_RAILS_OPTIONS: --skip-git --skip-bundle --skip-listen --skip-spring --skip-yarn --skip-keeps --skip-coffee --skip-puma --skip-test
34
34
  COVERALLS_PARALLEL: true
35
35
 
36
36
  steps:
@@ -53,7 +53,7 @@ jobs:
53
53
 
54
54
  - restore_cache:
55
55
  keys:
56
- - v1-internal-test-app-{{ .Branch }}-{{ checksum "hyrax-active_encode.gemspec" }}
56
+ - v2-internal-test-app-{{ checksum "hyrax-active_encode.gemspec" }}-{{ checksum "spec/test_app_templates/lib/generators/test_app_generator.rb" }}
57
57
 
58
58
  # Download and cache dependencies
59
59
  - restore_cache:
@@ -82,7 +82,19 @@ jobs:
82
82
  - save_cache:
83
83
  paths:
84
84
  - ./.internal_test_app
85
- key: v1-internal-test-app-{{ .Branch }}-{{ checksum "hyrax-active_encode.gemspec" }}
85
+ key: v2-internal-test-app-{{ checksum "hyrax-active_encode.gemspec" }}-{{ checksum "spec/test_app_templates/lib/generators/test_app_generator.rb" }}
86
+
87
+ - run:
88
+ name: Install test app dependencies
89
+ command: |
90
+ cd .internal_test_app
91
+ bundle install
92
+
93
+ - run:
94
+ name: Run the plugin generator
95
+ command: |
96
+ cd .internal_test_app
97
+ bundle exec rails g hyrax:active_encode:install
86
98
 
87
99
  - run:
88
100
  name: Load config into SolrCloud
data/README.md CHANGED
@@ -12,13 +12,13 @@ gem 'hyrax-active_encode'
12
12
  And then execute:
13
13
 
14
14
  $ bundle
15
-
15
+
16
16
  ## Usage
17
17
 
18
18
  To enable derivative generation through `active_encode` run the install generator which will modify the generated `FileSet` model:
19
19
 
20
20
  $ rails g hyrax:active_encode:install
21
-
21
+
22
22
  ## Configuration
23
23
 
24
24
  By default, hyrax-active_encode will use ActiveEncode's FFmpeg adapter and default ffmpeg options which will generate derivatives matching the defaults in Hyrax.
@@ -27,3 +27,4 @@ By default, hyrax-active_encode will use ActiveEncode's FFmpeg adapter and defau
27
27
 
28
28
  `Hyrax::ActiveEncode::ActiveEncodeDerivativeService` can also be passed the ActiveEncode encode class to be used. By default this will be `ActiveEncode::Base`.
29
29
 
30
+ `Hyrax::ActiveEncode::WatchedEncode` is an optional `ActiveEncode::Base` subclass that includes `ActiveEncode::Polling` and `ActiveEncode::Persistence`. This optional encode class allows for tracking the encode process by saving the data from the encoding service in the `ActiveEncode::EncodeRecord` database table and saving the encode's global id on its associated file set.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'active_fedora/with_metadata/external_file_uri_schema'
2
+ require 'active_fedora/with_metadata/file_location_uri_schema'
3
3
 
4
4
  module Hyrax
5
5
  module ActiveEncode
@@ -7,11 +7,11 @@ module Hyrax
7
7
  extend ActiveSupport::Concern
8
8
 
9
9
  included do
10
- # Is this too late? Has the ActiveFedora::File metadata schema been frozen already?
11
- ActiveFedora::WithMetadata::DefaultMetadataClassFactory.file_metadata_schemas += [ActiveFedora::WithMetadata::ExternalFileUriSchema]
10
+ property :encode_global_id, predicate: ::RDF::URI.new('http://avalonmediasystem.org/rdf/vocab/transcoding#workflowId'), multiple: false do |index|
11
+ index.as :symbol
12
+ end
12
13
 
13
- # The following doesn't work because through isn't allowed on directly_contains even though it is on directly_contains_one
14
- # directly_contains :derivatives, through: :files, type: ::RDF::URI('http://pcdm.org/use#ServiceFile'), class_name: 'Hydra::PCDM::File'
14
+ ActiveFedora::WithMetadata::DefaultMetadataClassFactory.file_metadata_schemas += [ActiveFedora::WithMetadata::FileLocationUriSchema]
15
15
  end
16
16
 
17
17
  def build_derivative
@@ -26,7 +26,7 @@ module Hyrax
26
26
  end
27
27
 
28
28
  def derivatives_metadata
29
- derivatives.collect { |f| { id: f.id, label: f.label.first, external_file_uri: f.external_file_uri.first } }
29
+ derivatives.collect { |f| { id: f.id, label: f.label.first, file_location_uri: f.file_location_uri.first } }
30
30
  end
31
31
  end
32
32
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+ module Hyrax
3
+ module ActiveEncode
4
+ class WatchedEncode < ::ActiveEncode::Base
5
+ include ::ActiveEncode::Persistence
6
+ include ::ActiveEncode::Polling
7
+
8
+ around_create do |encode, block|
9
+ file_set_id = encode.options[:file_set_id]
10
+ block.call
11
+ ::FileSet.find(file_set_id).update(encode_global_id: encode.to_global_id.to_s) if file_set_id
12
+ end
13
+ end
14
+ end
15
+ end
@@ -26,7 +26,8 @@ module Hyrax
26
26
  end
27
27
 
28
28
  def default_local_streaming
29
- @@default_local_streaming ||= true
29
+ @@default_local_streaming = true unless defined?(@@default_local_streaming)
30
+ @@default_local_streaming
30
31
  end
31
32
  end
32
33
 
@@ -51,7 +52,7 @@ module Hyrax
51
52
  # What should this return?
52
53
  def derivative_url(file_label)
53
54
  derivative = file_set.derivatives.find { |d| d.label.first == file_label }
54
- derivative.nil? ? nil : derivative.external_file_uri.first
55
+ derivative.nil? ? nil : derivative.file_location_uri.first
55
56
  end
56
57
 
57
58
  def valid?
@@ -9,18 +9,14 @@ module Hyrax
9
9
  # @option directives [String] file_set_id the id of the file set to add the derivative
10
10
  def self.call(output, directives)
11
11
  file_set = ActiveFedora::Base.find(directives[:file_set_id])
12
- if directives[:local_streaming]
13
- old_url = output.url
14
- move_derivative(output, file_set)
15
- output.url = Hyrax::Engine.routes.url_helpers.download_path(file_set, file: File.basename(old_url))
16
- end
12
+ output.url = move_derivative(output, file_set) if directives[:local_streaming]
17
13
  create_pcdm_file(output, file_set)
18
14
  end
19
15
 
20
16
  def self.create_pcdm_file(output, file_set)
21
17
  pcdm_file = file_set.build_derivative
22
18
  pcdm_file.label = output.label
23
- pcdm_file.external_file_uri = output.url
19
+ pcdm_file.file_location_uri = output.url
24
20
  pcdm_file.content = ''
25
21
  file_set.save!
26
22
  end
@@ -18,13 +18,13 @@ Gem::Specification.new do |s|
18
18
  f.match(%r{^(test|spec|features)/})
19
19
  end
20
20
 
21
- s.add_dependency "active_encode", "~> 0.4"
21
+ s.add_dependency "active_encode", "~> 0.5"
22
22
  s.add_dependency "hyrax", "~> 2.1"
23
23
 
24
24
  s.add_development_dependency 'bixby'
25
25
  s.add_development_dependency 'coffee-rails'
26
26
  s.add_development_dependency 'database_cleaner'
27
- s.add_development_dependency 'engine_cart', '~> 2.0'
27
+ s.add_development_dependency 'engine_cart', '~> 2.2'
28
28
  s.add_development_dependency 'fcrepo_wrapper'
29
29
  s.add_development_dependency "rspec-rails", "~> 3.8"
30
30
  s.add_development_dependency 'solr_wrapper'
@@ -3,9 +3,9 @@
3
3
  # added to it. This is most commonly used with ActiveFedora::File, when we want
4
4
  # to add rdf triples to a non-rdf resource and have them persisted.
5
5
  module ActiveFedora::WithMetadata
6
- class ExternalFileUriSchema < ActiveTriples::Schema
6
+ class FileLocationUriSchema < ActiveTriples::Schema
7
7
  # Don't cast to keep values as RDF::URI instead of RDF::Resource
8
- property :external_file_uri, predicate: ::RDF::Vocab::EBUCore.locator, cast: false do |index|
8
+ property :file_location_uri, predicate: ::RDF::Vocab::EBUCore.locator, cast: false do |index|
9
9
  index.as :stored_searchable
10
10
  end
11
11
  end
@@ -7,12 +7,20 @@ module Hyrax
7
7
  source_root "../templates"
8
8
 
9
9
  def enhance_file_set
10
+ # This module include has to come before Hyrax::FileSetBehavior since it finalizes properties
11
+ insert_into_file 'app/models/file_set.rb', before: 'include ::Hyrax::FileSetBehavior' do
12
+ "include Hyrax::ActiveEncode::FileSetBehavior\n "
13
+ end
14
+ # The indexer has to be set after Hyrax::FileSetBehavior in order to have effect
10
15
  insert_into_file 'app/models/file_set.rb', after: 'include ::Hyrax::FileSetBehavior' do
11
- "\n" \
12
- " include Hyrax::ActiveEncode::FileSetBehavior\n" \
13
- " self.indexer = Hyrax::ActiveEncode::ActiveEncodeIndexer"
16
+ "\n self.indexer = Hyrax::ActiveEncode::ActiveEncodeIndexer"
14
17
  end
15
18
  end
19
+
20
+ def install_active_encode
21
+ rake 'active_encode:install:migrations'
22
+ rake 'db:migrate'
23
+ end
16
24
  end
17
25
  end
18
26
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Hyrax
3
3
  module ActiveEncode
4
- VERSION = '0.1.1'
4
+ VERSION = '0.2.0'
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyrax-active_encode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Colvard
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2018-10-09 00:00:00.000000000 Z
15
+ date: 2019-04-17 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: active_encode
@@ -20,14 +20,14 @@ dependencies:
20
20
  requirements:
21
21
  - - "~>"
22
22
  - !ruby/object:Gem::Version
23
- version: '0.4'
23
+ version: '0.5'
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
28
  - - "~>"
29
29
  - !ruby/object:Gem::Version
30
- version: '0.4'
30
+ version: '0.5'
31
31
  - !ruby/object:Gem::Dependency
32
32
  name: hyrax
33
33
  requirement: !ruby/object:Gem::Requirement
@@ -90,14 +90,14 @@ dependencies:
90
90
  requirements:
91
91
  - - "~>"
92
92
  - !ruby/object:Gem::Version
93
- version: '2.0'
93
+ version: '2.2'
94
94
  type: :development
95
95
  prerelease: false
96
96
  version_requirements: !ruby/object:Gem::Requirement
97
97
  requirements:
98
98
  - - "~>"
99
99
  - !ruby/object:Gem::Version
100
- version: '2.0'
100
+ version: '2.2'
101
101
  - !ruby/object:Gem::Dependency
102
102
  name: fcrepo_wrapper
103
103
  requirement: !ruby/object:Gem::Requirement
@@ -177,12 +177,13 @@ files:
177
177
  - app/indexers/concerns/hyrax/active_encode/indexes_file_metadata.rb
178
178
  - app/indexers/hyrax/active_encode/active_encode_indexer.rb
179
179
  - app/models/concerns/hyrax/active_encode/file_set_behavior.rb
180
+ - app/models/hyrax/active_encode/watched_encode.rb
180
181
  - app/services/hyrax/active_encode/active_encode_derivative_service.rb
181
182
  - app/services/hyrax/active_encode/default_option_service.rb
182
183
  - app/services/hyrax/active_encode/persist_active_encode_derivatives.rb
183
184
  - bin/rails
184
185
  - hyrax-active_encode.gemspec
185
- - lib/active_fedora/with_metadata/external_file_uri_schema.rb
186
+ - lib/active_fedora/with_metadata/file_location_uri_schema.rb
186
187
  - lib/generators/hyrax/active_encode/install_generator.rb
187
188
  - lib/hyrax/active_encode.rb
188
189
  - lib/hyrax/active_encode/engine.rb
@@ -207,8 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
208
  - !ruby/object:Gem::Version
208
209
  version: '0'
209
210
  requirements: []
210
- rubyforge_project:
211
- rubygems_version: 2.6.14
211
+ rubygems_version: 3.0.3
212
212
  signing_key:
213
213
  specification_version: 4
214
214
  summary: Hyrax plugin to enable audiovisual derivative generation through active_encode