trucker 0.3.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.rdoc +15 -25
  2. data/VERSION.yml +2 -2
  3. metadata +5 -5
@@ -13,7 +13,7 @@ Trucker is a gem that helps migrate legacy data into a Rails app.
13
13
 
14
14
  config.gem "trucker"
15
15
 
16
- 2. Generate the basic trucker files
16
+ 3. Generate the basic trucker files
17
17
 
18
18
  script/generate truck
19
19
 
@@ -24,7 +24,7 @@ Trucker is a gem that helps migrate legacy data into a Rails app.
24
24
  * Add app/models/legacy to load path in Rails Initializer config block
25
25
  * Generate sample migration task (using pluralized model names)
26
26
 
27
- 3. Update the legacy database adapter in <em>database.yml</em> with your legacy database info
27
+ 4. Update the legacy database adapter in <em>database.yml</em> with your legacy database info
28
28
 
29
29
  legacy:
30
30
  adapter: mysql
@@ -35,21 +35,21 @@ Trucker is a gem that helps migrate legacy data into a Rails app.
35
35
 
36
36
  (By convention, we recommend naming your legacy database APP_NAME_legacy.)
37
37
 
38
- 4. If the legacy database doesn't already exist, add it.
38
+ 5. If the legacy database doesn't already exist, add it.
39
39
 
40
40
  rake db:create:all
41
41
 
42
- 5. Import your legacy data into the legacy database
42
+ 6. Import your legacy data into the legacy database
43
43
 
44
44
  mysql -u root app_legacy < old_database.sql
45
45
 
46
- 6. Update <em>set_table_name</em> in each of your legacy models as needed
46
+ 7. Update <em>set_table_name</em> in each of your legacy models as needed
47
47
 
48
48
  class LegacyPost < LegacyBase
49
49
  set_table_name "LEGACY_TABLE_NAME_GOES_HERE"
50
50
  end
51
51
 
52
- 7. Update legacy model field mappings as needed
52
+ 8. Update legacy model field mappings as needed
53
53
 
54
54
  class LegacyPost < LegacyBase
55
55
  set_table_name "YOUR LEGACY TABLE NAME GOES HERE"
@@ -62,40 +62,30 @@ Trucker is a gem that helps migrate legacy data into a Rails app.
62
62
  end
63
63
  end
64
64
 
65
- Non-legacy model attributes on the left side.
65
+ New model attributes on the left side.
66
66
  Legacy model attributes on the right side.
67
67
  (aka :new_field => legacy_field)
68
68
 
69
- 8. Need to tweak some data? Just add some core ruby methods or add a helper method.
69
+ 9. Need to tweak some data? Just add some core ruby methods or add a helper method.
70
70
 
71
71
  class LegacyPost < LegacyBase
72
72
  set_table_name "YOUR LEGACY TABLE NAME GOES HERE"
73
73
 
74
74
  def map
75
75
  {
76
- :headline => self.title.squish.capitalize,
77
- :body => self.long_text.squish
78
- }
79
- end
80
- end
81
-
82
- class LegacyPost < LegacyBase
83
- set_table_name "YOUR LEGACY TABLE NAME GOES HERE"
84
-
85
- def map
86
- {
87
- :headline => tweak_title(self.title.squish),
88
- :body => self.long_text.squish
76
+ :headline => self.title.squish.capitalize, # <= Added capitalize method
77
+ :body => tweak_body(self.long_text.squish) # <= Added tweak_body method
89
78
  }
90
79
  end
91
80
 
92
- def tweak_title(title)
93
- title = title.capitalize
94
- title = title.gsub(/teh/, "the")
81
+ # Insert helper methods as needed
82
+ def tweak_body(body)
83
+ body = body.gsub(/<br \//,"\n") # <= Convert break tags into normal line breaks
84
+ body = body.gsub(/teh/, "the") # <= Fix common typos
95
85
  end
96
86
  end
97
87
 
98
- 9. Start migrating!
88
+ 10. Start migrating!
99
89
 
100
90
  rake db:migrate:posts
101
91
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- :minor: 3
2
+ :minor: 4
3
3
  :build:
4
- :patch: 0
4
+ :patch: 1
5
5
  :major: 0
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trucker
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 3
9
- - 0
10
- version: 0.3.0
8
+ - 4
9
+ - 1
10
+ version: 0.4.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Patrick Crowley and Rob Kaufman
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-17 00:00:00 -05:00
18
+ date: 2010-07-21 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency