mobile_version 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data/.gitignore +4 -0
  2. data/Gemfile +4 -0
  3. data/README +0 -0
  4. data/README.rdoc +33 -0
  5. data/Rakefile +10 -0
  6. data/lib/mobile_version.rb +30 -0
  7. data/lib/mobile_version/.DS_Store +0 -0
  8. data/lib/mobile_version/controller.rb +24 -0
  9. data/lib/mobile_version/filters.rb +13 -0
  10. data/lib/mobile_version/missing_template_resolver.rb +16 -0
  11. data/lib/mobile_version/railtie.rb +10 -0
  12. data/lib/mobile_version/request.rb +13 -0
  13. data/lib/mobile_version/version.rb +3 -0
  14. data/mobile_version.gemspec +25 -0
  15. data/test/.DS_Store +0 -0
  16. data/test/dummy/.DS_Store +0 -0
  17. data/test/dummy/Rakefile +7 -0
  18. data/test/dummy/app/assets/javascripts/application.js +9 -0
  19. data/test/dummy/app/assets/stylesheets/application.css +7 -0
  20. data/test/dummy/app/controllers/application_controller.rb +4 -0
  21. data/test/dummy/app/controllers/home_controller.rb +12 -0
  22. data/test/dummy/app/helpers/application_helper.rb +2 -0
  23. data/test/dummy/app/mailers/.gitkeep +0 -0
  24. data/test/dummy/app/models/.gitkeep +0 -0
  25. data/test/dummy/app/views/home/action_one.html.erb +1 -0
  26. data/test/dummy/app/views/home/action_one.mobilehtml.erb +1 -0
  27. data/test/dummy/app/views/home/action_two.html.erb +1 -0
  28. data/test/dummy/config.ru +4 -0
  29. data/test/dummy/config/.DS_Store +0 -0
  30. data/test/dummy/config/application.rb +41 -0
  31. data/test/dummy/config/boot.rb +10 -0
  32. data/test/dummy/config/database.yml +25 -0
  33. data/test/dummy/config/environment.rb +7 -0
  34. data/test/dummy/config/environments/test.rb +42 -0
  35. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  36. data/test/dummy/config/initializers/inflections.rb +10 -0
  37. data/test/dummy/config/initializers/mime_types.rb +5 -0
  38. data/test/dummy/config/initializers/secret_token.rb +7 -0
  39. data/test/dummy/config/initializers/session_store.rb +8 -0
  40. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  41. data/test/dummy/config/locales/en.yml +5 -0
  42. data/test/dummy/config/routes.rb +6 -0
  43. data/test/dummy/db/test.sqlite3 +0 -0
  44. data/test/dummy/lib/assets/.gitkeep +0 -0
  45. data/test/dummy/log/.gitkeep +0 -0
  46. data/test/dummy/log/test.log +390 -0
  47. data/test/dummy/public/404.html +26 -0
  48. data/test/dummy/public/422.html +26 -0
  49. data/test/dummy/public/500.html +26 -0
  50. data/test/dummy/public/favicon.ico +0 -0
  51. data/test/dummy/script/rails +6 -0
  52. data/test/mobile_version_test.rb +31 -0
  53. data/test/test_helper.rb +11 -0
  54. metadata +230 -0
@@ -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,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,31 @@
1
+ require 'test_helper'
2
+
3
+ class MobileVersionTest < ActionController::TestCase
4
+
5
+ tests HomeController
6
+
7
+
8
+ test "renders html version" do
9
+ get :action_one
10
+ assert_dom_equal "ACTION ONE HTML", @response.body
11
+ end
12
+
13
+ test "renders mobile version when available" do
14
+ HomeController.any_instance.expects(:browser).returns( stub(:mobile? => true) )
15
+ get :action_one
16
+ assert_dom_equal "ACTION ONE MOBILEHTML", @response.body
17
+ end
18
+
19
+ test "render html version when a mobile version is not available" do
20
+ HomeController.any_instance.expects(:browser).returns( stub(:mobile? => true) )
21
+ get :action_two
22
+ assert_dom_equal "ACTION TWO HTML", @response.body
23
+ end
24
+
25
+ test "render default format" do
26
+ assert_raises ActionView::MissingTemplate do
27
+ get :action_two, :format => :json
28
+ end
29
+ end
30
+
31
+ end
@@ -0,0 +1,11 @@
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
+
metadata ADDED
@@ -0,0 +1,230 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mobile_version
3
+ version: !ruby/object:Gem::Version
4
+ hash: 25
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 3
10
+ version: 0.0.3
11
+ platform: ruby
12
+ authors:
13
+ - Marc Essindi
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-10-30 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rails
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 1
29
+ segments:
30
+ - 3
31
+ - 0
32
+ - 3
33
+ version: 3.0.3
34
+ type: :development
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: sqlite3
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 3
45
+ segments:
46
+ - 0
47
+ version: "0"
48
+ type: :development
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: mocha
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ hash: 3
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ type: :development
63
+ version_requirements: *id003
64
+ - !ruby/object:Gem::Dependency
65
+ name: rails
66
+ prerelease: false
67
+ requirement: &id004 !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ hash: 1
73
+ segments:
74
+ - 3
75
+ - 0
76
+ - 3
77
+ version: 3.0.3
78
+ type: :runtime
79
+ version_requirements: *id004
80
+ - !ruby/object:Gem::Dependency
81
+ name: browser
82
+ prerelease: false
83
+ requirement: &id005 !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ hash: 29
89
+ segments:
90
+ - 0
91
+ - 1
92
+ - 3
93
+ version: 0.1.3
94
+ type: :runtime
95
+ version_requirements: *id005
96
+ description:
97
+ email:
98
+ - marc.essindi@dunkelbraun.com
99
+ executables: []
100
+
101
+ extensions: []
102
+
103
+ extra_rdoc_files: []
104
+
105
+ files:
106
+ - .gitignore
107
+ - Gemfile
108
+ - README
109
+ - README.rdoc
110
+ - Rakefile
111
+ - lib/mobile_version.rb
112
+ - lib/mobile_version/.DS_Store
113
+ - lib/mobile_version/controller.rb
114
+ - lib/mobile_version/filters.rb
115
+ - lib/mobile_version/missing_template_resolver.rb
116
+ - lib/mobile_version/railtie.rb
117
+ - lib/mobile_version/request.rb
118
+ - lib/mobile_version/version.rb
119
+ - mobile_version.gemspec
120
+ - test/.DS_Store
121
+ - test/dummy/.DS_Store
122
+ - test/dummy/Rakefile
123
+ - test/dummy/app/assets/javascripts/application.js
124
+ - test/dummy/app/assets/stylesheets/application.css
125
+ - test/dummy/app/controllers/application_controller.rb
126
+ - test/dummy/app/controllers/home_controller.rb
127
+ - test/dummy/app/helpers/application_helper.rb
128
+ - test/dummy/app/mailers/.gitkeep
129
+ - test/dummy/app/models/.gitkeep
130
+ - test/dummy/app/views/home/action_one.html.erb
131
+ - test/dummy/app/views/home/action_one.mobilehtml.erb
132
+ - test/dummy/app/views/home/action_two.html.erb
133
+ - test/dummy/config.ru
134
+ - test/dummy/config/.DS_Store
135
+ - test/dummy/config/application.rb
136
+ - test/dummy/config/boot.rb
137
+ - test/dummy/config/database.yml
138
+ - test/dummy/config/environment.rb
139
+ - test/dummy/config/environments/test.rb
140
+ - test/dummy/config/initializers/backtrace_silencers.rb
141
+ - test/dummy/config/initializers/inflections.rb
142
+ - test/dummy/config/initializers/mime_types.rb
143
+ - test/dummy/config/initializers/secret_token.rb
144
+ - test/dummy/config/initializers/session_store.rb
145
+ - test/dummy/config/initializers/wrap_parameters.rb
146
+ - test/dummy/config/locales/en.yml
147
+ - test/dummy/config/routes.rb
148
+ - test/dummy/db/test.sqlite3
149
+ - test/dummy/lib/assets/.gitkeep
150
+ - test/dummy/log/.gitkeep
151
+ - test/dummy/log/test.log
152
+ - test/dummy/public/404.html
153
+ - test/dummy/public/422.html
154
+ - test/dummy/public/500.html
155
+ - test/dummy/public/favicon.ico
156
+ - test/dummy/script/rails
157
+ - test/mobile_version_test.rb
158
+ - test/test_helper.rb
159
+ homepage: ""
160
+ licenses: []
161
+
162
+ post_install_message:
163
+ rdoc_options: []
164
+
165
+ require_paths:
166
+ - lib
167
+ required_ruby_version: !ruby/object:Gem::Requirement
168
+ none: false
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ hash: 3
173
+ segments:
174
+ - 0
175
+ version: "0"
176
+ required_rubygems_version: !ruby/object:Gem::Requirement
177
+ none: false
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ hash: 3
182
+ segments:
183
+ - 0
184
+ version: "0"
185
+ requirements: []
186
+
187
+ rubyforge_project:
188
+ rubygems_version: 1.8.10
189
+ signing_key:
190
+ specification_version: 3
191
+ summary: Test
192
+ test_files:
193
+ - test/dummy/.DS_Store
194
+ - test/dummy/Rakefile
195
+ - test/dummy/app/assets/javascripts/application.js
196
+ - test/dummy/app/assets/stylesheets/application.css
197
+ - test/dummy/app/controllers/application_controller.rb
198
+ - test/dummy/app/controllers/home_controller.rb
199
+ - test/dummy/app/helpers/application_helper.rb
200
+ - test/dummy/app/mailers/.gitkeep
201
+ - test/dummy/app/models/.gitkeep
202
+ - test/dummy/app/views/home/action_one.html.erb
203
+ - test/dummy/app/views/home/action_one.mobilehtml.erb
204
+ - test/dummy/app/views/home/action_two.html.erb
205
+ - test/dummy/config.ru
206
+ - test/dummy/config/.DS_Store
207
+ - test/dummy/config/application.rb
208
+ - test/dummy/config/boot.rb
209
+ - test/dummy/config/database.yml
210
+ - test/dummy/config/environment.rb
211
+ - test/dummy/config/environments/test.rb
212
+ - test/dummy/config/initializers/backtrace_silencers.rb
213
+ - test/dummy/config/initializers/inflections.rb
214
+ - test/dummy/config/initializers/mime_types.rb
215
+ - test/dummy/config/initializers/secret_token.rb
216
+ - test/dummy/config/initializers/session_store.rb
217
+ - test/dummy/config/initializers/wrap_parameters.rb
218
+ - test/dummy/config/locales/en.yml
219
+ - test/dummy/config/routes.rb
220
+ - test/dummy/db/test.sqlite3
221
+ - test/dummy/lib/assets/.gitkeep
222
+ - test/dummy/log/.gitkeep
223
+ - test/dummy/log/test.log
224
+ - test/dummy/public/404.html
225
+ - test/dummy/public/422.html
226
+ - test/dummy/public/500.html
227
+ - test/dummy/public/favicon.ico
228
+ - test/dummy/script/rails
229
+ - test/mobile_version_test.rb
230
+ - test/test_helper.rb