blythedunham-ar_dumper 1.2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.rdoc +77 -0
- data/Rakefile +76 -0
- data/db/migrate/generic_schema.rb +31 -0
- data/init.rb +3 -0
- data/lib/ar_dumper.rb +5 -0
- data/lib/ar_dumper_active_record.rb +31 -0
- data/lib/ar_dumper_base.rb +505 -0
- data/lib/ar_dumper_controller.rb +52 -0
- data/lib/xml_serializer_dumper_support.rb +49 -0
- data/test/ar_dumper_controller_test.rb +10 -0
- data/test/ar_dumper_test.rb +101 -0
- data/test/data/expected_results/all_books.csv +10 -0
- data/test/data/expected_results/all_books.xml +93 -0
- data/test/data/expected_results/all_books.yml +90 -0
- data/test/data/expected_results/except_title_and_author.csv +10 -0
- data/test/data/expected_results/except_title_and_author.xml +75 -0
- data/test/data/expected_results/except_title_and_author.yml +72 -0
- data/test/data/expected_results/only_title_and_author.csv +10 -0
- data/test/data/expected_results/only_title_and_author.xml +39 -0
- data/test/data/expected_results/only_title_and_author.yml +36 -0
- data/test/data/expected_results/proc.csv +3 -0
- data/test/data/expected_results/proc.xml +11 -0
- data/test/data/expected_results/proc.yml +8 -0
- data/test/data/expected_results/second_book.csv +2 -0
- data/test/data/expected_results/second_book.xml +13 -0
- data/test/data/expected_results/second_book.yml +10 -0
- data/test/data/expected_results/topic_name.csv +10 -0
- data/test/data/expected_results/topic_name.xml +48 -0
- data/test/data/expected_results/topic_name.yml +45 -0
- data/test/fixtures/books.yml +65 -0
- data/test/fixtures/topics.yml +5 -0
- data/test/models/book.rb +8 -0
- data/test/models/topic.rb +13 -0
- data/test/run.rb +38 -0
- data/test/test_helper.rb +60 -0
- metadata +96 -0
@@ -0,0 +1,72 @@
|
|
1
|
+
---
|
2
|
+
book_1:
|
3
|
+
topic_id: ""
|
4
|
+
updated_at: Sun Apr 12 21:17:34 -0600 2009
|
5
|
+
id: "1"
|
6
|
+
publisher: Del Rey
|
7
|
+
for_sale: "true"
|
8
|
+
created_at: Sun Apr 12 21:17:34 -0600 2009
|
9
|
+
|
10
|
+
book_2:
|
11
|
+
topic_id: ""
|
12
|
+
updated_at: Sun Apr 12 21:17:34 -0600 2009
|
13
|
+
id: "2"
|
14
|
+
publisher: Del Rey
|
15
|
+
for_sale: "false"
|
16
|
+
created_at: Sun Apr 12 21:17:34 -0600 2009
|
17
|
+
|
18
|
+
book_3:
|
19
|
+
topic_id: ""
|
20
|
+
updated_at: Sun Apr 12 21:17:34 -0600 2009
|
21
|
+
id: "3"
|
22
|
+
publisher: Del Rey
|
23
|
+
for_sale: "true"
|
24
|
+
created_at: Sun Apr 12 21:17:34 -0600 2009
|
25
|
+
|
26
|
+
book_4:
|
27
|
+
topic_id: "4"
|
28
|
+
updated_at: Sun Apr 12 21:17:34 -0600 2009
|
29
|
+
id: "4"
|
30
|
+
publisher: Del Rey
|
31
|
+
for_sale: "true"
|
32
|
+
created_at: Sun Apr 12 21:17:34 -0600 2009
|
33
|
+
|
34
|
+
book_5:
|
35
|
+
topic_id: ""
|
36
|
+
updated_at: Sun Apr 12 21:17:34 -0600 2009
|
37
|
+
id: "5"
|
38
|
+
publisher: ACE Fantasy
|
39
|
+
for_sale: "true"
|
40
|
+
created_at: Sun Apr 12 21:17:34 -0600 2009
|
41
|
+
|
42
|
+
book_6:
|
43
|
+
topic_id: ""
|
44
|
+
updated_at: Sun Apr 12 21:17:34 -0600 2009
|
45
|
+
id: "6"
|
46
|
+
publisher: Hallmark Books
|
47
|
+
for_sale: "true"
|
48
|
+
created_at: Sun Apr 12 21:17:34 -0600 2009
|
49
|
+
|
50
|
+
book_7:
|
51
|
+
topic_id: ""
|
52
|
+
updated_at: Sun Apr 12 21:17:34 -0600 2009
|
53
|
+
id: "7"
|
54
|
+
publisher: Free Press
|
55
|
+
for_sale: "true"
|
56
|
+
created_at: Sun Apr 12 21:17:34 -0600 2009
|
57
|
+
|
58
|
+
book_8:
|
59
|
+
topic_id: ""
|
60
|
+
updated_at: Sun Apr 12 21:17:34 -0600 2009
|
61
|
+
id: "8"
|
62
|
+
publisher: Forgotten Realms
|
63
|
+
for_sale: "true"
|
64
|
+
created_at: Sun Apr 12 21:17:34 -0600 2009
|
65
|
+
|
66
|
+
book_9:
|
67
|
+
topic_id: ""
|
68
|
+
updated_at: Sun Apr 12 21:17:34 -0600 2009
|
69
|
+
id: "9"
|
70
|
+
publisher: W Publishing Group
|
71
|
+
for_sale: "true"
|
72
|
+
created_at: Sun Apr 12 21:17:34 -0600 2009
|
@@ -0,0 +1,10 @@
|
|
1
|
+
title,author_name
|
2
|
+
The Voyage of Jerle Shannara: Antrax,Terry Brooks
|
3
|
+
The Voyage of Jerle Shannara: Ilse Witch,Terry Brooks
|
4
|
+
The Voyage of Jerle Shannara: Jarka Ruus,Terry Brooks
|
5
|
+
The Voyage of Jerle Shannara: Morgwar,Terry Brooks
|
6
|
+
Circle At Center,Douglas Niles
|
7
|
+
WISDOM for the way,Charles R. Swindoll
|
8
|
+
High Tech Startup,John L. Neshem
|
9
|
+
The Two Swords,R.A. Salvatore
|
10
|
+
Come Thirsty,Max Lucado
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<books>
|
3
|
+
<book>
|
4
|
+
<author-name>Terry Brooks</author-name>
|
5
|
+
<title>The Voyage of Jerle Shannara: Antrax</title>
|
6
|
+
</book>
|
7
|
+
<book>
|
8
|
+
<author-name>Terry Brooks</author-name>
|
9
|
+
<title>The Voyage of Jerle Shannara: Ilse Witch</title>
|
10
|
+
</book>
|
11
|
+
<book>
|
12
|
+
<author-name>Terry Brooks</author-name>
|
13
|
+
<title>The Voyage of Jerle Shannara: Jarka Ruus</title>
|
14
|
+
</book>
|
15
|
+
<book>
|
16
|
+
<author-name>Terry Brooks</author-name>
|
17
|
+
<title>The Voyage of Jerle Shannara: Morgwar</title>
|
18
|
+
</book>
|
19
|
+
<book>
|
20
|
+
<author-name>Douglas Niles</author-name>
|
21
|
+
<title>Circle At Center</title>
|
22
|
+
</book>
|
23
|
+
<book>
|
24
|
+
<author-name>Charles R. Swindoll</author-name>
|
25
|
+
<title>WISDOM for the way</title>
|
26
|
+
</book>
|
27
|
+
<book>
|
28
|
+
<author-name>John L. Neshem</author-name>
|
29
|
+
<title>High Tech Startup</title>
|
30
|
+
</book>
|
31
|
+
<book>
|
32
|
+
<author-name>R.A. Salvatore</author-name>
|
33
|
+
<title>The Two Swords</title>
|
34
|
+
</book>
|
35
|
+
<book>
|
36
|
+
<author-name>Max Lucado</author-name>
|
37
|
+
<title>Come Thirsty</title>
|
38
|
+
</book>
|
39
|
+
</books>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
---
|
2
|
+
book_1:
|
3
|
+
author_name: Terry Brooks
|
4
|
+
title: "The Voyage of Jerle Shannara: Antrax"
|
5
|
+
|
6
|
+
book_2:
|
7
|
+
author_name: Terry Brooks
|
8
|
+
title: "The Voyage of Jerle Shannara: Ilse Witch"
|
9
|
+
|
10
|
+
book_3:
|
11
|
+
author_name: Terry Brooks
|
12
|
+
title: "The Voyage of Jerle Shannara: Jarka Ruus"
|
13
|
+
|
14
|
+
book_4:
|
15
|
+
author_name: Terry Brooks
|
16
|
+
title: "The Voyage of Jerle Shannara: Morgwar"
|
17
|
+
|
18
|
+
book_5:
|
19
|
+
author_name: Douglas Niles
|
20
|
+
title: Circle At Center
|
21
|
+
|
22
|
+
book_6:
|
23
|
+
author_name: Charles R. Swindoll
|
24
|
+
title: WISDOM for the way
|
25
|
+
|
26
|
+
book_7:
|
27
|
+
author_name: John L. Neshem
|
28
|
+
title: High Tech Startup
|
29
|
+
|
30
|
+
book_8:
|
31
|
+
author_name: R.A. Salvatore
|
32
|
+
title: The Two Swords
|
33
|
+
|
34
|
+
book_9:
|
35
|
+
author_name: Max Lucado
|
36
|
+
title: Come Thirsty
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<books>
|
3
|
+
<book>
|
4
|
+
<author-name>Terry Brooks</author-name>
|
5
|
+
<topic-content>NO CONTENT</topic-content>
|
6
|
+
</book>
|
7
|
+
<book>
|
8
|
+
<author-name>Terry Brooks</author-name>
|
9
|
+
<topic-content>Giraffes rock</topic-content>
|
10
|
+
</book>
|
11
|
+
</books>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<books>
|
3
|
+
<book>
|
4
|
+
<author-name>Terry Brooks</author-name>
|
5
|
+
<created-at type="datetime">2009-04-12T21:17:34-06:00</created-at>
|
6
|
+
<for-sale type="boolean">false</for-sale>
|
7
|
+
<id type="integer">2</id>
|
8
|
+
<publisher>Del Rey</publisher>
|
9
|
+
<title>The Voyage of Jerle Shannara: Ilse Witch</title>
|
10
|
+
<topic-id type="integer" nil="true"></topic-id>
|
11
|
+
<updated-at type="datetime">2009-04-12T21:17:34-06:00</updated-at>
|
12
|
+
</book>
|
13
|
+
</books>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
title,author_name,topic_name
|
2
|
+
The Voyage of Jerle Shannara: Antrax,Terry Brooks,NO TOPIC
|
3
|
+
The Voyage of Jerle Shannara: Ilse Witch,Terry Brooks,NO TOPIC
|
4
|
+
The Voyage of Jerle Shannara: Jarka Ruus,Terry Brooks,NO TOPIC
|
5
|
+
The Voyage of Jerle Shannara: Morgwar,Terry Brooks,Giraffes
|
6
|
+
Circle At Center,Douglas Niles,NO TOPIC
|
7
|
+
WISDOM for the way,Charles R. Swindoll,NO TOPIC
|
8
|
+
High Tech Startup,John L. Neshem,NO TOPIC
|
9
|
+
The Two Swords,R.A. Salvatore,NO TOPIC
|
10
|
+
Come Thirsty,Max Lucado,NO TOPIC
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<books>
|
3
|
+
<book>
|
4
|
+
<author-name>Terry Brooks</author-name>
|
5
|
+
<title>The Voyage of Jerle Shannara: Antrax</title>
|
6
|
+
<topic-name>NO TOPIC</topic-name>
|
7
|
+
</book>
|
8
|
+
<book>
|
9
|
+
<author-name>Terry Brooks</author-name>
|
10
|
+
<title>The Voyage of Jerle Shannara: Ilse Witch</title>
|
11
|
+
<topic-name>NO TOPIC</topic-name>
|
12
|
+
</book>
|
13
|
+
<book>
|
14
|
+
<author-name>Terry Brooks</author-name>
|
15
|
+
<title>The Voyage of Jerle Shannara: Jarka Ruus</title>
|
16
|
+
<topic-name>NO TOPIC</topic-name>
|
17
|
+
</book>
|
18
|
+
<book>
|
19
|
+
<author-name>Terry Brooks</author-name>
|
20
|
+
<title>The Voyage of Jerle Shannara: Morgwar</title>
|
21
|
+
<topic-name>Giraffes</topic-name>
|
22
|
+
</book>
|
23
|
+
<book>
|
24
|
+
<author-name>Douglas Niles</author-name>
|
25
|
+
<title>Circle At Center</title>
|
26
|
+
<topic-name>NO TOPIC</topic-name>
|
27
|
+
</book>
|
28
|
+
<book>
|
29
|
+
<author-name>Charles R. Swindoll</author-name>
|
30
|
+
<title>WISDOM for the way</title>
|
31
|
+
<topic-name>NO TOPIC</topic-name>
|
32
|
+
</book>
|
33
|
+
<book>
|
34
|
+
<author-name>John L. Neshem</author-name>
|
35
|
+
<title>High Tech Startup</title>
|
36
|
+
<topic-name>NO TOPIC</topic-name>
|
37
|
+
</book>
|
38
|
+
<book>
|
39
|
+
<author-name>R.A. Salvatore</author-name>
|
40
|
+
<title>The Two Swords</title>
|
41
|
+
<topic-name>NO TOPIC</topic-name>
|
42
|
+
</book>
|
43
|
+
<book>
|
44
|
+
<author-name>Max Lucado</author-name>
|
45
|
+
<title>Come Thirsty</title>
|
46
|
+
<topic-name>NO TOPIC</topic-name>
|
47
|
+
</book>
|
48
|
+
</books>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
book_1:
|
3
|
+
author_name: Terry Brooks
|
4
|
+
title: "The Voyage of Jerle Shannara: Antrax"
|
5
|
+
topic_name: NO TOPIC
|
6
|
+
|
7
|
+
book_2:
|
8
|
+
author_name: Terry Brooks
|
9
|
+
title: "The Voyage of Jerle Shannara: Ilse Witch"
|
10
|
+
topic_name: NO TOPIC
|
11
|
+
|
12
|
+
book_3:
|
13
|
+
author_name: Terry Brooks
|
14
|
+
title: "The Voyage of Jerle Shannara: Jarka Ruus"
|
15
|
+
topic_name: NO TOPIC
|
16
|
+
|
17
|
+
book_4:
|
18
|
+
author_name: Terry Brooks
|
19
|
+
title: "The Voyage of Jerle Shannara: Morgwar"
|
20
|
+
topic_name: Giraffes
|
21
|
+
|
22
|
+
book_5:
|
23
|
+
author_name: Douglas Niles
|
24
|
+
title: Circle At Center
|
25
|
+
topic_name: NO TOPIC
|
26
|
+
|
27
|
+
book_6:
|
28
|
+
author_name: Charles R. Swindoll
|
29
|
+
title: WISDOM for the way
|
30
|
+
topic_name: NO TOPIC
|
31
|
+
|
32
|
+
book_7:
|
33
|
+
author_name: John L. Neshem
|
34
|
+
title: High Tech Startup
|
35
|
+
topic_name: NO TOPIC
|
36
|
+
|
37
|
+
book_8:
|
38
|
+
author_name: R.A. Salvatore
|
39
|
+
title: The Two Swords
|
40
|
+
topic_name: NO TOPIC
|
41
|
+
|
42
|
+
book_9:
|
43
|
+
author_name: Max Lucado
|
44
|
+
title: Come Thirsty
|
45
|
+
topic_name: NO TOPIC
|
@@ -0,0 +1,65 @@
|
|
1
|
+
first:
|
2
|
+
id: 1
|
3
|
+
title: "The Voyage of Jerle Shannara: Antrax"
|
4
|
+
publisher: Del Rey
|
5
|
+
author_name: Terry Brooks
|
6
|
+
created_at: 2009-04-12 21:17:34
|
7
|
+
updated_at: 2009-04-12 21:17:34
|
8
|
+
second:
|
9
|
+
id: 2
|
10
|
+
title: "The Voyage of Jerle Shannara: Ilse Witch"
|
11
|
+
publisher: Del Rey
|
12
|
+
author_name: Terry Brooks
|
13
|
+
for_sale: false
|
14
|
+
created_at: 2009-04-12 21:17:34
|
15
|
+
updated_at: 2009-04-12 21:17:34
|
16
|
+
third:
|
17
|
+
id: 3
|
18
|
+
title: "The Voyage of Jerle Shannara: Jarka Ruus"
|
19
|
+
publisher: Del Rey
|
20
|
+
author_name: Terry Brooks
|
21
|
+
created_at: 2009-04-12 21:17:34
|
22
|
+
updated_at: 2009-04-12 21:17:34
|
23
|
+
fourth:
|
24
|
+
id: 4
|
25
|
+
title: "The Voyage of Jerle Shannara: Morgwar"
|
26
|
+
publisher: Del Rey
|
27
|
+
author_name: Terry Brooks
|
28
|
+
created_at: 2009-04-12 21:17:34
|
29
|
+
updated_at: 2009-04-12 21:17:34
|
30
|
+
topic_id: 4
|
31
|
+
fifth:
|
32
|
+
id: 5
|
33
|
+
title: "Circle At Center"
|
34
|
+
publisher: "ACE Fantasy"
|
35
|
+
author_name: Douglas Niles
|
36
|
+
created_at: 2009-04-12 21:17:34
|
37
|
+
updated_at: 2009-04-12 21:17:34
|
38
|
+
sixth:
|
39
|
+
id: 6
|
40
|
+
title: WISDOM for the way
|
41
|
+
publisher: Hallmark Books
|
42
|
+
author_name: Charles R. Swindoll
|
43
|
+
created_at: 2009-04-12 21:17:34
|
44
|
+
updated_at: 2009-04-12 21:17:34
|
45
|
+
seventh:
|
46
|
+
id: 7
|
47
|
+
title: High Tech Startup
|
48
|
+
publisher: Free Press
|
49
|
+
author_name: John L. Neshem
|
50
|
+
created_at: 2009-04-12 21:17:34
|
51
|
+
updated_at: 2009-04-12 21:17:34
|
52
|
+
eighth:
|
53
|
+
id: 8
|
54
|
+
title: The Two Swords
|
55
|
+
publisher: Forgotten Realms
|
56
|
+
author_name: R.A. Salvatore
|
57
|
+
created_at: 2009-04-12 21:17:34
|
58
|
+
updated_at: 2009-04-12 21:17:34
|
59
|
+
ninth:
|
60
|
+
id: 9
|
61
|
+
title: Come Thirsty
|
62
|
+
publisher: W Publishing Group
|
63
|
+
author_name: Max Lucado
|
64
|
+
created_at: 2009-04-12 21:17:34
|
65
|
+
updated_at: 2009-04-12 21:17:34
|
data/test/models/book.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
class Topic < ActiveRecord::Base
|
2
|
+
validates_presence_of :author_name
|
3
|
+
has_many :books
|
4
|
+
|
5
|
+
composed_of :description, :mapping => [ %w(title title), %w(author_name author_name)], :allow_nil => true, :class_name => "TopicDescription"
|
6
|
+
end
|
7
|
+
|
8
|
+
class TopicDescription
|
9
|
+
attr_reader :title, :author_name
|
10
|
+
def initialize(title, author_name)
|
11
|
+
@title, @author_name = title, author_name
|
12
|
+
end
|
13
|
+
end
|
data/test/run.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
dir = File.dirname( __FILE__ )
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
if version=ENV["AR_VERSION"]
|
5
|
+
gem 'activerecord', version
|
6
|
+
gem 'actionpack', version
|
7
|
+
else
|
8
|
+
gem 'activerecord'
|
9
|
+
gem 'actionpack'
|
10
|
+
end
|
11
|
+
require 'active_record'
|
12
|
+
require 'active_record/version'
|
13
|
+
require 'actionpack'
|
14
|
+
require 'action_controller'
|
15
|
+
require 'action_controller/test_case'
|
16
|
+
|
17
|
+
|
18
|
+
ActiveRecord::Base.logger = Logger.new("debug.log")
|
19
|
+
|
20
|
+
config = ActiveRecord::Base.configurations['test'] = {
|
21
|
+
:adapter => "mysql",
|
22
|
+
:username => "root",
|
23
|
+
:encoding => "utf8",
|
24
|
+
:host => '127.0.0.1',
|
25
|
+
:database => 'dumper_test' }
|
26
|
+
|
27
|
+
ActiveRecord::Base.establish_connection( config )
|
28
|
+
|
29
|
+
require File.join(dir, '../db/migrate/generic_schema')
|
30
|
+
|
31
|
+
require 'mocha'
|
32
|
+
require 'test/unit'
|
33
|
+
require 'fileutils'
|
34
|
+
require 'active_record/fixtures'
|
35
|
+
|
36
|
+
|
37
|
+
Dir.glob(File.join(dir, 'models', '*.rb')) {|f| require f }
|
38
|
+
|