hyperimage 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +3 -0
  3. data/Rakefile +40 -0
  4. data/app/assets/javascripts/hyperimage/application.js +15 -0
  5. data/app/assets/stylesheets/hyperimage/application.css +13 -0
  6. data/app/controllers/hyperimage/application_controller.rb +4 -0
  7. data/app/controllers/hyperimage/images_controller.rb +47 -0
  8. data/app/helpers/hyperimage/application_helper.rb +4 -0
  9. data/app/models/hyperimage/image.rb +54 -0
  10. data/app/views/layouts/hyperimage/application.html.erb +14 -0
  11. data/config/routes.rb +5 -0
  12. data/lib/hyperimage.rb +4 -0
  13. data/lib/hyperimage/engine.rb +5 -0
  14. data/lib/hyperimage/version.rb +3 -0
  15. data/lib/tasks/hyperimage_tasks.rake +4 -0
  16. data/test/dummy/README.rdoc +261 -0
  17. data/test/dummy/Rakefile +7 -0
  18. data/test/dummy/app/assets/images/cradle.gif +0 -0
  19. data/test/dummy/app/assets/images/donkey.bmp +0 -0
  20. data/test/dummy/app/assets/images/donkey.jpg +0 -0
  21. data/test/dummy/app/assets/images/donkey.png +0 -0
  22. data/test/dummy/app/assets/images/llama.gif +0 -0
  23. data/test/dummy/app/assets/images/nyan.gif +0 -0
  24. data/test/dummy/app/assets/images/owl.gif +0 -0
  25. data/test/dummy/app/assets/images/owl/0.png +0 -0
  26. data/test/dummy/app/assets/images/owl/1.png +0 -0
  27. data/test/dummy/app/assets/images/owl/2.png +0 -0
  28. data/test/dummy/app/assets/images/owl/3.png +0 -0
  29. data/test/dummy/app/assets/images/water.gif +0 -0
  30. data/test/dummy/app/assets/javascripts/application.js +15 -0
  31. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  32. data/test/dummy/app/controllers/application_controller.rb +3 -0
  33. data/test/dummy/app/helpers/application_helper.rb +2 -0
  34. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  35. data/test/dummy/config.ru +4 -0
  36. data/test/dummy/config/application.rb +56 -0
  37. data/test/dummy/config/boot.rb +10 -0
  38. data/test/dummy/config/database.yml +25 -0
  39. data/test/dummy/config/environment.rb +5 -0
  40. data/test/dummy/config/environments/development.rb +37 -0
  41. data/test/dummy/config/environments/production.rb +67 -0
  42. data/test/dummy/config/environments/test.rb +37 -0
  43. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  44. data/test/dummy/config/initializers/inflections.rb +15 -0
  45. data/test/dummy/config/initializers/mime_types.rb +5 -0
  46. data/test/dummy/config/initializers/secret_token.rb +7 -0
  47. data/test/dummy/config/initializers/session_store.rb +8 -0
  48. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  49. data/test/dummy/config/locales/en.yml +5 -0
  50. data/test/dummy/config/routes.rb +4 -0
  51. data/test/dummy/db/test.sqlite3 +0 -0
  52. data/test/dummy/log/test.log +129 -0
  53. data/test/dummy/public/404.html +26 -0
  54. data/test/dummy/public/422.html +26 -0
  55. data/test/dummy/public/500.html +25 -0
  56. data/test/dummy/public/favicon.ico +0 -0
  57. data/test/dummy/script/rails +6 -0
  58. data/test/functional/hyperimage/images_controller_test.rb +34 -0
  59. data/test/hyperimage_test.rb +7 -0
  60. data/test/integration/navigation_test.rb +10 -0
  61. data/test/test_helper.rb +10 -0
  62. data/test/unit/hyperimage/image_test.rb +64 -0
  63. metadata +203 -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,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,34 @@
1
+ require 'test_helper'
2
+
3
+ module Hyperimage
4
+
5
+ class ImagesControllerTest < ActionController::TestCase
6
+
7
+ test 'serves files that exist' do
8
+ assert File.exists?(Image.root.join('donkey.jpg'))
9
+ get :show, :resource => 'donkey', :format => 'jpg', :use_route => :hyperimage
10
+ assert_response :success
11
+ assert_match /app\/assets\/images\/donkey\.jpg/, assigns(:image).to_s
12
+ end
13
+
14
+ test 'serve static frames from animated GIFs' do
15
+ get :show, :resource => 'owl', :format => 'png', :frame => '3', :use_route => :hyperimage
16
+ assert_response :success
17
+ assert_match /app\/assets\/images\/owl\/3\.png/, assigns(:image).to_s
18
+ end
19
+
20
+ test 'raise a routing error for resources that don\'t exist' do
21
+ assert_raise(ActionController::RoutingError) do
22
+ get :show, :resource => 'not_found', :format => 'jpg', :use_route => :hyperimage
23
+ end
24
+ end
25
+
26
+ test 'raise a routing error for frames that don\'t exist' do
27
+ assert_raise(ActionController::RoutingError) do
28
+ get :show, :resource => 'owl', :format => 'png', :frame => '4', :use_route => :hyperimage
29
+ end
30
+ end
31
+
32
+ end
33
+
34
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class HyperimageTest < ActiveSupport::TestCase
4
+ test "truth" do
5
+ assert_kind_of Module, Hyperimage
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ require 'test_helper'
2
+
3
+ class NavigationTest < ActionDispatch::IntegrationTest
4
+ fixtures :all
5
+
6
+ # test "the truth" do
7
+ # assert true
8
+ # end
9
+ end
10
+
@@ -0,0 +1,10 @@
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 }
@@ -0,0 +1,64 @@
1
+ require 'test_helper'
2
+
3
+ module Hyperimage
4
+
5
+ class ImageTest < ActiveSupport::TestCase
6
+
7
+ test 'root' do
8
+ assert_kind_of Pathname, Hyperimage::Image.root
9
+ assert_match /app\/assets\/images$/, Hyperimage::Image.root.to_s
10
+ end
11
+
12
+ test 'exist?' do
13
+ assert Hyperimage::Image.exist?('owl')
14
+ assert Hyperimage::Image.exist?('owl', 'gif')
15
+ assert Hyperimage::Image.exist?('owl', 'png')
16
+ assert Hyperimage::Image.exist?('owl', 'png', 0)
17
+ assert Hyperimage::Image.exist?('owl', 'png', 1)
18
+ assert Hyperimage::Image.exist?('owl', 'png', 2)
19
+ assert Hyperimage::Image.exist?('owl', 'png', 3)
20
+ assert !Hyperimage::Image.exist?('owl', 'png', 4)
21
+ assert !Hyperimage::Image.exist?('owl', 'jpg')
22
+ end
23
+
24
+ test 'exists?' do
25
+ assert Hyperimage::Image.exists?('owl')
26
+ assert Hyperimage::Image.exists?('owl', 'gif')
27
+ assert Hyperimage::Image.exists?('owl', 'png')
28
+ assert Hyperimage::Image.exists?('owl', 'png', 0)
29
+ assert Hyperimage::Image.exists?('owl', 'png', 1)
30
+ assert Hyperimage::Image.exists?('owl', 'png', 2)
31
+ assert Hyperimage::Image.exists?('owl', 'png', 3)
32
+ assert !Hyperimage::Image.exists?('owl', 'png', 4)
33
+ assert !Hyperimage::Image.exists?('owl', 'jpg')
34
+ end
35
+
36
+ test 'first' do
37
+ assert_kind_of String, Hyperimage::Image.first('owl')
38
+ assert_not_nil Hyperimage::Image.first('owl')
39
+ assert_not_nil Hyperimage::Image.first('owl', 'gif')
40
+ assert_not_nil Hyperimage::Image.first('owl', 'png')
41
+ assert_not_nil Hyperimage::Image.first('owl', 'png', 0)
42
+ assert_not_nil Hyperimage::Image.first('owl', 'png', 1)
43
+ assert_not_nil Hyperimage::Image.first('owl', 'png', 2)
44
+ assert_not_nil Hyperimage::Image.first('owl', 'png', 3)
45
+ assert_nil Hyperimage::Image.first('owl', 'png', 4)
46
+ assert_nil Hyperimage::Image.first('owl', 'jpg')
47
+ end
48
+
49
+ test 'all' do
50
+ assert_kind_of String, Hyperimage::Image.all('owl').first
51
+ assert_equal 5, Hyperimage::Image.all('owl').count
52
+ assert_equal 1, Hyperimage::Image.all('owl', 'gif').count
53
+ assert_equal 4, Hyperimage::Image.all('owl', 'png').count
54
+ assert_equal 1, Hyperimage::Image.all('owl', 'png', 0).count
55
+ assert_equal 1, Hyperimage::Image.all('owl', 'png', 1).count
56
+ assert_equal 1, Hyperimage::Image.all('owl', 'png', 2).count
57
+ assert_equal 1, Hyperimage::Image.all('owl', 'png', 3).count
58
+ assert_equal 0, Hyperimage::Image.all('owl', 'png', 4).count
59
+ assert_equal [], Hyperimage::Image.all('owl', 'jpg')
60
+ end
61
+
62
+ end
63
+
64
+ end
metadata ADDED
@@ -0,0 +1,203 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hyperimage
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Erik Michaels-Ober
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-03-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.2.2
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.2
30
+ - !ruby/object:Gem::Dependency
31
+ name: rmagick
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: sqlite3
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ description: It's awesome!
63
+ email:
64
+ - sferik@gmail.com
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - app/assets/javascripts/hyperimage/application.js
70
+ - app/assets/stylesheets/hyperimage/application.css
71
+ - app/controllers/hyperimage/application_controller.rb
72
+ - app/controllers/hyperimage/images_controller.rb
73
+ - app/helpers/hyperimage/application_helper.rb
74
+ - app/models/hyperimage/image.rb
75
+ - app/views/layouts/hyperimage/application.html.erb
76
+ - config/routes.rb
77
+ - lib/hyperimage/engine.rb
78
+ - lib/hyperimage/version.rb
79
+ - lib/hyperimage.rb
80
+ - lib/tasks/hyperimage_tasks.rake
81
+ - MIT-LICENSE
82
+ - Rakefile
83
+ - README.rdoc
84
+ - test/dummy/app/assets/images/cradle.gif
85
+ - test/dummy/app/assets/images/donkey.bmp
86
+ - test/dummy/app/assets/images/donkey.jpg
87
+ - test/dummy/app/assets/images/donkey.png
88
+ - test/dummy/app/assets/images/llama.gif
89
+ - test/dummy/app/assets/images/nyan.gif
90
+ - test/dummy/app/assets/images/owl/0.png
91
+ - test/dummy/app/assets/images/owl/1.png
92
+ - test/dummy/app/assets/images/owl/2.png
93
+ - test/dummy/app/assets/images/owl/3.png
94
+ - test/dummy/app/assets/images/owl.gif
95
+ - test/dummy/app/assets/images/water.gif
96
+ - test/dummy/app/assets/javascripts/application.js
97
+ - test/dummy/app/assets/stylesheets/application.css
98
+ - test/dummy/app/controllers/application_controller.rb
99
+ - test/dummy/app/helpers/application_helper.rb
100
+ - test/dummy/app/views/layouts/application.html.erb
101
+ - test/dummy/config/application.rb
102
+ - test/dummy/config/boot.rb
103
+ - test/dummy/config/database.yml
104
+ - test/dummy/config/environment.rb
105
+ - test/dummy/config/environments/development.rb
106
+ - test/dummy/config/environments/production.rb
107
+ - test/dummy/config/environments/test.rb
108
+ - test/dummy/config/initializers/backtrace_silencers.rb
109
+ - test/dummy/config/initializers/inflections.rb
110
+ - test/dummy/config/initializers/mime_types.rb
111
+ - test/dummy/config/initializers/secret_token.rb
112
+ - test/dummy/config/initializers/session_store.rb
113
+ - test/dummy/config/initializers/wrap_parameters.rb
114
+ - test/dummy/config/locales/en.yml
115
+ - test/dummy/config/routes.rb
116
+ - test/dummy/config.ru
117
+ - test/dummy/db/test.sqlite3
118
+ - test/dummy/log/test.log
119
+ - test/dummy/public/404.html
120
+ - test/dummy/public/422.html
121
+ - test/dummy/public/500.html
122
+ - test/dummy/public/favicon.ico
123
+ - test/dummy/Rakefile
124
+ - test/dummy/README.rdoc
125
+ - test/dummy/script/rails
126
+ - test/functional/hyperimage/images_controller_test.rb
127
+ - test/hyperimage_test.rb
128
+ - test/integration/navigation_test.rb
129
+ - test/test_helper.rb
130
+ - test/unit/hyperimage/image_test.rb
131
+ homepage: https://github.com/sferik/mwrc2012-app
132
+ licenses: []
133
+ post_install_message:
134
+ rdoc_options: []
135
+ require_paths:
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ none: false
139
+ requirements:
140
+ - - ! '>='
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ required_rubygems_version: !ruby/object:Gem::Requirement
144
+ none: false
145
+ requirements:
146
+ - - ! '>='
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ requirements: []
150
+ rubyforge_project:
151
+ rubygems_version: 1.8.19
152
+ signing_key:
153
+ specification_version: 3
154
+ summary: Convert images!
155
+ test_files:
156
+ - test/dummy/app/assets/images/cradle.gif
157
+ - test/dummy/app/assets/images/donkey.bmp
158
+ - test/dummy/app/assets/images/donkey.jpg
159
+ - test/dummy/app/assets/images/donkey.png
160
+ - test/dummy/app/assets/images/llama.gif
161
+ - test/dummy/app/assets/images/nyan.gif
162
+ - test/dummy/app/assets/images/owl/0.png
163
+ - test/dummy/app/assets/images/owl/1.png
164
+ - test/dummy/app/assets/images/owl/2.png
165
+ - test/dummy/app/assets/images/owl/3.png
166
+ - test/dummy/app/assets/images/owl.gif
167
+ - test/dummy/app/assets/images/water.gif
168
+ - test/dummy/app/assets/javascripts/application.js
169
+ - test/dummy/app/assets/stylesheets/application.css
170
+ - test/dummy/app/controllers/application_controller.rb
171
+ - test/dummy/app/helpers/application_helper.rb
172
+ - test/dummy/app/views/layouts/application.html.erb
173
+ - test/dummy/config/application.rb
174
+ - test/dummy/config/boot.rb
175
+ - test/dummy/config/database.yml
176
+ - test/dummy/config/environment.rb
177
+ - test/dummy/config/environments/development.rb
178
+ - test/dummy/config/environments/production.rb
179
+ - test/dummy/config/environments/test.rb
180
+ - test/dummy/config/initializers/backtrace_silencers.rb
181
+ - test/dummy/config/initializers/inflections.rb
182
+ - test/dummy/config/initializers/mime_types.rb
183
+ - test/dummy/config/initializers/secret_token.rb
184
+ - test/dummy/config/initializers/session_store.rb
185
+ - test/dummy/config/initializers/wrap_parameters.rb
186
+ - test/dummy/config/locales/en.yml
187
+ - test/dummy/config/routes.rb
188
+ - test/dummy/config.ru
189
+ - test/dummy/db/test.sqlite3
190
+ - test/dummy/log/test.log
191
+ - test/dummy/public/404.html
192
+ - test/dummy/public/422.html
193
+ - test/dummy/public/500.html
194
+ - test/dummy/public/favicon.ico
195
+ - test/dummy/Rakefile
196
+ - test/dummy/README.rdoc
197
+ - test/dummy/script/rails
198
+ - test/functional/hyperimage/images_controller_test.rb
199
+ - test/hyperimage_test.rb
200
+ - test/integration/navigation_test.rb
201
+ - test/test_helper.rb
202
+ - test/unit/hyperimage/image_test.rb
203
+ has_rdoc: