Skip to content

Instantly share code, notes, and snippets.

View awead's full-sized avatar
🏠
Working from home

Adam Wead awead

🏠
Working from home
View GitHub Profile
@awead
awead / gist:81da09a83b173af505ab
Created January 9, 2015 19:57
Cap deploy fails
~/Projects/Github/psu-stewardship/scholarsphere (fedora-4/migrate *%=)$ bundle exec cap demo deploy BRANCH_NAME=fedora-4/migrate
** Invoke demo (first_time)
** Execute demo
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke rbenv:validate (first_time)
** Invoke rbenv:install (first_time)
** Execute rbenv:install
** Invoke rbenv:install_rbenv (first_time)
** Execute rbenv:install_rbenv
@awead
awead / gist:20249664b9a23281f614
Created January 9, 2015 20:42
Cap failure messages
~/Projects/Github/psu-stewardship/scholarsphere (fedora-4/migrate *%=)$ bundle exec cap demo deploy BRANCH_NAME=fedora-4/migrate
** Invoke demo (first_time)
** Execute demo
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke rbenv:validate (first_time)
** Invoke rbenv:install (first_time)
** Execute rbenv:install
** Invoke rbenv:install_rbenv (first_time)
** Execute rbenv:install_rbenv
@awead
awead / gist:f8411090bd28d14ead09
Created January 14, 2015 19:47
Using RDF::Reader with ntriples datastream
[16, 25] in /Users/awead/Projects/Github/projecthydra-labs/fedora-migrate/lib/fedora_migrate/rdf_datastream_mover.rb
16: save
17: end
18:
19: def migrate_rdf_triples
20: byebug
=> 21: target.resource << RDF::Reader.for(:ntriples).new(source.content)
22: end
23:
@awead
awead / gist:c318aa5d8629bdb4cbca
Created January 16, 2015 16:20
Writing to fcr:metadata
irb(main):018:0> f4.thumbnail.metadata.get_values(ActiveFedora::RDF::Fcrepo4.created)
=> [Fri, 16 Jan 2015 03:43:25 +0000]
irb(main):019:0> f4.thumbnail.metadata.set_value(ActiveFedora::RDF::Fcrepo4.created, "foo")
=> nil
irb(main):020:0> f4.thumbnail.metadata.get_values(ActiveFedora::RDF::Fcrepo4.created)
=> ["foo"]
irb(main):021:0> f4.thumbnail.metadata.save
NoMethodError: undefined method `local_attributes' for #<ActiveFedora::WithMetadata::MetadataNode:0x007fc8c9e8d340>
from /Users/awead/Projects/Github/psu-stewardship/scholarsphere/.bundle/ruby/2.1.0/gems/rdf-1.1.7/lib/rdf/mixin/enumerable.rb:693:in `method_missing'
from /Users/awead/Projects/Github/psu-stewardship/scholarsphere/.bundle/ruby/2.1.0/gems/rdf-1.1.7/lib/rdf/mixin/mutable.rb:175:in `method_missing'
@awead
awead / gist:a87f9cb2bc9a6224ae54
Created January 23, 2015 15:58
Escaped triples
<info:fedora/scholarsphere:6395wb555> <http://purl.org/dc/terms/title> "Leeman et al. 2014 JGR Data" .
<info:fedora/scholarsphere:6395wb555> <http://purl.org/dc/terms/creator> "John R. Leeman" .
<info:fedora/scholarsphere:6395wb555> <http://purl.org/dc/terms/description> "Data for:\r\nJournal: Journal of Geophysical Research: Solid Earth\r\n\r\nArticle title: \"On the Origin and Evolution of Electrical Signals During Frictional Stick-Slip in Sheared Granular Material\"" .
<info:fedora/scholarsphere:6395wb555> <http://purl.org/dc/terms/dateSubmitted> "2014-04-30Z"^^<http://www.w3.org/2001/XMLSchema#date> .
<info:fedora/scholarsphere:6395wb555> <http://purl.org/dc/terms/modified> "2014-04-30Z"^^<http://www.w3.org/2001/XMLSchema#date> .
@awead
awead / gist:73dff46f95ac30e1a4ff
Created January 27, 2015 20:42
scholarsphere:x346d634h
<rdf:RDF xmlns:ns0="info:fedora/fedora-system:def/relations-external#" xmlns:ns1="info:fedora/fedora-system:def/model#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="info:fedora/scholarsphere:x346d634h">
<ns1:hasModel rdf:resource="info:fedora/afmodel:GenericFile"></ns1:hasModel>
<ns0:isPartOf rdf:resource="info:fedora/scholarsphere:x346d619d"></ns0:isPartOf>
</rdf:Description>
</rdf:RDF>
irb(main):012:0> f = GenericFile.find("scholarsphere:x346d634h")
=> #<GenericFile pid: "scholarsphere:x346d634h", mime_type: "application/pdf", format_label: ["Portable Document Format"], file_size: ["1309183"], last_modified: ["2014:10:21 16:10:38-04:00"], filename: ["2006.001.Jones-Stolper.pdf"], original_checksum: ["8daaea4d5e7d94adf06a0d75b7612911"], rights_basis: [], copyright_basis: [], copyright_note: [], well_formed: ["true"], valid: ["true"], status_message: [], file_title: [], file_author: [], page_count: ["22"], file_language: [], word_count: [], character_count:
@awead
awead / gist:26d6f990aa0df6eeef2c
Last active August 29, 2015 14:16
RDF parsing
First example: rspec spec/integration/rdf_migration_spec.rb:39
This is currenly passing.
Encoding detection: {"encoding"=>"utf-8", "confidence"=>0.99}
Original description content:
"Objectives:\\r\\n• Explain the role of a new genomic assay (Target Now™) in guiding oncology treatment plans."
Gets altered via ::updated_datastream_content
"Objectives:\\r\\n• Explain the role of a new genomic assay (Target Now™) in guiding oncology treatment plans."
EPRECATION WARNING: solr_search_params_logic is deprecated and will be removed from blacklight 6.0 (use search_params_logic instead). (called from block in <module:ParseBasicQ> at /Users/awead/.gem/ruby/2.1.5/gems/blacklight_advanced_search-5.1.2/lib/blacklight_advanced_search/parse_basic_q.rb:18)
DEPRECATION WARNING: solr_search_params_logic= is deprecated and will be removed from blacklight 6.0 (use search_params_logic= instead). (called from block in <module:ParseBasicQ> at /Users/awead/.gem/ruby/2.1.5/gems/blacklight_advanced_search-5.1.2/lib/blacklight_advanced_search/parse_basic_q.rb:18)
DEPRECATION WARNING: solr_search_params_logic is deprecated and will be removed from blacklight 6.0 (use search_params_logic instead). (called from block in <module:Catalog> at /Users/awead/Projects/Github/projecthydra/sufia/app/controllers/concerns/sufia/catalog.rb:5)
DEPRECATION WARNING: solr_search_params_logic= is deprecated and will be removed from blacklight 6.0 (use search_params_logic= instead). (called from blo
[root@ss1qa httpd]# RBENV_VERSION=2.1.5 ~deploy/.rbenv/shims/passenger-status
ERROR: Phusion Passenger doesn't seem to be running. If you are sure that it is running, then the causes of this problem could be:
1. You customized the instance registry directory using Apache's PassengerInstanceRegistryDir option, Nginx's passenger_instance_registry_dir option, or Phusion Passenger Standalone's --instance-registry-dir command line argument. If so, please set the environment variable PASSENGER_INSTANCE_REGISTRY_DIR to that directory and run passenger-status again.
2. The instance directory has been removed by an operating system background service. Please set a different instance registry directory using Apache's PassengerInstanceRegistryDir option, Nginx's passenger_instance_registry_dir option, or Phusion Passenger Standalone's --instance-registry-dir command line argument.
@awead
awead / gist:356e5eb1d2b10ed22183
Created March 28, 2015 17:33
Capistrano problems
INFO [f0e12e5c] Running /usr/bin/env sudo /sbin/service resque_pool restart as [email protected]
DEBUG [f0e12e5c] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.5 /usr/bin/env sudo /sbin/service resque_pool restart )
DEBUG [f0e12e5c] Shutting down resque services:
DEBUG [f0e12e5c] -bash: wait: pid 4681 is not a child of this shell
DEBUG [f0e12e5c] Starting resque services:
INFO [f0e12e5c] Finished in 6.403 seconds with exit status 0 (successful).
** Invoke deploy:sitemapxml (first_time)
** Execute deploy:sitemapxml
DEBUG [b22efa7c] Running /usr/bin/env if test ! -d /opt/heracles/deploy/scholarsphere/releases/20150328164249; then echo "Directory does not exist '/opt/heracles/deploy/scholarsphere/releases/20150328164249'" 1>&2; false; fi as [email protected]
DEBUG [b22efa7c] Command: if test ! -d /opt/heracles/deploy/scholarsphere/releases/20150328164249; then echo "Directory does not exist '/opt/heracles/deploy/scholarsphere/releases/20150328164249'" 1>&2; false; fi