vinted-crummy 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -0
  3. data/.rvmrc +48 -0
  4. data/.travis.yml +7 -0
  5. data/Appraisals +9 -0
  6. data/CHANGELOG +47 -0
  7. data/Gemfile +3 -0
  8. data/MIT-LICENSE +20 -0
  9. data/README.md +220 -0
  10. data/Rakefile +25 -0
  11. data/crummy.gemspec +30 -0
  12. data/example/.gitignore +5 -0
  13. data/example/.rspec +1 -0
  14. data/example/.rvmrc +48 -0
  15. data/example/Gemfile +30 -0
  16. data/example/README.md +40 -0
  17. data/example/Rakefile +7 -0
  18. data/example/app/assets/images/rails.png +0 -0
  19. data/example/app/assets/javascripts/application.js +9 -0
  20. data/example/app/assets/javascripts/pages.js.coffee +3 -0
  21. data/example/app/assets/javascripts/post.js.coffee +3 -0
  22. data/example/app/assets/stylesheets/application.css +7 -0
  23. data/example/app/assets/stylesheets/layout.css.sass +26 -0
  24. data/example/app/assets/stylesheets/post.css.scss +3 -0
  25. data/example/app/controllers/application_controller.rb +6 -0
  26. data/example/app/controllers/pages_controller.rb +5 -0
  27. data/example/app/controllers/posts_controller.rb +19 -0
  28. data/example/app/helpers/application_helper.rb +9 -0
  29. data/example/app/helpers/pages_helper.rb +2 -0
  30. data/example/app/helpers/post_helper.rb +2 -0
  31. data/example/app/mailers/.gitkeep +0 -0
  32. data/example/app/models/.gitkeep +0 -0
  33. data/example/app/models/category.rb +6 -0
  34. data/example/app/models/post.rb +19 -0
  35. data/example/app/views/layouts/application.html.haml +16 -0
  36. data/example/app/views/pages/index.html.haml +4 -0
  37. data/example/app/views/posts/index.html.haml +5 -0
  38. data/example/app/views/posts/new.html.haml +1 -0
  39. data/example/app/views/posts/show.html.haml +3 -0
  40. data/example/config.ru +4 -0
  41. data/example/config/application.rb +48 -0
  42. data/example/config/boot.rb +6 -0
  43. data/example/config/database.yml +25 -0
  44. data/example/config/environment.rb +5 -0
  45. data/example/config/environments/development.rb +30 -0
  46. data/example/config/environments/production.rb +60 -0
  47. data/example/config/environments/test.rb +39 -0
  48. data/example/config/initializers/backtrace_silencers.rb +7 -0
  49. data/example/config/initializers/inflections.rb +10 -0
  50. data/example/config/initializers/mime_types.rb +5 -0
  51. data/example/config/initializers/secret_token.rb +7 -0
  52. data/example/config/initializers/session_store.rb +8 -0
  53. data/example/config/initializers/wrap_parameters.rb +14 -0
  54. data/example/config/locales/en.yml +5 -0
  55. data/example/config/routes.rb +5 -0
  56. data/example/db/migrate/20111104103150_create_posts.rb +10 -0
  57. data/example/db/migrate/20111104103738_create_categories.rb +12 -0
  58. data/example/db/migrate/20111104104040_add_category_id_to_posts.rb +5 -0
  59. data/example/db/schema.rb +32 -0
  60. data/example/db/seeds.rb +15 -0
  61. data/example/doc/README_FOR_APP +2 -0
  62. data/example/lib/assets/.gitkeep +0 -0
  63. data/example/lib/tasks/.gitkeep +0 -0
  64. data/example/log/.gitkeep +0 -0
  65. data/example/public/404.html +26 -0
  66. data/example/public/422.html +26 -0
  67. data/example/public/500.html +26 -0
  68. data/example/public/favicon.ico +0 -0
  69. data/example/public/robots.txt +5 -0
  70. data/example/script/rails +6 -0
  71. data/example/spec/controllers/posts_controller_spec.rb +7 -0
  72. data/example/spec/spec_helper.rb +38 -0
  73. data/example/vendor/assets/stylesheets/.gitkeep +0 -0
  74. data/example/vendor/plugins/.gitkeep +0 -0
  75. data/gemfiles/rails3_2.gemfile +8 -0
  76. data/gemfiles/rails4_0.gemfile +8 -0
  77. data/init.rb +1 -0
  78. data/lib/crummy.rb +69 -0
  79. data/lib/crummy/action_controller.rb +83 -0
  80. data/lib/crummy/action_view.rb +29 -0
  81. data/lib/crummy/railtie.rb +20 -0
  82. data/lib/crummy/standard_renderer.rb +170 -0
  83. data/lib/crummy/version.rb +6 -0
  84. data/test/standard_renderer_test.rb +182 -0
  85. metadata +200 -0
@@ -0,0 +1,60 @@
1
+ CrummyTest::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # Code is not reloaded between requests
5
+ config.cache_classes = true
6
+
7
+ # Full error reports are disabled and caching is turned on
8
+ config.consider_all_requests_local = false
9
+ config.action_controller.perform_caching = true
10
+
11
+ # Disable Rails's static asset server (Apache or nginx will already do this)
12
+ config.serve_static_assets = false
13
+
14
+ # Compress JavaScripts and CSS
15
+ config.assets.compress = true
16
+
17
+ # Don't fallback to assets pipeline if a precompiled asset is missed
18
+ config.assets.compile = false
19
+
20
+ # Generate digests for assets URLs
21
+ config.assets.digest = true
22
+
23
+ # Defaults to Rails.root.join("public/assets")
24
+ # config.assets.manifest = YOUR_PATH
25
+
26
+ # Specifies the header that your server uses for sending files
27
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
29
+
30
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
+ # config.force_ssl = true
32
+
33
+ # See everything in the log (default is :info)
34
+ # config.log_level = :debug
35
+
36
+ # Use a different logger for distributed setups
37
+ # config.logger = SyslogLogger.new
38
+
39
+ # Use a different cache store in production
40
+ # config.cache_store = :mem_cache_store
41
+
42
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
43
+ # config.action_controller.asset_host = "http://assets.example.com"
44
+
45
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
46
+ # config.assets.precompile += %w( search.js )
47
+
48
+ # Disable delivery errors, bad email addresses will be ignored
49
+ # config.action_mailer.raise_delivery_errors = false
50
+
51
+ # Enable threaded mode
52
+ # config.threadsafe!
53
+
54
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
55
+ # the I18n.default_locale when a translation can not be found)
56
+ config.i18n.fallbacks = true
57
+
58
+ # Send deprecation notices to registered listeners
59
+ config.active_support.deprecation = :notify
60
+ end
@@ -0,0 +1,39 @@
1
+ CrummyTest::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Configure static asset server for tests with Cache-Control for performance
11
+ config.serve_static_assets = true
12
+ config.static_cache_control = "public, max-age=3600"
13
+
14
+ # Log error messages when you accidentally call methods on nil
15
+ config.whiny_nils = true
16
+
17
+ # Show full error reports and disable caching
18
+ config.consider_all_requests_local = true
19
+ config.action_controller.perform_caching = false
20
+
21
+ # Raise exceptions instead of rendering exception templates
22
+ config.action_dispatch.show_exceptions = false
23
+
24
+ # Disable request forgery protection in test environment
25
+ config.action_controller.allow_forgery_protection = false
26
+
27
+ # Tell Action Mailer not to deliver emails to the real world.
28
+ # The :test delivery method accumulates sent emails in the
29
+ # ActionMailer::Base.deliveries array.
30
+ config.action_mailer.delivery_method = :test
31
+
32
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
33
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
34
+ # like if you have constraints or database-specific column types
35
+ # config.active_record.schema_format = :sql
36
+
37
+ # Print deprecation notices to the stderr
38
+ config.active_support.deprecation = :stderr
39
+ end
@@ -0,0 +1,7 @@
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!
@@ -0,0 +1,10 @@
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
@@ -0,0 +1,5 @@
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
@@ -0,0 +1,7 @@
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
+ CrummyTest::Application.config.secret_token = '2d7d27ce1894b9d894b07b80d805e7322dcbc4b1f219c6570a29624e620957e399097f343f88a05be49c21ca4555fcd948bb1a1275928eb1187f0a420ec645e2'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ CrummyTest::Application.config.session_store :cookie_store, :key => '_crummy-test_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # CrummyTest::Application.config.session_store :active_record_store
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters :format => [:json]
9
+ end
10
+
11
+ # Disable root element in JSON by default.
12
+ ActiveSupport.on_load(:active_record) do
13
+ self.include_root_in_json = false
14
+ end
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,5 @@
1
+ CrummyTest::Application.routes.draw do
2
+ resources :posts
3
+
4
+ root :to => "pages#index"
5
+ end
@@ -0,0 +1,10 @@
1
+ class CreatePosts < ActiveRecord::Migration
2
+ def change
3
+ create_table :posts do |t|
4
+ t.string :title
5
+ t.string :slug
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,12 @@
1
+ class CreateCategories < ActiveRecord::Migration
2
+ def change
3
+ create_table :categories do |t|
4
+ t.string :title
5
+ t.string :slug
6
+
7
+ t.string :category_id # Can have a category as a parent
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ class AddCategoryIdToPosts < ActiveRecord::Migration
2
+ def change
3
+ add_column :posts, :category_id, :integer
4
+ end
5
+ end
@@ -0,0 +1,32 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 20111104104040) do
15
+
16
+ create_table "categories", :force => true do |t|
17
+ t.string "title"
18
+ t.string "slug"
19
+ t.string "category_id"
20
+ t.datetime "created_at"
21
+ t.datetime "updated_at"
22
+ end
23
+
24
+ create_table "posts", :force => true do |t|
25
+ t.string "title"
26
+ t.string "slug"
27
+ t.datetime "created_at"
28
+ t.datetime "updated_at"
29
+ t.integer "category_id"
30
+ end
31
+
32
+ end
@@ -0,0 +1,15 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7
+ # Mayor.create(name: 'Emanuel', city: cities.first)
8
+
9
+ movies = Category.create :title => "Movies", :slug => "movies"
10
+ star_wars = Category.create :title => "Star Wars", :slug => "star-wars", :category => movies
11
+ time = Category.create :title => "What time Is It?", :slug => "time"
12
+
13
+ Post.create :title => "A Long Long Time Ago", :slug => "a-long-long-time-ago", :category => star_wars
14
+ Post.create :title => "It's Hammer Time", :slug => "its-hammer-time", :category => time
15
+ Post.create :title => "Test", :slug => "test"
@@ -0,0 +1,2 @@
1
+ Use this README file to introduce your application and point to useful places in the API for learning more.
2
+ Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
File without changes
File without changes
File without changes
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
24
+ </div>
25
+ </body>
26
+ </html>
File without changes
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-Agent: *
5
+ # Disallow: /
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,7 @@
1
+ require "spec_helper"
2
+
3
+ describe PostsController do
4
+ it "exists! (and RSpec works)" do
5
+ # nop
6
+ end
7
+ end
@@ -0,0 +1,38 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV["RAILS_ENV"] ||= 'test'
3
+ require File.expand_path("../../config/environment", __FILE__)
4
+ require 'rspec/rails'
5
+ require 'rspec/autorun'
6
+
7
+ # Requires supporting ruby files with custom matchers and macros, etc,
8
+ # in spec/support/ and its subdirectories.
9
+ Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
10
+
11
+ RSpec.configure do |config|
12
+ # ## Mock Framework
13
+ #
14
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
15
+ #
16
+ # config.mock_with :mocha
17
+ # config.mock_with :flexmock
18
+ # config.mock_with :rr
19
+
20
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
21
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
22
+
23
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
24
+ # examples within a transaction, remove the following line or assign false
25
+ # instead of true.
26
+ config.use_transactional_fixtures = true
27
+
28
+ # If true, the base class of anonymous controllers will be inferred
29
+ # automatically. This will be the default behavior in future versions of
30
+ # rspec-rails.
31
+ config.infer_base_class_for_anonymous_controllers = false
32
+
33
+ # Run specs in random order to surface order dependencies. If you find an
34
+ # order dependency and want to debug it, you can fix the order by providing
35
+ # the seed, which is printed after each run.
36
+ # --seed 1234
37
+ config.order = "random"
38
+ end
File without changes
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "activesupport", ">= 3.0", "< 4"
6
+ gem "actionpack", ">= 3.0", "< 4"
7
+
8
+ gemspec :path=>"../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "activesupport", ">= 4.0.0.beta", "< 5"
6
+ gem "actionpack", ">= 4.0.0.beta", "< 5"
7
+
8
+ gemspec :path=>"../"
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'crummy'
@@ -0,0 +1,69 @@
1
+ module Crummy
2
+
3
+ def self.configuration
4
+ @configuration ||= Configuration.new
5
+ end
6
+
7
+ def self.configure
8
+ yield configuration
9
+ end
10
+
11
+ class Configuration
12
+ attr_accessor :format
13
+ attr_accessor :links
14
+ attr_accessor :skip_if_blank
15
+ attr_accessor :html_separator
16
+ attr_accessor :html_right_separator
17
+ attr_accessor :xml_separator
18
+ attr_accessor :xml_right_separator
19
+ attr_accessor :html_list_separator
20
+ attr_accessor :html_list_right_separator
21
+ attr_accessor :first_class
22
+ attr_accessor :last_class
23
+ attr_accessor :ol_id
24
+ attr_accessor :ol_class
25
+ attr_accessor :li_class
26
+ attr_accessor :microdata
27
+ attr_accessor :last_crumb_linked
28
+ attr_accessor :truncate
29
+ attr_accessor :right_side
30
+
31
+ def initialize
32
+ @format = :html
33
+ @html_separator = " &raquo; ".html_safe
34
+ @html_right_separator = " &raquo; ".html_safe
35
+ @xml_separator = "crumb"
36
+ @xml_right_separator = "crumb"
37
+ @html_list_separator = ''
38
+ @html_list_right_separator = ''
39
+ @skip_if_blank = true
40
+ @links = true
41
+ @first_class = ''
42
+ @last_class = ''
43
+ @ol_id = ''
44
+ @ol_class = ''
45
+ @li_class = ''
46
+ @microdata = false
47
+ @last_crumb_linked = true
48
+ @truncate = nil
49
+ @right_side = false
50
+ end
51
+
52
+ def active_li_class=(class_name)
53
+ puts "CRUMMY: The 'active_li_class' option is DEPRECATED and will be removed from a future version"
54
+ end
55
+
56
+ def active_li_class
57
+ puts "CRUMMY: The 'active_li_class' option is DEPRECATED and will be removed from a future version"
58
+ end
59
+ end
60
+
61
+ if defined?(Rails::Railtie)
62
+ require 'crummy/railtie'
63
+ else
64
+ require 'crummy/action_controller'
65
+ require 'crummy/action_view'
66
+ ActionController::Base.send :include, Crummy::ControllerMethods
67
+ ActionView::Base.send :include, Crummy::ViewMethods
68
+ end
69
+ end