From 74f6e52dcaa54cdbd4a3e37b237c405b97f39014 Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Sat, 1 Mar 2014 18:42:22 -0800 Subject: [PATCH 1/2] Update to EngineCart 0.3 --- .gitignore | 4 ++-- Gemfile | 18 +++++++------- Rakefile | 1 + blacklight.gemspec | 6 ++--- gemfiles/rails3.gemfile | 24 ++++--------------- gemfiles/rails4.gemfile | 22 ++++------------- spec/test_app_templates/Gemfile.extra | 21 ---------------- .../lib/generators/test_app_generator.rb | 5 ---- .../lib/tasks/blacklight_test_app.rake | 14 ----------- 9 files changed, 25 insertions(+), 90 deletions(-) delete mode 100644 spec/test_app_templates/Gemfile.extra delete mode 100644 spec/test_app_templates/lib/tasks/blacklight_test_app.rake diff --git a/.gitignore b/.gitignore index 523bed2304..ce6119f9ce 100644 --- a/.gitignore +++ b/.gitignore @@ -11,5 +11,5 @@ log/* solr_marc/solrmarc.log lib/solrmarc.log.* tmp/* -spec/internal/ -pkg/* \ No newline at end of file +pkg/* +spec/internal diff --git a/Gemfile b/Gemfile index 1bc12008ee..d56e7a80bf 100644 --- a/Gemfile +++ b/Gemfile @@ -1,21 +1,21 @@ source 'https://rubygems.org' # Please see blacklight.gemspec for dependency information. -gemspec +gemspec path: File.expand_path('..', __FILE__) gem 'simplecov', require: false gem 'coveralls', require: false +gem 'engine_cart', '~> 0.3.0' + group :test do - gem 'devise' - gem 'devise-guests' - gem "bootstrap-sass" - gem 'turbolinks' - gem 'sass-rails' - gem 'blacklight-marc', :github => 'projectblacklight/blacklight_marc' + gem "blacklight-marc", "~> 5.0", github: "projectblacklight/blacklight_marc" + gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby end -if File.exists?('spec/test_app_templates/Gemfile.extra') - eval File.read('spec/test_app_templates/Gemfile.extra'), nil, 'spec/test_app_templates/Gemfile.extra' +file = File.expand_path("Gemfile", ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path("../spec/internal", __FILE__)) +if File.exists?(file) + puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v` + instance_eval File.read(file) end diff --git a/Rakefile b/Rakefile index b69b1fb978..8d17579cea 100644 --- a/Rakefile +++ b/Rakefile @@ -1,5 +1,6 @@ # encoding: UTF-8 require 'rubygems' +require 'rails' begin require 'bundler/setup' rescue LoadError diff --git a/blacklight.gemspec b/blacklight.gemspec index cf7295c315..e1d0417e33 100644 --- a/blacklight.gemspec +++ b/blacklight.gemspec @@ -17,18 +17,18 @@ Gem::Specification.new do |s| s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ["lib"] - # PRODUCTION GEM REQUIREMENTS - # --------------------------------------- s.add_dependency "rails", ">= 3.2.6", "< 5" s.add_dependency "nokogiri", "~>1.6" # XML Parser s.add_dependency "kaminari", "~> 0.13" # the pagination (page 1,2,3, etc..) of our search results s.add_dependency "rsolr", "~> 1.0.6" # Library for interacting with rSolr. - s.add_dependency "sass-rails" s.add_dependency "bootstrap-sass", "~> 3.0" s.add_dependency "deprecation" + s.add_development_dependency "jettywrapper", ">= 1.5.2" s.add_development_dependency "blacklight-marc", "~> 5.0" s.add_development_dependency "rspec-rails" + s.add_development_dependency "capybara" + s.add_development_dependency "poltergeist" s.add_development_dependency 'engine_cart', ">= 0.1.0" s.add_development_dependency "equivalent-xml" end diff --git a/gemfiles/rails3.gemfile b/gemfiles/rails3.gemfile index b04b098121..596f5d20a8 100644 --- a/gemfiles/rails3.gemfile +++ b/gemfiles/rails3.gemfile @@ -1,23 +1,9 @@ source 'http://rubygems.org' -# Please see blacklight.gemspec for dependency information. -gemspec :path=>"../" - -gem 'rails', "~> 3.2" - -gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby - -group :test do - gem 'simplecov', require: false - gem 'coveralls', require: false - gem 'devise' - gem 'devise-guests' - gem "bootstrap-sass" - gem 'turbolinks' - gem 'uglifier' +file = File.expand_path("../../Gemfile", __FILE__) +if File.exists?(file) + puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v` + instance_eval File.read(file) end -f = File.expand_path(File.dirname(__FILE__) + '/../spec/test_app_templates/Gemfile.extra') -if File.exists?(f) - eval File.read(f), nil, f -end +gem 'rails', "3.2.17" diff --git a/gemfiles/rails4.gemfile b/gemfiles/rails4.gemfile index ec0d191e10..142e39fd23 100644 --- a/gemfiles/rails4.gemfile +++ b/gemfiles/rails4.gemfile @@ -1,22 +1,10 @@ source 'http://rubygems.org' -# Please see blacklight.gemspec for dependency information. -gemspec :path=>"../" +file = File.expand_path("../../Gemfile", __FILE__) -gem 'rails', '~> 4.0.0' - -gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby - -group :test do - gem 'simplecov', require: false - gem 'coveralls', require: false - gem 'devise' - gem 'devise-guests' - gem "bootstrap-sass" - gem 'turbolinks' +if File.exists?(file) + puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v` + instance_eval File.read(file) end -f = File.expand_path(File.dirname(__FILE__) + '/../spec/test_app_templates/Gemfile.extra') -if File.exists?(f) - eval File.read(f), nil, f -end +gem 'rails', '4.0.3' diff --git a/spec/test_app_templates/Gemfile.extra b/spec/test_app_templates/Gemfile.extra deleted file mode 100644 index e2889ff424..0000000000 --- a/spec/test_app_templates/Gemfile.extra +++ /dev/null @@ -1,21 +0,0 @@ -platforms :jruby do - gem 'jdbc-sqlite3' - gem 'mediashelf-loggable', '>= 0.4.8' - gem 'therubyrhino' -end - -platforms :ruby do - gem 'sqlite3' -end - -gem 'jquery-rails' - -group :test do - gem 'rspec-rails', '~> 2.13' - gem 'generator_spec' - gem 'poltergeist' - gem 'simplecov' -end - -gem 'jettywrapper', '>= 1.2.0' - diff --git a/spec/test_app_templates/lib/generators/test_app_generator.rb b/spec/test_app_templates/lib/generators/test_app_generator.rb index a831858f8a..6a45e97ee7 100644 --- a/spec/test_app_templates/lib/generators/test_app_generator.rb +++ b/spec/test_app_templates/lib/generators/test_app_generator.rb @@ -11,13 +11,8 @@ def fix_travis_rails_4 end end - def copy_blacklight_test_app_rake_task - copy_file "lib/tasks/blacklight_test_app.rake" - end - def remove_index remove_file "public/index.html" - remove_file 'app/assets/images/rails.png' end def run_blacklight_generator diff --git a/spec/test_app_templates/lib/tasks/blacklight_test_app.rake b/spec/test_app_templates/lib/tasks/blacklight_test_app.rake deleted file mode 100644 index ab69cf852c..0000000000 --- a/spec/test_app_templates/lib/tasks/blacklight_test_app.rake +++ /dev/null @@ -1,14 +0,0 @@ -require 'rspec/core/rake_task' - -desc "run the blacklight gem spec" -gem_home = File.expand_path('../../../../..', __FILE__) - -namespace :blacklight_test_app do - - RSpec::Core::RakeTask.new(:spec) do |t| - t.pattern = gem_home + '/spec/**/*_spec.rb' - t.rspec_opts = "--colour" - t.ruby_opts = "-I#{gem_home}/spec" - end - -end From a699dd94cd4f3fad4f5233f945e3881b0ff59fed Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Sun, 9 Mar 2014 19:40:10 -0700 Subject: [PATCH 2/2] re-add #asset_url helper (removed in 12fed9ac) fixes #810 --- app/helpers/blacklight/url_helper_behavior.rb | 7 ++++++- spec/views/catalog/opensearch.xml.builder_spec.rb | 10 ++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 spec/views/catalog/opensearch.xml.builder_spec.rb diff --git a/app/helpers/blacklight/url_helper_behavior.rb b/app/helpers/blacklight/url_helper_behavior.rb index 0b36546e6e..62e7923fcf 100644 --- a/app/helpers/blacklight/url_helper_behavior.rb +++ b/app/helpers/blacklight/url_helper_behavior.rb @@ -215,4 +215,9 @@ def remove_facet_params(field, item, source_params=params) p end -end \ No newline at end of file + if ::Rails.version < "4.0" + def asset_url *args + "#{request.protocol}#{request.host_with_port}#{asset_path(*args)}" + end + end +end diff --git a/spec/views/catalog/opensearch.xml.builder_spec.rb b/spec/views/catalog/opensearch.xml.builder_spec.rb new file mode 100644 index 0000000000..b59c8d7c12 --- /dev/null +++ b/spec/views/catalog/opensearch.xml.builder_spec.rb @@ -0,0 +1,10 @@ +require 'spec_helper' + +describe 'catalog/opensearch.xml.builder' do + it "should render an OpenSearch description document" do + render + doc = Nokogiri::XML.parse(rendered) + doc.remove_namespaces! + expect(doc.xpath('/OpenSearchDescription').length).to eq 1 + end +end