taps 0.3.6 → 0.3.7
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/Rakefile +1 -1
- data/VERSION.yml +1 -1
- data/bin/schema +1 -1
- data/lib/taps/data_stream.rb +5 -1
- data/lib/taps/operation.rb +1 -1
- data/lib/taps/schema.rb +3 -2
- data/lib/taps/server.rb +1 -1
- data/lib/taps/utils.rb +4 -1
- metadata +7 -7
    
        data/Rakefile
    CHANGED
    
    | @@ -13,7 +13,7 @@ begin | |
| 13 13 | 
             
                s.add_dependency 'json_pure', '>= 1.2.0', '< 1.5.0'
         | 
| 14 14 | 
             
                s.add_dependency 'sinatra', '~> 1.0.0'
         | 
| 15 15 | 
             
                s.add_dependency 'rest-client', '~> 1.4.0'
         | 
| 16 | 
            -
                s.add_dependency 'sequel', '~> 3. | 
| 16 | 
            +
                s.add_dependency 'sequel', '~> 3.12.0'
         | 
| 17 17 | 
             
                s.add_dependency 'sqlite3-ruby', '~> 1.2.0'
         | 
| 18 18 | 
             
                s.add_dependency 'rack', '>= 1.0.1'
         | 
| 19 19 |  | 
    
        data/VERSION.yml
    CHANGED
    
    
    
        data/bin/schema
    CHANGED
    
    
    
        data/lib/taps/data_stream.rb
    CHANGED
    
    | @@ -38,6 +38,10 @@ class DataStream | |
| 38 38 | 
             
            		state[:table_name].to_sym
         | 
| 39 39 | 
             
            	end
         | 
| 40 40 |  | 
| 41 | 
            +
            	def table_name_sql
         | 
| 42 | 
            +
            		table_name.identifier
         | 
| 43 | 
            +
            	end
         | 
| 44 | 
            +
             | 
| 41 45 | 
             
            	def to_hash
         | 
| 42 46 | 
             
            		state.merge(:klass => self.class.to_s)
         | 
| 43 47 | 
             
            	end
         | 
| @@ -51,7 +55,7 @@ class DataStream | |
| 51 55 | 
             
            	end
         | 
| 52 56 |  | 
| 53 57 | 
             
            	def table
         | 
| 54 | 
            -
            		@table ||= db[ | 
| 58 | 
            +
            		@table ||= db[table_name_sql]
         | 
| 55 59 | 
             
            	end
         | 
| 56 60 |  | 
| 57 61 | 
             
            	def order_by(name=nil)
         | 
    
        data/lib/taps/operation.rb
    CHANGED
    
    | @@ -538,7 +538,7 @@ class Push < Operation | |
| 538 538 | 
             
            	def fetch_local_tables_info
         | 
| 539 539 | 
             
            		tables_with_counts = {}
         | 
| 540 540 | 
             
            		db.tables.each do |table|
         | 
| 541 | 
            -
            			tables_with_counts[table] = db[table].count
         | 
| 541 | 
            +
            			tables_with_counts[table] = db[table.to_sym.identifier].count
         | 
| 542 542 | 
             
            		end
         | 
| 543 543 | 
             
            		apply_table_filter(tables_with_counts)
         | 
| 544 544 | 
             
            	end
         | 
    
        data/lib/taps/schema.rb
    CHANGED
    
    | @@ -14,15 +14,16 @@ module Schema | |
| 14 14 | 
             
            	end
         | 
| 15 15 |  | 
| 16 16 | 
             
            	def dump_table(database_url, table)
         | 
| 17 | 
            +
            		table = table.to_sym
         | 
| 17 18 | 
             
            		Sequel.connect(database_url) do |db|
         | 
| 18 19 | 
             
            			<<END_MIG
         | 
| 19 20 | 
             
            Class.new(Sequel::Migration) do
         | 
| 20 21 | 
             
            	def up
         | 
| 21 | 
            -
            		#{db.dump_table_schema(table, :indexes => false)}
         | 
| 22 | 
            +
            		#{db.dump_table_schema(table.identifier, :indexes => false)}
         | 
| 22 23 | 
             
            	end
         | 
| 23 24 |  | 
| 24 25 | 
             
            	def down
         | 
| 25 | 
            -
            		drop_table( | 
| 26 | 
            +
            		drop_table("#{table}") if @db.table_exists?("#{table}")
         | 
| 26 27 | 
             
            	end
         | 
| 27 28 | 
             
            end
         | 
| 28 29 | 
             
            END_MIG
         | 
    
        data/lib/taps/server.rb
    CHANGED
    
    
    
        data/lib/taps/utils.rb
    CHANGED
    
    | @@ -122,10 +122,11 @@ module Utils | |
| 122 122 | 
             
            	end
         | 
| 123 123 |  | 
| 124 124 | 
             
            	def schema_bin(*args)
         | 
| 125 | 
            -
            		 | 
| 125 | 
            +
            		`'#{File.dirname(__FILE__)}/../../bin/#{bin('schema')}' #{args.map { |a| "'#{a}'" }.join(' ')}`
         | 
| 126 126 | 
             
            	end
         | 
| 127 127 |  | 
| 128 128 | 
             
            	def primary_key(db, table)
         | 
| 129 | 
            +
            		table = table.to_sym.identifier unless table.kind_of?(Sequel::SQL::Identifier)
         | 
| 129 130 | 
             
            		if db.respond_to?(:primary_key)
         | 
| 130 131 | 
             
            			db.primary_key(table)
         | 
| 131 132 | 
             
            		else
         | 
| @@ -134,6 +135,7 @@ module Utils | |
| 134 135 | 
             
            	end
         | 
| 135 136 |  | 
| 136 137 | 
             
            	def single_integer_primary_key(db, table)
         | 
| 138 | 
            +
            		table = table.to_sym.identifier unless table.kind_of?(Sequel::SQL::Identifier)
         | 
| 137 139 | 
             
            		keys = db.schema(table).select { |c| c[1][:primary_key] and c[1][:type] == :integer }
         | 
| 138 140 | 
             
            		not keys.nil? and keys.size == 1
         | 
| 139 141 | 
             
            	end
         | 
| @@ -143,6 +145,7 @@ module Utils | |
| 143 145 | 
             
            		if pkey
         | 
| 144 146 | 
             
            			pkey.kind_of?(Array) ? pkey : [pkey.to_sym]
         | 
| 145 147 | 
             
            		else
         | 
| 148 | 
            +
            			table = table.to_sym.identifier unless table.kind_of?(Sequel::SQL::Identifier)
         | 
| 146 149 | 
             
            			db[table].columns
         | 
| 147 150 | 
             
            		end
         | 
| 148 151 | 
             
            	end
         | 
    
        metadata
    CHANGED
    
    | @@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version | |
| 5 5 | 
             
              segments: 
         | 
| 6 6 | 
             
              - 0
         | 
| 7 7 | 
             
              - 3
         | 
| 8 | 
            -
              -  | 
| 9 | 
            -
              version: 0.3. | 
| 8 | 
            +
              - 7
         | 
| 9 | 
            +
              version: 0.3.7
         | 
| 10 10 | 
             
            platform: ruby
         | 
| 11 11 | 
             
            authors: 
         | 
| 12 12 | 
             
            - Ricardo Chimal, Jr.
         | 
| @@ -14,7 +14,7 @@ autorequire: | |
| 14 14 | 
             
            bindir: bin
         | 
| 15 15 | 
             
            cert_chain: []
         | 
| 16 16 |  | 
| 17 | 
            -
            date: 2010- | 
| 17 | 
            +
            date: 2010-06-02 00:00:00 -07:00
         | 
| 18 18 | 
             
            default_executable: 
         | 
| 19 19 | 
             
            dependencies: 
         | 
| 20 20 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| @@ -75,9 +75,9 @@ dependencies: | |
| 75 75 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 76 76 | 
             
                    segments: 
         | 
| 77 77 | 
             
                    - 3
         | 
| 78 | 
            -
                    -  | 
| 78 | 
            +
                    - 12
         | 
| 79 79 | 
             
                    - 0
         | 
| 80 | 
            -
                    version: 3. | 
| 80 | 
            +
                    version: 3.12.0
         | 
| 81 81 | 
             
              type: :runtime
         | 
| 82 82 | 
             
              version_requirements: *id004
         | 
| 83 83 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| @@ -177,9 +177,9 @@ signing_key: | |
| 177 177 | 
             
            specification_version: 3
         | 
| 178 178 | 
             
            summary: simple database import/export app
         | 
| 179 179 | 
             
            test_files: 
         | 
| 180 | 
            -
            - spec/ | 
| 180 | 
            +
            - spec/base.rb
         | 
| 181 181 | 
             
            - spec/cli_spec.rb
         | 
| 182 182 | 
             
            - spec/data_stream_spec.rb
         | 
| 183 183 | 
             
            - spec/operation_spec.rb
         | 
| 184 | 
            -
            - spec/base.rb
         | 
| 185 184 | 
             
            - spec/server_spec.rb
         | 
| 185 | 
            +
            - spec/utils_spec.rb
         |