source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/wings/transformer_value_mapper.rb | Ruby | apache-2.0 | 197 | main | 2,569 | # frozen_string_literal: true
module Wings
##
# A base value mapper for converting property values in the
# `ActiveFedora`/`ActiveTriples` type system to `Valkyrie` types
#
# This top level matcher has registered several internal mappers which handle
# indivdual value types from the source data.
class Tr... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/wings/setup.rb | Ruby | apache-2.0 | 197 | main | 5,171 | # frozen_string_literal: true
ActiveFedora::Base.include Wings::Valkyrizable
ActiveFedora::File.include Wings::Valkyrizable
Hydra::AccessControl.include Wings::Valkyrizable
module ActiveTriples
class NodeConfig
##
# all ActiveTriples nodes are multiple
#
# this is a commonly used method on ActiveFed... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/wings/converter_value_mapper.rb | Ruby | apache-2.0 | 197 | main | 6,021 | # frozen_string_literal: true
module Wings
##
# A base value mapper for converting property values in the
# `Valkyrie` type system to `ActiveFedora`/`ActiveTriples` type
#
# This top level matcher has registered several internal mappers which handle
# indivdual value types from the source data.
class Con... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/wings/attribute_transformer.rb | Ruby | apache-2.0 | 197 | main | 3,371 | # frozen_string_literal: true
require 'wings/transformer_value_mapper'
module Wings
##
# Transform AF attributes to Valkyrie::Resource attributes representation.
class AttributeTransformer
def self.for(obj)
case obj
when Hydra::PCDM::File
FileAttributeTransformer.new
else
s... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/wings/valkyrie/persister.rb | Ruby | apache-2.0 | 197 | main | 5,331 | # frozen_string_literal: true
require 'active_fedora/cleaner'
module Wings
module Valkyrie
##
# A valkyrie persister that aims for data consistency/backwards compatibility with ActiveFedora.
#
# The guiding principle of design for this persister is that resources persisted with it should
# be dir... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/wings/valkyrie/storage.rb | Ruby | apache-2.0 | 197 | main | 2,957 | # frozen_string_literal: true
require 'faraday/multipart'
module Wings
module Valkyrie
##
# This is a Wings storage adapter designed for compatibility with
# Hydra::Pcdm/Hydra::Works.
#
# Where the built-in `Valkyrie::Storage::Fedora` adapter uploads files
# without LDP containment relations... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/wings/valkyrie/metadata_adapter.rb | Ruby | apache-2.0 | 197 | main | 807 | # frozen_string_literal: true
module Wings
module Valkyrie
class MetadataAdapter
def persister
@persister ||= Wings::Valkyrie::Persister.new(adapter: self)
end
# @return [Class] +Valkyrie::Persistence::Postgres::QueryService+
def query_service
@query_service ||= Wings::Va... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/wings/valkyrie/query_service.rb | Ruby | apache-2.0 | 197 | main | 8,447 | # frozen_string_literal: true
module Wings
module Valkyrie
##
# @note does not support duplicates!
class QueryService
attr_reader :adapter
extend Forwardable
def_delegator :adapter, :resource_factory
##
# @param adapter [Wings::Valkyrie::MetadataAdapter] The adapter which
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/wings/valkyrie/resource_factory.rb | Ruby | apache-2.0 | 197 | main | 1,155 | # frozen_string_literal: true
require 'wings/active_fedora_converter'
module Wings
module Valkyrie
##
# This class provides two-way mapping between `ActiveFedora::Base` and
# `Valkyrie::Resource` models.
#
# @see Wings::ActiveFedoraConverter
# @see Wings::Valkyrizable
class ResourceFacto... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/wings/hydra/works/services/add_file_to_file_set.rb | Ruby | apache-2.0 | 197 | main | 2,750 | # frozen_string_literal: true
# TODO: This should live in Hyrax::AddFileMetadataToFileSet service and should work for all valkyrie adapters.
module Wings::Works
class AddFileToFileSet
class << self
# Adds a file to the file_set
# @param file_set [Valkyrie::Resource] adding file to this file set
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/wings/active_fedora_converter/instance_builder.rb | Ruby | apache-2.0 | 197 | main | 2,505 | # frozen_string_literal: true
module Wings
class ActiveFedoraConverter
##
# Constructs an instance for the given converter. +converter+ must provide
# an +id+, +resource+, and +active_fedora_class+.
#
# This interface allows handling for special cases based on the target
# class, instance dat... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/wings/active_fedora_converter/nested_resource.rb | Ruby | apache-2.0 | 197 | main | 983 | # frozen_string_literal: true
module Wings
class ActiveFedoraConverter
class NestedResource < ActiveTriples::Resource
property :title, predicate: ::RDF::Vocab::DC.title
property :author, predicate: ::RDF::URI('http://example.com/ns/author')
property :depositor, predicate: ::RDF::URI('http://exa... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/wings/active_fedora_converter/file_metadata_node.rb | Ruby | apache-2.0 | 197 | main | 1,471 | # frozen_string_literal: true
module Wings
class ActiveFedoraConverter
def self.FileMetadataNode(resource_class) # rubocop:disable Naming/MethodName
class_cache[resource_class] ||= Class.new(FileMetadataNode) do
self.valkyrie_class = resource_class
# skip reserved attributes, we assume we ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/wings/active_fedora_converter/default_work.rb | Ruby | apache-2.0 | 197 | main | 5,001 | # frozen_string_literal: true
module Wings
class ActiveFedoraConverter
def self.apply_properties(klass, schema)
schema.each { |schema_key| PropertyApplicator.new(schema_key).apply(klass) }
end
##
# Constructs an ActiveFedora property from a Dry::Types schema key. This applicator
# is inten... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/wings/services/custom_queries/find_ids_by_model.rb | Ruby | apache-2.0 | 197 | main | 1,560 | # frozen_string_literal: true
module Wings
module CustomQueries
##
# @see https://github.com/samvera/valkyrie/wiki/Queries#custom-queries
# @see Hyrax::CustomQueries::FindIdsByModel
class FindIdsByModel
def self.queries
[:find_ids_by_model]
end
def initialize(query_service:,... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/wings/services/custom_queries/find_file_metadata.rb | Ruby | apache-2.0 | 197 | main | 4,974 | # frozen_string_literal: true
module Wings
module CustomQueries
# Custom query override specific to Wings for finding Hydra::PCDM::File and converting to Hyrax::FileMetadata.
#
# @example
# Hyrax.custom_queries.find_file_metadata_by(id: valkyrie_id, use_valkyrie: true)
# Hyrax.custom_queries.f... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/wings/services/custom_queries/find_collections_by_type.rb | Ruby | apache-2.0 | 197 | main | 812 | # frozen_string_literal: true
module Wings
module CustomQueries
##
# @see Hyrax::CustomQueries::FindCollectionsByType
class FindCollectionsByType
def self.queries
[:find_collections_by_type]
end
def initialize(query_service:)
@query_service = query_service
end
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/wings/services/custom_queries/find_many_by_alternate_ids.rb | Ruby | apache-2.0 | 197 | main | 1,200 | # frozen_string_literal: true
module Wings
module CustomQueries
class FindManyByAlternateIds
# Custom query override specific to Wings
# Use:
# Hyrax.custom_queries.find_many_by_alternate_ids(alternate_ids: ids, use_valkyrie: true)
def self.queries
[:find_many_by_alternate_ids]
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/wings/services/custom_queries/find_access_control.rb | Ruby | apache-2.0 | 197 | main | 1,604 | # frozen_string_literal: true
module Wings
module CustomQueries
class FindAccessControl
# Custom query override specific to Wings
# Use:
# Hyrax.custom_queries.find_access_control_for(resource: resource)
def self.queries
[:find_access_control_for]
end
attr_reader :q... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/valkyrie_simple_path_generator.rb | Ruby | apache-2.0 | 197 | main | 616 | # frozen_string_literal: true
module Hyrax
##
# Provide "simple", paths for the valkyrie disk storage adapter.
#
# By default, Valkyrie does bucketed/pairtree style paths. Since some of our
# older on-disk file storage does not do this, we need this to provide
# backward compatibility.
class ValkyrieSimpl... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/indexer.rb | Ruby | apache-2.0 | 197 | main | 2,203 | # frozen_string_literal: true
module Hyrax
##
# @api public
#
# Build an indexer module from a schema. Generates custom indexer behavior
# from rules provided by `index_loader`.
#
# @param [Symbol] schema_name
# @param [#index_rule_for] index_loader
#
# @return [Module]
#
# @example building a ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/redis_event_store.rb | Ruby | apache-2.0 | 197 | main | 2,262 | # frozen_string_literal: true
module Hyrax
##
# @todo stop swallowing all errors! let clients determine how to handle
# failure cases.
class RedisEventStore < EventStore
class << self
# @return [Fixnum, nil] the id of the event, or `nil` on failure(?!)
def create(action, timestamp)
ins... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/role_registry.rb | Ruby | apache-2.0 | 197 | main | 1,729 | # frozen_string_literal: true
module Hyrax
# Responsible for registering roles critical for your application.
# Registering a role is effectively saying "my application logic will not work if this role goes away".
#
# @see Sipity::Role
class RoleRegistry
# @api public
# You may develop your applicatio... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/controlled_vocabularies.rb | Ruby | apache-2.0 | 197 | main | 213 | # frozen_string_literal: true
module Hyrax
module ControlledVocabularies
extend ActiveSupport::Autoload
eager_autoload do
autoload :Location
autoload :ResourceLabelCaching
end
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/active_fedora_dummy_model.rb | Ruby | apache-2.0 | 197 | main | 1,929 | # frozen_string_literal: true
module Hyrax
##
# @api public
#
# Given a model class and an +id+, provides +ActiveModel+ style methods. This
# is a tool for providing route resolution and other +ActiveModel+ behavior
# for +ActiveFedora+ without loading the object from the fedora backend.
#
# @note this ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/model_decorator.rb | Ruby | apache-2.0 | 197 | main | 757 | # frozen_string_literal: true
module Hyrax
##
# Provides ActiveModel-safe decoration via `Draper`.
#
# This is needed to preserve Presenter, View, and URL
# helper behavior for decorated models.
#
# @example
# class TitleDecorator < Hyrax::ModelDecorator
# ##
# # @return [String]
# d... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/errors.rb | Ruby | apache-2.0 | 197 | main | 533 | # frozen_string_literal: true
module Hyrax
require 'active_fedora/errors'
# Generic Hyrax exception class.
class HyraxError < StandardError; end
# Error that is raised when an active workflow can't be found
class MissingWorkflowError < HyraxError; end
class WorkflowAuthorizationException < HyraxError; en... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/event_store.rb | Ruby | apache-2.0 | 197 | main | 2,469 | # frozen_string_literal: true
module Hyrax
##
# @abstract
#
# The event store provides an interface to log numbered events into a storage
# system, e.g. a key-value store.
#
# At the class level, we provide a `.create` method for logging event data
# with incrementing ids. Events have an "action" (a st... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/arkivo.rb | Ruby | apache-2.0 | 197 | main | 284 | # frozen_string_literal: true
require 'hyrax/arkivo/config'
require 'hyrax/arkivo/schema_validator'
require 'hyrax/arkivo/metadata_munger'
require 'hyrax/arkivo/actor'
require 'hyrax/arkivo/create_subscription_job'
module Hyrax
module Arkivo
VERSION = Hyrax::VERSION
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/move_all_works_to_admin_set.rb | Ruby | apache-2.0 | 197 | main | 248 | # frozen_string_literal: true
# If you want to move all your works to an admin set run this.
class MoveAllWorksToAdminSet
def self.run(admin_set)
Hyrax::WorkRelation.new.find_each do |w|
w.update(admin_set: admin_set)
end
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions.rb | Ruby | apache-2.0 | 197 | main | 476 | # frozen_string_literal: true
require 'hyrax/transactions/container'
module Hyrax
##
# This is a parent module for DRY Transaction classes handling Hyrax
# processes. Especially: transactions and steps for creating, updating, and
# destroying PCDM Objects are located here.
#
# @since 2.4.0
#
# @example... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/resource_name.rb | Ruby | apache-2.0 | 197 | main | 598 | # frozen_string_literal: true
module Hyrax
##
# A custom name for Valkyrie Resource objects. Route keys for resources may
# not be the same as the model name.
class ResourceName < Name
def initialize(klass, namespace = nil, name = nil)
super
return unless defined?(Wings::ModelRegistry)
l... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/search_state.rb | Ruby | apache-2.0 | 197 | main | 772 | # frozen_string_literal: true
module Hyrax
class SearchState < Blacklight::SearchState
delegate :hyrax, :main_app, to: :controller
# Override Blacklight so we can use the per-worktype routes
# @param doc [#collection?, #model_name]
def url_for_document(doc, _options = {})
return [hyrax, doc] if... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/collection_name.rb | Ruby | apache-2.0 | 197 | main | 627 | # frozen_string_literal: true
module Hyrax
##
# A custom name for Valkyrie PcdmCollection objects. Route keys are mapped to `collection`
# not be the same as the model name.
class CollectionName < Name
def initialize(klass, namespace = nil, name = nil)
super
@human = 'Collection'
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/name.rb | Ruby | apache-2.0 | 197 | main | 782 | # frozen_string_literal: true
module Hyrax
# A model name that provides routes that are namespaced to Hyrax,
# without changing the param key.
#
# Example:
# name = Hyrax::Name.new(MyWork)
# name.param_key
# # => 'my_work'
# name.route_key
# # => 'hyrax_my_works'
#
class Name < ActiveMod... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/resource_sync.rb | Ruby | apache-2.0 | 197 | main | 286 | # frozen_string_literal: true
module Hyrax
module ResourceSync
extend ActiveSupport::Autoload
eager_autoload do
autoload :CapabilityListWriter
autoload :ChangeListWriter
autoload :ResourceListWriter
autoload :SourceDescriptionWriter
end
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/controller_resource.rb | Ruby | apache-2.0 | 197 | main | 348 | # frozen_string_literal: true
module Hyrax
# Overrides CanCan so that attributes are not automatically assigned
# to loaded resources
class ControllerResource < CanCan::ControllerResource
private
# Override resource_params to make this a nop. Hyrax uses actors to assign attributes
def resource_params... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/schema.rb | Ruby | apache-2.0 | 197 | main | 3,036 | # frozen_string_literal: true
module Hyrax
##
# @api public
#
# Builds a schema module for a +Valkyrie::Resource+. The schema itself is
# resolved by a schema loader instance, which must implement
# {SimpleSchemaLoader#attributes_for}, with a hash from attribute names to
# +Dry::Type+ types.
#
# For ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/engine.rb | Ruby | apache-2.0 | 197 | main | 5,990 | # frozen_string_literal: true
module Hyrax
class Engine < ::Rails::Engine # rubocop:disable Metrics/ClassLength
isolate_namespace Hyrax
require 'almond-rails'
require 'awesome_nested_set'
require 'blacklight_dynamic_sitemap'
require 'breadcrumbs_on_rails'
require 'clipboard/rails'
require... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/configuration.rb | Ruby | apache-2.0 | 197 | main | 43,764 | # frozen_string_literal: true
require 'hyrax/callbacks'
require 'hyrax/role_registry'
module Hyrax
##
# Handles configuration for the Hyrax engine.
#
# This class provides a series of accessors for setting and retrieving global
# engine options. For convenient reference, options are grouped into the
# foll... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/publisher.rb | Ruby | apache-2.0 | 197 | main | 9,348 | # coding: utf-8
# frozen_string_literal: true
module Hyrax
##
# This is an application-wide publisher for Hyrax's Pub/Sub interface.
#
# Hyrax publishes events on a variety of streams. The streams are namespaced
# using `dry-rb`'s dot notation idiom to help with organization. Namespaces
# reflect the kinds... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/form_fields.rb | Ruby | apache-2.0 | 197 | main | 2,150 | # frozen_string_literal: true
module Hyrax
##
# @api public
#
# @param [Symbol] schema_name
#
# @since 3.0.0
def self.FormFields(schema_name, **options)
Hyrax::FormFields.new(schema_name, **options)
end
##
# @api private
#
# @see .FormFields
class FormFields < Module
attr_reader :nam... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/deprecation.rb | Ruby | apache-2.0 | 197 | main | 926 | # frozen_string_literal: true
module Hyrax
# Provides version-specific deprecators for Hyrax
#
# @example Standard usage for next major version
# Hyrax.deprecator.warn("This will be removed in Hyrax 6.0")
#
# @example Specific version targeting
# Hyrax.deprecator(7).warn("This will be removed in Hyra... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/valkyrie_can_can_adapter.rb | Ruby | apache-2.0 | 197 | main | 905 | # frozen_string_literal: true
module Hyrax
##
# A `CanCan::ModelAdapter` for valkyrie resources
class ValkyrieCanCanAdapter < CanCan::ModelAdapters::AbstractAdapter
##
# @param [Class] member_class
def self.for_class?(member_class)
member_class == Hyrax::Resource ||
member_class < Hyrax... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/administrative_set_name.rb | Ruby | apache-2.0 | 197 | main | 545 | # frozen_string_literal: true
module Hyrax
##
# A custom name for Valkyrie AdministrativeSet objects. Route keys are mapped to `admin_set`
# not be the same as the model name.
class AdministrativeSetName < Name
def initialize(klass, namespace = nil, name = nil)
super
@human = 'Admi... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/work_destroy.rb | Ruby | apache-2.0 | 197 | main | 535 | # frozen_string_literal: true
require 'hyrax/transactions/transaction'
module Hyrax
module Transactions
##
# Destroys a work resource
#
# @since 3.0.0
class WorkDestroy < Transaction
DEFAULT_STEPS = ['work_resource.delete_all_file_sets',
'work_resource.delete_acl',
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/container.rb | Ruby | apache-2.0 | 197 | main | 8,881 | # frozen_string_literal: true
require 'dry/container'
module Hyrax
module Transactions
##
# Provides a container for transaction steps related to creating, updating,
# and destroying PCDM Objects in Hyrax.
#
# In advanced use, the container could provide runtime dependency injection
# for pa... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/apply_change_set.rb | Ruby | apache-2.0 | 197 | main | 1,582 | # frozen_string_literal: true
require 'hyrax/transactions/transaction'
module Hyrax
module Transactions
##
# Applies and saves a `ChangeSet`.
#
# This transaction is intended to ensure appropriate results for a Hyrax
# model when saving changes from a `ChangeSet`. For example: it will set the
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/collection_destroy.rb | Ruby | apache-2.0 | 197 | main | 750 | # frozen_string_literal: true
require 'hyrax/transactions/transaction'
module Hyrax
module Transactions
##
# Destroys a {Hyrax::PcdmCollection}
#
# @since 3.4.0
class CollectionDestroy < Transaction
# TODO: Add step that checks if collection is empty for collections of types that require it... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/admin_set_destroy.rb | Ruby | apache-2.0 | 197 | main | 690 | # frozen_string_literal: true
require 'hyrax/transactions/transaction'
module Hyrax
module Transactions
##
# Destroys a {Hyraxe::AdministrativeSet}
#
# @since 3.4.0
class AdminSetDestroy < Transaction
DEFAULT_STEPS = ['admin_set_resource.check_default',
'admin_set_res... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/transaction.rb | Ruby | apache-2.0 | 197 | main | 5,382 | # frozen_string_literal: true
require 'dry/monads'
require 'dry/monads/do'
module Hyrax
module Transactions
##
# Queues up a set of `#steps` to run over a value via `#call`. Steps are
# given by name, and resolved at runtime via `container`, which defaults to
# `Hyrax::Transactions::Container`. This... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/admin_set_update.rb | Ruby | apache-2.0 | 197 | main | 505 | # frozen_string_literal: true
require 'hyrax/transactions/transaction'
module Hyrax
module Transactions
##
# Updates a {Hyrax::AdministrativeSet} from a ChangeSet
#
# @since 3.4.0
class AdminSetUpdate < Transaction
DEFAULT_STEPS = ['change_set.apply',
'admin_set_resou... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/collection_update.rb | Ruby | apache-2.0 | 197 | main | 628 | # frozen_string_literal: true
require 'hyrax/transactions/transaction'
module Hyrax
module Transactions
##
# Updates a Collection from a ChangeSet
#
# @since 3.2.0
class CollectionUpdate < Transaction
DEFAULT_STEPS = ['change_set.apply',
'collection_resource.save_coll... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/file_set_destroy.rb | Ruby | apache-2.0 | 197 | main | 583 | # frozen_string_literal: true
require 'hyrax/transactions/transaction'
module Hyrax
module Transactions
##
# destroys a FileSet resource.
#
# @since 3.1.0
class FileSetDestroy < Transaction
DEFAULT_STEPS = ['file_set.delete_all_file_metadata',
'file_set.remove_from_wo... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/work_create.rb | Ruby | apache-2.0 | 197 | main | 877 | # frozen_string_literal: true
require 'hyrax/transactions/transaction'
module Hyrax
module Transactions
##
# Creates a Work from a ChangeSet
#
# @since 3.0.0
class WorkCreate < Transaction
DEFAULT_STEPS = ['change_set.set_default_admin_set',
'change_set.ensure_admin_s... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/admin_set_create.rb | Ruby | apache-2.0 | 197 | main | 639 | # frozen_string_literal: true
require 'hyrax/transactions/transaction'
module Hyrax
module Transactions
##
# Creates a Hyrax::AdministrativeSet from a ChangeSet
#
# @since 3.2.0
class AdminSetCreate < Transaction
DEFAULT_STEPS = ['change_set.set_user_as_creator',
'cha... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/collection_create.rb | Ruby | apache-2.0 | 197 | main | 748 | # frozen_string_literal: true
require 'hyrax/transactions/transaction'
module Hyrax
module Transactions
##
# Creates a Collection from a ChangeSet
#
# @since 3.2.0
class CollectionCreate < Transaction
DEFAULT_STEPS = ['change_set.set_user_as_depositor',
'change_set.se... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/work_update.rb | Ruby | apache-2.0 | 197 | main | 578 | # frozen_string_literal: true
module Hyrax
module Transactions
##
# @since 3.4.0
class WorkUpdate < Transaction
DEFAULT_STEPS = ['change_set.apply',
'work_resource.apply_permission_template_on_update',
'work_resource.save_acl',
'wo... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/file_metadata_destroy.rb | Ruby | apache-2.0 | 197 | main | 435 | # frozen_string_literal: true
require 'hyrax/transactions/transaction'
module Hyrax
module Transactions
##
# destroys a FileSet resource.
#
# @since 3.1.0
class FileMetadataDestroy < Transaction
DEFAULT_STEPS = ['file_metadata.delete'].freeze
##
# @see Hyrax::Transactions::Tran... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/file_set_update.rb | Ruby | apache-2.0 | 197 | main | 484 | # frozen_string_literal: true
require 'hyrax/transactions/transaction'
module Hyrax
module Transactions
##
# Updates a {Hyrax::FileSet} from a ChangeSet
#
# @since 3.4.0
class FileSetUpdate < Transaction
DEFAULT_STEPS = ['change_set.apply',
'file_set.save_acl'].freeze... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/check_for_empty_admin_set.rb | Ruby | apache-2.0 | 197 | main | 1,081 | # frozen_string_literal: true
require 'dry/monads'
module Hyrax
module Transactions
module Steps
##
# Validates emptiness of the {Hyrax::AdministrativeSet}; gives `Success`
# when empty and `Failure` otherwise.
#
# Use this step to guard against destroying AdminSets with member obje... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/check_for_default_admin_set.rb | Ruby | apache-2.0 | 197 | main | 957 | # frozen_string_literal: true
require 'dry/monads'
module Hyrax
module Transactions
module Steps
##
# Validates non-defaultness of the {Hyrax::AdministrativeSet}; gives `Success`
# when not the default and `Failure` otherwise.
#
# Use this step to guard against destroying the defaul... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/set_user_as_depositor.rb | Ruby | apache-2.0 | 197 | main | 913 | # frozen_string_literal: true
require 'dry/monads'
module Hyrax
module Transactions
module Steps
##
# Add a given `::User` as the `#depositor` via a ChangeSet.
#
# If no user is given, simply passes as a `Success`.
#
# @since 3.0.0
class SetUserAsDepositor
includ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/update_work_members.rb | Ruby | apache-2.0 | 197 | main | 1,680 | # frozen_string_literal: true
require 'dry/monads'
module Hyrax
module Transactions
module Steps
##
# Adds and removes work members
class UpdateWorkMembers
include Dry::Monads[:result]
##
# @param [Hyrax::Work] obj
# @param [Hash] work_members_attributes
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/file_metadata_delete.rb | Ruby | apache-2.0 | 197 | main | 1,247 | # frozen_string_literal: true
require 'dry/monads'
module Hyrax
module Transactions
module Steps
##
# Deletes a resource from the persister, returning a `Dry::Monads::Result`
# (`Success`|`Failure`).
#
# @see https://dry-rb.org/gems/dry-monads/1.0/result/
class FileMetadataDel... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/save_collection_logo.rb | Ruby | apache-2.0 | 197 | main | 4,773 | # frozen_string_literal: true
module Hyrax
module Transactions
module Steps
##
# Adds logo info via `ChangeSet`.
#
# During the update collection process this step is called to update the file(s)
# to be used as logo(s) for the collection.
#
class SaveCollectionLogo
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/set_collection_type_gid.rb | Ruby | apache-2.0 | 197 | main | 1,165 | # frozen_string_literal: true
module Hyrax
module Transactions
module Steps
##
# A step that sets the `#collection_type_gid` in the change set.
#
# @since 3.2.0
class SetCollectionTypeGid
include Dry::Monads[:result]
##
# @param [Hyrax::ChangeSet] change_set
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/validate.rb | Ruby | apache-2.0 | 197 | main | 1,124 | # frozen_string_literal: true
require 'dry/monads'
module Hyrax
module Transactions
module Steps
##
# Validates a ChangeSet, returning `Success(change_set)` if valid, and
# a `Failure` including the errors otherwise.
#
# Callers provide the particular `ChangeSet` to validate, and it... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/change_depositor.rb | Ruby | apache-2.0 | 197 | main | 1,088 | # frozen_string_literal: true
require 'dry/monads'
module Hyrax
module Transactions
module Steps
##
# Add a given `::User` as the `#depositor`
# Move the previous value of that property to `#proxy_depositor`
#
#
# If no user is given, simply passes as a `Success`.
#
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/apply_permission_template.rb | Ruby | apache-2.0 | 197 | main | 1,323 | # frozen_string_literal: true
module Hyrax
module Transactions
module Steps
##
# A `dry-transcation` step that applies a permission template
# to a saved object.
#
# @note by design, this step should succeed even if for some reason a
# permission template could not be applied... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/delete_all_file_metadata.rb | Ruby | apache-2.0 | 197 | main | 1,365 | # frozen_string_literal: true
require 'dry/monads'
module Hyrax
module Transactions
module Steps
##
# Deletes a resource from the persister, returning a `Dry::Monads::Result`
# (`Success`|`Failure`).
#
# @see https://dry-rb.org/gems/dry-monads/1.0/result/
class DeleteAllFileMe... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/set_uploaded_date_unless_present.rb | Ruby | apache-2.0 | 197 | main | 1,958 | # frozen_string_literal: true
module Hyrax
module Transactions
module Steps
##
# A step that sets the uploaded date for an input `Valkyrie::Resource` or
# `ValkyrieChangeSet`.
#
# The uploaded date is derived in the following way:
#
# - if a `date_uploaded` is already p... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/set_modified_date.rb | Ruby | apache-2.0 | 197 | main | 799 | # frozen_string_literal: true
module Hyrax
module Transactions
module Steps
##
# A step that sets the modified date to now for an input resource or
# change_set
#
# @since 2.4.0
class SetModifiedDate
include Dry::Monads[:result]
##
# @param [#time_in_ut... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/apply_collection_type_permissions.rb | Ruby | apache-2.0 | 197 | main | 971 | # frozen_string_literal: true
module Hyrax
module Transactions
module Steps
##
# A `dry-transcation` step that applies permission templates from a
# collection type on a given collection.
#
# @since 3.2.0
class ApplyCollectionTypePermissions
include Dry::Monads[:result]... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/save.rb | Ruby | apache-2.0 | 197 | main | 4,512 | # frozen_string_literal: true
require 'dry/monads'
module Hyrax
module Transactions
module Steps
##
# Saves a given work from a change_set, returning a `Dry::Monads::Result`
# (`Success`|`Failure`).
#
# If the save is successful, publishes an `object.metadata.updated` event
# ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/set_user_as_creator.rb | Ruby | apache-2.0 | 197 | main | 934 | # frozen_string_literal: true
require 'dry/monads'
module Hyrax
module Transactions
module Steps
##
# Add a given `::User` as the `#creator` via a ChangeSet.
#
# If no user is given, simply passes as a `Success`.
#
# @since 3.0.0
class SetUserAsCreator
include Dr... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/save_collection_banner.rb | Ruby | apache-2.0 | 197 | main | 2,154 | # frozen_string_literal: true
module Hyrax
module Transactions
module Steps
##
# Adds banner info via `ChangeSet`.
#
# During the update collection process this step is called to update the file
# to be used as a the banner for the collection.
#
class SaveCollectionBanner... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/delete_permission_template.rb | Ruby | apache-2.0 | 197 | main | 852 | # frozen_string_literal: true
require 'dry/monads'
module Hyrax
module Transactions
module Steps
##
# Deletes the Hyrax::PermissionTemplate for a resource.
# If no PermissionTemplate associated with that resource is found, succeeds.
#
# @see https://dry-rb.org/gems/dry-monads/1.0/re... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/add_to_collections.rb | Ruby | apache-2.0 | 197 | main | 1,568 | # frozen_string_literal: true
require 'dry/monads'
module Hyrax
module Transactions
module Steps
##
# Add a resource to collections via `ChangeSet`.
#
# Accepts `:collection_ids` and never retrieves the actual collections
# from the persisted data. We trust that the identifiers pass... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/add_file_sets.rb | Ruby | apache-2.0 | 197 | main | 1,600 | # frozen_string_literal: true
require 'dry/monads'
module Hyrax
module Transactions
module Steps
##
# Adds a Hyrax::FileSet
#
# @see https://wiki.lyrasis.org/display/samvera/Hydra::Works+Shared+Modeling
class AddFileSets
include Dry::Monads[:result]
##
# @pa... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/apply_permission_template_on_update.rb | Ruby | apache-2.0 | 197 | main | 2,878 | # frozen_string_literal: true
module Hyrax
module Transactions
module Steps
##
# A `dry-transaction` step that applies a permission template to a work
# when its admin set has changed during an update.
#
# Removes grants from the old admin set's permission template that are not
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/delete_access_control.rb | Ruby | apache-2.0 | 197 | main | 821 | # frozen_string_literal: true
require 'dry/monads'
module Hyrax
module Transactions
module Steps
##
# Deletes the Hyrax::AccessControlList for any resource with a `#permission_manager`.
# If `#permission_manager` is undefined, succeeds.
#
# @see https://dry-rb.org/gems/dry-monads/1.... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/save_access_control.rb | Ruby | apache-2.0 | 197 | main | 1,394 | # frozen_string_literal: true
require 'dry/monads'
module Hyrax
module Transactions
module Steps
##
# Saves the Hyrax::AccessControlList for any resource with a `#permission_manager`.
# If `#permission_manager` is undefined, succeeds.
#
# @see https://dry-rb.org/gems/dry-monads/1.0/... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/set_default_admin_set.rb | Ruby | apache-2.0 | 197 | main | 661 | # frozen_string_literal: true
module Hyrax
module Transactions
module Steps
##
# A step that sets the `AdminSet` for an input work to the default admin
# set if none is already set. Creates the default admin set if it doesn't
# already exist.
#
# @since 2.4.0
class SetDef... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/ensure_admin_set.rb | Ruby | apache-2.0 | 197 | main | 590 | # frozen_string_literal: true
module Hyrax
module Transactions
module Steps
##
# A step that ensures the input object has an `#admin_set_id`.
#
# @since 2.4.0
class EnsureAdminSet
include Dry::Monads[:result]
##
# @param [#admin_set_id] obj
#
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/remove_file_set_from_work.rb | Ruby | apache-2.0 | 197 | main | 2,411 | # frozen_string_literal: true
require 'dry/monads'
module Hyrax
module Transactions
module Steps
##
# removes the file set from all its parents, returning a
# `Dry::Monads::Result` (`Success`|`Failure`).
#
# there should normally be only one parent for a FileSet, but in the case
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/add_to_parent.rb | Ruby | apache-2.0 | 197 | main | 1,109 | # frozen_string_literal: true
require 'dry/monads'
module Hyrax
module Transactions
module Steps
##
# Adds a work to a parent work
#
# @see https://wiki.lyrasis.org/display/samvera/Hydra::Works+Shared+Modeling
class AddToParent
include Dry::Monads[:result]
##
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/delete_resource.rb | Ruby | apache-2.0 | 197 | main | 1,561 | # frozen_string_literal: true
require 'dry/monads'
module Hyrax
module Transactions
module Steps
##
# Deletes a resource from the persister, returning a `Dry::Monads::Result`
# (`Success`|`Failure`).
#
# @see https://dry-rb.org/gems/dry-monads/1.0/result/
class DeleteResource
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/delete_all_file_sets.rb | Ruby | apache-2.0 | 197 | main | 1,501 | # frozen_string_literal: true
require 'dry/monads'
module Hyrax
module Transactions
module Steps
##
# Deletes a resource's member FileSets from the persister, returning a `Dry::Monads::Result`
# (`Success`|`Failure`).
#
# @see https://dry-rb.org/gems/dry-monads/1.0/result/
cla... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/transactions/steps/remove_from_membership.rb | Ruby | apache-2.0 | 197 | main | 1,425 | # frozen_string_literal: true
require 'dry/monads'
module Hyrax
module Transactions
module Steps
##
# Removes a collection from its members, returning a `Dry::Monads::Result`
# (`Success`|`Failure`).
#
# @see https://dry-rb.org/gems/dry-monads/1.0/result/
class RemoveFromMembe... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs.rb | Ruby | apache-2.0 | 197 | main | 334 | require 'hyrax/specs/shared_specs/derivative_service'
require 'hyrax/specs/shared_specs/identifiers'
require 'hyrax/specs/shared_specs/indexers'
require 'hyrax/specs/shared_specs/metadata'
require 'hyrax/specs/shared_specs/hydra_works'
require 'hyrax/specs/shared_specs/workflow_method'
require 'hyrax/specs/shared_specs... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/capybara.rb | Ruby | apache-2.0 | 197 | main | 3,377 | # without lines 1-12, screenshots and html captured from failing specs are blank
# source: https://github.com/mattheworiordan/capybara-screenshot/issues/225
require "action_dispatch/system_testing/test_helpers/setup_and_teardown"
::ActionDispatch::SystemTesting::TestHelpers::SetupAndTeardown.module_eval do
def before... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/spy_listener.rb | Ruby | apache-2.0 | 197 | main | 2,516 | # frozen_string_literal: true
module Hyrax
module Specs
# A spec support class for assisting in spec testing of the
# Hyrax::Publisher pub/sub behavior.
#
# For each registered event, there are two corresponding instance methods
#
# 1. `#on_<registered_event>`
# 2. `#<registered_event>`
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/indexers.rb | Ruby | apache-2.0 | 197 | main | 14,356 | # frozen_string_literal: true
# These shared specs test various aspects of valkyrie based indexers by calling the #to_solr method.
# All tests require two variables to be set in the caller using let statements:
# * indexer_class - class of the indexer being tested
# * resource - a Hyrax::Resource that defines attr... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/metadata.rb | Ruby | apache-2.0 | 197 | main | 2,711 | # frozen_string_literal: true
RSpec.shared_examples 'a model with basic metadata' do
subject(:resource) { described_class.new }
it 'has abstracts' do
expect { resource.abstract = ['lorem ipsum', 'a story about moomins'] }
.to change { resource.abstract }
.to contain_exactly 'lorem ipsum', 'a story... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/change_set.rb | Ruby | apache-2.0 | 197 | main | 292 | require 'valkyrie/specs/shared_specs'
RSpec.shared_examples 'a Hyrax::ChangeSet' do
before do
raise 'change_set creation requires `let(:resource)`' unless defined? resource
end
subject(:changeset) { described_class.for(resource) }
it_behaves_like 'a Valkyrie::ChangeSet'
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/hydra_works.rb | Ruby | apache-2.0 | 197 | main | 12,372 | require 'valkyrie/specs/shared_specs'
require 'hyrax/specs/shared_specs/metadata'
RSpec.shared_examples 'a Hyrax::Resource' do
subject(:resource) { described_class.new }
let(:adapter) { Valkyrie::MetadataAdapter.find(:test_adapter) }
it_behaves_like 'a Valkyrie::Resource' do
let(:resource_klass) { desc... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/simple_work.rb | Ruby | apache-2.0 | 197 | main | 1,430 | # frozen_string_literal: true
module Hyrax
module Test
##
# A generic PCDM Work, with only Hyrax "core" (required) metadata.
#
# @example building with FactoryBot
# work = FactoryBot.build(:hyrax_work, :public, title: ['Comet in Moominland'])
#
# @example creating with FactoryBot
# ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/identifiers.rb | Ruby | apache-2.0 | 197 | main | 809 | # frozen_string_literal: true
RSpec.shared_examples 'a Hyrax::Identifier::Builder' do
subject(:builder) { described_class.new }
describe '#build' do
it 'returns an identifier string' do
expect(builder.build(hint: 'moomin'))
.to respond_to :to_str
end
end
end
RSpec.shared_examples 'a Hyrax... |
github | samvera/hyrax | https://github.com/samvera/hyrax | lib/hyrax/specs/shared_specs/derivative_service.rb | Ruby | apache-2.0 | 197 | main | 884 | RSpec.shared_examples 'a Hyrax::DerivativeService' do
before do
raise 'valid_file_set must be set with `let(:valid_file_set)`' unless
defined? valid_file_set
end
subject { described_class.new(file_set) }
let(:file_set) { valid_file_set }
it { is_expected.to respond_to(:create_derivatives).with(1).... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.