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
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,15 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -1,3 +1,2 @@
1
- # Methods added to this helper will be available to all templates in the application.
2
1
  module ApplicationHelper
3
2
  end
File without changes
File without changes
@@ -1,5 +1,5 @@
1
1
  class Abstract < ActiveRecord::Base
2
- set_table_name :photo_dbs
2
+ self.table_name = :photo_dbs
3
3
 
4
4
  acts_as_fleximage do
5
5
  require_image false
@@ -1,5 +1,5 @@
1
1
  class PhotoCustomError < ActiveRecord::Base
2
- set_table_name :photo_dbs
2
+ self.table_name = :photo_dbs
3
3
  acts_as_fleximage do
4
4
  image_directory 'public/uploads'
5
5
  validates_image_size '2x2'
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag "application", :media => "all" %>
6
+ <%= javascript_include_tag "application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
@@ -0,0 +1,56 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require
6
+ require "fleximage"
7
+
8
+ module Dummy
9
+ class Application < Rails::Application
10
+ # Settings in config/environments/* take precedence over those specified here.
11
+ # Application configuration should go into files in config/initializers
12
+ # -- all .rb files in that directory are automatically loaded.
13
+
14
+ # Custom directories with classes and modules you want to be autoloadable.
15
+ # config.autoload_paths += %W(#{config.root}/extras)
16
+
17
+ # Only load the plugins named here, in the order given (default is alphabetical).
18
+ # :all can be used as a placeholder for all plugins not explicitly named.
19
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
20
+
21
+ # Activate observers that should always be running.
22
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
23
+
24
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
25
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
26
+ # config.time_zone = 'Central Time (US & Canada)'
27
+
28
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
29
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
30
+ # config.i18n.default_locale = :de
31
+
32
+ # Configure the default encoding used in templates for Ruby 1.9.
33
+ config.encoding = "utf-8"
34
+
35
+ # Configure sensitive parameters which will be filtered from the log file.
36
+ config.filter_parameters += [:password]
37
+
38
+ # Use SQL instead of Active Record's schema dumper when creating the database.
39
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
40
+ # like if you have constraints or database-specific column types
41
+ # config.active_record.schema_format = :sql
42
+
43
+ # Enforce whitelist mode for mass assignment.
44
+ # This will create an empty whitelist of attributes available for mass-assignment for all models
45
+ # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
46
+ # parameters by using an attr_accessible or attr_protected declaration.
47
+ # config.active_record.whitelist_attributes = true
48
+
49
+ # Enable the asset pipeline
50
+ config.assets.enabled = true
51
+
52
+ # Version of your assets, change this if you want to expire all your assets
53
+ config.assets.version = '1.0'
54
+ end
55
+ end
56
+
@@ -1,109 +1,10 @@
1
- # Don't change this file!
2
- # Configure your app in config/environment.rb and config/environments/*.rb
1
+ require 'rubygems'
2
+ gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
3
 
4
- Rails.root = "#{File.dirname(__FILE__)}/.." unless defined?(Rails.root)
5
-
6
- module Rails
7
- class << self
8
- def boot!
9
- unless booted?
10
- preinitialize
11
- pick_boot.run
12
- end
13
- end
14
-
15
- def booted?
16
- defined? Rails::Initializer
17
- end
18
-
19
- def pick_boot
20
- (vendor_rails? ? VendorBoot : GemBoot).new
21
- end
22
-
23
- def vendor_rails?
24
- File.exist?("#{Rails.root}/vendor/rails")
25
- end
26
-
27
- # FIXME : Ruby 1.9
28
- def preinitialize
29
- load(preinitializer_path) if File.exists?(preinitializer_path)
30
- end
31
-
32
- def preinitializer_path
33
- "#{Rails.root}/config/preinitializer.rb"
34
- end
35
- end
36
-
37
- class Boot
38
- def run
39
- load_initializer
40
- Rails::Initializer.run(:set_load_path)
41
- end
42
- end
43
-
44
- class VendorBoot < Boot
45
- def load_initializer
46
- require "#{Rails.root}/vendor/rails/railties/lib/initializer"
47
- end
48
- end
49
-
50
- class GemBoot < Boot
51
- def load_initializer
52
- self.class.load_rubygems
53
- load_rails_gem
54
- require 'initializer'
55
- end
56
-
57
- def load_rails_gem
58
- if version = self.class.gem_version
59
- gem 'rails', version
60
- else
61
- gem 'rails'
62
- end
63
- rescue Gem::LoadError => load_error
64
- $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
65
- exit 1
66
- end
67
-
68
- class << self
69
- def rubygems_version
70
- Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion
71
- end
72
-
73
- def gem_version
74
- if defined? RAILS_GEM_VERSION
75
- RAILS_GEM_VERSION
76
- elsif ENV.include?('RAILS_GEM_VERSION')
77
- ENV['RAILS_GEM_VERSION']
78
- else
79
- parse_gem_version(read_environment_rb)
80
- end
81
- end
82
-
83
- def load_rubygems
84
- require 'rubygems'
85
-
86
- unless rubygems_version >= '0.9.4'
87
- $stderr.puts %(Rails requires RubyGems >= 0.9.4 (you have #{rubygems_version}). Please `gem update --system` and try again.)
88
- exit 1
89
- end
90
-
91
- rescue LoadError
92
- $stderr.puts %(Rails requires RubyGems >= 0.9.4. Please install RubyGems and try again: http://rubygems.rubyforge.org)
93
- exit 1
94
- end
95
-
96
- def parse_gem_version(text)
97
- $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
98
- end
99
-
100
- private
101
- def read_environment_rb
102
- File.read("#{Rails.root}/config/environment.rb")
103
- end
104
- end
105
- end
4
+ if File.exist?(gemfile)
5
+ ENV['BUNDLE_GEMFILE'] = gemfile
6
+ require 'bundler'
7
+ Bundler.setup
106
8
  end
107
9
 
108
- # All that for this:
109
- Rails.boot!
10
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -1,7 +1,25 @@
1
1
  # SQLite version 3.x
2
- # gem install sqlite3-ruby (not necessary on OS X Leopard)
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ development:
7
+ adapter: sqlite3
8
+ database: db/development.sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
3
15
  test:
4
16
  adapter: sqlite3
5
17
  database: db/test.sqlite3
18
+ pool: 5
6
19
  timeout: 5000
7
20
 
21
+ production:
22
+ adapter: sqlite3
23
+ database: db/production.sqlite3
24
+ pool: 5
25
+ timeout: 5000
@@ -1,66 +1,5 @@
1
- # Be sure to restart your server when you modify this file
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
2
3
 
3
- # Uncomment below to force Rails into production mode when
4
- # you don't control web/app server and can't set it the proper way
5
- # ENV['RAILS_ENV'] ||= 'production'
6
-
7
- # Specifies gem version of Rails to use when vendor/rails is not present
8
- RAILS_GEM_VERSION = '2.2.2' unless defined? RAILS_GEM_VERSION
9
-
10
- # Bootstrap the Rails environment, frameworks, and default configuration
11
- require File.join(File.dirname(__FILE__), 'boot')
12
-
13
- Rails::Initializer.run do |config|
14
- # Settings in config/environments/* take precedence over those specified here.
15
- # Application configuration should go into files in config/initializers
16
- # -- all .rb files in that directory are automatically loaded.
17
- # See Rails::Configuration for more options.
18
-
19
- # Skip frameworks you're not going to use (only works if using vendor/rails).
20
- # To use Rails without a database, you must remove the Active Record framework
21
- # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
22
-
23
- # Only load the plugins named here, in the order given. By default, all plugins
24
- # in vendor/plugins are loaded in alphabetical order.
25
- # :all can be used as a placeholder for all plugins not explicitly named
26
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
27
-
28
- # Add additional load paths for your own custom dirs
29
- # config.load_paths += %W( #{Rails.root}/extras )
30
-
31
- # Force all environments to use the same logger level
32
- # (by default production uses :info, the others :debug)
33
- # config.log_level = :debug
34
-
35
- # Your secret key for verifying cookie session data integrity.
36
- # If you change this key, all old sessions will become invalid!
37
- # Make sure the secret is at least 30 characters and all random,
38
- # no regular words or you'll be exposed to dictionary attacks.
39
- config.action_controller.session = {
40
- :session_key => '_rails_root_session',
41
- :secret => '8de2aeb0162710e3afe8b889d0902631f528d32ffc39756ec968262c498c230e549ac60399cede2a705214fae80280898d37cc58f4e66acb47a3771d3d12f618'
42
- }
43
-
44
- # Use the database for sessions instead of the cookie-based default,
45
- # which shouldn't be used to store highly confidential information
46
- # (create the session table with 'rake db:sessions:create')
47
- # config.action_controller.session_store = :active_record_store
48
-
49
- # Use SQL instead of Active Record's schema dumper when creating the test database.
50
- # This is necessary if your schema can't be completely dumped by the schema dumper,
51
- # like if you have constraints or database-specific column types
52
- # config.active_record.schema_format = :sql
53
-
54
- # Activate observers that should always be running
55
- # config.active_record.observers = :cacher, :garbage_collector
56
-
57
- # Make Active Record use UTC-base instead of local time
58
- # config.active_record.default_timezone = :utc
59
-
60
- config.log_level = :debug
61
- config.cache_classes = false
62
- config.whiny_nils = true
63
- config.load_paths << "#{File.dirname(__FILE__)}/../../../lib/"
64
- end
65
-
66
- #Dependencies.log_activity = true
4
+ # Initialize the rails application
5
+ Dummy::Application.initialize!
@@ -1,18 +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
- # In the development environment your application's code is reloaded on
4
- # every request. This slows down response time but is perfect for development
5
- # since you don't have to restart the webserver when you make code changes.
6
- config.cache_classes = false
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
7
8
 
8
- # Log error messages when you accidentally call methods on nil.
9
- config.whiny_nils = true
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
10
11
 
11
- # Show full error reports and disable caching
12
- config.action_controller.consider_all_requests_local = true
13
- config.action_view.debug_rjs = true
14
- config.action_controller.perform_caching = false
15
- config.action_view.cache_template_extensions = false
12
+ # Show full error reports and disable caching
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
16
15
 
17
- # Don't care if the mailer can't send
18
- config.action_mailer.raise_delivery_errors = false
16
+ # Don't care if the mailer can't send
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger
20
+ config.active_support.deprecation = :log
21
+
22
+ # Only use best-standards-support built into browsers
23
+ config.action_dispatch.best_standards_support = :builtin
24
+
25
+ # Raise exception on mass assignment protection for Active Record models
26
+ config.active_record.mass_assignment_sanitizer = :strict
27
+
28
+ # Log the query plan for queries taking more than this (works
29
+ # with SQLite, MySQL, and PostgreSQL)
30
+ config.active_record.auto_explain_threshold_in_seconds = 0.5
31
+
32
+ # Do not compress assets
33
+ config.assets.compress = false
34
+
35
+ # Expands the lines which load the assets
36
+ config.assets.debug = true
37
+ end
@@ -1,19 +1,67 @@
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 production environment is meant for finished, "live" apps.
4
- # Code is not reloaded between requests
5
- config.cache_classes = true
4
+ # Code is not reloaded between requests
5
+ config.cache_classes = true
6
6
 
7
- # Use a different logger for distributed setups
8
- # config.logger = SyslogLogger.new
7
+ # Full error reports are disabled and caching is turned on
8
+ config.consider_all_requests_local = false
9
+ config.action_controller.perform_caching = true
9
10
 
10
- # Full error reports are disabled and caching is turned on
11
- config.action_controller.consider_all_requests_local = false
12
- config.action_controller.perform_caching = true
13
- config.action_view.cache_template_loading = true
11
+ # Disable Rails's static asset server (Apache or nginx will already do this)
12
+ config.serve_static_assets = false
14
13
 
15
- # Enable serving of images, stylesheets, and javascripts from an asset server
16
- # config.action_controller.asset_host = "http://assets.example.com"
14
+ # Compress JavaScripts and CSS
15
+ config.assets.compress = true
17
16
 
18
- # Disable delivery errors, bad email addresses will be ignored
19
- # config.action_mailer.raise_delivery_errors = false
17
+ # Don't fallback to assets pipeline if a precompiled asset is missed
18
+ config.assets.compile = false
19
+
20
+ # Generate digests for assets URLs
21
+ config.assets.digest = true
22
+
23
+ # Defaults to Rails.root.join("public/assets")
24
+ # config.assets.manifest = YOUR_PATH
25
+
26
+ # Specifies the header that your server uses for sending files
27
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
29
+
30
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
+ # config.force_ssl = true
32
+
33
+ # See everything in the log (default is :info)
34
+ # config.log_level = :debug
35
+
36
+ # Prepend all log lines with the following tags
37
+ # config.log_tags = [ :subdomain, :uuid ]
38
+
39
+ # Use a different logger for distributed setups
40
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
41
+
42
+ # Use a different cache store in production
43
+ # config.cache_store = :mem_cache_store
44
+
45
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
46
+ # config.action_controller.asset_host = "http://assets.example.com"
47
+
48
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
49
+ # config.assets.precompile += %w( search.js )
50
+
51
+ # Disable delivery errors, bad email addresses will be ignored
52
+ # config.action_mailer.raise_delivery_errors = false
53
+
54
+ # Enable threaded mode
55
+ # config.threadsafe!
56
+
57
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
58
+ # the I18n.default_locale when a translation can not be found)
59
+ config.i18n.fallbacks = true
60
+
61
+ # Send deprecation notices to registered listeners
62
+ config.active_support.deprecation = :notify
63
+
64
+ # Log the query plan for queries taking more than this (works
65
+ # with SQLite, MySQL, and PostgreSQL)
66
+ # config.active_record.auto_explain_threshold_in_seconds = 0.5
67
+ end