From 2794141830dbb4bc802fe9d8ee32ac878e59adca Mon Sep 17 00:00:00 2001 From: mnutini Date: Wed, 29 Nov 2017 10:12:50 -0800 Subject: [PATCH 01/21] #21200 update appraisals file to include rails 5 --- Appraisals | 5 +++++ gemfiles/rails3_2.gemfile | 4 ++-- gemfiles/rails4_0.gemfile | 4 ++-- gemfiles/rails5_0.gemfile | 8 ++++++++ 4 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 gemfiles/rails5_0.gemfile diff --git a/Appraisals b/Appraisals index d5d28d3..3490079 100644 --- a/Appraisals +++ b/Appraisals @@ -7,3 +7,8 @@ appraise "rails4_0" do gem 'activesupport', '>= 4.0.0.beta', '< 5' gem 'actionpack', '>= 4.0.0.beta', '< 5' end + +appraise "rails5_0" do + gem 'activesupport', '~> 5.0' + gem 'actionpack', '~> 5.0' +end \ No newline at end of file diff --git a/gemfiles/rails3_2.gemfile b/gemfiles/rails3_2.gemfile index f8cddd5..3985c9d 100644 --- a/gemfiles/rails3_2.gemfile +++ b/gemfiles/rails3_2.gemfile @@ -1,8 +1,8 @@ # This file was generated by Appraisal -source "http://rubygems.org" +source "https://rubygems.org" gem "activesupport", ">= 3.0", "< 4" gem "actionpack", ">= 3.0", "< 4" -gemspec :path=>"../" \ No newline at end of file +gemspec path: "../" diff --git a/gemfiles/rails4_0.gemfile b/gemfiles/rails4_0.gemfile index c54674f..5ce2766 100644 --- a/gemfiles/rails4_0.gemfile +++ b/gemfiles/rails4_0.gemfile @@ -1,8 +1,8 @@ # This file was generated by Appraisal -source "http://rubygems.org" +source "https://rubygems.org" gem "activesupport", ">= 4.0.0.beta", "< 5" gem "actionpack", ">= 4.0.0.beta", "< 5" -gemspec :path=>"../" \ No newline at end of file +gemspec path: "../" diff --git a/gemfiles/rails5_0.gemfile b/gemfiles/rails5_0.gemfile new file mode 100644 index 0000000..339984c --- /dev/null +++ b/gemfiles/rails5_0.gemfile @@ -0,0 +1,8 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "activesupport", "~> 5.0" +gem "actionpack", "~> 5.0" + +gemspec path: "../" From 6a57c4c3487a140477b16735ac6b11709940dc51 Mon Sep 17 00:00:00 2001 From: mnutini Date: Wed, 29 Nov 2017 10:13:46 -0800 Subject: [PATCH 02/21] #21200 change from rvmrc to ruby-version file --- .ruby-version | 1 + .rvmrc | 48 ------------------------------------------------ 2 files changed, 1 insertion(+), 48 deletions(-) create mode 100644 .ruby-version delete mode 100644 .rvmrc diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..bed811b --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +ruby-2.3.3 diff --git a/.rvmrc b/.rvmrc deleted file mode 100644 index 003daaa..0000000 --- a/.rvmrc +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash - -# This is an RVM Project .rvmrc file, used to automatically load the ruby -# development environment upon cd'ing into the directory - -# First we specify our desired [@], the @gemset name is optional, -# Only full ruby name is supported here, for short names use: -# echo "rvm use 1.9.3" > .rvmrc -environment_id="ruby-1.9.3-head@crummy" - -# Uncomment the following lines if you want to verify rvm version per project -# rvmrc_rvm_version="1.17.7 (stable)" # 1.10.1 seams as a safe start -# eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || { -# echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading." -# return 1 -# } - -# First we attempt to load the desired environment directly from the environment -# file. This is very fast and efficient compared to running through the entire -# CLI and selector. If you want feedback on which environment was used then -# insert the word 'use' after --create as this triggers verbose mode. -if [[ -d "${rvm_path:-$HOME/.rvm}/environments" - && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]] -then - \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id" - [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] && - \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true -else - # If the environment file has not yet been created, use the RVM CLI to select. - rvm --create "$environment_id" || { - echo "Failed to create RVM environment '${environment_id}'." - return 1 - } -fi - -# If you use bundler, this might be useful to you: -# if [[ -s Gemfile ]] && { -# ! builtin command -v bundle >/dev/null || -# builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null -# } -# then -# printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n" -# gem install bundler -# fi -# if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null -# then -# bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete' -# fi From e11d2ce73b60c2ef50481f1ee4039049492607ea Mon Sep 17 00:00:00 2001 From: mnutini Date: Wed, 29 Nov 2017 10:14:41 -0800 Subject: [PATCH 03/21] #21200 change deprecated before_filter rails method to before_action --- README.md | 4 ++-- lib/crummy/action_controller.rb | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1b6d14b..d89283e 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ end class BusinessController < ApplicationController add_crumb("Businesses") { |instance| instance.send :businesses_path } add_crumb("Comments", only: "comments") { |instance| instance.send :businesses_comments_path } - before_filter :load_comment, only: "show" + before_action :load_comment, only: "show" add_crumb :comment, only: "show" # Example for nested routes: @@ -180,7 +180,7 @@ See `lib/crummy.rb` for a list of these parameters and their defaults. ```ruby add_crumb support_link, {:right_side => true, :links => "/support", : li_class => "my_class", :li_right_class => "pull-right hidden-phone"} ``` -Simple add that parameter to options hash. +Simple add that parameter to options hash. ## Live example application diff --git a/lib/crummy/action_controller.rb b/lib/crummy/action_controller.rb index a720a21..efbbab5 100644 --- a/lib/crummy/action_controller.rb +++ b/lib/crummy/action_controller.rb @@ -7,16 +7,16 @@ module ClassMethods # add_crumb(lambda { |instance| instance.business_name }, "/") # add_crumb("Business") { |instance| instance.business_path } # - # Works like a before_filter so +:only+ and +except+ both work. + # Works like a before_action so +:only+ and +except+ both work. def add_crumb(name, *args) options = args.extract_options! url = args.first raise ArgumentError, "Need more arguments" unless name or options[:record] or block_given? raise ArgumentError, "Cannot pass url and use block" if url && block_given? - before_filter(options) do |instance| + before_action(options) do |instance| url = yield instance if block_given? url = instance.send url if url.is_a? Symbol - + if url.present? if url.kind_of? Array url.map! do |name| @@ -34,17 +34,17 @@ def add_crumb(name, *args) _record = instance.instance_variable_get("@#{name}") unless name.kind_of?(String) if _record and _record.respond_to? :to_param instance.add_crumb(_record.to_s, url || instance.url_for(_record), options) - else + else instance.add_crumb(name, url, options) end - + # FIXME: url = instance.url_for(name) if name.respond_to?("to_param") && url.nil? # FIXME: Add ||= for the name, url above end end def clear_crumbs - before_filter do |instance| + before_action do |instance| instance.clear_crumbs end end From cf69828fdda6a4d8b5f20f5dcd76b027f48cc7d0 Mon Sep 17 00:00:00 2001 From: Andrea Salicetti Date: Wed, 14 Feb 2018 16:22:34 +0100 Subject: [PATCH 04/21] Support for Rails 5.1 --- .ruby-version | 2 +- .travis.yml | 2 ++ CHANGELOG | 4 ++++ crummy.gemspec | 2 +- lib/crummy/action_controller.rb | 15 +++++++++++---- lib/crummy/version.rb | 2 +- 6 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.ruby-version b/.ruby-version index bed811b..437459c 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-2.3.3 +2.5.0 diff --git a/.travis.yml b/.travis.yml index a796904..5e7a896 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,8 @@ language: ruby rvm: - 1.9.3 - 2.0.0 + - 2.5.0 gemfile: - gemfiles/rails3_2.gemfile - gemfiles/rails4_0.gemfile + - gemfiles/rails5_1.gemfile diff --git a/CHANGELOG b/CHANGELOG index 4f072bf..b8a6d93 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +1.9.0 +* [ADDED] Adds support for Rails 5.1 and above. +* [ADDED] Adds ruby 2.5.0 to .travis.yml + 1.8.0 * [ADDED] You can now set each parameters individually for each crumb * [ADDED] You can now set each crumb on right or left side diff --git a/crummy.gemspec b/crummy.gemspec index 8ce4251..c55a348 100644 --- a/crummy.gemspec +++ b/crummy.gemspec @@ -20,7 +20,7 @@ Gem::Specification.new do |s| s.homepage = "http://github.com/zachinglis/crummy" s.require_paths = [%q{lib}] - s.rubygems_version = %q{1.8.8} + s.rubygems_version = %q{1.9.0} s.add_development_dependency 'rake' s.add_development_dependency 'bundler', '~> 1.0' diff --git a/lib/crummy/action_controller.rb b/lib/crummy/action_controller.rb index efbbab5..a36a097 100644 --- a/lib/crummy/action_controller.rb +++ b/lib/crummy/action_controller.rb @@ -13,7 +13,8 @@ def add_crumb(name, *args) url = args.first raise ArgumentError, "Need more arguments" unless name or options[:record] or block_given? raise ArgumentError, "Cannot pass url and use block" if url && block_given? - before_action(options) do |instance| + + callback_before_method(options) do |instance| url = yield instance if block_given? url = instance.send url if url.is_a? Symbol @@ -43,11 +44,17 @@ def add_crumb(name, *args) end end - def clear_crumbs - before_action do |instance| - instance.clear_crumbs + def callback_before_method(options = {}) + if Rails::VERSION::MAJOR >= 5 + before_action(options) { |instance| yield instance } + else + before_filter(options) { |instance| yield instance } end end + + def clear_crumbs + callback_before_method(&:clear_crumbs) + end end module InstanceMethods diff --git a/lib/crummy/version.rb b/lib/crummy/version.rb index 1f45d18..0fad063 100644 --- a/lib/crummy/version.rb +++ b/lib/crummy/version.rb @@ -1,6 +1,6 @@ module Crummy MAJOR = 1 - MINOR = 8 + MINOR = 9 PATCH = 0 VERSION = [MAJOR, MINOR, PATCH].join('.') end From afcfa74b17c3ea453469ee768b837723e74a4d89 Mon Sep 17 00:00:00 2001 From: Andrea Salicetti Date: Wed, 14 Feb 2018 16:32:29 +0100 Subject: [PATCH 05/21] Removes support for ruby 1.9.3 --- .travis.yml | 1 - CHANGELOG | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5e7a896..9230cf0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: ruby rvm: - - 1.9.3 - 2.0.0 - 2.5.0 gemfile: diff --git a/CHANGELOG b/CHANGELOG index b8a6d93..af78bd2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ 1.9.0 * [ADDED] Adds support for Rails 5.1 and above. * [ADDED] Adds ruby 2.5.0 to .travis.yml +* [BREAKING] Removes support for ruby 1.9.3 1.8.0 * [ADDED] You can now set each parameters individually for each crumb From ad0a34f301480c77f5a28b4b48897ee116f1e530 Mon Sep 17 00:00:00 2001 From: Andrea Salicetti Date: Wed, 14 Feb 2018 16:52:48 +0100 Subject: [PATCH 06/21] Fixes test --- crummy.gemspec | 1 + test/standard_renderer_test.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/crummy.gemspec b/crummy.gemspec index c55a348..c5b59e2 100644 --- a/crummy.gemspec +++ b/crummy.gemspec @@ -28,4 +28,5 @@ Gem::Specification.new do |s| s.add_development_dependency 'actionpack' s.add_development_dependency 'appraisal' s.add_development_dependency 'test-unit' + s.add_development_dependency('rails-dom-testing') end diff --git a/test/standard_renderer_test.rb b/test/standard_renderer_test.rb index 8c05bbe..de18e73 100644 --- a/test/standard_renderer_test.rb +++ b/test/standard_renderer_test.rb @@ -33,8 +33,8 @@ def test_classes assert_dom_equal('', renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html, :microdata => true)) - assert_equal('
', - renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html_list, :microdata => true)) + assert_dom_equal '
', + renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html_list, :microdata => true) assert_equal('
  1. name
', renderer.render_crumbs([['name', 'url']], :format => :html_list, :ol_id => "crumbid", :ol_class => "crumbclass", :li_class => "liclass")) end From 646ec1f1b826ff7ac92860bddf45ecb3a579bda6 Mon Sep 17 00:00:00 2001 From: Andrea Salicetti Date: Wed, 14 Feb 2018 17:30:38 +0100 Subject: [PATCH 07/21] [test] Stronger assertion --- test/standard_renderer_test.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/standard_renderer_test.rb b/test/standard_renderer_test.rb index de18e73..9ebfbe6 100644 --- a/test/standard_renderer_test.rb +++ b/test/standard_renderer_test.rb @@ -97,8 +97,8 @@ def test_link_html_options assert_equal('name', renderer.render_crumbs([['name', 'url', {:link_html_options => {:title => 'link title'}}]], :first_class => 'first', :last_class => 'last', :format => :html, :last_crumb_linked => false)) - assert_equal('
  1. name
', - renderer.render_crumbs([['name', 'url', {:link_html_options => {:title => 'link title'}}]], :first_class => 'first', :last_class => 'last', :format => :html_list)) + assert_dom_equal '
  1. name
', + renderer.render_crumbs([['name', 'url', {:link_html_options => {:title => 'link title'}}]], :first_class => 'first', :last_class => 'last', :format => :html_list) assert_equal('
  1. name
', renderer.render_crumbs([['name', 'url', {:link_html_options => {:title => 'link title'}}]], :first_class => 'first', :last_class => 'last', :format => :html_list, :last_crumb_linked => false)) @@ -110,17 +110,17 @@ def test_link_html_options_with_microdata config.microdata = true end - assert_dom_equal('', - renderer.render_crumbs([['name', 'url', {:link_html_options => {:title => 'link title'}}]], :first_class => 'first', :last_class => 'last', :format => :html)) + assert_dom_equal '', + renderer.render_crumbs([['name', 'url', {:link_html_options => {:title => 'link title'}}]], :first_class => 'first', :last_class => 'last', :format => :html) assert_equal('
name
', renderer.render_crumbs([['name', 'url', {:link_html_options => {:title => 'link title'}}]], :first_class => 'first', :last_class => 'last', :format => :html, :last_crumb_linked => false)) - assert_equal('
', - renderer.render_crumbs([['name', 'url', {:link_html_options => {:title => 'link title'}}]], :first_class => 'first', :last_class => 'last', :format => :html_list)) + assert_dom_equal '
', + renderer.render_crumbs([['name', 'url', {:link_html_options => {:title => 'link title'}}]], :first_class => 'first', :last_class => 'last', :format => :html_list) - assert_equal('
  1. name
', - renderer.render_crumbs([['name', 'url', {:link_html_options => {:title => 'link title'}}]], :first_class => 'first', :last_class => 'last', :format => :html_list, :last_crumb_linked => false)) + assert_dom_equal '
  1. name
', + renderer.render_crumbs([['name', 'url', {:link_html_options => {:title => 'link title'}}]], :first_class => 'first', :last_class => 'last', :format => :html_list, :last_crumb_linked => false) end def test_inline_configuration From df0db0699957628b03c583dea153242de38952a1 Mon Sep 17 00:00:00 2001 From: Andrea Salicetti Date: Wed, 14 Feb 2018 17:35:56 +0100 Subject: [PATCH 08/21] More rails versions (4.1, 4.2, 5.0), removed rails 5.1 from test --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9230cf0..0870872 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,4 +5,6 @@ rvm: gemfile: - gemfiles/rails3_2.gemfile - gemfiles/rails4_0.gemfile - - gemfiles/rails5_1.gemfile + - gemfiles/rails4_1.gemfile + - gemfiles/rails4_2.gemfile + - gemfiles/rails5_0.gemfile From c37d2abbfa6c2b098cc9e5e1aa2c5ea44f8c4f62 Mon Sep 17 00:00:00 2001 From: Andrea Salicetti Date: Fri, 16 Feb 2018 15:59:05 +0100 Subject: [PATCH 09/21] Rubocop linting --- Appraisals | 8 +- Gemfile | 4 +- Rakefile | 2 +- crummy.gemspec | 33 ++--- example/Gemfile | 8 +- .../app/controllers/application_controller.rb | 6 +- example/app/controllers/pages_controller.rb | 1 - example/app/controllers/posts_controller.rb | 10 +- example/app/helpers/application_helper.rb | 2 +- example/app/models/category.rb | 2 +- example/app/models/post.rb | 8 +- example/config.ru | 2 +- example/config/application.rb | 4 +- example/config/boot.rb | 2 +- example/config/environments/test.rb | 4 +- example/config/initializers/session_store.rb | 2 +- .../config/initializers/wrap_parameters.rb | 2 +- example/config/routes.rb | 4 +- .../20111104103738_create_categories.rb | 4 +- example/db/schema.rb | 29 ++-- example/db/seeds.rb | 12 +- example/script/rails | 4 +- .../spec/controllers/posts_controller_spec.rb | 4 +- example/spec/spec_helper.rb | 8 +- lib/crummy.rb | 11 +- lib/crummy/action_controller.rb | 18 +-- lib/crummy/action_view.rb | 22 +-- lib/crummy/railtie.rb | 8 +- lib/crummy/standard_renderer.rb | 140 ++++++++++-------- lib/crummy/version.rb | 2 +- test/standard_renderer_test.rb | 92 ++++++------ 31 files changed, 230 insertions(+), 228 deletions(-) diff --git a/Appraisals b/Appraisals index 3490079..42739d5 100644 --- a/Appraisals +++ b/Appraisals @@ -1,14 +1,14 @@ -appraise "rails3_2" do +appraise 'rails3_2' do gem 'activesupport', '>= 3.0', '< 4' gem 'actionpack', '>= 3.0', '< 4' end -appraise "rails4_0" do +appraise 'rails4_0' do gem 'activesupport', '>= 4.0.0.beta', '< 5' gem 'actionpack', '>= 4.0.0.beta', '< 5' end -appraise "rails5_0" do +appraise 'rails5_0' do gem 'activesupport', '~> 5.0' gem 'actionpack', '~> 5.0' -end \ No newline at end of file +end diff --git a/Gemfile b/Gemfile index 896d547..fa75df1 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,3 @@ -source "https://rubygems.org" +source 'https://rubygems.org' -gemspec \ No newline at end of file +gemspec diff --git a/Rakefile b/Rakefile index fedfb6a..ea3709f 100755 --- a/Rakefile +++ b/Rakefile @@ -3,7 +3,7 @@ require 'bundler/gem_tasks' require 'appraisal' desc 'Default: run unit tests.' -task :default => :test +task default: :test require 'rake/testtask' desc 'Test the crummy plugin.' diff --git a/crummy.gemspec b/crummy.gemspec index c5b59e2..ff61b10 100644 --- a/crummy.gemspec +++ b/crummy.gemspec @@ -1,32 +1,31 @@ -# -*- encoding: utf-8 -*- -$:.push File.expand_path("../lib", __FILE__) -require "crummy/version" +$LOAD_PATH.push File.expand_path('../lib', __FILE__) +require 'crummy/version' Gem::Specification.new do |s| - s.name = "crummy" + s.name = 'crummy' s.version = Crummy::VERSION s.platform = Gem::Platform::RUBY s.licenses = ['MIT'] - s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= - s.authors = ["Zach Inglis", "Andrew Nesbitt"] - s.summary = "Tasty breadcrumbs!" - s.description = "Crummy is a simple and tasty way to add breadcrumbs to your Rails applications." - s.email = "zach+crummy@londonmade.co.uk" - s.extra_rdoc_files = ["README.md"] + s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version= + s.authors = ['Zach Inglis', 'Andrew Nesbitt'] + s.summary = 'Tasty breadcrumbs!' + s.description = 'Crummy is a simple and tasty way to add breadcrumbs to your Rails applications.' + s.email = 'zach+crummy@londonmade.co.uk' + s.extra_rdoc_files = ['README.md'] s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") - s.homepage = "http://github.com/zachinglis/crummy" - s.require_paths = [%q{lib}] - s.rubygems_version = %q{1.9.0} + s.homepage = 'http://github.com/zachinglis/crummy' + s.require_paths = ['lib'] + s.rubygems_version = '1.9.0' - s.add_development_dependency 'rake' - s.add_development_dependency 'bundler', '~> 1.0' - s.add_development_dependency 'activesupport' s.add_development_dependency 'actionpack' + s.add_development_dependency 'activesupport' s.add_development_dependency 'appraisal' - s.add_development_dependency 'test-unit' + s.add_development_dependency 'bundler', '~> 1.0' s.add_development_dependency('rails-dom-testing') + s.add_development_dependency 'rake' + s.add_development_dependency 'test-unit' end diff --git a/example/Gemfile b/example/Gemfile index fb2225e..815afcd 100644 --- a/example/Gemfile +++ b/example/Gemfile @@ -10,21 +10,21 @@ gem 'sqlite3' # Gems used only for assets and not required # in production environments by default. group :assets do - gem 'sass-rails', '~> 3.1.4' gem 'coffee-rails', '~> 3.1.1' + gem 'sass-rails', '~> 3.1.4' gem 'uglifier', '>= 1.0.3' end gem 'jquery-rails' +gem 'crummy', path: '../' gem 'haml' -gem 'crummy', :path => '../' group :test do # Pretty printed test output - gem 'turn', :require => false + gem 'turn', require: false end group :test, :development do - gem "rspec-rails", "~> 2.0" + gem 'rspec-rails', '~> 2.0' end diff --git a/example/app/controllers/application_controller.rb b/example/app/controllers/application_controller.rb index 139ef22..c5c4457 100644 --- a/example/app/controllers/application_controller.rb +++ b/example/app/controllers/application_controller.rb @@ -1,6 +1,6 @@ class ApplicationController < ActionController::Base - add_crumb("Homepage") { |instance| instance.send :root_url } - add_crumb("Customer Dashboard", '/') - + add_crumb('Homepage') { |instance| instance.send :root_url } + add_crumb('Customer Dashboard', '/') + protect_from_forgery end diff --git a/example/app/controllers/pages_controller.rb b/example/app/controllers/pages_controller.rb index 5755c1b..39848c6 100644 --- a/example/app/controllers/pages_controller.rb +++ b/example/app/controllers/pages_controller.rb @@ -1,5 +1,4 @@ class PagesController < ApplicationController def index end - end diff --git a/example/app/controllers/posts_controller.rb b/example/app/controllers/posts_controller.rb index 7661226..da40bd4 100644 --- a/example/app/controllers/posts_controller.rb +++ b/example/app/controllers/posts_controller.rb @@ -1,5 +1,5 @@ class PostsController < ApplicationController - add_crumb "Posts", :posts_url, :except => [:new] + add_crumb 'Posts', :posts_url, except: [:new] def index @posts = Post.all @@ -7,13 +7,13 @@ def index def show @post = Post.find params[:id] - + @post.categories.each do |category| - add_crumb category.title, "#" + add_crumb category.title, '#' end end - + def new - add_crumb "Forever Alone" + add_crumb 'Forever Alone' end end diff --git a/example/app/helpers/application_helper.rb b/example/app/helpers/application_helper.rb index 658a94a..40136da 100644 --- a/example/app/helpers/application_helper.rb +++ b/example/app/helpers/application_helper.rb @@ -3,7 +3,7 @@ def page_title if @page_title "Crummy Test - #{@page_title}" else - "Crummy Test" + 'Crummy Test' end end end diff --git a/example/app/models/category.rb b/example/app/models/category.rb index 1de6ed5..43c948d 100644 --- a/example/app/models/category.rb +++ b/example/app/models/category.rb @@ -1,6 +1,6 @@ class Category < ActiveRecord::Base belongs_to :category - + has_many :categories has_many :posts end diff --git a/example/app/models/post.rb b/example/app/models/post.rb index 67f71cd..92164b4 100644 --- a/example/app/models/post.rb +++ b/example/app/models/post.rb @@ -1,18 +1,18 @@ class Post < ActiveRecord::Base belongs_to :category - + def categories category = self.category categories = [] - + while category.present? categories << category category = category.category end - + categories.reverse end - + def to_s title end diff --git a/example/config.ru b/example/config.ru index 3d8c915..4375427 100644 --- a/example/config.ru +++ b/example/config.ru @@ -1,4 +1,4 @@ # This file is used by Rack-based servers to start the application. -require ::File.expand_path('../config/environment', __FILE__) +require ::File.expand_path('../config/environment', __FILE__) run CrummyTest::Application diff --git a/example/config/application.rb b/example/config/application.rb index 48402ab..34ea22c 100644 --- a/example/config/application.rb +++ b/example/config/application.rb @@ -4,7 +4,7 @@ if defined?(Bundler) # If you precompile assets before deploying to production, use this line - Bundler.require(*Rails.groups(:assets => %w(development test))) + Bundler.require(*Rails.groups(assets: %w[development test])) # If you want your assets lazily compiled in production, use this line # Bundler.require(:default, :assets, Rails.env) end @@ -34,7 +34,7 @@ class Application < Rails::Application # config.i18n.default_locale = :de # Configure the default encoding used in templates for Ruby 1.9. - config.encoding = "utf-8" + config.encoding = 'utf-8' # Configure sensitive parameters which will be filtered from the log file. config.filter_parameters += [:password] diff --git a/example/config/boot.rb b/example/config/boot.rb index 4489e58..f2830ae 100644 --- a/example/config/boot.rb +++ b/example/config/boot.rb @@ -3,4 +3,4 @@ # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) -require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) +require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) diff --git a/example/config/environments/test.rb b/example/config/environments/test.rb index 653c11f..be28e07 100644 --- a/example/config/environments/test.rb +++ b/example/config/environments/test.rb @@ -9,7 +9,7 @@ # Configure static asset server for tests with Cache-Control for performance config.serve_static_assets = true - config.static_cache_control = "public, max-age=3600" + config.static_cache_control = 'public, max-age=3600' # Log error messages when you accidentally call methods on nil config.whiny_nils = true @@ -22,7 +22,7 @@ config.action_dispatch.show_exceptions = false # Disable request forgery protection in test environment - config.action_controller.allow_forgery_protection = false + config.action_controller.allow_forgery_protection = false # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the diff --git a/example/config/initializers/session_store.rb b/example/config/initializers/session_store.rb index e60a5c9..4dd3432 100644 --- a/example/config/initializers/session_store.rb +++ b/example/config/initializers/session_store.rb @@ -1,6 +1,6 @@ # Be sure to restart your server when you modify this file. -CrummyTest::Application.config.session_store :cookie_store, :key => '_crummy-test_session' +CrummyTest::Application.config.session_store :cookie_store, key: '_crummy-test_session' # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information diff --git a/example/config/initializers/wrap_parameters.rb b/example/config/initializers/wrap_parameters.rb index da4fb07..999df20 100644 --- a/example/config/initializers/wrap_parameters.rb +++ b/example/config/initializers/wrap_parameters.rb @@ -5,7 +5,7 @@ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do - wrap_parameters :format => [:json] + wrap_parameters format: [:json] end # Disable root element in JSON by default. diff --git a/example/config/routes.rb b/example/config/routes.rb index 08a20e6..292b8e2 100644 --- a/example/config/routes.rb +++ b/example/config/routes.rb @@ -1,5 +1,5 @@ CrummyTest::Application.routes.draw do resources :posts - - root :to => "pages#index" + + root to: 'pages#index' end diff --git a/example/db/migrate/20111104103738_create_categories.rb b/example/db/migrate/20111104103738_create_categories.rb index 241f53e..980a068 100644 --- a/example/db/migrate/20111104103738_create_categories.rb +++ b/example/db/migrate/20111104103738_create_categories.rb @@ -3,9 +3,9 @@ def change create_table :categories do |t| t.string :title t.string :slug - + t.string :category_id # Can have a category as a parent - + t.timestamps end end diff --git a/example/db/schema.rb b/example/db/schema.rb index 52a8bbe..7a0ba94 100644 --- a/example/db/schema.rb +++ b/example/db/schema.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -11,22 +10,20 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20111104104040) do - - create_table "categories", :force => true do |t| - t.string "title" - t.string "slug" - t.string "category_id" - t.datetime "created_at" - t.datetime "updated_at" +ActiveRecord::Schema.define(version: 20111104104040) do + create_table 'categories', force: true do |t| + t.string 'title' + t.string 'slug' + t.string 'category_id' + t.datetime 'created_at' + t.datetime 'updated_at' end - create_table "posts", :force => true do |t| - t.string "title" - t.string "slug" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "category_id" + create_table 'posts', force: true do |t| + t.string 'title' + t.string 'slug' + t.datetime 'created_at' + t.datetime 'updated_at' + t.integer 'category_id' end - end diff --git a/example/db/seeds.rb b/example/db/seeds.rb index 950febc..d6fdd27 100644 --- a/example/db/seeds.rb +++ b/example/db/seeds.rb @@ -6,10 +6,10 @@ # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel', city: cities.first) -movies = Category.create :title => "Movies", :slug => "movies" -star_wars = Category.create :title => "Star Wars", :slug => "star-wars", :category => movies -time = Category.create :title => "What time Is It?", :slug => "time" +movies = Category.create title: 'Movies', slug: 'movies' +star_wars = Category.create title: 'Star Wars', slug: 'star-wars', category: movies +time = Category.create title: 'What time Is It?', slug: 'time' -Post.create :title => "A Long Long Time Ago", :slug => "a-long-long-time-ago", :category => star_wars -Post.create :title => "It's Hammer Time", :slug => "its-hammer-time", :category => time -Post.create :title => "Test", :slug => "test" +Post.create title: 'A Long Long Time Ago', slug: 'a-long-long-time-ago', category: star_wars +Post.create title: "It's Hammer Time", slug: 'its-hammer-time', category: time +Post.create title: 'Test', slug: 'test' diff --git a/example/script/rails b/example/script/rails index f8da2cf..bd79dce 100755 --- a/example/script/rails +++ b/example/script/rails @@ -1,6 +1,6 @@ #!/usr/bin/env ruby # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. -APP_PATH = File.expand_path('../../config/application', __FILE__) -require File.expand_path('../../config/boot', __FILE__) +APP_PATH = File.expand_path('../../config/application', __FILE__) +require File.expand_path('../../config/boot', __FILE__) require 'rails/commands' diff --git a/example/spec/controllers/posts_controller_spec.rb b/example/spec/controllers/posts_controller_spec.rb index 245571b..72cb702 100644 --- a/example/spec/controllers/posts_controller_spec.rb +++ b/example/spec/controllers/posts_controller_spec.rb @@ -1,7 +1,7 @@ -require "spec_helper" +require 'spec_helper' describe PostsController do - it "exists! (and RSpec works)" do + it 'exists! (and RSpec works)' do # nop end end diff --git a/example/spec/spec_helper.rb b/example/spec/spec_helper.rb index 0909127..24802ad 100644 --- a/example/spec/spec_helper.rb +++ b/example/spec/spec_helper.rb @@ -1,12 +1,12 @@ # This file is copied to spec/ when you run 'rails generate rspec:install' -ENV["RAILS_ENV"] ||= 'test' -require File.expand_path("../../config/environment", __FILE__) +ENV['RAILS_ENV'] ||= 'test' +require File.expand_path('../../config/environment', __FILE__) require 'rspec/rails' require 'rspec/autorun' # Requires supporting ruby files with custom matchers and macros, etc, # in spec/support/ and its subdirectories. -Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} +Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } RSpec.configure do |config| # ## Mock Framework @@ -34,5 +34,5 @@ # order dependency and want to debug it, you can fix the order by providing # the seed, which is printed after each run. # --seed 1234 - config.order = "random" + config.order = 'random' end diff --git a/lib/crummy.rb b/lib/crummy.rb index 3c9a3f3..816a1fd 100644 --- a/lib/crummy.rb +++ b/lib/crummy.rb @@ -1,5 +1,4 @@ module Crummy - def self.configuration @configuration ||= Configuration.new end @@ -30,10 +29,10 @@ class Configuration def initialize @format = :html - @html_separator = " » ".html_safe - @html_right_separator = " » ".html_safe - @xml_separator = "crumb" - @xml_right_separator = "crumb" + @html_separator = ' » '.html_safe + @html_right_separator = ' » '.html_safe + @xml_separator = 'crumb' + @xml_right_separator = 'crumb' @html_list_separator = '' @html_list_right_separator = '' @skip_if_blank = true @@ -49,7 +48,7 @@ def initialize @right_side = false end - def active_li_class=(class_name) + def active_li_class=(_class_name) puts "CRUMMY: The 'active_li_class' option is DEPRECATED and will be removed from a future version" end diff --git a/lib/crummy/action_controller.rb b/lib/crummy/action_controller.rb index a36a097..8cfa5b4 100644 --- a/lib/crummy/action_controller.rb +++ b/lib/crummy/action_controller.rb @@ -11,20 +11,20 @@ module ClassMethods def add_crumb(name, *args) options = args.extract_options! url = args.first - raise ArgumentError, "Need more arguments" unless name or options[:record] or block_given? - raise ArgumentError, "Cannot pass url and use block" if url && block_given? + raise ArgumentError, 'Need more arguments' unless name or options[:record] or block_given? + raise ArgumentError, 'Cannot pass url and use block' if url && block_given? callback_before_method(options) do |instance| url = yield instance if block_given? url = instance.send url if url.is_a? Symbol if url.present? - if url.kind_of? Array - url.map! do |name| - name.is_a?(Symbol) ? instance.instance_variable_get("@#{name}") : name + if url.is_a? Array + url.map! do |nam| + nam.is_a?(Symbol) ? instance.instance_variable_get("@#{nam}") : nam end end - if not url.kind_of? String + unless url.is_a? String url = instance.send :url_for, url end end @@ -32,7 +32,7 @@ def add_crumb(name, *args) # Get the return value of the name if its a proc. name = name.call(instance) if name.is_a?(Proc) - _record = instance.instance_variable_get("@#{name}") unless name.kind_of?(String) + _record = instance.instance_variable_get("@#{name}") unless name.is_a?(String) if _record and _record.respond_to? :to_param instance.add_crumb(_record.to_s, url || instance.url_for(_record), options) else @@ -63,7 +63,7 @@ module InstanceMethods # add_crumb("Home", "/") # add_crumb("Business") { |instance| instance.business_path } # - def add_crumb(name, url=nil, options={}) + def add_crumb(name, url = nil, options = {}) crumbs.push [name, url, options] end @@ -73,7 +73,7 @@ def clear_crumbs # Lists the crumbs as an array def crumbs - get_or_set_ivar "@_crumbs", [] + get_or_set_ivar '@_crumbs', [] end def get_or_set_ivar(var, value) # :nodoc: diff --git a/lib/crummy/action_view.rb b/lib/crummy/action_view.rb index 3dbc410..4f7bc36 100644 --- a/lib/crummy/action_view.rb +++ b/lib/crummy/action_view.rb @@ -4,24 +4,24 @@ module ViewMethods def crumbs @_crumbs ||= [] # Give me something to push to end - + # Add a crumb to the +crumbs+ array - def add_crumb(name, url=nil, options={}) + def add_crumb(name, url = nil, options = {}) crumbs.push [name, url, options] end - + # Render the list of crumbs using renderer # def render_crumbs(options = {}) - raise ArgumentError, "Renderer and block given" if options.has_key?(:renderer) && block_given? + raise ArgumentError, 'Renderer and block given' if options.key?(:renderer) && block_given? return yield(crumbs, options) if block_given? - - @_renderer ||= if options.has_key?(:renderer) - options.delete(:renderer) - else - require 'crummy/standard_renderer' - Crummy::StandardRenderer.new - end + + @_renderer ||= if options.key?(:renderer) + options.delete(:renderer) + else + require 'crummy/standard_renderer' + Crummy::StandardRenderer.new + end @_renderer.render_crumbs(crumbs, options) end diff --git a/lib/crummy/railtie.rb b/lib/crummy/railtie.rb index b165210..8e0e6d9 100644 --- a/lib/crummy/railtie.rb +++ b/lib/crummy/railtie.rb @@ -3,14 +3,14 @@ module Crummy class Railtie < Rails::Railtie - initializer "crummy.action_controller" do |app| + initializer 'crummy.action_controller' do |_app| if defined?(ActionController) require 'crummy/action_controller' - ActionController::Base.send :include, Crummy::ControllerMethods + ActionController::Base.send :include, Crummy::ControllerMethods end end - - initializer "crummy.action_view" do |app| + + initializer 'crummy.action_view' do |_app| require 'crummy/action_view' ActionView::Base.send :include, Crummy::ViewMethods end diff --git a/lib/crummy/standard_renderer.rb b/lib/crummy/standard_renderer.rb index e27fee1..10546ee 100644 --- a/lib/crummy/standard_renderer.rb +++ b/lib/crummy/standard_renderer.rb @@ -1,9 +1,7 @@ -# encoding: utf-8 - module Crummy class StandardRenderer include ActionView::Helpers::UrlHelper - include ActionView::Helpers::TagHelper unless self.included_modules.include?(ActionView::Helpers::TagHelper) + include ActionView::Helpers::TagHelper unless included_modules.include?(ActionView::Helpers::TagHelper) ActionView::Helpers::TagHelper::BOOLEAN_ATTRIBUTES.merge([:itemscope].to_set) # Render the list of crumbs as either html or xml @@ -28,7 +26,6 @@ class StandardRenderer # render_crumbs(" . ") #=> Home . Businesses # def render_crumbs(crumbs, options = {}) - options[:skip_if_blank] ||= Crummy.configuration.skip_if_blank return '' if options[:skip_if_blank] && crumbs.count < 1 options[:format] ||= Crummy.configuration.format @@ -42,24 +39,29 @@ def render_crumbs(crumbs, options = {}) options[:last_crumb_linked] = Crummy.configuration.last_crumb_linked if options[:last_crumb_linked].nil? options[:right_side] ||= Crummy.configuration.right_side - last_hash = lambda {|o|k=o.map{|c| - c.is_a?(Hash) ? (c.empty? ? nil: c) : nil}.compact - k.empty? ? {} : k.last - } - local_global = lambda {|crumb, global_options, param_name| last_hash.call(crumb).has_key?(param_name.to_sym) ? last_hash.call(crumb)[param_name.to_sym] : global_options[param_name.to_sym]} + last_hash = lambda { |o| + k = o.map { |c| c.is_a?(Hash) ? (c.empty? ? nil : c) : nil }.compact + k.empty? ? {} : k.last + } + local_global = lambda { |crumb, global_options, param_name| last_hash.call(crumb).key?(param_name.to_sym) ? last_hash.call(crumb)[param_name.to_sym] : global_options[param_name.to_sym] } case options[:format] when :html - crumb_string = crumbs.map{|crumb|local_global.call(crumb, options, :right_side) ? nil : - crumb_to_html(crumb, - local_global.call(crumb, options, :links), - local_global.call(crumb, options, :first_class), - local_global.call(crumb, options, :last_class), - (crumb == crumbs.first), - (crumb == crumbs.last), - local_global.call(crumb, options, :microdata), - local_global.call(crumb, options, :last_crumb_linked), - local_global.call(crumb, options, :truncate))}.compact.join(options[:separator]).html_safe + crumb_string = crumbs.map do |crumb| + if local_global.call(crumb, options, :right_side) + nil + else + crumb_to_html(crumb, + local_global.call(crumb, options, :links), + local_global.call(crumb, options, :first_class), + local_global.call(crumb, options, :last_class), + (crumb == crumbs.first), + (crumb == crumbs.last), + local_global.call(crumb, options, :microdata), + local_global.call(crumb, options, :last_crumb_linked), + local_global.call(crumb, options, :truncate)) + end + end.compact.join(options[:separator]).html_safe crumb_string when :html_list # Let's set values for special options of html_list format @@ -68,47 +70,55 @@ def render_crumbs(crumbs, options = {}) options[:ol_id] ||= Crummy.configuration.ol_id options[:ol_id] = nil if options[:ol_id].blank? - crumb_string = crumbs.map{|crumb|local_global.call(crumb, options, :right_side) ? nil : - crumb_to_html_list(crumb, - local_global.call(crumb, options, :links), - local_global.call(crumb, options, :li_class), - local_global.call(crumb, options, :first_class), - local_global.call(crumb, options, :last_class), - (crumb == crumbs.first), - (crumb == crumbs.find_all{|crumb| - !last_hash.call(crumb).fetch(:right_side,false)}.compact.last), - local_global.call(crumb, options, :microdata), - local_global.call(crumb, options, :last_crumb_linked), - local_global.call(crumb, options, :truncate), - local_global.call(crumb, options, :separator))}.compact.join.html_safe - crumb_right_string = crumbs.reverse.map{|crumb|!local_global.call(crumb, options, :right_side) ? nil : - - crumb_to_html_list(crumb, - local_global.call(crumb, options, :links), - local_global.call(crumb, options, :li_right_class), - local_global.call(crumb, options, :first_class), - local_global.call(crumb, options, :last_class), - (crumb == crumbs.first), - (crumb == crumbs.find_all{|crumb|!local_global.call(crumb, options, :right_side)}.compact.last), - local_global.call(crumb, options, :microdata), - local_global.call(crumb, options, :last_crumb_linked), - local_global.call(crumb, options, :truncate), - local_global.call(crumb, options, :right_separator))}.compact.join.html_safe + crumb_string = crumbs.map do |crumb| + if local_global.call(crumb, options, :right_side) + nil + else + crumb_to_html_list(crumb, + local_global.call(crumb, options, :links), + local_global.call(crumb, options, :li_class), + local_global.call(crumb, options, :first_class), + local_global.call(crumb, options, :last_class), + (crumb == crumbs.first), + (crumb == crumbs.find_all { |c| !last_hash.call(c).fetch(:right_side, false) }.compact.last), + local_global.call(crumb, options, :microdata), + local_global.call(crumb, options, :last_crumb_linked), + local_global.call(crumb, options, :truncate), + local_global.call(crumb, options, :separator)) + end + end.compact.join.html_safe + crumb_right_string = crumbs.reverse.map do |crumb| + if !local_global.call(crumb, options, :right_side) + nil + else + crumb_to_html_list(crumb, + local_global.call(crumb, options, :links), + local_global.call(crumb, options, :li_right_class), + local_global.call(crumb, options, :first_class), + local_global.call(crumb, options, :last_class), + (crumb == crumbs.first), + (crumb == crumbs.find_all { |c| !local_global.call(c, options, :right_side) }.compact.last), + local_global.call(crumb, options, :microdata), + local_global.call(crumb, options, :last_crumb_linked), + local_global.call(crumb, options, :truncate), + local_global.call(crumb, options, :right_separator)) + end + end.compact.join.html_safe crumb_string = content_tag(:ol, - crumb_string+crumb_right_string, - :class => options[:ol_class], - :id => options[:ol_id]) + crumb_string + crumb_right_string, + class: options[:ol_class], + id: options[:ol_id]) crumb_string when :xml crumbs.collect do |crumb| crumb_to_xml(crumb, - local_global.call(crumb, options, :links), - local_global.call(crumb, options, :separator), - (crumb == crumbs.first), - (crumb == crumbs.last)) + local_global.call(crumb, options, :links), + local_global.call(crumb, options, :separator), + (crumb == crumbs.first), + (crumb == crumbs.last)) end * '' else - raise ArgumentError, "Unknown breadcrumb output format" + raise ArgumentError, 'Unknown breadcrumb output format' end end @@ -124,9 +134,9 @@ def crumb_to_html(crumb, links, first_class, last_class, is_first, is_last, with link_html_options = options[:link_html_options] || {} link_html_options[:class] = html_classes if with_microdata - item_title = content_tag(:span, (truncate.present? ? name.truncate(truncate) : name), :itemprop => "title") - html_options = {:itemscope => true, :itemtype => data_definition_url("Breadcrumb")} - link_html_options[:itemprop] = "url" + item_title = content_tag(:span, (truncate.present? ? name.truncate(truncate) : name), itemprop: 'title') + html_options = { itemscope: true, itemtype: data_definition_url('Breadcrumb') } + link_html_options[:itemprop] = 'url' html_content = can_link ? link_to(item_title, url, link_html_options) : item_title content_tag(:div, html_content, html_options) else @@ -134,33 +144,33 @@ def crumb_to_html(crumb, links, first_class, last_class, is_first, is_last, with end end - def crumb_to_html_list(crumb, links, li_class, first_class, last_class, is_first, is_last, with_microdata, last_crumb_linked, truncate, separator='') + def crumb_to_html_list(crumb, links, li_class, first_class, last_class, is_first, is_last, with_microdata, last_crumb_linked, truncate, separator = '') name, url, options = crumb options = {} unless options.is_a?(Hash) - can_link = url && links && (!is_last || last_crumb_linked) && !(/<\/a/ =~ name) + can_link = url && links && (!is_last || last_crumb_linked) && !(%r{ 0 ? {:class => html_classes.join(' ').strip} : {} + html_options = html_classes.empty? ? {} : { class: html_classes.join(' ').strip } if with_microdata html_options[:itemscope] = true - html_options[:itemtype] = data_definition_url("Breadcrumb") - item_title = content_tag(:span, (truncate.present? ? name.truncate(truncate) : name), :itemprop => "title") + html_options[:itemtype] = data_definition_url('Breadcrumb') + item_title = content_tag(:span, (truncate.present? ? name.truncate(truncate) : name), itemprop: 'title') link_html_options = options[:link_html_options] || {} - link_html_options[:itemprop] = "url" + link_html_options[:itemprop] = 'url' html_content = can_link ? link_to(item_title, url, link_html_options) : item_title else html_content = can_link ? link_to((truncate.present? ? name.truncate(truncate) : name), url, options[:link_html_options]) : content_tag(:span, (truncate.present? ? name.truncate(truncate) : name)) end - content_tag(:li, html_content, html_options)+(/<\/li/ =~ separator ? + content_tag(:li, html_content, html_options) + (%r{ (url && links ? url : nil)) + content_tag(separator, name, href: (url && links ? url : nil)) end def data_definition_url(type) diff --git a/lib/crummy/version.rb b/lib/crummy/version.rb index 0fad063..a386ffd 100644 --- a/lib/crummy/version.rb +++ b/lib/crummy/version.rb @@ -1,6 +1,6 @@ module Crummy MAJOR = 1 MINOR = 9 - PATCH = 0 + PATCH = 0 VERSION = [MAJOR, MINOR, PATCH].join('.') end diff --git a/test/standard_renderer_test.rb b/test/standard_renderer_test.rb index 9ebfbe6..5dfb7c2 100644 --- a/test/standard_renderer_test.rb +++ b/test/standard_renderer_test.rb @@ -16,53 +16,53 @@ class StandardRendererTest < Test::Unit::TestCase def test_classes renderer = StandardRenderer.new assert_dom_equal('name', - renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html)) + renderer.render_crumbs([%w[name url]], first_class: 'first', last_class: 'last', format: :html)) assert_equal('
  1. name
', - renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html_list)) + renderer.render_crumbs([%w[name url]], first_class: 'first', last_class: 'last', format: :html_list)) assert_equal('name', - renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :xml)) + renderer.render_crumbs([%w[name url]], first_class: 'first', last_class: 'last', format: :xml)) assert_dom_equal('name1 » name2', - renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2']], :first_class => 'first', :last_class => 'last', :format => :html)) + renderer.render_crumbs([%w[name1 url1], %w[name2 url2]], first_class: 'first', last_class: 'last', format: :html)) assert_equal('
  1. name1
  2. name2
  3. name3
', - renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2'], ['name3', 'url3']], :li_class => "li_class", :first_class => 'first', :last_class => 'last', :format => :html_list)) + renderer.render_crumbs([%w[name1 url1], %w[name2 url2], %w[name3 url3]], li_class: 'li_class', first_class: 'first', last_class: 'last', format: :html_list)) assert_equal('
  1. name1
  2. /
  3. name2
  4. /
  5. name3
', - renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2'], ['name3', 'url3']], :li_class => "li_class", :first_class => 'first', :last_class => 'last', :format => :html_list, :separator => " / ")) + renderer.render_crumbs([%w[name1 url1], %w[name2 url2], %w[name3 url3]], li_class: 'li_class', first_class: 'first', last_class: 'last', format: :html_list, separator: ' / ')) assert_equal('name1name2', - renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2']], :first_class => 'first', :last_class => 'last', :format => :xml)) + renderer.render_crumbs([%w[name1 url1], %w[name2 url2]], first_class: 'first', last_class: 'last', format: :xml)) assert_dom_equal('', - renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html, :microdata => true)) + renderer.render_crumbs([%w[name url]], first_class: 'first', last_class: 'last', format: :html, microdata: true)) assert_dom_equal '
', - renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html_list, :microdata => true) + renderer.render_crumbs([%w[name url]], first_class: 'first', last_class: 'last', format: :html_list, microdata: true) assert_equal('
  1. name
', - renderer.render_crumbs([['name', 'url']], :format => :html_list, :ol_id => "crumbid", :ol_class => "crumbclass", :li_class => "liclass")) + renderer.render_crumbs([%w[name url]], format: :html_list, ol_id: 'crumbid', ol_class: 'crumbclass', li_class: 'liclass')) end def test_classes_last_crumb_not_linked renderer = StandardRenderer.new assert_equal('name', - renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html, :last_crumb_linked => false)) + renderer.render_crumbs([%w[name url]], first_class: 'first', last_class: 'last', format: :html, last_crumb_linked: false)) assert_equal('
  1. name
', - renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html_list, :last_crumb_linked => false)) + renderer.render_crumbs([%w[name url]], first_class: 'first', last_class: 'last', format: :html_list, last_crumb_linked: false)) assert_equal('name', - renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :xml, :last_crumb_linked => false)) + renderer.render_crumbs([%w[name url]], first_class: 'first', last_class: 'last', format: :xml, last_crumb_linked: false)) assert_dom_equal('name1 » name2', - renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2']], :first_class => 'first', :last_class => 'last', :format => :html, :last_crumb_linked => false)) + renderer.render_crumbs([%w[name1 url1], %w[name2 url2]], first_class: 'first', last_class: 'last', format: :html, last_crumb_linked: false)) assert_equal('
  1. name1
  2. name2
  3. name3
', - renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2'], ['name3', 'url3']], :li_class => "li_class", :first_class => 'first', :last_class => 'last', :format => :html_list, :last_crumb_linked => false)) + renderer.render_crumbs([%w[name1 url1], %w[name2 url2], %w[name3 url3]], li_class: 'li_class', first_class: 'first', last_class: 'last', format: :html_list, last_crumb_linked: false)) assert_equal('
  1. name1
  2. /
  3. name2
  4. /
  5. name3
', - renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2'], ['name3', 'url3']], :li_class => "li_class", :first_class => 'first', :last_class => 'last', :format => :html_list, :separator => " / ", :last_crumb_linked => false)) + renderer.render_crumbs([%w[name1 url1], %w[name2 url2], %w[name3 url3]], li_class: 'li_class', first_class: 'first', last_class: 'last', format: :html_list, separator: ' / ', last_crumb_linked: false)) assert_equal('name1name2', - renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2']], :first_class => 'first', :last_class => 'last', :format => :xml, :last_crumb_linked => false)) + renderer.render_crumbs([%w[name1 url1], %w[name2 url2]], first_class: 'first', last_class: 'last', format: :xml, last_crumb_linked: false)) assert_equal('
name
', - renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html, :microdata => true, :last_crumb_linked => false)) + renderer.render_crumbs([%w[name url]], first_class: 'first', last_class: 'last', format: :html, microdata: true, last_crumb_linked: false)) assert_equal('
  1. name
', - renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html_list, :microdata => true, :last_crumb_linked => false)) + renderer.render_crumbs([%w[name url]], first_class: 'first', last_class: 'last', format: :html_list, microdata: true, last_crumb_linked: false)) assert_equal('
  1. name
', - renderer.render_crumbs([['name', 'url']], :format => :html_list, :ol_id => "crumbid", :ol_class => "crumbclass", :li_class => "liclass", :last_crumb_linked => false)) + renderer.render_crumbs([%w[name url]], format: :html_list, ol_id: 'crumbid', ol_class: 'crumbclass', li_class: 'liclass', last_crumb_linked: false)) end def test_input_object_mutation @@ -76,13 +76,13 @@ def test_input_object_mutation name2 = 'name2' url2 = nil - renderer.render_crumbs([[name1, url1], [name2, url2]], :format => :html, :microdata => false) + renderer.render_crumbs([[name1, url1], [name2, url2]], format: :html, microdata: false) # Rendering the crumbs shouldn't alter the input objects. - assert_equal('name1', name1); - assert_equal(nil, url2); - assert_equal('name2', name2); - assert_equal(nil, url2); + assert_equal('name1', name1) + assert_equal(nil, url2) + assert_equal('name2', name2) + assert_equal(nil, url2) end def test_link_html_options @@ -92,16 +92,16 @@ def test_link_html_options end assert_dom_equal('name', - renderer.render_crumbs([['name', 'url', {:link_html_options => {:title => 'link title'}}]], :first_class => 'first', :last_class => 'last', :format => :html)) + renderer.render_crumbs([['name', 'url', { link_html_options: { title: 'link title' } }]], first_class: 'first', last_class: 'last', format: :html)) assert_equal('name', - renderer.render_crumbs([['name', 'url', {:link_html_options => {:title => 'link title'}}]], :first_class => 'first', :last_class => 'last', :format => :html, :last_crumb_linked => false)) + renderer.render_crumbs([['name', 'url', { link_html_options: { title: 'link title' } }]], first_class: 'first', last_class: 'last', format: :html, last_crumb_linked: false)) assert_dom_equal '
  1. name
', - renderer.render_crumbs([['name', 'url', {:link_html_options => {:title => 'link title'}}]], :first_class => 'first', :last_class => 'last', :format => :html_list) + renderer.render_crumbs([['name', 'url', { link_html_options: { title: 'link title' } }]], first_class: 'first', last_class: 'last', format: :html_list) assert_equal('
  1. name
', - renderer.render_crumbs([['name', 'url', {:link_html_options => {:title => 'link title'}}]], :first_class => 'first', :last_class => 'last', :format => :html_list, :last_crumb_linked => false)) + renderer.render_crumbs([['name', 'url', { link_html_options: { title: 'link title' } }]], first_class: 'first', last_class: 'last', format: :html_list, last_crumb_linked: false)) end def test_link_html_options_with_microdata @@ -111,16 +111,16 @@ def test_link_html_options_with_microdata end assert_dom_equal '', - renderer.render_crumbs([['name', 'url', {:link_html_options => {:title => 'link title'}}]], :first_class => 'first', :last_class => 'last', :format => :html) + renderer.render_crumbs([['name', 'url', { link_html_options: { title: 'link title' } }]], first_class: 'first', last_class: 'last', format: :html) assert_equal('
name
', - renderer.render_crumbs([['name', 'url', {:link_html_options => {:title => 'link title'}}]], :first_class => 'first', :last_class => 'last', :format => :html, :last_crumb_linked => false)) + renderer.render_crumbs([['name', 'url', { link_html_options: { title: 'link title' } }]], first_class: 'first', last_class: 'last', format: :html, last_crumb_linked: false)) assert_dom_equal '
', - renderer.render_crumbs([['name', 'url', {:link_html_options => {:title => 'link title'}}]], :first_class => 'first', :last_class => 'last', :format => :html_list) + renderer.render_crumbs([['name', 'url', { link_html_options: { title: 'link title' } }]], first_class: 'first', last_class: 'last', format: :html_list) assert_dom_equal '
  1. name
', - renderer.render_crumbs([['name', 'url', {:link_html_options => {:title => 'link title'}}]], :first_class => 'first', :last_class => 'last', :format => :html_list, :last_crumb_linked => false) + renderer.render_crumbs([['name', 'url', { link_html_options: { title: 'link title' } }]], first_class: 'first', last_class: 'last', format: :html_list, last_crumb_linked: false) end def test_inline_configuration @@ -130,40 +130,39 @@ def test_inline_configuration config.last_crumb_linked = true end - assert_no_match(/itemscope/, renderer.render_crumbs([['name', 'url']], :microdata => false)) - assert_match(/href/, renderer.render_crumbs([['name', 'url']], :last_crumb_linked => true)) + assert_no_match(/itemscope/, renderer.render_crumbs([%w[name url]], microdata: false)) + assert_match(/href/, renderer.render_crumbs([%w[name url]], last_crumb_linked: true)) Crummy.configure do |config| config.microdata = false config.last_crumb_linked = true end - assert_match(/itemscope/, renderer.render_crumbs([['name', 'url']], :microdata => true)) - assert_no_match(/href/, renderer.render_crumbs([['name', 'url']], :last_crumb_linked => false)) + assert_match(/itemscope/, renderer.render_crumbs([%w[name url]], microdata: true)) + assert_no_match(/href/, renderer.render_crumbs([%w[name url]], last_crumb_linked: false)) end def test_configuration - renderer = StandardRenderer.new # check defaults - assert_equal " » ", Crummy.configuration.html_separator + assert_equal ' » ', Crummy.configuration.html_separator # adjust configuration Crummy.configure do |config| - config.html_separator = " / " + config.html_separator = ' / ' end - assert_equal " / ", Crummy.configuration.html_separator + assert_equal ' / ', Crummy.configuration.html_separator end def test_configured_renderer renderer = StandardRenderer.new Crummy.configure do |config| - config.html_separator = " / " + config.html_separator = ' / ' end # using configured separator assert_dom_equal('name1 / name2', - renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2']])) + renderer.render_crumbs([%w[name1 url1], %w[name2 url2]])) # overriding configured separator assert_dom_equal('name1 | name2', - renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2']], :separator => " | ")) + renderer.render_crumbs([%w[name1 url1], %w[name2 url2]], separator: ' | ')) end def test_configured_renderer_with_microdata @@ -173,10 +172,9 @@ def test_configured_renderer_with_microdata end # using configured microdata setting assert_dom_equal('', - renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html)) + renderer.render_crumbs([%w[name url]], first_class: 'first', last_class: 'last', format: :html)) # last crumb not linked assert_equal('
name
', - renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html, :last_crumb_linked => false)) + renderer.render_crumbs([%w[name url]], first_class: 'first', last_class: 'last', format: :html, last_crumb_linked: false)) end - end From a9d7e5a0b6f87b19e61c2dd33281c2e4eceefe4b Mon Sep 17 00:00:00 2001 From: Andrea Salicetti Date: Fri, 16 Feb 2018 16:06:07 +0100 Subject: [PATCH 10/21] .travis.ci: removes RoR 4.1 & 4.2 spec, adds 5.1 --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0870872..7313937 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,5 @@ rvm: gemfile: - gemfiles/rails3_2.gemfile - gemfiles/rails4_0.gemfile - - gemfiles/rails4_1.gemfile - - gemfiles/rails4_2.gemfile - gemfiles/rails5_0.gemfile + - gemfiles/rails5_1.gemfile From 7156024b10101d29e81e6caeb346ba6e70573521 Mon Sep 17 00:00:00 2001 From: Andrea Salicetti Date: Fri, 16 Feb 2018 16:33:59 +0100 Subject: [PATCH 11/21] [ruby] Replaces match? with =~ (backward compatible with ruby 2.0.0) --- lib/crummy/standard_renderer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/crummy/standard_renderer.rb b/lib/crummy/standard_renderer.rb index 10546ee..18e95e6 100644 --- a/lib/crummy/standard_renderer.rb +++ b/lib/crummy/standard_renderer.rb @@ -164,7 +164,7 @@ def crumb_to_html_list(crumb, links, li_class, first_class, last_class, is_first else html_content = can_link ? link_to((truncate.present? ? name.truncate(truncate) : name), url, options[:link_html_options]) : content_tag(:span, (truncate.present? ? name.truncate(truncate) : name)) end - content_tag(:li, html_content, html_options) + (%r{ Date: Fri, 16 Feb 2018 17:41:34 +0100 Subject: [PATCH 12/21] Excludes RoR 5.x from build with ruby 2.0.0 --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index 7313937..6e08f29 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,3 +7,10 @@ gemfile: - gemfiles/rails4_0.gemfile - gemfiles/rails5_0.gemfile - gemfiles/rails5_1.gemfile + + matrix: + exclude: + - rvm: 2.0.0 + gemfile: + - gemfiles/rails5_0.gemfile + - gemfiles/rails5_1.gemfile From c632ba9e0e1c328d6a154d21426e472dad6aa6ef Mon Sep 17 00:00:00 2001 From: Andrea Salicetti Date: Fri, 16 Feb 2018 17:41:49 +0100 Subject: [PATCH 13/21] Adds RoR 5.1 to apprisals defs. --- Appraisals | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Appraisals b/Appraisals index 42739d5..07486d1 100644 --- a/Appraisals +++ b/Appraisals @@ -12,3 +12,8 @@ appraise 'rails5_0' do gem 'activesupport', '~> 5.0' gem 'actionpack', '~> 5.0' end + +appraise "rails5_1" do + gem 'activesupport', '~> 5.1' + gem 'actionpack', '~> 5.1' +end \ No newline at end of file From 41558587d0493774d9b32b8f2e2e5ef74e844920 Mon Sep 17 00:00:00 2001 From: Andrea Salicetti Date: Fri, 16 Feb 2018 17:48:09 +0100 Subject: [PATCH 14/21] Fix --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6e08f29..b53a540 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ gemfile: - gemfiles/rails5_0.gemfile - gemfiles/rails5_1.gemfile - matrix: +matrix: exclude: - rvm: 2.0.0 gemfile: From 5016e185f376b53634920c6784028063e9282709 Mon Sep 17 00:00:00 2001 From: Andrea Salicetti Date: Fri, 16 Feb 2018 17:54:26 +0100 Subject: [PATCH 15/21] Fix travis.ci --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index b53a540..67c5c7c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,6 @@ gemfile: matrix: exclude: - rvm: 2.0.0 - gemfile: - - gemfiles/rails5_0.gemfile - - gemfiles/rails5_1.gemfile + gemfile: gemfiles/rails5_0.gemfile + - rvm: 2.0.0 + gemfile: gemfiles/rails5_1.gemfile From f83905361fca7658763dfa58934c4d631ef2c0bc Mon Sep 17 00:00:00 2001 From: Andrea Salicetti Date: Fri, 16 Feb 2018 19:04:51 +0100 Subject: [PATCH 16/21] Fix trial for Appraisal --- Appraisals | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Appraisals b/Appraisals index 07486d1..ad84366 100644 --- a/Appraisals +++ b/Appraisals @@ -13,7 +13,7 @@ appraise 'rails5_0' do gem 'actionpack', '~> 5.0' end -appraise "rails5_1" do - gem 'activesupport', '~> 5.1' - gem 'actionpack', '~> 5.1' -end \ No newline at end of file +appraise 'rails5_1' do + gem 'activesupport', '~> 5.1.0' + gem 'actionpack', '~> 5.1.0' +end From 8851c35c3609c11e695263cbe6798a8809493af0 Mon Sep 17 00:00:00 2001 From: Andrea Salicetti Date: Sun, 18 Feb 2018 22:35:37 +0100 Subject: [PATCH 17/21] Fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d89283e..4cd5b03 100644 --- a/README.md +++ b/README.md @@ -192,7 +192,7 @@ An example application is available right inside this gem. That application is d - Accept collections of models as a single argument - Accept instances of models as a single argument - Allow for variables in names. (The workaround is to do your own - before\_filter for that currently) + before_filter for that currently) - Make a crumbs? type method ## Credits From 2f385a9ed1b6292ce6c4527605416e95c9b83c81 Mon Sep 17 00:00:00 2001 From: Andrea Salicetti Date: Sun, 18 Feb 2018 22:35:48 +0100 Subject: [PATCH 18/21] [rubocop] Linting --- lib/crummy/action_controller.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/crummy/action_controller.rb b/lib/crummy/action_controller.rb index 8cfa5b4..ef8741a 100644 --- a/lib/crummy/action_controller.rb +++ b/lib/crummy/action_controller.rb @@ -24,9 +24,7 @@ def add_crumb(name, *args) nam.is_a?(Symbol) ? instance.instance_variable_get("@#{nam}") : nam end end - unless url.is_a? String - url = instance.send :url_for, url - end + url = instance.send :url_for, url unless url.is_a? String end # Get the return value of the name if its a proc. From 5020b76ded415a456d086535f0dcdaa315a6eef6 Mon Sep 17 00:00:00 2001 From: Andrea Salicetti Date: Sun, 18 Feb 2018 22:36:04 +0100 Subject: [PATCH 19/21] README: updates version number on doc. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4cd5b03..2d37561 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Crummy is a simple and tasty way to add breadcrumbs to your Rails applications. Simply add the dependency to your Gemfile: ```ruby -gem "crummy", "~> 1.8.0" +gem "crummy", "~> 1.9.0" ``` # Example From 36f623ce851d6c7ba13dcabe51ed87aa2c3476b2 Mon Sep 17 00:00:00 2001 From: Andrea Salicetti Date: Sun, 18 Feb 2018 22:37:01 +0100 Subject: [PATCH 20/21] [travis.ci] Removes test on RoR 5.1 --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 67c5c7c..ba86667 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,11 +6,8 @@ gemfile: - gemfiles/rails3_2.gemfile - gemfiles/rails4_0.gemfile - gemfiles/rails5_0.gemfile - - gemfiles/rails5_1.gemfile matrix: exclude: - rvm: 2.0.0 gemfile: gemfiles/rails5_0.gemfile - - rvm: 2.0.0 - gemfile: gemfiles/rails5_1.gemfile From 883e40df9964df8a4d2ba51208bfe33b209c9218 Mon Sep 17 00:00:00 2001 From: Andrea Salicetti Date: Sun, 18 Feb 2018 22:44:05 +0100 Subject: [PATCH 21/21] Respecting semantic versioning. --- CHANGELOG | 2 +- README.md | 2 +- crummy.gemspec | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index af78bd2..f746ceb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,4 @@ -1.9.0 +2.0.0 * [ADDED] Adds support for Rails 5.1 and above. * [ADDED] Adds ruby 2.5.0 to .travis.yml * [BREAKING] Removes support for ruby 1.9.3 diff --git a/README.md b/README.md index 2d37561..735ac2f 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Crummy is a simple and tasty way to add breadcrumbs to your Rails applications. Simply add the dependency to your Gemfile: ```ruby -gem "crummy", "~> 1.9.0" +gem "crummy", "~> 2.0.0" # "~> 1.8.0" for ruby < 2.0 ``` # Example diff --git a/crummy.gemspec b/crummy.gemspec index ff61b10..99c28d1 100644 --- a/crummy.gemspec +++ b/crummy.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |s| s.homepage = 'http://github.com/zachinglis/crummy' s.require_paths = ['lib'] - s.rubygems_version = '1.9.0' + s.rubygems_version = '2.0.0' s.add_development_dependency 'actionpack' s.add_development_dependency 'activesupport'