tvdeyen-fleximage 1.0.9 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/.gitignore +28 -0
  2. data/Gemfile +8 -0
  3. data/README.rdoc +3 -32
  4. data/Rakefile +23 -34
  5. data/VERSION +1 -1
  6. data/lib/dsl_accessor.rb +12 -9
  7. data/lib/fleximage.rb +0 -1
  8. data/lib/fleximage/model.rb +4 -41
  9. data/test/rails_root/README.rdoc +261 -0
  10. data/test/rails_root/Rakefile +7 -0
  11. data/test/rails_root/app/assets/javascripts/application.js +15 -0
  12. data/test/rails_root/app/assets/stylesheets/application.css +13 -0
  13. data/test/rails_root/app/controllers/application_controller.rb +3 -0
  14. data/test/rails_root/app/helpers/application_helper.rb +0 -1
  15. data/test/rails_root/app/mailers/.gitkeep +0 -0
  16. data/test/rails_root/app/models/.gitkeep +0 -0
  17. data/test/rails_root/app/models/abstract.rb +1 -1
  18. data/test/rails_root/app/models/photo_custom_error.rb +1 -1
  19. data/test/rails_root/app/views/layouts/application.html.erb +14 -0
  20. data/test/rails_root/config.ru +4 -0
  21. data/test/rails_root/config/application.rb +56 -0
  22. data/test/rails_root/config/boot.rb +7 -106
  23. data/test/rails_root/config/database.yml +19 -1
  24. data/test/rails_root/config/environment.rb +4 -65
  25. data/test/rails_root/config/environments/development.rb +33 -14
  26. data/test/rails_root/config/environments/production.rb +62 -14
  27. data/test/rails_root/config/environments/test.rb +32 -17
  28. data/test/rails_root/config/initializers/backtrace_silencers.rb +7 -0
  29. data/test/rails_root/config/initializers/inflections.rb +7 -2
  30. data/test/rails_root/config/initializers/secret_token.rb +7 -0
  31. data/test/rails_root/config/initializers/session_store.rb +8 -0
  32. data/test/rails_root/config/initializers/wrap_parameters.rb +14 -0
  33. data/test/rails_root/config/locales/en.yml +5 -0
  34. data/test/rails_root/config/routes.rb +38 -23
  35. data/test/rails_root/db/schema.rb +45 -0
  36. data/test/rails_root/lib/assets/.gitkeep +0 -0
  37. data/test/rails_root/public/404.html +15 -19
  38. data/test/rails_root/public/422.html +15 -19
  39. data/test/rails_root/public/500.html +15 -20
  40. data/test/rails_root/script/rails +6 -0
  41. data/test/test_helper.rb +4 -4
  42. data/test/unit/minimum_image_size_test.rb +3 -3
  43. data/test/unit/require_image_option_test.rb +1 -1
  44. data/tvdeyen-fleximage.gemspec +9 -163
  45. metadata +67 -62
  46. data/test/rails_root/app/controllers/application.rb +0 -10
  47. data/test/rails_root/app/models/photo_s3.rb +0 -5
  48. data/test/rails_root/db/migrate/005_create_photo_s3s.rb +0 -12
  49. data/test/s3_stubs.rb +0 -7
@@ -1,22 +1,37 @@
1
- # Settings specified here will take precedence over those in config/environment.rb
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
2
3
 
3
- # The test environment is used exclusively to run your application's
4
- # test suite. You never need to work with it otherwise. Remember that
5
- # your test database is "scratch space" for the test suite and is wiped
6
- # and recreated between test runs. Don't rely on the data there!
7
- config.cache_classes = false
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
8
9
 
9
- # Log error messages when you accidentally call methods on nil.
10
- config.whiny_nils = true
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"
11
13
 
12
- # Show full error reports and disable caching
13
- config.action_controller.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
14
+ # Log error messages when you accidentally call methods on nil
15
+ config.whiny_nils = true
15
16
 
16
- # Disable request forgery protection in test environment
17
- config.action_controller.allow_forgery_protection = false
17
+ # Show full error reports and disable caching
18
+ config.consider_all_requests_local = true
19
+ config.action_controller.perform_caching = false
18
20
 
19
- # Tell ActionMailer not to deliver emails to the real world.
20
- # The :test delivery method accumulates sent emails in the
21
- # ActionMailer::Base.deliveries array.
22
- config.action_mailer.delivery_method = :test
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
+ # Raise exception on mass assignment protection for Active Record models
33
+ config.active_record.mass_assignment_sanitizer = :strict
34
+
35
+ # Print deprecation notices to the stderr
36
+ config.active_support.deprecation = :stderr
37
+ 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!
@@ -1,10 +1,15 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- # Add new inflection rules using the following format
3
+ # Add new inflection rules using the following format
4
4
  # (all these examples are active by default):
5
- # Inflector.inflections do |inflect|
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
6
  # inflect.plural /^(ox)$/i, '\1en'
7
7
  # inflect.singular /^(ox)en/i, '\1'
8
8
  # inflect.irregular 'person', 'people'
9
9
  # inflect.uncountable %w( fish sheep )
10
10
  # end
11
+ #
12
+ # These inflection rules are supported but not enabled by default:
13
+ # ActiveSupport::Inflector.inflections do |inflect|
14
+ # inflect.acronym 'RESTful'
15
+ # end
@@ -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
+ Dummy::Application.config.secret_token = 'b42f67c05b17e2efbb1c1f458c7b4c163c9c92ab304aadd61f8c4b4763828ad8a003fa3d3265d7c4806842c11892b86006388d007101e21718cc81271d1dd421'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, :key => '_dummy_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
+ # Dummy::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"
@@ -1,43 +1,58 @@
1
- ActionController::Routing::Routes.draw do |map|
2
- map.resources :avatars
3
-
4
- map.resources :photo_bares
5
-
6
- map.resources :photo_dbs
7
-
8
- map.resources :photo_files
9
-
10
- # The priority is based upon order of creation: first created -> highest priority.
1
+ Dummy::Application.routes.draw do
2
+ # The priority is based upon order of creation:
3
+ # first created -> highest priority.
11
4
 
12
5
  # Sample of regular route:
13
- # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
6
+ # match 'products/:id' => 'catalog#view'
14
7
  # Keep in mind you can assign values other than :controller and :action
15
8
 
16
9
  # Sample of named route:
17
- # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
10
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
18
11
  # This route can be invoked with purchase_url(:id => product.id)
19
12
 
20
13
  # Sample resource route (maps HTTP verbs to controller actions automatically):
21
- # map.resources :products
14
+ # resources :products
22
15
 
23
16
  # Sample resource route with options:
24
- # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
17
+ # resources :products do
18
+ # member do
19
+ # get 'short'
20
+ # post 'toggle'
21
+ # end
22
+ #
23
+ # collection do
24
+ # get 'sold'
25
+ # end
26
+ # end
25
27
 
26
28
  # Sample resource route with sub-resources:
27
- # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
29
+ # resources :products do
30
+ # resources :comments, :sales
31
+ # resource :seller
32
+ # end
33
+
34
+ # Sample resource route with more complex sub-resources
35
+ # resources :products do
36
+ # resources :comments
37
+ # resources :sales do
38
+ # get 'recent', :on => :collection
39
+ # end
40
+ # end
28
41
 
29
42
  # Sample resource route within a namespace:
30
- # map.namespace :admin do |admin|
31
- # # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
32
- # admin.resources :products
43
+ # namespace :admin do
44
+ # # Directs /admin/products/* to Admin::ProductsController
45
+ # # (app/controllers/admin/products_controller.rb)
46
+ # resources :products
33
47
  # end
34
48
 
35
- # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
36
- # map.root :controller => "welcome"
49
+ # You can have the root of your site routed with "root"
50
+ # just remember to delete public/index.html.
51
+ # root :to => 'welcome#index'
37
52
 
38
53
  # See how all your routes lay out with "rake routes"
39
54
 
40
- # Install the default routes as the lowest priority.
41
- map.connect ':controller/:action/:id'
42
- map.connect ':controller/:action/:id.:format'
55
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
56
+ # Note: This route will make all actions in every controller accessible via GET requests.
57
+ # match ':controller(/:action(/:id))(.:format)'
43
58
  end
@@ -0,0 +1,45 @@
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 => 4) do
15
+
16
+ create_table "avatars", :force => true do |t|
17
+ t.string "username"
18
+ t.datetime "created_at", :null => false
19
+ t.datetime "updated_at", :null => false
20
+ end
21
+
22
+ create_table "photo_bares", :force => true do |t|
23
+ t.datetime "created_at", :null => false
24
+ t.datetime "updated_at", :null => false
25
+ end
26
+
27
+ create_table "photo_dbs", :force => true do |t|
28
+ t.string "image_filename"
29
+ t.integer "image_width"
30
+ t.integer "image_height"
31
+ t.binary "image_file_data"
32
+ t.datetime "created_at", :null => false
33
+ t.datetime "updated_at", :null => false
34
+ end
35
+
36
+ create_table "photo_files", :force => true do |t|
37
+ t.string "image_filename"
38
+ t.integer "image_width"
39
+ t.integer "image_height"
40
+ t.string "image_format"
41
+ t.datetime "created_at", :null => false
42
+ t.datetime "updated_at", :null => false
43
+ end
44
+
45
+ end
File without changes
@@ -1,23 +1,19 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
-
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
-
1
+ <!DOCTYPE html>
2
+ <html>
6
3
  <head>
7
- <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
8
4
  <title>The page you were looking for doesn't exist (404)</title>
9
- <style type="text/css">
10
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
11
- div.dialog {
12
- width: 25em;
13
- padding: 0 4em;
14
- margin: 4em auto 0 auto;
15
- border: 1px solid #ccc;
16
- border-right-color: #999;
17
- border-bottom-color: #999;
18
- }
19
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
20
- </style>
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>
21
17
  </head>
22
18
 
23
19
  <body>
@@ -27,4 +23,4 @@
27
23
  <p>You may have mistyped the address or the page may have moved.</p>
28
24
  </div>
29
25
  </body>
30
- </html>
26
+ </html>
@@ -1,23 +1,19 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
-
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
-
1
+ <!DOCTYPE html>
2
+ <html>
6
3
  <head>
7
- <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
8
4
  <title>The change you wanted was rejected (422)</title>
9
- <style type="text/css">
10
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
11
- div.dialog {
12
- width: 25em;
13
- padding: 0 4em;
14
- margin: 4em auto 0 auto;
15
- border: 1px solid #ccc;
16
- border-right-color: #999;
17
- border-bottom-color: #999;
18
- }
19
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
20
- </style>
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>
21
17
  </head>
22
18
 
23
19
  <body>
@@ -27,4 +23,4 @@
27
23
  <p>Maybe you tried to change something you didn't have access to.</p>
28
24
  </div>
29
25
  </body>
30
- </html>
26
+ </html>
@@ -1,30 +1,25 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
-
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
-
1
+ <!DOCTYPE html>
2
+ <html>
6
3
  <head>
7
- <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
8
4
  <title>We're sorry, but something went wrong (500)</title>
9
- <style type="text/css">
10
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
11
- div.dialog {
12
- width: 25em;
13
- padding: 0 4em;
14
- margin: 4em auto 0 auto;
15
- border: 1px solid #ccc;
16
- border-right-color: #999;
17
- border-bottom-color: #999;
18
- }
19
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
20
- </style>
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>
21
17
  </head>
22
18
 
23
19
  <body>
24
20
  <!-- This file lives in public/500.html -->
25
21
  <div class="dialog">
26
22
  <h1>We're sorry, but something went wrong.</h1>
27
- <p>We've been notified about this issue and we'll take a look at it shortly.</p>
28
23
  </div>
29
24
  </body>
30
- </html>
25
+ </html>
@@ -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'
data/test/test_helper.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  # Load the environment
2
- ENV['RAILS_ENV'] ||= 'test'
3
- require File.dirname(__FILE__) + '/rails_root/config/environment.rb'
4
-
2
+ ENV["RAILS_ENV"] = "test"
3
+ require File.expand_path("../rails_root/config/environment.rb", __FILE__)
4
+
5
5
  # Load the testing framework
6
- require 'test_help'
6
+ require 'rails/test_help'
7
7
  silence_warnings { RAILS_ENV = ENV['RAILS_ENV'] }
8
8
 
9
9
  # Run the migrations
@@ -2,21 +2,21 @@ require File.dirname(__FILE__) + '/../../test/test_helper'
2
2
 
3
3
 
4
4
  class BigPhoto < ActiveRecord::Base
5
- set_table_name :photo_dbs
5
+ self.table_name = :photo_dbs
6
6
  acts_as_fleximage do
7
7
  validates_image_size '80x60'
8
8
  end
9
9
  end
10
10
 
11
11
  class WidePhoto < ActiveRecord::Base
12
- set_table_name :photo_dbs
12
+ self.table_name = :photo_dbs
13
13
  acts_as_fleximage do
14
14
  validates_image_size '80x0'
15
15
  end
16
16
  end
17
17
 
18
18
  class HighPhoto < ActiveRecord::Base
19
- set_table_name :photo_dbs
19
+ self.table_name = :photo_dbs
20
20
  acts_as_fleximage do
21
21
  validates_image_size '0x60'
22
22
  end
@@ -1,7 +1,7 @@
1
1
  require File.dirname(__FILE__) + '/../../test/test_helper'
2
2
 
3
3
  class ValidatedPhoto < ActiveRecord::Base
4
- set_table_name :photo_dbs
4
+ self.table_name = :photo_dbs
5
5
  acts_as_fleximage
6
6
 
7
7
  def validate