table_renamable 2.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/README.rdoc +3 -1
  3. data/Rakefile +32 -0
  4. data/lib/table_renamable.rb +6 -15
  5. data/lib/table_renamable/connection_adapters.rb +8 -2
  6. data/lib/table_renamable/connection_adapters/mysql2_adapter.rb +21 -29
  7. data/lib/table_renamable/connection_adapters/sqlite3_adapter.rb +62 -0
  8. data/lib/table_renamable/engine.rb +22 -0
  9. data/lib/table_renamable/model.rb +5 -3
  10. data/lib/table_renamable/version.rb +1 -1
  11. data/spec/dummy/README.rdoc +261 -0
  12. data/spec/dummy/Rakefile +3 -6
  13. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  14. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  15. data/spec/dummy/app/controllers/application_controller.rb +1 -8
  16. data/spec/dummy/app/helpers/application_helper.rb +0 -1
  17. data/spec/dummy/app/models/post.rb +1 -3
  18. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  19. data/spec/dummy/config.ru +4 -0
  20. data/spec/dummy/config/application.rb +65 -0
  21. data/spec/dummy/config/boot.rb +7 -111
  22. data/spec/dummy/config/database.yml +3 -3
  23. data/spec/dummy/config/environment.rb +4 -40
  24. data/spec/dummy/config/environments/development.rb +33 -13
  25. data/spec/dummy/config/environments/production.rb +59 -20
  26. data/spec/dummy/config/environments/test.rb +37 -28
  27. data/spec/dummy/config/initializers/backtrace_silencers.rb +2 -2
  28. data/spec/dummy/config/initializers/inflections.rb +6 -1
  29. data/spec/dummy/config/initializers/{cookie_verification_secret.rb → secret_token.rb} +2 -2
  30. data/spec/dummy/config/initializers/session_store.rb +3 -10
  31. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  32. data/spec/dummy/config/locales/en.yml +2 -2
  33. data/spec/dummy/config/routes.rb +2 -41
  34. data/spec/dummy/public/404.html +15 -19
  35. data/spec/dummy/public/422.html +15 -19
  36. data/spec/dummy/public/500.html +14 -19
  37. data/spec/dummy/script/rails +6 -0
  38. data/spec/spec_helper.rb +29 -3
  39. metadata +34 -76
  40. data/spec/dummy/README +0 -243
  41. data/spec/dummy/config/initializers/new_rails_defaults.rb +0 -21
  42. data/spec/dummy/db/seeds.rb +0 -7
  43. data/spec/dummy/doc/README_FOR_APP +0 -2
  44. data/spec/dummy/public/images/rails.png +0 -0
  45. data/spec/dummy/public/index.html +0 -275
  46. data/spec/dummy/public/javascripts/application.js +0 -2
  47. data/spec/dummy/public/javascripts/controls.js +0 -963
  48. data/spec/dummy/public/javascripts/dragdrop.js +0 -973
  49. data/spec/dummy/public/javascripts/effects.js +0 -1128
  50. data/spec/dummy/public/javascripts/prototype.js +0 -4320
  51. data/spec/dummy/public/robots.txt +0 -5
  52. data/spec/dummy/script/about +0 -4
  53. data/spec/dummy/script/console +0 -3
  54. data/spec/dummy/script/dbconsole +0 -3
  55. data/spec/dummy/script/destroy +0 -3
  56. data/spec/dummy/script/generate +0 -3
  57. data/spec/dummy/script/performance/benchmarker +0 -3
  58. data/spec/dummy/script/performance/profiler +0 -3
  59. data/spec/dummy/script/plugin +0 -3
  60. data/spec/dummy/script/runner +0 -3
  61. data/spec/dummy/script/server +0 -3
  62. data/spec/dummy/test/performance/browsing_test.rb +0 -9
  63. data/spec/dummy/test/test_helper.rb +0 -38
data/spec/dummy/Rakefile CHANGED
@@ -1,10 +1,7 @@
1
+ #!/usr/bin/env rake
1
2
  # Add your own tasks in files placed in lib/tasks ending in .rake,
2
3
  # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
4
 
4
- require(File.join(File.dirname(__FILE__), 'config', 'boot'))
5
+ require File.expand_path('../config/application', __FILE__)
5
6
 
6
- require 'rake'
7
- require 'rake/testtask'
8
- require 'rake/rdoctask'
9
-
10
- require 'tasks/rails'
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
+ */
@@ -1,10 +1,3 @@
1
- # Filters added to this controller apply to all controllers in the application.
2
- # Likewise, all the methods added will be available for all controllers.
3
-
4
1
  class ApplicationController < ActionController::Base
5
- helper :all # include all helpers, all the time
6
- protect_from_forgery # See ActionController::RequestForgeryProtection for details
7
-
8
- # Scrub sensitive parameters from your log
9
- # filter_parameter_logging :password
2
+ protect_from_forgery
10
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
@@ -1,5 +1,3 @@
1
1
  class Post < ActiveRecord::Base
2
-
3
- belongs_to :user
4
-
2
+ attr_accessible :body, :title
5
3
  end
@@ -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,65 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ # Pick the frameworks you want:
4
+ require "active_record/railtie"
5
+ require "action_controller/railtie"
6
+ require "action_mailer/railtie"
7
+ require "active_resource/railtie"
8
+ # require "sprockets/railtie"
9
+ require "rails/test_unit/railtie"
10
+
11
+ Bundler.require(*Rails.groups)
12
+ require "table_renamable"
13
+
14
+ module Dummy
15
+ class Application < Rails::Application
16
+ # Settings in config/environments/* take precedence over those specified here.
17
+ # Application configuration should go into files in config/initializers
18
+ # -- all .rb files in that directory are automatically loaded.
19
+
20
+ # Custom directories with classes and modules you want to be autoloadable.
21
+ # config.autoload_paths += %W(#{config.root}/extras)
22
+
23
+ # Only load the plugins named here, in the order given (default is alphabetical).
24
+ # :all can be used as a placeholder for all plugins not explicitly named.
25
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
26
+
27
+ # Activate observers that should always be running.
28
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
29
+
30
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
31
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
32
+ # config.time_zone = 'Central Time (US & Canada)'
33
+
34
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
35
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
36
+ # config.i18n.default_locale = :de
37
+
38
+ # Configure the default encoding used in templates for Ruby 1.9.
39
+ config.encoding = "utf-8"
40
+
41
+ # Configure sensitive parameters which will be filtered from the log file.
42
+ config.filter_parameters += [:password]
43
+
44
+ # Enable escaping HTML in JSON.
45
+ config.active_support.escape_html_entities_in_json = true
46
+
47
+ # Use SQL instead of Active Record's schema dumper when creating the database.
48
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
49
+ # like if you have constraints or database-specific column types
50
+ # config.active_record.schema_format = :sql
51
+
52
+ # Enforce whitelist mode for mass assignment.
53
+ # This will create an empty whitelist of attributes available for mass-assignment for all models
54
+ # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
55
+ # parameters by using an attr_accessible or attr_protected declaration.
56
+ config.active_record.whitelist_attributes = true
57
+
58
+ # Enable the asset pipeline
59
+ config.assets.enabled = true
60
+
61
+ # Version of your assets, change this if you want to expire all your assets
62
+ config.assets.version = '1.0'
63
+ end
64
+ end
65
+
@@ -1,114 +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
- def preinitialize
28
- load(preinitializer_path) if File.exist?(preinitializer_path)
29
- end
30
-
31
- def preinitializer_path
32
- "#{RAILS_ROOT}/config/preinitializer.rb"
33
- end
34
- end
35
-
36
- class Boot
37
- def run
38
- load_initializer
39
- Rails::Initializer.run(:set_load_path)
40
- end
41
- end
42
-
43
- class VendorBoot < Boot
44
- def load_initializer
45
- require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
46
- Rails::Initializer.run(:install_gem_spec_stubs)
47
- Rails::GemDependency.add_frozen_gem_path
48
- end
49
- end
50
-
51
- class GemBoot < Boot
52
- def load_initializer
53
- self.class.load_rubygems
54
- load_rails_gem
55
- require 'initializer'
56
- end
57
-
58
- def load_rails_gem
59
- if version = self.class.gem_version
60
- gem 'rails', version
61
- else
62
- gem 'rails'
63
- end
64
- rescue Gem::LoadError => load_error
65
- if load_error.message =~ /Could not find RubyGem rails/
66
- 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.)
67
- exit 1
68
- else
69
- raise
70
- end
71
- end
72
-
73
- class << self
74
- def rubygems_version
75
- Gem::RubyGemsVersion rescue nil
76
- end
77
-
78
- def gem_version
79
- if defined? RAILS_GEM_VERSION
80
- RAILS_GEM_VERSION
81
- elsif ENV.include?('RAILS_GEM_VERSION')
82
- ENV['RAILS_GEM_VERSION']
83
- else
84
- parse_gem_version(read_environment_rb)
85
- end
86
- end
87
-
88
- def load_rubygems
89
- min_version = '1.3.2'
90
- require 'rubygems'
91
- unless rubygems_version >= min_version
92
- $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
93
- exit 1
94
- end
95
-
96
- rescue LoadError
97
- $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
98
- exit 1
99
- end
100
-
101
- def parse_gem_version(text)
102
- $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
103
- end
104
-
105
- private
106
- def read_environment_rb
107
- File.read("#{RAILS_ROOT}/config/environment.rb")
108
- end
109
- end
110
- end
4
+ if File.exist?(gemfile)
5
+ ENV['BUNDLE_GEMFILE'] = gemfile
6
+ require 'bundler'
7
+ Bundler.setup
111
8
  end
112
9
 
113
- # All that for this:
114
- Rails.boot!
10
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -3,9 +3,9 @@
3
3
  # Do not set this db to the same as development or production.
4
4
  test:
5
5
  adapter: mysql2
6
- database: 'table_renamable_test'
6
+ host: localhost
7
7
  username: root
8
8
  password:
9
- host: 'localhost'
9
+ database: 'table_renamable_test'
10
10
  pool: 5
11
- timeout: 5000
11
+ timeout: 5000
@@ -1,41 +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
- # Specifies gem version of Rails to use when vendor/rails is not present
4
- RAILS_GEM_VERSION = '2.3.18' unless defined? RAILS_GEM_VERSION
5
-
6
- # Bootstrap the Rails environment, frameworks, and default configuration
7
- require File.join(File.dirname(__FILE__), 'boot')
8
-
9
- Rails::Initializer.run do |config|
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
- # Add additional load paths for your own custom dirs
15
- # config.autoload_paths += %W( #{RAILS_ROOT}/extras )
16
-
17
- # Specify gems that this application depends on and have them installed with rake gems:install
18
- # config.gem "bj"
19
- # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
20
- # config.gem "sqlite3-ruby", :lib => "sqlite3"
21
- # config.gem "aws-s3", :lib => "aws/s3"
22
-
23
- # Only load the plugins named here, in the order given (default is alphabetical).
24
- # :all can be used as a placeholder for all plugins not explicitly named
25
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
26
-
27
- # Skip frameworks you're not going to use. To use Rails without a database,
28
- # you must remove the Active Record framework.
29
- # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
30
-
31
- # Activate observers that should always be running
32
- # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
33
-
34
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
35
- # Run "rake -D time" for a list of tasks for finding time zone names.
36
- config.time_zone = 'UTC'
37
-
38
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
39
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
40
- # config.i18n.default_locale = :de
41
- end
4
+ # Initialize the rails application
5
+ Dummy::Application.initialize!
@@ -1,17 +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
12
+ # Show full error reports and disable caching
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
15
 
16
- # Don't care if the mailer can't send
17
- 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,28 +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
- # Full error reports are disabled and caching is turned on
8
- config.action_controller.consider_all_requests_local = false
9
- config.action_controller.perform_caching = true
10
- config.action_view.cache_template_loading = true
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
11
10
 
12
- # See everything in the log (default is :info)
13
- # config.log_level = :debug
11
+ # Disable Rails's static asset server (Apache or nginx will already do this)
12
+ config.serve_static_assets = false
14
13
 
15
- # Use a different logger for distributed setups
16
- # config.logger = SyslogLogger.new
14
+ # Compress JavaScripts and CSS
15
+ config.assets.compress = true
17
16
 
18
- # Use a different cache store in production
19
- # config.cache_store = :mem_cache_store
17
+ # Don't fallback to assets pipeline if a precompiled asset is missed
18
+ config.assets.compile = false
20
19
 
21
- # Enable serving of images, stylesheets, and javascripts from an asset server
22
- # config.action_controller.asset_host = "http://assets.example.com"
20
+ # Generate digests for assets URLs
21
+ config.assets.digest = true
23
22
 
24
- # Disable delivery errors, bad email addresses will be ignored
25
- # config.action_mailer.raise_delivery_errors = false
23
+ # Defaults to nil and saved in location specified by config.assets.prefix
24
+ # config.assets.manifest = YOUR_PATH
26
25
 
27
- # Enable threaded mode
28
- # config.threadsafe!
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