Skip to content

Instantly share code, notes, and snippets.

View jcoyne's full-sized avatar

Justin Coyne jcoyne

  • Stanford University Libraries
  • Minneapolis, MN
View GitHub Profile
# lib/hydra/derivatives/psu_video.rb
# This class must live in the Hydra::Derivatives namespace
class Hydra::Derivatives::PsuVideo < Hydra::Derivatives::Video
def codecs(format)
case format
when 'mp4'
"-vcodec libx264 -acodec libflaac"
@jcoyne
jcoyne / gist:10388838
Created April 10, 2014 14:33
Recommendations
  • In CatalogController: author_link, series_link, url_link and subject_link appear to be view helpers and ought to be refactored into a module in app/views/helpers/. https://github.iu.edu/listeam/Blacklight/blob/59ae572f8433bb0d1269e0df7b11557c187d9baa/app/controllers/catalog_controller.rb#L405-L491

  • In CatalogController and Iucat::WebserviceHelper, avoid using instance variables such as (@display_text & @display_line) if you aren’t using these variables in a view.

  • In CatalogController encapsulate the building of @bib_display into its own method. You could consider moving this method into the SolrDocument class and add the results to the document so they could be treated as fields coming out of Solr.

NoMethodError:
undefined method `literal?' for nil:NilClass
# /Users/justin/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rdf-turtle-1.1.3/lib/rdf/turtle/writer.rb:373:in `preprocess_statement'
# /Users/justin/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rdf-turtle-1.1.3/lib/rdf/turtle/writer.rb:357:in `block in preprocess'
# /Users/justin/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rdf-1.1.3/lib/rdf/repository.rb:341:in `call'
# /Users/justin/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rdf-1.1.3/lib/rdf/repository.rb:341:in `block (4 levels) in query_pattern'
# /Users/justin/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rdf-1.1.3/lib/rdf/repository.rb:339:in `each'
# /Users/justin/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rdf-1.1.3/lib/rdf/repository.rb:339:in `block (3 levels) in query_pattern'
# /Users/justin/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rdf-1.1.3/lib/rdf/repository.rb:336:in `each'
# /Users/justin/.rbenv/versions/2.1.1/li
puts @book.orm.graph.dump(:ttl)
<> <http://fedora.info/definitions/v4/repository#created> "";
<info:fedora/fedora-system:def/relations-external#hasConstituent> <http://localhost:8983/fedora/rest/80/cf/92/c6/80cf92c6-3e97-49fa-a2a5-7fc01dafbc10>;
<http://localhost:8983/fedora/rest/a9/d6/82/9f/a9d6829f-98bb-4894-849b-26dd0c67b418> <http://fedora.info/definitions/v4/repository#created> "";
<info:fedora/fedora-system:def/relations-external#hasConstituent> <http://localhost:8983/fedora/rest/9f/9a/70/c1/9f9a70c1-b28d-4bb2-a6a3-eca2e9552888>;
POST /fedora/rest
<http://localhost:8983/fedora/rest/foobar> <http://purl.org/dc/elements/1.1/title> "" .
STATUS: 500 java.lang.NullPointerException
at org.fcrepo.kernel.utils.iterators.RdfAdder.operateOnProperty(RdfAdder.java:89)
at org.fcrepo.kernel.utils.iterators.PersistingRdfStreamConsumer.operateOnTriple(PersistingRdfStreamConsumer.java:140)
at org.fcrepo.kernel.utils.iterators.PersistingRdfStreamConsumer.consume(PersistingRdfStreamConsumer.java:116)
at org.fcrepo.kernel.FedoraResourceImpl.replaceProperties(FedoraResourceImpl.java:361)
at org.fcrepo.http.api.FedoraNodes.createObject(FedoraNodes.java:500)
Ldp::HttpError:
STATUS: 412 ...
# /Users/justin/workspace/ldp/lib/ldp/client/methods.rb:112:in `block in check_for_errors'
# /Users/justin/workspace/ldp/lib/ldp/client/methods.rb:109:in `tap'
# /Users/justin/workspace/ldp/lib/ldp/client/methods.rb:109:in `check_for_errors'
# /Users/justin/workspace/ldp/lib/ldp/client/methods.rb:68:in `delete'
# /Users/justin/workspace/ldp/lib/ldp/resource.rb:48:in `delete'
PATH
remote: .
specs:
active-fedora (8.0.0.alpha)
activesupport (>= 3.0.0)
deprecation
fedora_lens
linkeddata
mediashelf-loggable
nom-xml (>= 0.5.1)
Failure/Error: sign_in FactoryGirl.create :user_with_fixtures
ActionView::Template::Error:
No route matches {:action=>"show", :controller=>"generic_files", :format=>nil, :id=>nil} missing required keys: [:id]
# ./app/views/homepage/_recent_document.html.erb:7:in `___sers_justin_workspace_sufia_app_views_homepage__recent_document_html_erb__1361688684229981467_70141465426720'
# ./app/views/homepage/_recents.html.erb:12:in `___sers_justin_workspace_sufia_app_views_homepage__recents_html_erb__2393444579696316361_70141465486460'
# ./app/views/homepage/_home_content.html.erb:11:in `___sers_justin_workspace_sufia_app_views_homepage__home_content_html_erb__2624305231342099455_70141501315840'
# ./app/views/homepage/_home.html.erb:5:in `___sers_justin_workspace_sufia_app_views_homepage__home_html_erb___1471984316352986006_70141518390500'
# ./app/views/homepage/index.html.erb:1:in `___sers_justin_workspace_sufia_app_views_homepage_index_html_erb__1207346188574631630_701415184257
class CollectionMetadata < ActiveFedora::NtriplesRDFDatastream
property :member_list, predicate: RDF::DC.relation, class_name: 'ActiveFedora::Rdf::List'
end
require 'ostruct'
fake_obj = OpenStruct.new(pid: 'fake:123')
ds = CollectionMetadata.new(fake_obj, 'fakeDS')
1) MetadataXmlParser::get_record_class returns a class
Failure/Error: record_class = MetadataXmlParser.get_record_class(build_node)
HasModelNodeInvalidError:
Invalid data in <rel:hasModel> for record beginning at line 5 (file: anatomicaltables00ches.pdf, pid: tufts:1)
# ./lib/import_export/metadata_xml_parser.rb:199:in `get_record_class'
# ./spec/lib/import_export/metadata_xml_parser_spec.rb:203:in `block (3 levels) in <top (required)>'
2) MetadataXmlParser::build_record builds a record that has the given filename
Failure/Error: m = MetadataXmlParser.build_record(build_node(attributes).to_xml, attributes['file'].first)
HasModelNodeInvalidError: