Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds in basic tasks for harvesting opengeometadata
- Loading branch information
1 parent
454fa42
commit 1fe5de8
Showing
6 changed files
with
74 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
require "bundler/gem_tasks" | ||
require 'bundler/gem_tasks' | ||
|
||
Dir.glob('lib/tasks/*.rake').each { |r| load r} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
require "geo_combine/version" | ||
require 'geo_combine/version' | ||
|
||
module GeoCombine | ||
# Your code goes here... | ||
|
||
end | ||
|
||
load File.expand_path('../tasks/geo_combine.rake', __FILE__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module GeoCombine | ||
VERSION = "0.0.1" | ||
VERSION = '0.0.1' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
require 'find' | ||
require 'net/http' | ||
require 'json' | ||
require 'rsolr' | ||
|
||
namespace :geocombine do | ||
desc 'Clone all OpenGeoMetadata repositories' | ||
task :clone do | ||
ogm_api_uri = URI('https://api.github.com/orgs/opengeometadata/repos') | ||
ogm_repos = JSON.parse(Net::HTTP.get(ogm_api_uri)).map{ |repo| repo['git_url']} | ||
ogm_repos.each do |repo| | ||
if repo =~ /^git:\/\/github.com\/OpenGeoMetadata\/edu.*/ | ||
system "cd tmp && git clone #{repo}" | ||
end | ||
end | ||
end | ||
desc '"git pull" OpenGeoMetadata repositories' | ||
task :pull do | ||
Dir.glob('tmp/*').map{ |dir| system "cd #{dir} && git pull origin master" if dir =~ /.*edu.*./ } | ||
end | ||
desc 'Index all of the GeoBlacklight documents' | ||
task :index do | ||
solr = RSolr.connect :url => 'http://127.0.0.1:8983/solr' | ||
Find.find('tmp') do |path| | ||
if path =~ /.*geoblacklight.xml$/ | ||
doc = File.read(path) | ||
begin | ||
solr.update data: doc | ||
solr.commit | ||
rescue RSolr::Error::Http => error | ||
puts error | ||
end | ||
end | ||
end | ||
end | ||
end |