legacy_migrations 0.3.2 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.2
1
+ 0.3.5
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{legacy_migrations}
8
- s.version = "0.3.2"
8
+ s.version = "0.3.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Bernie Telles"]
12
- s.date = %q{2010-05-31}
12
+ s.date = %q{2010-06-12}
13
13
  s.description = %q{Rails plugin for transferring or updating data between two db structures.}
14
14
  s.email = %q{bernardo.telles@dms.myflorida.com}
15
15
  s.extra_rdoc_files = [
@@ -47,21 +47,21 @@ Gem::Specification.new do |s|
47
47
  s.homepage = %q{http://github.com/btelles/legacy_migrations}
48
48
  s.rdoc_options = ["--charset=UTF-8"]
49
49
  s.require_paths = ["lib"]
50
- s.rubygems_version = %q{1.3.6}
50
+ s.rubygems_version = %q{1.3.7}
51
51
  s.summary = %q{Rails plugin for transferring or updating data between two db structures.}
52
52
  s.test_files = [
53
53
  "spec/lib/transformations_spec.rb",
54
- "spec/db/schema.rb",
55
54
  "spec/models.rb",
56
55
  "spec/legacy_migrations_spec.rb",
57
- "spec/spec_helper.rb"
56
+ "spec/spec_helper.rb",
57
+ "spec/db/schema.rb"
58
58
  ]
59
59
 
60
60
  if s.respond_to? :specification_version then
61
61
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
62
62
  s.specification_version = 3
63
63
 
64
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
64
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
65
65
  s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
66
66
  else
67
67
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
@@ -12,17 +12,20 @@ module LegacyMigrations
12
12
  # This is useful when you're trying to find faulty data in the source
13
13
  # table, and don't want to run the entire dataset.
14
14
  # * <tt>:validate</tt> - Default = true. Use ActiveRecord validations
15
- # when saving destination data.
15
+ # when saving the destination rows.
16
16
  # * <tt>:source_type</tt> - Default = :active_record. Sets the source
17
17
  # destination type.
18
18
  # Options:
19
- # _:active_record_: Assumes the From option is a class that inherits
19
+ # _:active\_record_: Assumes the From option is a class that inherits
20
20
  # from ActiveRecord::Base, then iterates through each record of From
21
21
  # table by using *From*.all.each...
22
22
  # _:other_: Assumes the From option is an iterable 'collection' whose
23
- # elements/items can respond to all columns speficied in the given block.
23
+ # elements/items can respond to all source methods speficied in the given block.
24
24
  # * <tt>:store_as</tt> - Stores the generated destination record as a key
25
- # that is retrievable in other transformations
25
+ # that is retrievable in other transformations. Note that for this to work, the
26
+ # source object must respond to the method <tt>id</tt> which returns
27
+ # a value that is unique for all rows within the table (usually
28
+ # this is just a primary key).
26
29
  #
27
30
  # _Example_
28
31
  # <tt>
@@ -50,6 +53,52 @@ module LegacyMigrations
50
53
  @status_report
51
54
  end
52
55
 
56
+ # Define a source and destination table with which to update data
57
+ #
58
+ # This method accepts all of the same options as <tt>transfer_from</tt>.
59
+ #
60
+ # In addition, you'll need to use a series of columns that match data
61
+ # from the source to the destination. For example, if your source and
62
+ # destination data have a social security number, then you'd use the
63
+ # social security number to match records from the two rows. The following
64
+ # is how you would do that.
65
+ #
66
+ # <tt>
67
+ # update_from SourceTable, :to => DestinationTable do
68
+ # based_on do
69
+ # ssn == from.social_security_number
70
+ # end
71
+ #
72
+ # from :last_name, :to => :last_name
73
+ # end
74
+ # </tt>
75
+ #
76
+ # Note that when using the 'based_on' method, the left-hannd item always
77
+ # corresponds to a column method on the destination table.
78
+ #
79
+ # The methods available in the based_on block correspond to the well-known
80
+ # squirrel plugin's syntax. Here's a quick review of the possible operators:
81
+ #
82
+ # Handles comparisons in the query. This class is analagous to the columns in the database.
83
+ # When comparing the Condition to a value, the operators are used as follows:
84
+ # * ==, === : Straight-up Equals. Can also be used as the "IN" operator if the operand is an Array.
85
+ # Additionally, when the oprand is +nil+, the comparison is correctly generates as "IS NULL"."
86
+ # * =~ : The LIKE and REGEXP operators. If the operand is a String, it will generate a LIKE
87
+ # comparison. If it is a Regexp, the REGEXP operator will be used. NOTE: MySQL regular expressions
88
+ # are NOT the same as Ruby regular expressions. Also NOTE: No wildcards are inserted into the LIKE
89
+ # comparison, so you may add them where you wish.
90
+ # * <=> : Performs a BETWEEN comparison, as long as the operand responds to both #first and #last,
91
+ # which both Ranges and Arrays do.
92
+ # * > : A simple greater-than comparison.
93
+ # * >= : Greater-than or equal-to.
94
+ # * < : A simple less-than comparison.
95
+ # * <= : Less-than or equal-to.
96
+ # * contains? : Like =~, except automatically surrounds the operand in %s, which =~ does not do.
97
+ # * nil? : Works exactly like "column == nil", but in a nicer syntax, which is what Squirrel is all about.
98
+ #
99
+ # ==== Options
100
+ #
101
+ #
53
102
  def update_from(from_table, *args, &block)
54
103
 
55
104
  configure_transfer(from_table, *args) { yield }
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legacy_migrations
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 25
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 3
8
- - 2
9
- version: 0.3.2
9
+ - 5
10
+ version: 0.3.5
10
11
  platform: ruby
11
12
  authors:
12
13
  - Bernie Telles
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-05-31 00:00:00 -04:00
18
+ date: 2010-06-12 00:00:00 -04:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: rspec
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 13
27
30
  segments:
28
31
  - 1
29
32
  - 2
@@ -77,29 +80,33 @@ rdoc_options:
77
80
  require_paths:
78
81
  - lib
79
82
  required_ruby_version: !ruby/object:Gem::Requirement
83
+ none: false
80
84
  requirements:
81
85
  - - ">="
82
86
  - !ruby/object:Gem::Version
87
+ hash: 3
83
88
  segments:
84
89
  - 0
85
90
  version: "0"
86
91
  required_rubygems_version: !ruby/object:Gem::Requirement
92
+ none: false
87
93
  requirements:
88
94
  - - ">="
89
95
  - !ruby/object:Gem::Version
96
+ hash: 3
90
97
  segments:
91
98
  - 0
92
99
  version: "0"
93
100
  requirements: []
94
101
 
95
102
  rubyforge_project:
96
- rubygems_version: 1.3.6
103
+ rubygems_version: 1.3.7
97
104
  signing_key:
98
105
  specification_version: 3
99
106
  summary: Rails plugin for transferring or updating data between two db structures.
100
107
  test_files:
101
108
  - spec/lib/transformations_spec.rb
102
- - spec/db/schema.rb
103
109
  - spec/models.rb
104
110
  - spec/legacy_migrations_spec.rb
105
111
  - spec/spec_helper.rb
112
+ - spec/db/schema.rb