Skip to content

Instantly share code, notes, and snippets.

View elrayle's full-sized avatar

E. Lynette Rayle elrayle

View GitHub Profile
@elrayle
elrayle / gist:d9519b1e1010acdb6a7f
Created September 3, 2015 15:44
AddMembersToCollection service
module Hydra
module Collections
class AddMembersToCollection
##
# Add members to a collection.
#
# @param [Collection] :collection to which to add members
# @param [Object] :new_member_ids being added
#
@elrayle
elrayle / 1_basic_pcdm__add_file_example.rb
Last active September 16, 2015 15:43
add files to pcdm/works
# ----------------------------------- PCDM example adding a file to an object ---------------------------------
require "hydra/pcdm"
obj1 = Hydra::PCDM::Object.create
file1 = File.open("war_and_peace.pdf","r")
pcdm_file = Hydra::PCDM::File.new
pcdm_file.content = file1
obj1.files << pcdm_file
@elrayle
elrayle / reindeer.rb
Last active September 23, 2015 19:06
Example code showing how to make each type of LDP container in Fedora
class ReindeerGroup < ActiveFedora::Base
# create a basic container
contains :info, class_name: 'Note'
# create a direct container
directly_contains :creator, has_member_relation: ::RDF::DC.creator,
class_name: 'Person'
# create an indirect container via active-fedora gem
indirectly_contains :related_objects, has_member_relation: RDF::Vocab::ORE.aggregates,
@elrayle
elrayle / test_eigenclass.rb
Created September 29, 2015 14:17
Test Ruby Classes and Eigenclasses
class TestParent
MY_CONSTANT = "Hello"
class << self
MY_EIGAN_CONSTANT = "World"
end
end
class TestChild < TestParent
begin
@elrayle
elrayle / pcdm_ordering_api.md
Last active October 21, 2015 15:39
PCDM API for ordering and sets

Observations:

  • What is the purpose for maintaining two lists where the only difference is whether an item can repeat?
  • It seems that the use case for order is more common than the use case for unordered sets.
  • The use case for an unordered set can be achieved using ordered lists code.
  • Why not make ordered lists the default?

Proposed API changes making everything an ordered set

Working with everything as an ordered list

context "when multiple files are uploaded together" do
let(:mock1) { GenericFile.new(id: 'test_1') }
# let(:mock2) { GenericFile.new(id: 'test_2') }
# let(:mock3) { GenericFile.new(id: 'test_3') }
let(:file1) { fixture_file_upload('/world.png', 'image/png') }
let(:file2) { fixture_file_upload('/image.jpg', 'image/jpg') }
let(:file3) { fixture_file_upload('/4-20.png', 'image/png') }
let(:batch1) { Batch.create }
let(:batch1_id) { batch1.id }
let(:batch2) { Batch.create }
describe 'upload files to collection', :js do
it "preselects the collection we are uploading files to" do
attach_file('files[]', File.dirname(__FILE__) + '/../../spec/fixtures/image.jp2')
attach_file('files[]', File.dirname(__FILE__) + '/../../spec/fixtures/jp2_fits.xml')
expect(page).to have_css('button#main_upload_start[disabled]')
first(:checkbox, 'terms_of_service').click

Release 6.4

  • Configure minimagick to use posix-spawn instead of popen3 (rake task must be run). [Anna Headley]
  • Citation config (TODO: flesh this out at time of next release)
  • Lock manager (TODO: flesh this out at time of next release)
  • Geonames username (TODO: flesh this out at time of next release) -- NOTE: must be overridden in config
  • Add configuration allowing select menu on batch upload to upload files to a collection. [E. Lynette Rayle]
  • Add button 'Upload files' on collection show page which goes to batch upload with collection select menu set to the calling collection [E. Lynette Rayle]
  • Pin active-fedora version to ~>9.4 [E. Lynette Rayle]
  • Pin hydra-collections to >=5.0.3, < 6.0 [E. Lynette Rayle]
  • Pin hydra-jetty to 8.6.0, which pins Fedora to 4.4 [Adam Wead]
@elrayle
elrayle / members.rb
Last active December 9, 2015 14:11
ordered_members vs. members and their interactions
# How do ordered_members and members behave and interact
# Setup
col1 = Hydra::Works::Collection.new(id: 'c1')
wrk1 = Hydra::Works::Work.new(id: 'w1')
wrk2 = Hydra::Works::Work.new(id: 'w2')
wrk3 = Hydra::Works::Work.new(id: 'w3')
wrk4 = Hydra::Works::Work.new(id: 'w4')
# 1. adding to members does NOT add to ordered members
@elrayle
elrayle / aggregations_doc.md
Last active December 18, 2015 23:21
Proposed updates to Aggregations API Document for review and comment

warning Warning: The API is under active development. It may have changed since the last update to the document.

Last Update: 2015-12-18


Table of Contents