Skip to content

Commit

Permalink
removes curl calls in favor of ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
mejackreed committed Feb 24, 2015
1 parent ba93619 commit 215295f
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ To install Solr (with Jetty)
$ cd app-name
$ rake jetty:download
$ rake jetty:unzip
$ rake geoblacklight:configure_jetty
$ rake geoblacklight:configure_solr
```

Or install with [Docker](https://github.com/geoblacklight/geoblacklight-docker)
Expand Down
13 changes: 3 additions & 10 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ require 'rspec/core/rake_task'
require 'engine_cart/rake_task'
require 'jettywrapper'

Dir.glob('lib/tasks/configure_solr.rake').each { |r| load r}

task default: :ci

RSpec::Core::RakeTask.new(:spec)
Expand All @@ -26,7 +28,7 @@ task :fixtures => ['engine_cart:generate'] do
end

desc "Execute Continuous Integration build"
task :ci => ['engine_cart:generate', 'jetty:clean', 'geoblacklight:configure_jetty'] do
task :ci => ['engine_cart:generate', 'jetty:clean', 'geoblacklight:configure_solr'] do
ENV['environment'] = "test"
jetty_params = Jettywrapper.load_config
jetty_params[:startup_wait]= 60
Expand All @@ -38,12 +40,3 @@ task :ci => ['engine_cart:generate', 'jetty:clean', 'geoblacklight:configure_jet
Rake::Task["spec"].invoke
end
end


namespace :geoblacklight do
desc "Copies the default SOLR config for the bundled Testing Server"
task :configure_jetty do
system 'curl -o jetty/solr/blacklight-core/conf/schema.xml https://raw.githubusercontent.com/geoblacklight/geoblacklight-schema/master/conf/schema.xml'
system 'curl -o jetty/solr/blacklight-core/conf/solrconfig.xml https://raw.githubusercontent.com/geoblacklight/geoblacklight-schema/master/conf/solrconfig.xml'
end
end
36 changes: 36 additions & 0 deletions lib/tasks/configure_solr.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
require 'rails/generators'
require 'generators/geoblacklight/install_generator'
require 'geoblacklight'
require 'open-uri'

namespace :geoblacklight do
desc 'Copies the default SOLR config for the included Solr'
task :configure_solr do
files_urls = [
{
url: 'https://raw.githubusercontent.com/geoblacklight/geoblacklight-schema/master/conf/schema.xml',
file: 'schema.xml'
},
{
url: 'https://raw.githubusercontent.com/geoblacklight/geoblacklight-schema/master/conf/solrconfig.xml',
file: 'solrconfig.xml'
}
]
files_urls.each do |item|
puts item.inspect
begin
open(item[:url]) do |io|
IO.copy_stream(io, "jetty/solr/blacklight-core/conf/#{item[:file]}")
end
rescue Exception => e
abort "Unable to download #{item[:file]} from #{item[:url]} #{e.message}"
end
end
end

# Leaving this task in for backwards compatibility
desc 'Runs geoblacklight:configure_solr, you should just use geoblacklight:configure_solr'
task :configure_jetty do
Rake::Task['geoblacklight:configure_solr'].invoke
end
end
6 changes: 0 additions & 6 deletions lib/tasks/geoblacklight.rake
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ require 'rails/generators'
require 'generators/geoblacklight/install_generator'

namespace :geoblacklight do
desc "Copies the default SOLR config for the included Solr"
task :configure_jetty do
system 'curl -o jetty/solr/blacklight-core/conf/schema.xml https://raw.githubusercontent.com/geoblacklight/geoblacklight-schema/master/conf/schema.xml'
system 'curl -o jetty/solr/blacklight-core/conf/solrconfig.xml https://raw.githubusercontent.com/geoblacklight/geoblacklight-schema/master/conf/solrconfig.xml'
end

namespace :solr do
desc "Put sample data into solr"
task :seed => :environment do
Expand Down

0 comments on commit 215295f

Please sign in to comment.