gretel 3.0.8 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +11 -7
  3. data/.travis.yml +12 -8
  4. data/CHANGELOG.md +33 -1
  5. data/Gemfile +2 -13
  6. data/LICENSE.txt +2 -2
  7. data/README.md +31 -62
  8. data/Rakefile +3 -7
  9. data/coverage/coverage.txt +5 -0
  10. data/gretel.gemspec +13 -11
  11. data/lib/gretel.rb +2 -29
  12. data/lib/gretel/crumb.rb +5 -2
  13. data/lib/gretel/crumbs.rb +26 -7
  14. data/lib/gretel/railtie.rb +11 -0
  15. data/lib/gretel/renderer.rb +46 -27
  16. data/lib/gretel/version.rb +2 -2
  17. data/lib/gretel/view_helpers.rb +2 -0
  18. metadata +83 -109
  19. data/gemfiles/Gemfile-rails.3.2.x +0 -17
  20. data/gemfiles/Gemfile-rails.4.0.x +0 -17
  21. data/gemfiles/Gemfile-rails.4.1.x +0 -17
  22. data/lib/gretel/deprecated.rb +0 -1
  23. data/lib/gretel/deprecated/default_style_key.rb +0 -11
  24. data/lib/gretel/deprecated/layout.rb +0 -15
  25. data/lib/gretel/deprecated/show_root_alone.rb +0 -12
  26. data/lib/gretel/deprecated/yield_links.rb +0 -20
  27. data/test/deprecated_test.rb +0 -45
  28. data/test/dummy/Rakefile +0 -7
  29. data/test/dummy/app/assets/javascripts/application.js +0 -15
  30. data/test/dummy/app/assets/stylesheets/application.css +0 -13
  31. data/test/dummy/app/controllers/application_controller.rb +0 -3
  32. data/test/dummy/app/helpers/application_helper.rb +0 -5
  33. data/test/dummy/app/mailers/.gitkeep +0 -0
  34. data/test/dummy/app/models/.gitkeep +0 -0
  35. data/test/dummy/app/models/issue.rb +0 -3
  36. data/test/dummy/app/models/project.rb +0 -3
  37. data/test/dummy/app/views/breadcrumbs/site.rb +0 -3
  38. data/test/dummy/config.ru +0 -4
  39. data/test/dummy/config/application.rb +0 -14
  40. data/test/dummy/config/boot.rb +0 -10
  41. data/test/dummy/config/breadcrumbs.rb +0 -3
  42. data/test/dummy/config/breadcrumbs/test_crumbs.rb +0 -85
  43. data/test/dummy/config/database.yml +0 -25
  44. data/test/dummy/config/environment.rb +0 -5
  45. data/test/dummy/config/environments/development.rb +0 -2
  46. data/test/dummy/config/environments/production.rb +0 -2
  47. data/test/dummy/config/environments/test.rb +0 -2
  48. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  49. data/test/dummy/config/initializers/inflections.rb +0 -15
  50. data/test/dummy/config/initializers/mime_types.rb +0 -5
  51. data/test/dummy/config/initializers/secret_token.rb +0 -7
  52. data/test/dummy/config/initializers/session_store.rb +0 -8
  53. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  54. data/test/dummy/config/locales/en.yml +0 -5
  55. data/test/dummy/config/routes.rb +0 -11
  56. data/test/dummy/db/migrate/20130122163007_create_projects.rb +0 -9
  57. data/test/dummy/db/migrate/20130122163051_create_issues.rb +0 -10
  58. data/test/dummy/db/schema.rb +0 -29
  59. data/test/dummy/lib/assets/.gitkeep +0 -0
  60. data/test/dummy/log/.gitkeep +0 -0
  61. data/test/dummy/public/404.html +0 -26
  62. data/test/dummy/public/422.html +0 -26
  63. data/test/dummy/public/500.html +0 -25
  64. data/test/dummy/public/favicon.ico +0 -0
  65. data/test/dummy/script/rails +0 -6
  66. data/test/fixtures/issues.yml +0 -4
  67. data/test/fixtures/projects.yml +0 -3
  68. data/test/gretel_test.rb +0 -24
  69. data/test/helper_methods_test.rb +0 -539
  70. data/test/test_helper.rb +0 -15
@@ -1,17 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "gretel", :path => ".."
4
-
5
- gem "rails", "~> 3.2.0"
6
- gem "sqlite3"
7
-
8
- # jquery-rails is used by the dummy application
9
- gem "jquery-rails"
10
-
11
- # Declare any dependencies that are still in development here instead of in
12
- # your gemspec. These might include edge Rails or gems from your path or
13
- # Git. Remember to move these dependencies to your gemspec before releasing
14
- # your gem to rubygems.org.
15
-
16
- # To use debugger
17
- # gem 'debugger'
@@ -1,17 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "gretel", :path => ".."
4
-
5
- gem "rails", "~> 4.0.0"
6
- gem "sqlite3"
7
-
8
- # jquery-rails is used by the dummy application
9
- gem "jquery-rails"
10
-
11
- # Declare any dependencies that are still in development here instead of in
12
- # your gemspec. These might include edge Rails or gems from your path or
13
- # Git. Remember to move these dependencies to your gemspec before releasing
14
- # your gem to rubygems.org.
15
-
16
- # To use debugger
17
- # gem 'debugger'
@@ -1,17 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "gretel", :path => ".."
4
-
5
- gem "rails", "~> 4.1.0"
6
- gem "sqlite3"
7
-
8
- # jquery-rails is used by the dummy application
9
- gem "jquery-rails"
10
-
11
- # Declare any dependencies that are still in development here instead of in
12
- # your gemspec. These might include edge Rails or gems from your path or
13
- # Git. Remember to move these dependencies to your gemspec before releasing
14
- # your gem to rubygems.org.
15
-
16
- # To use debugger
17
- # gem 'debugger'
@@ -1 +0,0 @@
1
- Dir[File.dirname(__FILE__) + "/deprecated/*.rb"].each { |file| require file }
@@ -1,11 +0,0 @@
1
- Gretel::Renderer.class_eval do
2
- def options_for_style_with_default_style_key(style_key)
3
- if style_key == :default
4
- Gretel.show_deprecation_warning "The :default style key is now called :inline. Please use `breadcrumbs style: :inline` instead or omit it, as it is the default."
5
- style_key = :inline
6
- end
7
- options_for_style_without_default_style_key(style_key)
8
- end
9
-
10
- alias_method_chain :options_for_style, :default_style_key
11
- end
@@ -1,15 +0,0 @@
1
- Gretel::Crumbs.class_eval do
2
- class << self
3
- # Was used to lay out breadcrumbs in an initializer. Deprecated since v2.1.0
4
- # and removed in v3.0.0. Will raise an exception if used. Put breadcrumbs in
5
- # +config/breadcrumbs.rb+ instead (see
6
- # https://github.com/lassebunk/gretel/blob/master/README.md for details).
7
- def layout(&block)
8
- raise (
9
- "Gretel::Crumbs.layout was removed in Gretel version 3.0. " +
10
- "Please put your breadcrumbs in `config/breadcrumbs.rb`. " +
11
- "This will also automatically reload your breadcrumbs when you change them in the development environment. " +
12
- "See https://github.com/lassebunk/gretel/blob/master/README.md for details.")
13
- end
14
- end
15
- end
@@ -1,12 +0,0 @@
1
- Gretel::Renderer.class_eval do
2
- def options_for_render_with_show_root_alone(options = {})
3
- options = options_for_render_without_show_root_alone(options)
4
- if show_root_alone = options.delete(:show_root_alone)
5
- Gretel.show_deprecation_warning "The :show_root_alone option is deprecated and will be removed in Gretel v4.0.0. Use `breadcrumbs(display_single_fragment: #{show_root_alone.inspect})` instead."
6
- options[:display_single_fragment] = show_root_alone
7
- end
8
- options
9
- end
10
-
11
- alias_method_chain :options_for_render, :show_root_alone
12
- end
@@ -1,20 +0,0 @@
1
- Gretel::ViewHelpers.class_eval do
2
- def breadcrumbs_with_yield_links(options = {})
3
- if block_given?
4
- Gretel.show_deprecation_warning(
5
- "Calling `breadcrumbs` with a block has been deprecated and will be removed in Gretel version 4.0. Please use `tap` instead. Example:\n" +
6
- "\n" +
7
- " breadcrumbs(autoroot: false).tap do |links|\n" +
8
- " if links.any?\n" +
9
- " # process links here\n" +
10
- " end\n" +
11
- " end\n"
12
- )
13
- yield gretel_renderer.render(options)
14
- else
15
- breadcrumbs_without_yield_links(options)
16
- end
17
- end
18
-
19
- alias_method_chain :breadcrumbs, :yield_links
20
- end
@@ -1,45 +0,0 @@
1
- require 'test_helper'
2
-
3
- class DeprecatedTest < ActionView::TestCase
4
- include Gretel::ViewHelpers
5
- fixtures :all
6
- helper :application
7
-
8
- setup do
9
- Gretel.reset!
10
- Gretel.suppress_deprecation_warnings = true
11
- end
12
-
13
- test "show root alone" do
14
- breadcrumb :root
15
- assert_equal %{<div class="breadcrumbs"><span class="current">Home</span></div>},
16
- breadcrumbs(show_root_alone: true).to_s
17
- end
18
-
19
- test "deprecated configuration block" do
20
- assert_raises RuntimeError do
21
- Gretel::Crumbs.layout do
22
- end
23
- end
24
- end
25
-
26
- test ":default style key" do
27
- breadcrumb :basic
28
-
29
- assert_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="current">About</span></div>},
30
- breadcrumbs(style: :default).to_s
31
- end
32
-
33
- test "yield links" do
34
- breadcrumb :multiple_links_with_parent
35
-
36
- out = breadcrumbs do |links|
37
- links.map { |link| [link.key, link.text, link.url] }
38
- end
39
-
40
- assert_equal [[:root, "Home", "/"],
41
- [:basic, "About", "/about"],
42
- [:multiple_links_with_parent, "Contact", "/about/contact"],
43
- [:multiple_links_with_parent, "Contact form", "/about/contact/form"]], out
44
- end
45
- end
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env rake
2
- # Add your own tasks in files placed in lib/tasks ending in .rake,
3
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
-
5
- require File.expand_path('../config/application', __FILE__)
6
-
7
- Dummy::Application.load_tasks
@@ -1,15 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // the compiled file.
9
- //
10
- // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
- // GO AFTER THE REQUIRES BELOW.
12
- //
13
- //= require jquery
14
- //= require jquery_ujs
15
- //= require_tree .
@@ -1,13 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the top of the
9
- * compiled file, but it's generally better to create a new file per style scope.
10
- *
11
- *= require_self
12
- *= require_tree .
13
- */
@@ -1,3 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- protect_from_forgery
3
- end
@@ -1,5 +0,0 @@
1
- module ApplicationHelper
2
- def times_two(text)
3
- text * 2
4
- end
5
- end
File without changes
File without changes
@@ -1,3 +0,0 @@
1
- class Issue < ActiveRecord::Base
2
- belongs_to :project
3
- end
@@ -1,3 +0,0 @@
1
- class Project < ActiveRecord::Base
2
- has_many :issues
3
- end
@@ -1,3 +0,0 @@
1
- crumb :from_views do
2
- link "Breadcrumb From View", about_path
3
- end
@@ -1,4 +0,0 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require ::File.expand_path('../config/environment', __FILE__)
4
- run Dummy::Application
@@ -1,14 +0,0 @@
1
- require File.expand_path('../boot', __FILE__)
2
-
3
- require 'rails/all'
4
-
5
- Bundler.require
6
- require "gretel"
7
-
8
- module Dummy
9
- class Application < Rails::Application
10
- config.secret_token = "secret token"
11
- config.active_support.deprecation = :log
12
- config.eager_load = false
13
- end
14
- end
@@ -1,10 +0,0 @@
1
- require 'rubygems'
2
- gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
-
4
- if File.exist?(gemfile)
5
- ENV['BUNDLE_GEMFILE'] = gemfile
6
- require 'bundler'
7
- Bundler.setup
8
- end
9
-
10
- $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -1,3 +0,0 @@
1
- crumb :root do
2
- link "Home", root_path
3
- end
@@ -1,85 +0,0 @@
1
- crumb :basic do
2
- link "About", about_path
3
- end
4
-
5
- crumb :with_root do
6
- link "About", about_path
7
- parent :root
8
- end
9
-
10
- crumb :with_parent do
11
- link "Contact", contact_path
12
- parent :basic
13
- end
14
-
15
- crumb :object do |project|
16
- link project.name, project
17
- end
18
-
19
- crumb :with_autopath do |project|
20
- link project.name, project
21
- end
22
-
23
- crumb :with_parent_object do |issue|
24
- link issue.title, project_issue_path(issue.project, issue)
25
- parent :object, issue.project
26
- end
27
-
28
- crumb :multiple_links do
29
- link "Contact", contact_path
30
- link "Contact form", contact_form_path
31
- end
32
-
33
- crumb :multiple_links_with_parent do
34
- link "Contact", contact_path
35
- link "Contact form", contact_form_path
36
- parent :basic
37
- end
38
-
39
- crumb :with_proc do
40
- link Proc.new { "Name from proc" }, Proc.new { "URL from proc" }
41
- end
42
-
43
- crumb :with_multiple_arguments do |a, b, c|
44
- link "#{a} and #{b} and #{c}", contact_path
45
- parent :parent_with_multiple_arguments, a * 2, b * 2, c * 2
46
- end
47
-
48
- crumb :parent_with_multiple_arguments do |d, e, f|
49
- link "First #{d} then #{e} then #{f}", about_path
50
- end
51
-
52
- crumb :with_unsafe_html do
53
- link "Test <strong>bold text</strong>", about_path
54
- end
55
-
56
- crumb :with_safe_html do
57
- link "Test <strong>bold text</strong>".html_safe, about_path
58
- end
59
-
60
- crumb :without_link do
61
- link "Without link"
62
- parent :parent_without_link
63
- end
64
-
65
- crumb :parent_without_link do
66
- link "Also without link"
67
- end
68
-
69
- crumb :using_view_helper do
70
- link times_two("Test"), about_path
71
- end
72
-
73
- crumb :project do |project|
74
- link project.name, project
75
- end
76
-
77
- crumb :with_link_options do
78
- link "Test", about_path, title: "My Title", other: "Other Option"
79
- link "Other Link", some_option: "Test"
80
- end
81
-
82
- crumb :with_inferred_parent do
83
- link "Test", about_path
84
- parent Project.first
85
- end
@@ -1,25 +0,0 @@
1
- # SQLite version 3.x
2
- # gem install sqlite3
3
- #
4
- # Ensure the SQLite 3 gem is defined in your Gemfile
5
- # gem 'sqlite3'
6
- development:
7
- adapter: sqlite3
8
- database: db/development.sqlite3
9
- pool: 5
10
- timeout: 5000
11
-
12
- # Warning: The database defined as "test" will be erased and
13
- # re-generated from your development database when you run "rake".
14
- # Do not set this db to the same as development or production.
15
- test:
16
- adapter: sqlite3
17
- database: db/test.sqlite3
18
- pool: 5
19
- timeout: 5000
20
-
21
- production:
22
- adapter: sqlite3
23
- database: db/production.sqlite3
24
- pool: 5
25
- timeout: 5000
@@ -1,5 +0,0 @@
1
- # Load the rails application
2
- require File.expand_path('../application', __FILE__)
3
-
4
- # Initialize the rails application
5
- Dummy::Application.initialize!
@@ -1,2 +0,0 @@
1
- Dummy::Application.configure do
2
- end
@@ -1,2 +0,0 @@
1
- Dummy::Application.configure do
2
- end
@@ -1,2 +0,0 @@
1
- Dummy::Application.configure do
2
- end
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
- # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
-
6
- # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
- # Rails.backtrace_cleaner.remove_silencers!
@@ -1,15 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new inflection rules using the following format
4
- # (all these examples are active by default):
5
- # ActiveSupport::Inflector.inflections do |inflect|
6
- # inflect.plural /^(ox)$/i, '\1en'
7
- # inflect.singular /^(ox)en/i, '\1'
8
- # inflect.irregular 'person', 'people'
9
- # inflect.uncountable %w( fish sheep )
10
- # end
11
- #
12
- # These inflection rules are supported but not enabled by default:
13
- # ActiveSupport::Inflector.inflections do |inflect|
14
- # inflect.acronym 'RESTful'
15
- # end
@@ -1,5 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new mime types for use in respond_to blocks:
4
- # Mime::Type.register "text/richtext", :rtf
5
- # Mime::Type.register_alias "text/html", :iphone
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key for verifying the integrity of signed cookies.
4
- # If you change this key, all old signed cookies will become invalid!
5
- # Make sure the secret is at least 30 characters and all random,
6
- # no regular words or you'll be exposed to dictionary attacks.
7
- Dummy::Application.config.secret_token = '42da708db5725479ebd37530644412b9a6203a31f1db83d8799995365f1c026abb0c9fed978d81a80388b8bbfc9f9b9b33683330f4b657e6253d1a6df55860bb'