lib/generators/spotlight/install_generator.rb in blacklight-spotlight-0.2.0 vs lib/generators/spotlight/install_generator.rb in blacklight-spotlight-0.3.0
- old
+ new
@@ -19,10 +19,14 @@
def friendly_id
gem "friendly_id"
generate "friendly_id"
end
+ def paper_trail
+ generate 'paper_trail:install'
+ end
+
def assets
copy_file "spotlight.scss", "app/assets/stylesheets/spotlight.scss"
copy_file "spotlight.js", "app/assets/javascripts/spotlight.js"
end
@@ -40,25 +44,35 @@
copy_file "spotlight_helper.rb", "app/helpers/spotlight_helper.rb"
inject_into_class 'app/helpers/application_helper.rb', ApplicationHelper, " include SpotlightHelper"
end
def add_model_mixin
- inject_into_file 'app/models/solr_document.rb', after: "include Blacklight::Solr::Document" do
- "\n include Spotlight::SolrDocument\n"
+ if File.exists? 'app/models/solr_document.rb'
+ inject_into_file 'app/models/solr_document.rb', after: "include Blacklight::Solr::Document" do
+ "\n include Spotlight::SolrDocument\n"
+ end
+ else
+ say "Unable to find SolrDocument class; add `include Spotlight::SolrDocument` to the class manually"
end
end
def add_solr_indexing_mixin
- inject_into_file 'app/models/solr_document.rb', after: "include Spotlight::SolrDocument\n" do
- "\n include #{options[:solr_update_class]}\n"
+ if File.exists? 'app/models/solr_document.rb'
+ inject_into_file 'app/models/solr_document.rb', after: "include Spotlight::SolrDocument\n" do
+ "\n include #{options[:solr_update_class]}\n"
+ end
+ else
+ say "Unable to find SolrDocument class; add `include #{options[:solr_update_class]}` to the class manually"
end
end
def add_osd_viewer
+ gem 'blacklight-gallery'
generate 'blacklight_gallery:install'
end
def add_oembed
+ gem 'blacklight-oembed'
generate 'blacklight_oembed:install'
end
def add_mailer_defaults
if options[:mailer_default_url_host].present?