Skip to content

Commit

Permalink
Address bug in default template install process (Solr4Generator).
Browse files Browse the repository at this point in the history
Don't require the jettywrapper option to be passed to the generator to install jettywrapper (it is already checked before running that generator).

Add the templates directory as a source_root so the generator can access to jetty.yml
  • Loading branch information
jkeck committed Mar 28, 2016
1 parent e3c72d5 commit 50024b3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
17 changes: 10 additions & 7 deletions lib/generators/blacklight/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ class Install < Rails::Generators::Base
EOS

def add_solr_wrapper
if options[:jettywrapper]
generate 'blacklight:solr4'
elsif solr_version == 'latest'
generate 'blacklight:solr5'
else
generate "blacklight:solr#{solr_version}"
end
generator_options = '--jettywrapper' if options[:jettywrapper]
solr_generator = case
when options[:jettywrapper]
'blacklight:solr4'
when solr_version == 'latest'
'blacklight:solr5'
else
"blacklight:solr#{solr_version}"
end
generate solr_generator, generator_options
end

def bundle_install
Expand Down
7 changes: 4 additions & 3 deletions lib/generators/blacklight/solr4_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@

module Blacklight
class Solr4Generator < Rails::Generators::Base

source_root File.expand_path('../templates', __FILE__)

desc <<-EOS
This generator makes the following changes to your application:
1. Installs jettywrapper into your application
2. Adds rsolr to your Gemfile
EOS

def install_jettywrapper
return unless options[:jettywrapper]
gem "jettywrapper".dup, ">= 2.0"

copy_file "config/jetty.yml"
copy_file "config/jetty.yml", "config/jetty.yml"

append_to_file "Rakefile",
"\nZIP_URL = \"https://github.com/projectblacklight/blacklight-jetty/archive/v4.10.4.zip\"\n" \
Expand Down

0 comments on commit 50024b3

Please sign in to comment.