table_renamable 0.0.1 → 2.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 (66) hide show
  1. data/Rakefile +0 -32
  2. data/lib/table_renamable/connection_adapters/mysql2_adapter.rb +29 -21
  3. data/lib/table_renamable/connection_adapters.rb +2 -8
  4. data/lib/table_renamable/model.rb +3 -5
  5. data/lib/table_renamable/version.rb +1 -1
  6. data/lib/table_renamable.rb +15 -6
  7. data/spec/dummy/README +243 -0
  8. data/spec/dummy/Rakefile +6 -3
  9. data/spec/dummy/app/controllers/application_controller.rb +8 -1
  10. data/spec/dummy/app/helpers/application_helper.rb +1 -0
  11. data/spec/dummy/app/models/post.rb +3 -1
  12. data/spec/dummy/config/boot.rb +111 -7
  13. data/spec/dummy/config/database.yml +3 -3
  14. data/spec/dummy/config/environment.rb +40 -4
  15. data/spec/dummy/config/environments/development.rb +13 -33
  16. data/spec/dummy/config/environments/production.rb +20 -59
  17. data/spec/dummy/config/environments/test.rb +28 -37
  18. data/spec/dummy/config/initializers/backtrace_silencers.rb +2 -2
  19. data/spec/dummy/config/initializers/{secret_token.rb → cookie_verification_secret.rb} +2 -2
  20. data/spec/dummy/config/initializers/inflections.rb +1 -6
  21. data/spec/dummy/config/initializers/new_rails_defaults.rb +21 -0
  22. data/spec/dummy/config/initializers/session_store.rb +10 -3
  23. data/spec/dummy/config/locales/en.yml +2 -2
  24. data/spec/dummy/config/routes.rb +41 -2
  25. data/spec/dummy/db/seeds.rb +7 -0
  26. data/spec/dummy/doc/README_FOR_APP +2 -0
  27. data/spec/dummy/log/production.log +0 -0
  28. data/spec/dummy/log/server.log +0 -0
  29. data/spec/dummy/log/test.log +100 -1158
  30. data/spec/dummy/public/404.html +19 -15
  31. data/spec/dummy/public/422.html +19 -15
  32. data/spec/dummy/public/500.html +19 -14
  33. data/spec/dummy/public/images/rails.png +0 -0
  34. data/spec/dummy/public/index.html +275 -0
  35. data/spec/dummy/public/javascripts/application.js +2 -0
  36. data/spec/dummy/public/javascripts/controls.js +963 -0
  37. data/spec/dummy/public/javascripts/dragdrop.js +973 -0
  38. data/spec/dummy/public/javascripts/effects.js +1128 -0
  39. data/spec/dummy/public/javascripts/prototype.js +4320 -0
  40. data/spec/dummy/public/robots.txt +5 -0
  41. data/spec/dummy/script/about +4 -0
  42. data/spec/dummy/script/console +3 -0
  43. data/spec/dummy/script/dbconsole +3 -0
  44. data/spec/dummy/script/destroy +3 -0
  45. data/spec/dummy/script/generate +3 -0
  46. data/spec/dummy/script/performance/benchmarker +3 -0
  47. data/spec/dummy/script/performance/profiler +3 -0
  48. data/spec/dummy/script/plugin +3 -0
  49. data/spec/dummy/script/runner +3 -0
  50. data/spec/dummy/script/server +3 -0
  51. data/spec/dummy/test/performance/browsing_test.rb +9 -0
  52. data/spec/dummy/test/test_helper.rb +38 -0
  53. data/spec/spec_helper.rb +3 -29
  54. metadata +83 -37
  55. checksums.yaml +0 -7
  56. data/lib/table_renamable/connection_adapters/sqlite3_adapter.rb +0 -62
  57. data/lib/table_renamable/engine.rb +0 -22
  58. data/spec/dummy/README.rdoc +0 -261
  59. data/spec/dummy/app/assets/javascripts/application.js +0 -15
  60. data/spec/dummy/app/assets/stylesheets/application.css +0 -13
  61. data/spec/dummy/app/views/layouts/application.html.erb +0 -14
  62. data/spec/dummy/config/application.rb +0 -65
  63. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  64. data/spec/dummy/config.ru +0 -4
  65. data/spec/dummy/script/rails +0 -6
  66. /data/spec/dummy/{db/test.sqlite3 → log/development.log} +0 -0
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-Agent: *
5
+ # Disallow: /
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info"
4
+ require 'commands/about'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ require 'commands/console'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ require 'commands/dbconsole'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ require 'commands/destroy'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ require 'commands/generate'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../../config/boot', __FILE__)
3
+ require 'commands/performance/benchmarker'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../../config/boot', __FILE__)
3
+ require 'commands/performance/profiler'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ require 'commands/plugin'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ require 'commands/runner'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ require 'commands/server'
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+ require 'performance_test_help'
3
+
4
+ # Profiling results for each test method are written to tmp/performance.
5
+ class BrowsingTest < ActionController::PerformanceTest
6
+ def test_homepage
7
+ get '/'
8
+ end
9
+ end
@@ -0,0 +1,38 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+ require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
3
+ require 'test_help'
4
+
5
+ class ActiveSupport::TestCase
6
+ # Transactional fixtures accelerate your tests by wrapping each test method
7
+ # in a transaction that's rolled back on completion. This ensures that the
8
+ # test database remains unchanged so your fixtures don't have to be reloaded
9
+ # between every test method. Fewer database queries means faster tests.
10
+ #
11
+ # Read Mike Clark's excellent walkthrough at
12
+ # http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
13
+ #
14
+ # Every Active Record database supports transactions except MyISAM tables
15
+ # in MySQL. Turn off transactional fixtures in this case; however, if you
16
+ # don't care one way or the other, switching from MyISAM to InnoDB tables
17
+ # is recommended.
18
+ #
19
+ # The only drawback to using transactional fixtures is when you actually
20
+ # need to test transactions. Since your test is bracketed by a transaction,
21
+ # any transactions started in your code will be automatically rolled back.
22
+ self.use_transactional_fixtures = true
23
+
24
+ # Instantiated fixtures are slow, but give you @david where otherwise you
25
+ # would need people(:david). If you don't want to migrate your existing
26
+ # test cases which use the @david style and don't mind the speed hit (each
27
+ # instantiated fixtures translates to a database query per test method),
28
+ # then set this back to true.
29
+ self.use_instantiated_fixtures = false
30
+
31
+ # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
32
+ #
33
+ # Note: You'll currently still have to declare fixtures explicitly in integration tests
34
+ # -- they do not yet inherit this setting
35
+ fixtures :all
36
+
37
+ # Add more helper methods to be used by all tests here...
38
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,40 +1,14 @@
1
1
  # This file is copied to spec/ when you run 'rails generate rspec:install'
2
2
  ENV["RAILS_ENV"] ||= 'test'
3
+
3
4
  require File.expand_path("../dummy/config/environment", __FILE__)
4
- require 'rspec/rails'
5
- require 'rspec/autorun'
5
+ require 'table_renamable'
6
6
 
7
7
  # Requires supporting ruby files with custom matchers and macros, etc,
8
8
  # in spec/support/ and its subdirectories.
9
9
  Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
10
10
 
11
- RSpec.configure do |config|
12
- # ## Mock Framework
13
- #
14
- # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
15
- #
16
- # config.mock_with :mocha
17
- # config.mock_with :flexmock
18
- # config.mock_with :rr
19
-
20
- # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
21
- config.fixture_path = "#{::Rails.root}/spec/fixtures"
22
-
23
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
24
- # examples within a transaction, remove the following line or assign false
25
- # instead of true.
26
- config.use_transactional_fixtures = true
27
-
28
- # If true, the base class of anonymous controllers will be inferred
29
- # automatically. This will be the default behavior in future versions of
30
- # rspec-rails.
31
- config.infer_base_class_for_anonymous_controllers = false
32
-
33
- # Run specs in random order to surface order dependencies. If you find an
34
- # order dependency and want to debug it, you can fix the order by providing
35
- # the seed, which is printed after each run.
36
- # --seed 1234
37
- config.order = "random"
11
+ Spec::Runner.configure do |config|
38
12
 
39
13
 
40
14
  end
metadata CHANGED
@@ -1,43 +1,48 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: table_renamable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 2.0.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Dan Langevin
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-10-25 00:00:00.000000000 Z
12
+ date: 2013-10-28 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: rails
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ~>
18
20
  - !ruby/object:Gem::Version
19
- version: 3.2.14
21
+ version: 2.3.17
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ~>
25
28
  - !ruby/object:Gem::Version
26
- version: 3.2.14
29
+ version: 2.3.17
27
30
  - !ruby/object:Gem::Dependency
28
- name: sqlite3
31
+ name: mysql2
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - '>='
35
+ - - <
32
36
  - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
37
+ version: '0.3'
38
+ type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - '>='
43
+ - - <
39
44
  - !ruby/object:Gem::Version
40
- version: '0'
45
+ version: '0.3'
41
46
  description: Gem to support live renaming of tables columns
42
47
  email:
43
48
  - dan.langevin@lifebooker.com
@@ -52,10 +57,8 @@ files:
52
57
  - app/views/layouts/table_renamable/application.html.erb
53
58
  - config/routes.rb
54
59
  - lib/table_renamable/connection_adapters/mysql2_adapter.rb
55
- - lib/table_renamable/connection_adapters/sqlite3_adapter.rb
56
60
  - lib/table_renamable/connection_adapters.rb
57
61
  - lib/table_renamable/deprecated_table.rb
58
- - lib/table_renamable/engine.rb
59
62
  - lib/table_renamable/model.rb
60
63
  - lib/table_renamable/version.rb
61
64
  - lib/table_renamable.rb
@@ -63,14 +66,10 @@ files:
63
66
  - MIT-LICENSE
64
67
  - Rakefile
65
68
  - README.rdoc
66
- - spec/dummy/app/assets/javascripts/application.js
67
- - spec/dummy/app/assets/stylesheets/application.css
68
69
  - spec/dummy/app/controllers/application_controller.rb
69
70
  - spec/dummy/app/helpers/application_helper.rb
70
71
  - spec/dummy/app/models/post.rb
71
72
  - spec/dummy/app/models/user.rb
72
- - spec/dummy/app/views/layouts/application.html.erb
73
- - spec/dummy/config/application.rb
74
73
  - spec/dummy/config/boot.rb
75
74
  - spec/dummy/config/database.yml
76
75
  - spec/dummy/config/environment.rb
@@ -78,57 +77,82 @@ files:
78
77
  - spec/dummy/config/environments/production.rb
79
78
  - spec/dummy/config/environments/test.rb
80
79
  - spec/dummy/config/initializers/backtrace_silencers.rb
80
+ - spec/dummy/config/initializers/cookie_verification_secret.rb
81
81
  - spec/dummy/config/initializers/inflections.rb
82
82
  - spec/dummy/config/initializers/mime_types.rb
83
- - spec/dummy/config/initializers/secret_token.rb
83
+ - spec/dummy/config/initializers/new_rails_defaults.rb
84
84
  - spec/dummy/config/initializers/session_store.rb
85
- - spec/dummy/config/initializers/wrap_parameters.rb
86
85
  - spec/dummy/config/locales/en.yml
87
86
  - spec/dummy/config/routes.rb
88
- - spec/dummy/config.ru
89
- - spec/dummy/db/test.sqlite3
87
+ - spec/dummy/db/seeds.rb
88
+ - spec/dummy/doc/README_FOR_APP
89
+ - spec/dummy/log/development.log
90
+ - spec/dummy/log/production.log
91
+ - spec/dummy/log/server.log
90
92
  - spec/dummy/log/test.log
91
93
  - spec/dummy/public/404.html
92
94
  - spec/dummy/public/422.html
93
95
  - spec/dummy/public/500.html
94
96
  - spec/dummy/public/favicon.ico
97
+ - spec/dummy/public/images/rails.png
98
+ - spec/dummy/public/index.html
99
+ - spec/dummy/public/javascripts/application.js
100
+ - spec/dummy/public/javascripts/controls.js
101
+ - spec/dummy/public/javascripts/dragdrop.js
102
+ - spec/dummy/public/javascripts/effects.js
103
+ - spec/dummy/public/javascripts/prototype.js
104
+ - spec/dummy/public/robots.txt
95
105
  - spec/dummy/Rakefile
96
- - spec/dummy/README.rdoc
97
- - spec/dummy/script/rails
106
+ - spec/dummy/README
107
+ - spec/dummy/script/about
108
+ - spec/dummy/script/console
109
+ - spec/dummy/script/dbconsole
110
+ - spec/dummy/script/destroy
111
+ - spec/dummy/script/generate
112
+ - spec/dummy/script/performance/benchmarker
113
+ - spec/dummy/script/performance/profiler
114
+ - spec/dummy/script/plugin
115
+ - spec/dummy/script/runner
116
+ - spec/dummy/script/server
117
+ - spec/dummy/test/performance/browsing_test.rb
118
+ - spec/dummy/test/test_helper.rb
98
119
  - spec/lib/table_renamable/model_spec.rb
99
120
  - spec/spec_helper.rb
100
121
  homepage: http://github.com/LifebookerInc/table_renamable
101
122
  licenses: []
102
- metadata: {}
103
123
  post_install_message:
104
124
  rdoc_options: []
105
125
  require_paths:
106
126
  - lib
107
127
  required_ruby_version: !ruby/object:Gem::Requirement
128
+ none: false
108
129
  requirements:
109
- - - '>='
130
+ - - ! '>='
110
131
  - !ruby/object:Gem::Version
111
132
  version: '0'
133
+ segments:
134
+ - 0
135
+ hash: -2936871622749901878
112
136
  required_rubygems_version: !ruby/object:Gem::Requirement
137
+ none: false
113
138
  requirements:
114
- - - '>='
139
+ - - ! '>='
115
140
  - !ruby/object:Gem::Version
116
141
  version: '0'
142
+ segments:
143
+ - 0
144
+ hash: -2936871622749901878
117
145
  requirements: []
118
146
  rubyforge_project:
119
- rubygems_version: 2.0.3
147
+ rubygems_version: 1.8.23
120
148
  signing_key:
121
- specification_version: 4
149
+ specification_version: 3
122
150
  summary: Renaming tables and columns
123
151
  test_files:
124
- - spec/dummy/app/assets/javascripts/application.js
125
- - spec/dummy/app/assets/stylesheets/application.css
126
152
  - spec/dummy/app/controllers/application_controller.rb
127
153
  - spec/dummy/app/helpers/application_helper.rb
128
154
  - spec/dummy/app/models/post.rb
129
155
  - spec/dummy/app/models/user.rb
130
- - spec/dummy/app/views/layouts/application.html.erb
131
- - spec/dummy/config/application.rb
132
156
  - spec/dummy/config/boot.rb
133
157
  - spec/dummy/config/database.yml
134
158
  - spec/dummy/config/environment.rb
@@ -136,22 +160,44 @@ test_files:
136
160
  - spec/dummy/config/environments/production.rb
137
161
  - spec/dummy/config/environments/test.rb
138
162
  - spec/dummy/config/initializers/backtrace_silencers.rb
163
+ - spec/dummy/config/initializers/cookie_verification_secret.rb
139
164
  - spec/dummy/config/initializers/inflections.rb
140
165
  - spec/dummy/config/initializers/mime_types.rb
141
- - spec/dummy/config/initializers/secret_token.rb
166
+ - spec/dummy/config/initializers/new_rails_defaults.rb
142
167
  - spec/dummy/config/initializers/session_store.rb
143
- - spec/dummy/config/initializers/wrap_parameters.rb
144
168
  - spec/dummy/config/locales/en.yml
145
169
  - spec/dummy/config/routes.rb
146
- - spec/dummy/config.ru
147
- - spec/dummy/db/test.sqlite3
170
+ - spec/dummy/db/seeds.rb
171
+ - spec/dummy/doc/README_FOR_APP
172
+ - spec/dummy/log/development.log
173
+ - spec/dummy/log/production.log
174
+ - spec/dummy/log/server.log
148
175
  - spec/dummy/log/test.log
149
176
  - spec/dummy/public/404.html
150
177
  - spec/dummy/public/422.html
151
178
  - spec/dummy/public/500.html
152
179
  - spec/dummy/public/favicon.ico
180
+ - spec/dummy/public/images/rails.png
181
+ - spec/dummy/public/index.html
182
+ - spec/dummy/public/javascripts/application.js
183
+ - spec/dummy/public/javascripts/controls.js
184
+ - spec/dummy/public/javascripts/dragdrop.js
185
+ - spec/dummy/public/javascripts/effects.js
186
+ - spec/dummy/public/javascripts/prototype.js
187
+ - spec/dummy/public/robots.txt
153
188
  - spec/dummy/Rakefile
154
- - spec/dummy/README.rdoc
155
- - spec/dummy/script/rails
189
+ - spec/dummy/README
190
+ - spec/dummy/script/about
191
+ - spec/dummy/script/console
192
+ - spec/dummy/script/dbconsole
193
+ - spec/dummy/script/destroy
194
+ - spec/dummy/script/generate
195
+ - spec/dummy/script/performance/benchmarker
196
+ - spec/dummy/script/performance/profiler
197
+ - spec/dummy/script/plugin
198
+ - spec/dummy/script/runner
199
+ - spec/dummy/script/server
200
+ - spec/dummy/test/performance/browsing_test.rb
201
+ - spec/dummy/test/test_helper.rb
156
202
  - spec/lib/table_renamable/model_spec.rb
157
203
  - spec/spec_helper.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 295d31b7d7ae975d082ac5d807465cd1eafad278
4
- data.tar.gz: 1af6841d11a014733e54832144587c531a795013
5
- SHA512:
6
- metadata.gz: 83340587d906f332996104c16470cf33f59c41cceeea0297956ba371901e459565132335a23406abf245ac4e554bbdc1f5b232ad4678f95efb9a264001d5215f
7
- data.tar.gz: 6e5bc7a75d85aef2fcb27f2d5e0cff43f9fca58ae2bc07fb9209d8ad2bcb7417e3ae015594c1e808e2a9caf2c0637f4eb43d8beeae3932bb6dbf87e3fc2db54d
@@ -1,62 +0,0 @@
1
- module TableRenamable
2
- module ConnectionAdapters
3
- module SQLite3Adapter
4
-
5
- extend ActiveSupport::Concern
6
-
7
- # when we are included we add our behavior
8
- self.included do |klass|
9
- klass.alias_method_chain(:exec_query, :table_renamable)
10
- klass.alias_method_chain(:execute, :table_renamable)
11
- klass.alias_method_chain(:table_structure, :table_renamable)
12
- end
13
-
14
- def exec_query_with_table_renamable(*args, &block)
15
- self.with_retry do
16
- self.exec_query_without_table_renamable(*args, &block)
17
- end
18
- end
19
-
20
- #
21
- # Override execute to reload database info
22
- # @param *args [Array<Mixed>] Just here so we can call super
23
- #
24
- # @return [type] [description]
25
- def execute_with_table_renamable(*args, &block)
26
- self.with_retry do
27
- self.execute_without_table_renamable(*args, &block)
28
- end
29
- end
30
-
31
- def table_structure_with_table_renamable(table_name)
32
- self.with_retry do
33
- # get the correct table name to check - otherwise this will fail
34
- # on retry
35
- current_table_name = TableRenamable::Model.get_current_table_name(
36
- table_name
37
- )
38
- self.table_structure_without_table_renamable(current_table_name)
39
- end
40
- end
41
-
42
-
43
- def with_retry(&block)
44
- # set up tries so we don't keep retrying
45
- tries = 0
46
- begin
47
- tries += 1
48
- # call the actual execute behavior
49
- yield
50
- rescue ActiveRecord::StatementInvalid => e
51
- # only try once
52
- raise e if tries > 1
53
- # re-raise if it's not an error we care about
54
- raise e unless e.message =~ /Could not find table/
55
- # otherwise we reload and retry
56
- TableRenamable::Model.reload_tables
57
- retry
58
- end
59
- end
60
- end
61
- end
62
- end
@@ -1,22 +0,0 @@
1
- module TableRenamable
2
- class Engine < ::Rails::Engine
3
- isolate_namespace TableRenamable
4
-
5
- config.after_initialize do
6
- # set up our reload behavior for when table names change for MySQL
7
- if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
8
- ActiveRecord::ConnectionAdapters::Mysql2Adapter.send(
9
- :include,
10
- TableRenamable::ConnectionAdapters::Mysql2Adapter
11
- )
12
- # same thing for SQLite
13
- elsif defined?(ActiveRecord::ConnectionAdapters::SQLite3Adapter)
14
- ActiveRecord::ConnectionAdapters::SQLite3Adapter.send(
15
- :include,
16
- TableRenamable::ConnectionAdapters::SQLite3Adapter
17
- )
18
- end
19
- end
20
-
21
- end
22
- end