taps 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,8 +4,14 @@ A simple database agnostic import/export app to transfer data to/from a remote d
4
4
 
5
5
  == Usage: Server
6
6
 
7
+ Here's how you start a taps server
8
+
7
9
  $ taps server postgres://localdbuser:localdbpass@localhost/dbname httpuser httppassword
8
10
 
11
+ You can also specify an encoding in the database url
12
+
13
+ $ taps server mysql://localdbuser:localdbpass@localhost/dbname?encoding=latin1 httpuser httppassword
14
+
9
15
  == Usage: Client
10
16
 
11
17
  When you want to pull down a database from a taps server
@@ -21,6 +27,7 @@ or when you want to push a local database to a taps server
21
27
  * Blob data may not transfer properly, I suspect that SQLite3 is modifying some native ruby objects.
22
28
  * Foreign Keys get lost in the schema transfer
23
29
  * Large tables (>1 million rows with a large number of columns) get slower as the offset gets larger. This is due to it being inefficient having large offset values in queries.
30
+ * Character encoding problems should be more transparent but they're not, it usually involves looking at the server log to see the error.
24
31
 
25
32
  == Meta
26
33
 
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 2
4
- :patch: 4
4
+ :patch: 5
@@ -0,0 +1,21 @@
1
+ module Taps
2
+ module AdapterHacks
3
+ extend self
4
+
5
+ LIST = {
6
+ :all => ['non_rails_schema_dump'],
7
+ :mysql => ['invalid_text_limit'],
8
+ :postgresql => ['invalid_text_limit']
9
+ }
10
+
11
+ def load(adapter)
12
+ LIST[:all].each do |r|
13
+ require File.dirname(__FILE__) + "/adapter_hacks/#{r}"
14
+ end
15
+
16
+ (LIST[adapter.to_sym] || []).each do |r|
17
+ require File.dirname(__FILE__) + "/adapter_hacks/#{r}"
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,13 @@
1
+ module ActiveRecord
2
+ module ConnectionAdapters
3
+ class TableDefinition
4
+ alias_method :original_text, :text
5
+ def text(*args)
6
+ options = args.extract_options!
7
+ options.delete(:limit)
8
+ column_names = args
9
+ column_names.each { |name| column(name, 'text', options) }
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ module ActiveRecord
2
+ class SchemaDumper
3
+ private
4
+
5
+ def header(stream)
6
+ stream.puts "ActiveRecord::Schema.define do"
7
+ end
8
+
9
+ def tables(stream)
10
+ @connection.tables.sort.each do |tbl|
11
+ table(tbl, stream)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -211,13 +211,15 @@ class ClientSession
211
211
 
212
212
  index_data = session_resource['indexes'].get(:taps_version => Taps.version)
213
213
 
214
- puts Taps::Utils.load_indexes(database_url, index_data)
214
+ output = Taps::Utils.load_indexes(database_url, index_data)
215
+ puts output if output
215
216
  end
216
217
 
217
218
  def cmd_reset_sequences
218
219
  puts "Resetting db sequences in #{database_url}"
219
220
 
220
- puts `#{File.dirname(__FILE__)}/../../bin/schema reset_db_sequences #{database_url}`
221
+ output = `#{File.dirname(__FILE__)}/../../bin/schema reset_db_sequences #{database_url}`
222
+ puts output if output
221
223
  end
222
224
 
223
225
  def format_number(num)
@@ -3,6 +3,8 @@ require 'active_support'
3
3
  require 'stringio'
4
4
  require 'uri'
5
5
 
6
+ require File.dirname(__FILE__) + '/adapter_hacks'
7
+
6
8
  module Taps
7
9
  module Schema
8
10
  extend self
@@ -23,6 +25,7 @@ module Schema
23
25
 
24
26
  def connection(database_url)
25
27
  config = create_config(database_url)
28
+ Taps::AdapterHacks.load(config['adapter'])
26
29
  ActiveRecord::Base.establish_connection(config)
27
30
  end
28
31
 
@@ -79,19 +82,3 @@ EORUBY
79
82
  end
80
83
  end
81
84
  end
82
-
83
- module ActiveRecord
84
- class SchemaDumper
85
- private
86
-
87
- def header(stream)
88
- stream.puts "ActiveRecord::Schema.define do"
89
- end
90
-
91
- def tables(stream)
92
- @connection.tables.sort.each do |tbl|
93
- table(tbl, stream)
94
- end
95
- end
96
- end
97
- end
@@ -3,6 +3,7 @@ require File.dirname(__FILE__) + '/../lib/taps/schema'
3
3
 
4
4
  describe Taps::Schema do
5
5
  before do
6
+ Taps::AdapterHacks.stubs(:load)
6
7
  @connection = mock("AR connection")
7
8
  ActiveRecord::Base.stubs(:connection).returns(@connection)
8
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Chimal, Jr.
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-02-17 00:00:00 -08:00
13
+ date: 2009-02-24 00:00:00 -08:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -84,16 +84,19 @@ extra_rdoc_files: []
84
84
 
85
85
  files:
86
86
  - spec/base.rb
87
- - spec/schema_spec.rb
88
87
  - spec/utils_spec.rb
89
88
  - spec/client_session_spec.rb
90
89
  - spec/server_spec.rb
90
+ - spec/schema_spec.rb
91
91
  - lib/taps/db_session.rb
92
92
  - lib/taps/progress_bar.rb
93
93
  - lib/taps/cli.rb
94
- - lib/taps/config.rb
95
- - lib/taps/schema.rb
96
94
  - lib/taps/client_session.rb
95
+ - lib/taps/adapter_hacks/invalid_text_limit.rb
96
+ - lib/taps/adapter_hacks/non_rails_schema_dump.rb
97
+ - lib/taps/schema.rb
98
+ - lib/taps/adapter_hacks.rb
99
+ - lib/taps/config.rb
97
100
  - lib/taps/server.rb
98
101
  - lib/taps/utils.rb
99
102
  - README.rdoc