mime_fallback 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +40 -0
  4. data/Rakefile +38 -0
  5. data/lib/mime_fallback/negotiation_extensions.rb +31 -0
  6. data/lib/mime_fallback/railtie.rb +14 -0
  7. data/lib/mime_fallback/resolver.rb +21 -0
  8. data/lib/mime_fallback/type.rb +20 -0
  9. data/lib/mime_fallback/version.rb +3 -0
  10. data/lib/mime_fallback.rb +9 -0
  11. data/lib/tasks/mime_fallback_tasks.rake +4 -0
  12. data/test/dummy/README.rdoc +261 -0
  13. data/test/dummy/Rakefile +7 -0
  14. data/test/dummy/app/assets/javascripts/application.js +15 -0
  15. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  16. data/test/dummy/app/controllers/application_controller.rb +14 -0
  17. data/test/dummy/app/controllers/test_controller.rb +6 -0
  18. data/test/dummy/app/helpers/application_helper.rb +2 -0
  19. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  20. data/test/dummy/app/views/test/_shared.html.erb +2 -0
  21. data/test/dummy/app/views/test/_split_again.html.erb +1 -0
  22. data/test/dummy/app/views/test/_split_again.mobile.erb +1 -0
  23. data/test/dummy/app/views/test/basic.html.erb +2 -0
  24. data/test/dummy/app/views/test/basic.mobile.erb +2 -0
  25. data/test/dummy/config/application.rb +59 -0
  26. data/test/dummy/config/boot.rb +10 -0
  27. data/test/dummy/config/database.yml +25 -0
  28. data/test/dummy/config/environment.rb +5 -0
  29. data/test/dummy/config/environments/development.rb +37 -0
  30. data/test/dummy/config/environments/production.rb +67 -0
  31. data/test/dummy/config/environments/test.rb +37 -0
  32. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  33. data/test/dummy/config/initializers/inflections.rb +15 -0
  34. data/test/dummy/config/initializers/mime_types.rb +11 -0
  35. data/test/dummy/config/initializers/secret_token.rb +7 -0
  36. data/test/dummy/config/initializers/session_store.rb +8 -0
  37. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  38. data/test/dummy/config/locales/en.yml +5 -0
  39. data/test/dummy/config/routes.rb +3 -0
  40. data/test/dummy/config.ru +4 -0
  41. data/test/dummy/db/test.sqlite3 +0 -0
  42. data/test/dummy/log/test.log +356 -0
  43. data/test/dummy/memory +0 -0
  44. data/test/dummy/public/404.html +26 -0
  45. data/test/dummy/public/422.html +26 -0
  46. data/test/dummy/public/500.html +25 -0
  47. data/test/dummy/public/favicon.ico +0 -0
  48. data/test/dummy/script/rails +6 -0
  49. data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  50. data/test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  51. data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  52. data/test/dummy/tmp/cache/assets/test/sprockets/6b36a21a75ddb9a45aa6e9133c79a3c7 +0 -0
  53. data/test/dummy/tmp/cache/assets/test/sprockets/c360bf7b66d29ebdf71b5814574b5fed +0 -0
  54. data/test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  55. data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  56. data/test/dummy/tmp/cache/assets/test/sprockets/e0ac75c1efdaac1b74d439c004c3b09f +0 -0
  57. data/test/dummy/tmp/cache/assets/test/sprockets/ec2d15616d5d09eb1693b761c72948ce +0 -0
  58. data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  59. data/test/mime_fallback_test.rb +7 -0
  60. data/test/test_controller_test.rb +23 -0
  61. data/test/test_helper.rb +15 -0
  62. metadata +182 -0
@@ -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,25 @@
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
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -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 'test_helper'
2
+
3
+ class MimeFallbackTest < ActiveSupport::TestCase
4
+ test "truth" do
5
+ assert_kind_of Module, MimeFallback
6
+ end
7
+ end
@@ -0,0 +1,23 @@
1
+ require 'test_helper'
2
+
3
+ class TestControllerTest < ActionController::TestCase
4
+
5
+ def test_rendering_html
6
+ get :basic
7
+ assert_response :success
8
+
9
+ assert_select "h1", :text => "HTML"
10
+ assert_select "h2", :text => "Shared"
11
+ assert_select "h3", :text => "HTML"
12
+ end
13
+
14
+ def test_rendering_mobile
15
+ get :basic, :mobile => "true"
16
+ assert_response :success
17
+
18
+ assert_select "h1", :text => "Mobile"
19
+ assert_select "h2", :text => "Shared"
20
+ assert_select "h3", :text => "Mobile"
21
+ end
22
+
23
+ end
@@ -0,0 +1,15 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require "rails/test_help"
6
+
7
+ Rails.backtrace_cleaner.remove_silencers!
8
+
9
+ # Load support files
10
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
11
+
12
+ # Load fixtures from the engine
13
+ if ActiveSupport::TestCase.method_defined?(:fixture_path=)
14
+ ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
15
+ end
metadata ADDED
@@ -0,0 +1,182 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mime_fallback
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jeff Ching
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 3.2.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 3.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: sqlite3
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Allows a rails format to act as a fallback for another format
42
+ email:
43
+ - ching.jeff@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - lib/mime_fallback/negotiation_extensions.rb
49
+ - lib/mime_fallback/railtie.rb
50
+ - lib/mime_fallback/resolver.rb
51
+ - lib/mime_fallback/type.rb
52
+ - lib/mime_fallback/version.rb
53
+ - lib/mime_fallback.rb
54
+ - lib/tasks/mime_fallback_tasks.rake
55
+ - MIT-LICENSE
56
+ - Rakefile
57
+ - README.md
58
+ - test/dummy/app/assets/javascripts/application.js
59
+ - test/dummy/app/assets/stylesheets/application.css
60
+ - test/dummy/app/controllers/application_controller.rb
61
+ - test/dummy/app/controllers/test_controller.rb
62
+ - test/dummy/app/helpers/application_helper.rb
63
+ - test/dummy/app/views/layouts/application.html.erb
64
+ - test/dummy/app/views/test/_shared.html.erb
65
+ - test/dummy/app/views/test/_split_again.html.erb
66
+ - test/dummy/app/views/test/_split_again.mobile.erb
67
+ - test/dummy/app/views/test/basic.html.erb
68
+ - test/dummy/app/views/test/basic.mobile.erb
69
+ - test/dummy/config/application.rb
70
+ - test/dummy/config/boot.rb
71
+ - test/dummy/config/database.yml
72
+ - test/dummy/config/environment.rb
73
+ - test/dummy/config/environments/development.rb
74
+ - test/dummy/config/environments/production.rb
75
+ - test/dummy/config/environments/test.rb
76
+ - test/dummy/config/initializers/backtrace_silencers.rb
77
+ - test/dummy/config/initializers/inflections.rb
78
+ - test/dummy/config/initializers/mime_types.rb
79
+ - test/dummy/config/initializers/secret_token.rb
80
+ - test/dummy/config/initializers/session_store.rb
81
+ - test/dummy/config/initializers/wrap_parameters.rb
82
+ - test/dummy/config/locales/en.yml
83
+ - test/dummy/config/routes.rb
84
+ - test/dummy/config.ru
85
+ - test/dummy/db/test.sqlite3
86
+ - test/dummy/log/test.log
87
+ - test/dummy/memory
88
+ - test/dummy/public/404.html
89
+ - test/dummy/public/422.html
90
+ - test/dummy/public/500.html
91
+ - test/dummy/public/favicon.ico
92
+ - test/dummy/Rakefile
93
+ - test/dummy/README.rdoc
94
+ - test/dummy/script/rails
95
+ - test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
96
+ - test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af
97
+ - test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953
98
+ - test/dummy/tmp/cache/assets/test/sprockets/6b36a21a75ddb9a45aa6e9133c79a3c7
99
+ - test/dummy/tmp/cache/assets/test/sprockets/c360bf7b66d29ebdf71b5814574b5fed
100
+ - test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994
101
+ - test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6
102
+ - test/dummy/tmp/cache/assets/test/sprockets/e0ac75c1efdaac1b74d439c004c3b09f
103
+ - test/dummy/tmp/cache/assets/test/sprockets/ec2d15616d5d09eb1693b761c72948ce
104
+ - test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655
105
+ - test/mime_fallback_test.rb
106
+ - test/test_controller_test.rb
107
+ - test/test_helper.rb
108
+ homepage: http://github.com/avvo/mime_fallback
109
+ licenses:
110
+ - MIT
111
+ metadata: {}
112
+ post_install_message:
113
+ rdoc_options: []
114
+ require_paths:
115
+ - lib
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ requirements: []
127
+ rubyforge_project:
128
+ rubygems_version: 2.0.3
129
+ signing_key:
130
+ specification_version: 4
131
+ summary: Format fallbacks for rendering partials
132
+ test_files:
133
+ - test/dummy/app/assets/javascripts/application.js
134
+ - test/dummy/app/assets/stylesheets/application.css
135
+ - test/dummy/app/controllers/application_controller.rb
136
+ - test/dummy/app/controllers/test_controller.rb
137
+ - test/dummy/app/helpers/application_helper.rb
138
+ - test/dummy/app/views/layouts/application.html.erb
139
+ - test/dummy/app/views/test/_shared.html.erb
140
+ - test/dummy/app/views/test/_split_again.html.erb
141
+ - test/dummy/app/views/test/_split_again.mobile.erb
142
+ - test/dummy/app/views/test/basic.html.erb
143
+ - test/dummy/app/views/test/basic.mobile.erb
144
+ - test/dummy/config/application.rb
145
+ - test/dummy/config/boot.rb
146
+ - test/dummy/config/database.yml
147
+ - test/dummy/config/environment.rb
148
+ - test/dummy/config/environments/development.rb
149
+ - test/dummy/config/environments/production.rb
150
+ - test/dummy/config/environments/test.rb
151
+ - test/dummy/config/initializers/backtrace_silencers.rb
152
+ - test/dummy/config/initializers/inflections.rb
153
+ - test/dummy/config/initializers/mime_types.rb
154
+ - test/dummy/config/initializers/secret_token.rb
155
+ - test/dummy/config/initializers/session_store.rb
156
+ - test/dummy/config/initializers/wrap_parameters.rb
157
+ - test/dummy/config/locales/en.yml
158
+ - test/dummy/config/routes.rb
159
+ - test/dummy/config.ru
160
+ - test/dummy/db/test.sqlite3
161
+ - test/dummy/log/test.log
162
+ - test/dummy/memory
163
+ - test/dummy/public/404.html
164
+ - test/dummy/public/422.html
165
+ - test/dummy/public/500.html
166
+ - test/dummy/public/favicon.ico
167
+ - test/dummy/Rakefile
168
+ - test/dummy/README.rdoc
169
+ - test/dummy/script/rails
170
+ - test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
171
+ - test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af
172
+ - test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953
173
+ - test/dummy/tmp/cache/assets/test/sprockets/6b36a21a75ddb9a45aa6e9133c79a3c7
174
+ - test/dummy/tmp/cache/assets/test/sprockets/c360bf7b66d29ebdf71b5814574b5fed
175
+ - test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994
176
+ - test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6
177
+ - test/dummy/tmp/cache/assets/test/sprockets/e0ac75c1efdaac1b74d439c004c3b09f
178
+ - test/dummy/tmp/cache/assets/test/sprockets/ec2d15616d5d09eb1693b761c72948ce
179
+ - test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655
180
+ - test/mime_fallback_test.rb
181
+ - test/test_controller_test.rb
182
+ - test/test_helper.rb