Rakefile in blacklight-spotlight-0.3.1 vs Rakefile in blacklight-spotlight-0.4.1
- old
+ new
@@ -2,11 +2,11 @@
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
-ZIP_URL = "https://github.com/projectblacklight/blacklight-jetty/archive/v4.6.0.zip"
+ZIP_URL = "https://github.com/projectblacklight/blacklight-jetty/archive/v4.10.4.zip"
require 'rdoc/task'
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
@@ -25,11 +25,11 @@
require 'engine_cart/rake_task'
EngineCart.fingerprint_proc = EngineCart.rails_fingerprint_proc
require 'spotlight/version'
-EngineCart.fingerprint = Spotlight::VERSION
+
task :ci => ['engine_cart:generate', 'jetty:clean', 'spotlight:configure_jetty'] do
ENV['environment'] = "test"
jetty_params = Jettywrapper.load_config
jetty_params[:startup_wait]= 60
@@ -75,9 +75,50 @@
system "bundle exec rake spotlight:initialize"
system "bundle exec rake spotlight_test:solr:seed"
File.open('.initialized', "w") {}
end
system "bundle exec rails s"
+ end
+ end
+ end
+
+ namespace :template do
+ task :server do
+ require 'tmpdir'
+ require 'fileutils'
+ template_path = File.expand_path(File.join(File.dirname(__FILE__), "template.rb"))
+
+ Dir.mktmpdir do |dir|
+
+ Dir.chdir(dir) do
+ Bundler.with_clean_env do
+ version = if Gem.loaded_specs["rails"]
+ "_#{Gem.loaded_specs["rails"].version}_"
+ end
+
+ Bundler.with_clean_env do
+ IO.popen({"SPOTLIGHT_GEM" => File.dirname(__FILE__)}, ["rails", version, "new", "internal", "--skip-spring", "-m", template_path] + [err: [:child, :out]]) do |io|
+ IO.copy_stream(io,$stderr)
+
+ _, exit_status = Process.wait2(io.pid)
+
+ if exit_status != 0
+ raise "Failed to generate spotlight"
+ end
+ end
+ end
+
+ Bundler.with_clean_env do
+ Dir.chdir("internal") do
+ APP_ROOT = Dir.pwd
+ jetty_params = Jettywrapper.load_config
+ Jettywrapper.wrap(jetty_params) do
+ system "bundle exec rails s"
+ end
+ end
+ end
+ end
+ end
end
end
end
end