Skip to content

Commit

Permalink
add whitelist support for geocombine:clone
Browse files Browse the repository at this point in the history
  • Loading branch information
drhardy committed Dec 11, 2017
1 parent 7d6f830 commit 23c4377
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/tasks/geo_combine.rake
Expand Up @@ -6,21 +6,27 @@ require 'rsolr'
namespace :geocombine do
ogm_path = ENV['OGM_PATH'] || 'tmp/opengeometadata'
solr_url = ENV['SOLR_URL'] || 'http://127.0.0.1:8983/solr/blacklight-core'
whitelist = %w[
git@github.com:OpenGeoMetadata/big-ten.git
]

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|org|uk)\..*/
if whitelist.include?(repo) || repo =~ /(edu|org|uk)\..*\.git$/
system "mkdir -p #{ogm_path} && cd #{ogm_path} && git clone --depth 1 #{repo}"
end
end
end

desc '"git pull" OpenGeoMetadata repositories'
task :pull do
Dir.glob("#{ogm_path}/*").map{ |dir| system "cd #{dir} && git pull origin master" if dir =~ /.*(edu|org|uk)\..*./ }
Dir.glob("#{ogm_path}/*").map{ |dir| system "cd #{dir} && git pull origin master" if dir =~ /(edu|org|uk)\..*$/ }
end
desc 'Index all of the GeoBlacklight documents'

desc 'Index all of the GeoBlacklight JSON documents'
task :index do
solr = RSolr.connect :url => solr_url
Find.find(ogm_path) do |path|
Expand Down

0 comments on commit 23c4377

Please sign in to comment.