pt-osc 0.0.5 → 0.1.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.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.1.0
2
+
3
+ - renamed `PtOscAdapter` -> `MysqlPtOscAdapter` for better compatibility with Rails db Rake tasks.
4
+
1
5
  ## 0.0.5
2
6
 
3
7
  - remove dependence on ActiveSupport/Rails
data/README.md CHANGED
@@ -23,7 +23,7 @@ Or install it yourself as:
23
23
 
24
24
  ## Usage
25
25
 
26
- Set your database adapter to be `pt_osc` in your application's database.yml.
26
+ Set your database adapter to be `mysql_pt_osc` in your application's database.yml.
27
27
  Specify `pt-online-schema-change` flags in a `percona` hash in the config.
28
28
  e.g.
29
29
  ```yaml
@@ -3,7 +3,7 @@ require 'active_record/connection_adapters/mysql2_adapter'
3
3
  module ActiveRecord
4
4
  class Base
5
5
  # Establishes a connection to the database that's used by all Active Record objects.
6
- def self.pt_osc_connection(config)
6
+ def self.mysql_pt_osc_connection(config)
7
7
  config[:username] = 'root' if config[:username].nil?
8
8
 
9
9
  if Mysql2::Client.const_defined? :FOUND_ROWS
@@ -12,13 +12,13 @@ module ActiveRecord
12
12
 
13
13
  client = Mysql2::Client.new(config.symbolize_keys)
14
14
  options = [config[:host], config[:username], config[:password], config[:database], config[:port], config[:socket], 0]
15
- ConnectionAdapters::PtOscAdapter.new(client, logger, options, config)
15
+ ConnectionAdapters::MysqlPtOscAdapter.new(client, logger, options, config)
16
16
  end
17
17
  end
18
18
 
19
19
  module ConnectionAdapters
20
- class PtOscAdapter < Mysql2Adapter
21
- ADAPTER_NAME = 'pt-osc'
20
+ class MysqlPtOscAdapter < Mysql2Adapter
21
+ ADAPTER_NAME = 'mysql-pt-osc'
22
22
 
23
23
  # Renames a table.
24
24
  #
@@ -70,7 +70,7 @@ module ActiveRecord
70
70
 
71
71
  protected
72
72
  def execute_pt_osc
73
- return unless @connection.is_a? ActiveRecord::ConnectionAdapters::PtOscAdapter
73
+ return unless @connection.is_a? ActiveRecord::ConnectionAdapters::MysqlPtOscAdapter
74
74
  return if @connection.get_commanded_tables.empty?
75
75
 
76
76
  database_name = database_config[:database]
@@ -104,7 +104,7 @@ module ActiveRecord
104
104
  end
105
105
 
106
106
  def print_pt_osc
107
- return unless @connection.is_a? ActiveRecord::ConnectionAdapters::PtOscAdapter
107
+ return unless @connection.is_a? ActiveRecord::ConnectionAdapters::MysqlPtOscAdapter
108
108
 
109
109
  database_name = database_config[:database]
110
110
 
@@ -1,5 +1,5 @@
1
1
  module Pt
2
2
  module Osc
3
- VERSION = '0.0.5'
3
+ VERSION = '0.1.0'
4
4
  end
5
5
  end
data/lib/pt-osc.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  require 'pt-osc/version'
2
- require 'active_record/connection_adapters/pt_osc_adapter'
2
+ require 'active_record/connection_adapters/mysql_pt_osc_adapter'
3
3
  require 'active_record/pt_osc_migration'
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
  require 'yaml'
3
3
 
4
- class PtOscAdapterTest < Test::Unit::TestCase
4
+ class MysqlPtOscAdapterTest < Test::Unit::TestCase
5
5
  class TestConnection < ActiveRecord::Base; end
6
6
 
7
7
  def test_connection
@@ -11,6 +11,6 @@ class PtOscAdapterTest < Test::Unit::TestCase
11
11
 
12
12
  assert_nothing_raised { TestConnection.establish_connection(spec) }
13
13
  assert_equal true, TestConnection.connection.in_use
14
- assert_kind_of ActiveRecord::ConnectionAdapters::PtOscAdapter, TestConnection.connection
14
+ assert_kind_of ActiveRecord::ConnectionAdapters::MysqlPtOscAdapter, TestConnection.connection
15
15
  end
16
16
  end
data/test/test_helper.rb CHANGED
@@ -14,7 +14,7 @@ Rails.backtrace_cleaner.remove_silencers!
14
14
 
15
15
  def test_spec
16
16
  test_spec = YAML.load_file(Rails.root.join(*%w(.. config database.yml)))['test']
17
- test_spec['adapter'] = 'pt_osc'
17
+ test_spec['adapter'] = 'mysql_pt_osc'
18
18
  test_spec
19
19
  end
20
20
 
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class PtOscAdapterTest < Test::Unit::TestCase
3
+ class MysqlPtOscAdapterTest < Test::Unit::TestCase
4
4
  class TestConnection < ActiveRecord::Base; end
5
5
 
6
6
  context 'a pt-osc adapter' do
@@ -104,7 +104,7 @@ class PtOscMigrationUnitTest < Test::Unit::TestCase
104
104
  context 'with a pt-osc connection' do
105
105
  setup do
106
106
  @mock_connection = mock
107
- @mock_connection.stubs(:is_a?).with(ActiveRecord::ConnectionAdapters::PtOscAdapter).returns(true)
107
+ @mock_connection.stubs(:is_a?).with(ActiveRecord::ConnectionAdapters::MysqlPtOscAdapter).returns(true)
108
108
 
109
109
  @old_connection = @migration.instance_variable_get(:@connection)
110
110
  @migration.instance_variable_set(:@connection, @mock_connection)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pt-osc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-19 00:00:00.000000000 Z
12
+ date: 2014-07-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -169,7 +169,7 @@ files:
169
169
  - Gemfile
170
170
  - README.md
171
171
  - Rakefile
172
- - lib/active_record/connection_adapters/pt_osc_adapter.rb
172
+ - lib/active_record/connection_adapters/mysql_pt_osc_adapter.rb
173
173
  - lib/active_record/pt_osc_migration.rb
174
174
  - lib/pt-osc.rb
175
175
  - lib/pt-osc/version.rb
@@ -210,10 +210,10 @@ files:
210
210
  - test/dummy/public/500.html
211
211
  - test/dummy/public/favicon.ico
212
212
  - test/dummy/script/rails
213
- - test/functional/pt_osc_adapter_test.rb
213
+ - test/functional/mysql_pt_osc_adapter_test.rb
214
214
  - test/functional/pt_osc_migration_functional_test.rb
215
215
  - test/test_helper.rb
216
- - test/unit/pt_osc_adapter_test.rb
216
+ - test/unit/mysql_pt_osc_adapter_test.rb
217
217
  - test/unit/pt_osc_migration_unit_test.rb
218
218
  homepage: https://github.com/steverice/pt-osc
219
219
  licenses: []
@@ -229,7 +229,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
229
229
  version: '0'
230
230
  segments:
231
231
  - 0
232
- hash: -1631463669037670360
232
+ hash: -1002230832062857032
233
233
  required_rubygems_version: !ruby/object:Gem::Requirement
234
234
  none: false
235
235
  requirements:
@@ -238,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
238
238
  version: '0'
239
239
  segments:
240
240
  - 0
241
- hash: -1631463669037670360
241
+ hash: -1002230832062857032
242
242
  requirements: []
243
243
  rubyforge_project:
244
244
  rubygems_version: 1.8.23
@@ -282,8 +282,8 @@ test_files:
282
282
  - test/dummy/public/500.html
283
283
  - test/dummy/public/favicon.ico
284
284
  - test/dummy/script/rails
285
- - test/functional/pt_osc_adapter_test.rb
285
+ - test/functional/mysql_pt_osc_adapter_test.rb
286
286
  - test/functional/pt_osc_migration_functional_test.rb
287
287
  - test/test_helper.rb
288
- - test/unit/pt_osc_adapter_test.rb
288
+ - test/unit/mysql_pt_osc_adapter_test.rb
289
289
  - test/unit/pt_osc_migration_unit_test.rb