cropped_paperclip 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. data/.gitignore +8 -0
  2. data/.rspec +2 -0
  3. data/.rvmrc +48 -0
  4. data/Gemfile +7 -0
  5. data/README.md +17 -0
  6. data/Rakefile +31 -0
  7. data/app/.DS_Store +0 -0
  8. data/app/assets/.DS_Store +0 -0
  9. data/app/assets/javascripts/.DS_Store +0 -0
  10. data/app/assets/javascripts/cropped_paperclip/filedrop.js.coffee +254 -0
  11. data/app/assets/javascripts/cropped_paperclip/upload_crop_scale.js.coffee +319 -0
  12. data/app/assets/javascripts/es5-shim.js +1105 -0
  13. data/app/assets/javascripts/uploader.js.coffee +3 -0
  14. data/app/controllers/cropped_paperclip/application_controller.rb +4 -0
  15. data/app/controllers/cropped_paperclip/uploads_controller.rb +40 -0
  16. data/app/helpers/cropped_paperclip/application_helper.rb +4 -0
  17. data/app/models/upload.rb +119 -0
  18. data/config/routes.rb +3 -0
  19. data/cropped_paperclip.gemspec +32 -0
  20. data/db/migrate/20120510103921_uploads.rb +11 -0
  21. data/init.rb +4 -0
  22. data/lib/cropped_paperclip.rb +170 -0
  23. data/lib/cropped_paperclip/engine.rb +7 -0
  24. data/lib/cropped_paperclip/glue.rb +20 -0
  25. data/lib/cropped_paperclip/schema.rb +35 -0
  26. data/lib/cropped_paperclip/version.rb +3 -0
  27. data/lib/paperclip/geometry_transformation.rb +80 -0
  28. data/lib/paperclip/validators/attachment_height_validator.rb +89 -0
  29. data/lib/paperclip/validators/attachment_width_validator.rb +89 -0
  30. data/lib/paperclip_processors/offset_thumbnail.rb +86 -0
  31. data/lib/tasks/cropped_paperclip_tasks.rake +4 -0
  32. data/script/rails +8 -0
  33. data/spec/.DS_Store +0 -0
  34. data/spec/acceptance/acceptance_helper.rb +2 -0
  35. data/spec/controllers/uploads_controller_spec.rb +5 -0
  36. data/spec/dummy/README.rdoc +261 -0
  37. data/spec/dummy/Rakefile +7 -0
  38. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  39. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  40. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  41. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  42. data/spec/dummy/app/mailers/.gitkeep +0 -0
  43. data/spec/dummy/app/models/.gitkeep +0 -0
  44. data/spec/dummy/app/models/thing.rb +15 -0
  45. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  46. data/spec/dummy/config.ru +4 -0
  47. data/spec/dummy/config/application.rb +56 -0
  48. data/spec/dummy/config/boot.rb +10 -0
  49. data/spec/dummy/config/database.yml +25 -0
  50. data/spec/dummy/config/environment.rb +5 -0
  51. data/spec/dummy/config/environments/development.rb +37 -0
  52. data/spec/dummy/config/environments/production.rb +67 -0
  53. data/spec/dummy/config/environments/test.rb +37 -0
  54. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  55. data/spec/dummy/config/initializers/inflections.rb +15 -0
  56. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  57. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  58. data/spec/dummy/config/initializers/session_store.rb +8 -0
  59. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  60. data/spec/dummy/config/locales/en.yml +5 -0
  61. data/spec/dummy/config/routes.rb +3 -0
  62. data/spec/dummy/db/migrate/20120510104910_things.rb +8 -0
  63. data/spec/dummy/db/schema.rb +51 -0
  64. data/spec/dummy/lib/assets/.gitkeep +0 -0
  65. data/spec/dummy/log/.gitkeep +0 -0
  66. data/spec/dummy/public/404.html +26 -0
  67. data/spec/dummy/public/422.html +26 -0
  68. data/spec/dummy/public/500.html +25 -0
  69. data/spec/dummy/public/favicon.ico +0 -0
  70. data/spec/dummy/script/rails +6 -0
  71. data/spec/fixtures/images/.DS_Store +0 -0
  72. data/spec/fixtures/images/icon.png +0 -0
  73. data/spec/fixtures/images/test.jpg +0 -0
  74. data/spec/models/thing_spec.rb +6 -0
  75. data/spec/models/upload_spec.rb +13 -0
  76. data/spec/spec_helper.rb +18 -0
  77. metadata +309 -0
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,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'
Binary file
Binary file
Binary file
@@ -0,0 +1,6 @@
1
+ require 'spec_helper'
2
+
3
+ describe Thing do
4
+ it { should belong_to :friend_upload }
5
+ it { should belong_to :pet_upload }
6
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe Upload do
4
+ it { should have_attached_file(:file) }
5
+ its(:precrop_processors) { should == [:thumbnail] }
6
+ its(:precrop_styles) {
7
+ should == {
8
+ :icon => { :geometry => "40x40#" },
9
+ :precrop => { :geometry => "1600x1600>" }
10
+ }
11
+ }
12
+
13
+ end
@@ -0,0 +1,18 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
4
+ require 'rspec/rails'
5
+ require "paperclip/matchers"
6
+ require 'shoulda/matchers/integrations/rspec'
7
+
8
+ Rails.backtrace_cleaner.remove_silencers!
9
+
10
+ # Load support files
11
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
12
+
13
+ require 'cropped_paperclip'
14
+
15
+ RSpec.configure do |config|
16
+ config.include Paperclip::Shoulda::Matchers
17
+ config.use_transactional_fixtures = true
18
+ end
metadata ADDED
@@ -0,0 +1,309 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cropped_paperclip
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - William Ross
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-09-10 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.0
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.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: paperclip
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 3.1.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: 3.1.0
46
+ - !ruby/object:Gem::Dependency
47
+ name: delayed_job_active_record
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
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
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: rspec-rails
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: shoulda-matchers
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: capybara
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: acts_as_fu
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ - !ruby/object:Gem::Dependency
143
+ name: sqlite3
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ description: Provides a mechanism for uploading, cropping and reusing images in any
159
+ of your models.
160
+ email:
161
+ - will@spanner.org
162
+ executables: []
163
+ extensions: []
164
+ extra_rdoc_files: []
165
+ files:
166
+ - .gitignore
167
+ - .rspec
168
+ - .rvmrc
169
+ - Gemfile
170
+ - README.md
171
+ - Rakefile
172
+ - app/.DS_Store
173
+ - app/assets/.DS_Store
174
+ - app/assets/javascripts/.DS_Store
175
+ - app/assets/javascripts/cropped_paperclip/filedrop.js.coffee
176
+ - app/assets/javascripts/cropped_paperclip/upload_crop_scale.js.coffee
177
+ - app/assets/javascripts/es5-shim.js
178
+ - app/assets/javascripts/uploader.js.coffee
179
+ - app/controllers/cropped_paperclip/application_controller.rb
180
+ - app/controllers/cropped_paperclip/uploads_controller.rb
181
+ - app/helpers/cropped_paperclip/application_helper.rb
182
+ - app/models/upload.rb
183
+ - config/routes.rb
184
+ - cropped_paperclip.gemspec
185
+ - db/migrate/20120510103921_uploads.rb
186
+ - init.rb
187
+ - lib/cropped_paperclip.rb
188
+ - lib/cropped_paperclip/engine.rb
189
+ - lib/cropped_paperclip/glue.rb
190
+ - lib/cropped_paperclip/schema.rb
191
+ - lib/cropped_paperclip/version.rb
192
+ - lib/paperclip/geometry_transformation.rb
193
+ - lib/paperclip/validators/attachment_height_validator.rb
194
+ - lib/paperclip/validators/attachment_width_validator.rb
195
+ - lib/paperclip_processors/offset_thumbnail.rb
196
+ - lib/tasks/cropped_paperclip_tasks.rake
197
+ - script/rails
198
+ - spec/.DS_Store
199
+ - spec/acceptance/acceptance_helper.rb
200
+ - spec/controllers/uploads_controller_spec.rb
201
+ - spec/dummy/README.rdoc
202
+ - spec/dummy/Rakefile
203
+ - spec/dummy/app/assets/javascripts/application.js
204
+ - spec/dummy/app/assets/stylesheets/application.css
205
+ - spec/dummy/app/controllers/application_controller.rb
206
+ - spec/dummy/app/helpers/application_helper.rb
207
+ - spec/dummy/app/mailers/.gitkeep
208
+ - spec/dummy/app/models/.gitkeep
209
+ - spec/dummy/app/models/thing.rb
210
+ - spec/dummy/app/views/layouts/application.html.erb
211
+ - spec/dummy/config.ru
212
+ - spec/dummy/config/application.rb
213
+ - spec/dummy/config/boot.rb
214
+ - spec/dummy/config/database.yml
215
+ - spec/dummy/config/environment.rb
216
+ - spec/dummy/config/environments/development.rb
217
+ - spec/dummy/config/environments/production.rb
218
+ - spec/dummy/config/environments/test.rb
219
+ - spec/dummy/config/initializers/backtrace_silencers.rb
220
+ - spec/dummy/config/initializers/inflections.rb
221
+ - spec/dummy/config/initializers/mime_types.rb
222
+ - spec/dummy/config/initializers/secret_token.rb
223
+ - spec/dummy/config/initializers/session_store.rb
224
+ - spec/dummy/config/initializers/wrap_parameters.rb
225
+ - spec/dummy/config/locales/en.yml
226
+ - spec/dummy/config/routes.rb
227
+ - spec/dummy/db/migrate/20120510104910_things.rb
228
+ - spec/dummy/db/schema.rb
229
+ - spec/dummy/lib/assets/.gitkeep
230
+ - spec/dummy/log/.gitkeep
231
+ - spec/dummy/public/404.html
232
+ - spec/dummy/public/422.html
233
+ - spec/dummy/public/500.html
234
+ - spec/dummy/public/favicon.ico
235
+ - spec/dummy/script/rails
236
+ - spec/fixtures/images/.DS_Store
237
+ - spec/fixtures/images/icon.png
238
+ - spec/fixtures/images/test.jpg
239
+ - spec/models/thing_spec.rb
240
+ - spec/models/upload_spec.rb
241
+ - spec/spec_helper.rb
242
+ homepage: ''
243
+ licenses: []
244
+ post_install_message:
245
+ rdoc_options: []
246
+ require_paths:
247
+ - lib
248
+ required_ruby_version: !ruby/object:Gem::Requirement
249
+ none: false
250
+ requirements:
251
+ - - ! '>='
252
+ - !ruby/object:Gem::Version
253
+ version: '0'
254
+ required_rubygems_version: !ruby/object:Gem::Requirement
255
+ none: false
256
+ requirements:
257
+ - - ! '>='
258
+ - !ruby/object:Gem::Version
259
+ version: '0'
260
+ requirements: []
261
+ rubyforge_project: cropped_paperclip
262
+ rubygems_version: 1.8.24
263
+ signing_key:
264
+ specification_version: 3
265
+ summary: A simple but specific way to attach croppable uploads to any model
266
+ test_files:
267
+ - spec/acceptance/acceptance_helper.rb
268
+ - spec/controllers/uploads_controller_spec.rb
269
+ - spec/dummy/README.rdoc
270
+ - spec/dummy/Rakefile
271
+ - spec/dummy/app/assets/javascripts/application.js
272
+ - spec/dummy/app/assets/stylesheets/application.css
273
+ - spec/dummy/app/controllers/application_controller.rb
274
+ - spec/dummy/app/helpers/application_helper.rb
275
+ - spec/dummy/app/mailers/.gitkeep
276
+ - spec/dummy/app/models/.gitkeep
277
+ - spec/dummy/app/models/thing.rb
278
+ - spec/dummy/app/views/layouts/application.html.erb
279
+ - spec/dummy/config.ru
280
+ - spec/dummy/config/application.rb
281
+ - spec/dummy/config/boot.rb
282
+ - spec/dummy/config/database.yml
283
+ - spec/dummy/config/environment.rb
284
+ - spec/dummy/config/environments/development.rb
285
+ - spec/dummy/config/environments/production.rb
286
+ - spec/dummy/config/environments/test.rb
287
+ - spec/dummy/config/initializers/backtrace_silencers.rb
288
+ - spec/dummy/config/initializers/inflections.rb
289
+ - spec/dummy/config/initializers/mime_types.rb
290
+ - spec/dummy/config/initializers/secret_token.rb
291
+ - spec/dummy/config/initializers/session_store.rb
292
+ - spec/dummy/config/initializers/wrap_parameters.rb
293
+ - spec/dummy/config/locales/en.yml
294
+ - spec/dummy/config/routes.rb
295
+ - spec/dummy/db/migrate/20120510104910_things.rb
296
+ - spec/dummy/db/schema.rb
297
+ - spec/dummy/lib/assets/.gitkeep
298
+ - spec/dummy/log/.gitkeep
299
+ - spec/dummy/public/404.html
300
+ - spec/dummy/public/422.html
301
+ - spec/dummy/public/500.html
302
+ - spec/dummy/public/favicon.ico
303
+ - spec/dummy/script/rails
304
+ - spec/fixtures/images/.DS_Store
305
+ - spec/fixtures/images/icon.png
306
+ - spec/fixtures/images/test.jpg
307
+ - spec/models/thing_spec.rb
308
+ - spec/models/upload_spec.rb
309
+ - spec/spec_helper.rb