ferry 1.1.1 → 1.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ef76e573bfc80a57098b2952267ed933fbfc2ad
4
- data.tar.gz: bb302f11d288ad5f9ce8755f6c1f9caef43dba06
3
+ metadata.gz: 065ab8138b33c19136ad3d48fae24740f770b315
4
+ data.tar.gz: 966b8a66bf724c5956c60ca93ca15d2a77201d67
5
5
  SHA512:
6
- metadata.gz: bf58e8ce129262b23cc641c9d690bf19d8b078530c8f8b774136dc84f03bd1b37f150c2a2c28a5950b5a6db4a8b7e2043fd844882da3a1a1c7313b173a2d3819
7
- data.tar.gz: befe88acf30a6e55483a3349a98e42f8fe61b61b74223aaf57b5325e9b5f5d8930bbaaac0208fd0491e47940cacf0008c9ae249bee9fe48e0d8c911b8795d881
6
+ metadata.gz: da24497d6f36699c0d9ffe2d94d7305605f5df133a09cf2ba68896a83b7daae2a700b0498f0d8ab67d4fa673f3ee008814139ee6d5ef543c44ea47842ded0c67
7
+ data.tar.gz: 41ac1f3daae74a4a20f6937789ccf9a39f49fc6f6e23837846174f0c816eb82bc4ed9e6158ef926550736115675bec1b658c41c342d534fa005c7416696219f1
@@ -4,6 +4,7 @@ rvm:
4
4
  - 2.0.0
5
5
  - 2.1.0
6
6
  - 2.1.2
7
+ - 2.2.0
7
8
  before_install:
8
9
  - sudo apt-get autoremove sqlite3
9
10
  - sudo apt-get install python-software-properties
data/bin/ferry CHANGED
@@ -5,24 +5,7 @@ OptionParser.new do |opts|
5
5
  options = {}
6
6
  opts.banner = "See more documentation at http://cmu-is-projects.github.io/ferry"
7
7
 
8
- opts.on('--db_switch ENVIRONMENT ADAPTER', 'Switches specified database env to a new adapter') do |opt|
9
- raise "too many arguments for input" unless ARGV.length <= 1
10
- raise "please enter a field for environment and table" unless ARGV.length == 1
11
- questionmaster = Ferry::Utilities.new
12
- if questionmaster.continue?("Are you sure you want to switch to a #{ARGV[0]} database in your #{opt} env? It could result in installing software that impacts your project.")
13
- switcher = Ferry::Switcher.new
14
- switcher.to_new_db_type(opt, ARGV[0])
15
- end
16
- end
17
-
18
- opts.on("--to_csv ENVIRONMENT TABLE", 'Exports table to csv file in db/csv/[your db environment]/[your table]') do |opt|
19
- raise "too many arguments for input" unless ARGV.length <= 1
20
- raise "please enter a field for environment and table" unless ARGV.length == 1
21
- exporter = Ferry::Exporter.new
22
- exporter.to_csv(opt, ARGV[0])
23
- end
24
-
25
- opts.on('--import ENVIRONMENT TABLE FILEPATH', 'Imports data from specified file into table and environment of your specification') do |opt|
8
+ opts.on("--import ENVIRONMENT TABLE FILEPATH", 'Imports data from specified file into table and environment of your specification') do |opt|
26
9
  raise "too many arguments for input" unless ARGV.length <= 2
27
10
  raise "please enter a field for environment and table and filename" unless ARGV.length == 2
28
11
  importer = Ferry::Importer.new
@@ -34,6 +17,20 @@ OptionParser.new do |opts|
34
17
  filemaker.make_starter_file
35
18
  end
36
19
 
20
+ opts.on("--to_csv ENVIRONMENT TABLE", 'Exports table to csv file in db/csv/[your db environment]/[your table]') do |opt|
21
+ raise "too many arguments for input" unless ARGV.length <= 1
22
+ raise "please enter a field for environment and table" unless ARGV.length == 1
23
+ exporter = Ferry::Exporter.new
24
+ exporter.to_csv(opt, ARGV[0])
25
+ end
26
+
27
+ opts.on("--to_json ENVIRONMENT TABLE", 'Exports table to json file in db/json/[your db environment]/[your table]') do |opt|
28
+ raise "too many arguments for input" unless ARGV.length <= 1
29
+ raise "please enter a field for environment and table" unless ARGV.length == 1
30
+ exporter = Ferry::Exporter.new
31
+ exporter.to_json(opt, ARGV[0])
32
+ end
33
+
37
34
  opts.on("--to_yaml ENVIRONMENT TABLE", 'Exports table to yaml file in db/yaml/[your db environment]/[your table]') do |opt|
38
35
  raise "too many arguments for input" unless ARGV.length <= 1
39
36
  raise "please enter a field for environment and table" unless ARGV.length == 1
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Ferry::VERSION
9
9
  spec.authors = ["Anthony Corletti", "Logan Watanabe", "Larry Heimann"]
10
10
  spec.email = ["anthcor@gmail.com", "loganwatanabe@gmail.com", "profh@cmu.edu"]
11
- spec.summary = "Ferry is a data migration and data manipulation tool"
12
- spec.description = "Ferry is a data migration and data manipulation tool that seeks to simplify the increasingly prevalent big data problems for developers"
11
+ spec.summary = "Ferry is a data migration and visualization command line tool rubygem"
12
+ spec.description = "Ferry is a data migration and visualization command line tool rubygem that seeks to simplify the increasingly prevalent big data problems for developers"
13
13
  spec.homepage = "https://cmu-is-projects.github.io/ferry"
14
14
  spec.license = "MIT"
15
15
  spec.files = `git ls-files -z`.split("\x0")
@@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency "sqlite3", "~> 1.3.10"
27
27
  spec.add_development_dependency "mysql2", "~> 0.3.16"
28
28
  spec.add_development_dependency "factory_girl", "~> 4.5.0"
29
+ spec.add_development_dependency "json"
29
30
  spec.add_runtime_dependency "progressbar", "~> 0.21.0"
30
31
  spec.add_runtime_dependency "highline", "~> 1.6.21"
31
32
  end
@@ -4,11 +4,11 @@ module Ferry
4
4
  class Exporter < Utilities
5
5
  def to_csv(environment, model)
6
6
  db_type = db_connect(environment)
7
- FileUtils.mkdir "db" unless Dir["db"].present? #to help with tests
7
+ FileUtils.mkdir "db" unless Dir["db"].present?
8
8
  FileUtils.mkdir "db/csv" unless Dir["db/csv"].present?
9
9
  homedir = "db/csv/#{environment}"
10
10
  FileUtils.mkdir homedir unless Dir[homedir].present?
11
- table = ActiveRecord::Base.connection.execute("SELECT * FROM #{model};") #error raised here if no table
11
+ table = ActiveRecord::Base.connection.execute("SELECT * FROM #{model};")
12
12
  CSV.open("#{homedir}/#{model}.csv", "w") do |csv|
13
13
  case db_type
14
14
  when 'sqlite3'
@@ -51,67 +51,103 @@ module Ferry
51
51
 
52
52
  def to_yaml(environment, model)
53
53
  db_type = db_connect(environment)
54
- FileUtils.mkdir "db" unless Dir["db"].present? #to help with tests
54
+ FileUtils.mkdir "db" unless Dir["db"].present?
55
55
  FileUtils.mkdir "db/yaml" unless Dir["db/yaml"].present?
56
56
  homedir = "db/yaml/#{environment}"
57
57
  FileUtils.mkdir homedir unless Dir[homedir].present?
58
- table = ActiveRecord::Base.connection.execute("SELECT * FROM #{model};") #error raised here is no table
58
+ table = ActiveRecord::Base.connection.execute("SELECT * FROM #{model};")
59
59
  db_object = {}
60
60
  db_output = {}
61
61
  case db_type
62
- when 'sqlite3'
63
- yaml_bar = ProgressBar.new("to_csv", table.length)
64
- keys = table[0].keys.first(table[0].length / 2)
65
- db_object["columns"] = keys
66
- model_arr=[]
67
- table.each do |row|
68
- model_arr << row.values_at(*keys)
69
- yaml_bar.inc
70
- end
71
- db_object["records"] = model_arr
72
- db_output[model] = db_object
73
- File.open("#{homedir}/#{model}.yml",'a') do |file|
74
- YAML::dump(db_output, file)
75
- end
76
- when 'postgresql'
77
- yaml_bar = ProgressBar.new("to_csv", table.num_tuples)
78
- keys = table[0].keys
79
- db_object["columns"] = keys
80
- model_arr=[]
81
- table.each do |row|
82
- model_arr << row.values_at(*keys)
83
- yaml_bar.inc
84
- end
85
- db_object["records"] = model_arr
86
- db_output[model] = db_object
87
- File.open("#{homedir}/#{model}.yml",'a') do |file|
88
- YAML::dump(db_output, file)
89
- end
90
- when 'mysql2'
91
- yaml_bar = ProgressBar.new("to_csv", table.count)
92
- db_config = YAML::load(IO.read("config/database.yml"))
93
- columns = ActiveRecord::Base.connection.execute("SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA`= '#{db_config[environment]['database']}' AND `TABLE_NAME`='#{model}';")
94
- col_names=[]
95
- columns.each do |col|
96
- col_names.append(col[0])
97
- end
98
- db_object["columns"] = col_names
99
- model_arr=[]
100
- table.each do |row|
101
- model_arr << row
102
- yaml_bar.inc
103
- end
104
- db_object["records"] = model_arr
105
- db_output[model] = db_object
106
- File.open("#{homedir}/#{model}.yml",'a') do |file|
107
- YAML::dump(db_output, file)
108
- end
109
- else
110
- puts "error in db type"
111
- return false
62
+ when 'sqlite3'
63
+ yaml_bar = ProgressBar.new("to_csv", table.length)
64
+ keys = table[0].keys.first(table[0].length / 2)
65
+ db_object["columns"] = keys
66
+ model_arr=[]
67
+ table.each do |row|
68
+ model_arr << row.values_at(*keys)
69
+ yaml_bar.inc
70
+ end
71
+ db_object["records"] = model_arr
72
+ db_output[model] = db_object
73
+ File.open("#{homedir}/#{model}.yml",'a') do |file|
74
+ YAML::dump(db_output, file)
75
+ end
76
+ when 'postgresql'
77
+ yaml_bar = ProgressBar.new("to_csv", table.num_tuples)
78
+ keys = table[0].keys
79
+ db_object["columns"] = keys
80
+ model_arr=[]
81
+ table.each do |row|
82
+ model_arr << row.values_at(*keys)
83
+ yaml_bar.inc
84
+ end
85
+ db_object["records"] = model_arr
86
+ db_output[model] = db_object
87
+ File.open("#{homedir}/#{model}.yml",'a') do |file|
88
+ YAML::dump(db_output, file)
89
+ end
90
+ when 'mysql2'
91
+ yaml_bar = ProgressBar.new("to_csv", table.count)
92
+ db_config = YAML::load(IO.read("config/database.yml"))
93
+ columns = ActiveRecord::Base.connection.execute("SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA`= '#{db_config[environment]['database']}' AND `TABLE_NAME`='#{model}';")
94
+ col_names=[]
95
+ columns.each do |col|
96
+ col_names.append(col[0])
97
+ end
98
+ db_object["columns"] = col_names
99
+ model_arr=[]
100
+ table.each do |row|
101
+ model_arr << row
102
+ yaml_bar.inc
103
+ end
104
+ db_object["records"] = model_arr
105
+ db_output[model] = db_object
106
+ File.open("#{homedir}/#{model}.yml",'a') do |file|
107
+ YAML::dump(db_output, file)
108
+ end
109
+ else
110
+ puts "error in db type"
111
+ return false
112
112
  end
113
113
  puts ""
114
114
  puts "exported to db/yaml/#{environment}"
115
115
  end
116
+
117
+ # to_json does not implement ProgressBar
118
+ def to_json(environment, model)
119
+ db_type = db_connect(environment)
120
+ FileUtils.mkdir "db" unless Dir["db"].present?
121
+ FileUtils.mkdir "db/json" unless Dir["db/json"].present?
122
+ homedir = "db/json/#{environment}"
123
+ FileUtils.mkdir homedir unless Dir[homedir].present?
124
+ table = ActiveRecord::Base.connection.execute("SELECT * FROM #{model};")
125
+ db_config = YAML::load(IO.read("config/database.yml"))
126
+ if db_type == "mysql2"
127
+ keys = []
128
+ columns = ActiveRecord::Base.connection.execute("SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA`= '#{db_config[environment]['database']}' AND `TABLE_NAME`='#{model}';")
129
+ columns.each do |col|
130
+ keys.append(col[0])
131
+ end
132
+ table_in_json = []
133
+ table.each do |record|
134
+ record_json = {}
135
+ keys.each do |key|
136
+ record_json[key] = record[keys.index(key)]
137
+ end
138
+ table_in_json << record_json
139
+ end
140
+ File.open("#{homedir}/#{model}.json",'a') do |file|
141
+ file.write(table_in_json.to_json)
142
+ end
143
+ else
144
+ File.open("#{homedir}/#{model}.json",'a') do |file|
145
+ file.write(table.to_json)
146
+ end
147
+ end
148
+ end
149
+
150
+ # TODO: export db functions, indexes, views, triggers, transactions, constraints, schemas, tests
151
+ # TODO: test!
116
152
  end
117
153
  end
@@ -25,6 +25,7 @@ module Ferry
25
25
  end
26
26
  end
27
27
 
28
+ # TODO: Add importing .json
28
29
  def import(environment, model, filename)
29
30
  db_connect(environment)
30
31
  adapter = YAML::load(IO.read("config/database.yml"))[environment]["adapter"]
@@ -53,5 +54,8 @@ module Ferry
53
54
  puts ""
54
55
  puts "csv imported to #{model} table"
55
56
  end
57
+
58
+ # TODO: export db functions, indexes, views, triggers, transactions, constraints, schemas, tests
59
+ # TODO: test!
56
60
  end
57
61
  end
@@ -1,3 +1,3 @@
1
1
  module Ferry
2
- VERSION = "1.1.1"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -14,6 +14,10 @@ describe("export functionality") do
14
14
  FileUtils.rm_rf('db')
15
15
  end
16
16
 
17
+ it "should error if specified table does not exist" do
18
+ expect{exporter.to_csv('sqlite3', 'cart')}.to raise_error
19
+ end
20
+
17
21
  describe "to_csv" do
18
22
  it "call should create a populated csv file" do
19
23
  exporter.to_csv('sqlite3', 'carts')
@@ -25,17 +29,12 @@ describe("export functionality") do
25
29
  expect(lines[1]).to eql(["1", "abby@example.com"])
26
30
  expect(lines[26]).to eql(["26", "zach@example.com"])
27
31
  end
28
-
29
- it "should error if specified table does not exist" do
30
- expect{exporter.to_csv('sqlite3', 'cart')}.to raise_error #correct table is "carts"
31
- end
32
-
33
32
  end
34
33
 
35
34
  describe "to_yaml" do
36
35
  it "call should create a populated yaml file" do
37
36
  exporter.to_yaml('sqlite3', 'carts')
38
- file_path = File.expand_path("..",Dir.pwd) + "/spec/db/yaml/sqlite3/carts.yml"
37
+ file_path = File.expand_path("..", Dir.pwd) + "/spec/db/yaml/sqlite3/carts.yml"
39
38
  expect(File).to exist(file_path)
40
39
  output = YAML.load_file(file_path)
41
40
  expect(output["carts"].length).to eql(2)
@@ -44,18 +43,25 @@ describe("export functionality") do
44
43
  expect(output["carts"]["records"][0]).to eql([1,"abby@example.com"])
45
44
  expect(output["carts"]["records"][25]).to eql([26,"zach@example.com"])
46
45
  end
46
+ end
47
47
 
48
- it "should error if specified table does not exist" do
49
- expect{exporter.to_yaml('sqlite3', 'cart')}.to raise_error #correct table is "carts"
48
+ describe "to_json" do
49
+ it "should create a correctly formatted json file" do
50
+ exporter.to_json('sqlite3', 'carts')
51
+ file_path = File.expand_path("..", Dir.pwd) + "/spec/db/json/sqlite3/carts.json"
52
+ file_content = File.read(file_path)
53
+ expect(File).to exist(file_path)
54
+ output = JSON.parse(file_content)
55
+ expect(output.length).to eql(26)
56
+ expect(output[0]["email"]).to eql("abby@example.com")
57
+ expect(output[25]["email"]).to eql("zach@example.com")
50
58
  end
51
59
  end
52
-
53
60
  end
54
61
 
55
62
  describe "postgresql db" do
56
63
  before(:all) do
57
64
  connect("postgresql")
58
- # requires you to have a ferry_test db in pg
59
65
  Contexts.setup
60
66
  end
61
67
  after(:all) do
@@ -63,6 +69,10 @@ describe("export functionality") do
63
69
  FileUtils.rm_rf('db')
64
70
  end
65
71
 
72
+ it "should error if specified table does not exist" do
73
+ expect{exporter.to_csv('postgresql', 'cart')}.to raise_error
74
+ end
75
+
66
76
  describe "to_csv" do
67
77
  it "call should create a populated csv file" do
68
78
  exporter.to_csv('postgresql', 'carts')
@@ -74,11 +84,8 @@ describe("export functionality") do
74
84
  expect(lines[1]).to eql(["1", "abby@example.com"])
75
85
  expect(lines[26]).to eql(["26", "zach@example.com"])
76
86
  end
77
-
78
- it "should error if specified table does not exist" do
79
- expect{exporter.to_csv('postgresql', 'cart')}.to raise_error #correct table is "carts"
80
- end
81
87
  end
88
+
82
89
  describe "to_yaml" do
83
90
  it "call should create a populated yaml file" do
84
91
  exporter.to_yaml('postgresql', 'carts')
@@ -91,9 +98,18 @@ describe("export functionality") do
91
98
  expect(output["carts"]["records"][0]).to eql(["1","abby@example.com"])
92
99
  expect(output["carts"]["records"][25]).to eql(["26","zach@example.com"])
93
100
  end
101
+ end
94
102
 
95
- it "should error if specified table does not exist" do
96
- expect{exporter.to_yaml('postgresql', 'cart')}.to raise_error #correct table is "carts"
103
+ describe "to_json" do
104
+ it "should create a correctly formatted json file" do
105
+ exporter.to_json('postgresql', 'carts')
106
+ file_path = File.expand_path("..", Dir.pwd) + "/spec/db/json/postgresql/carts.json"
107
+ file_content = File.read(file_path)
108
+ expect(File).to exist(file_path)
109
+ output = JSON.parse(file_content)
110
+ expect(output.length).to eql(26)
111
+ expect(output[0]["email"]).to eql("abby@example.com")
112
+ expect(output[25]["email"]).to eql("zach@example.com")
97
113
  end
98
114
  end
99
115
  end
@@ -101,7 +117,6 @@ describe("export functionality") do
101
117
  describe "mysql2 db" do
102
118
  before(:all) do
103
119
  connect("mysql2")
104
- # requires you to have a ferry_test db in mysql
105
120
  Contexts.setup
106
121
  end
107
122
  after(:all) do
@@ -109,6 +124,10 @@ describe("export functionality") do
109
124
  FileUtils.rm_rf('db')
110
125
  end
111
126
 
127
+ it "should error if specified table does not exist" do
128
+ expect{exporter.to_csv('mysql2', 'cart')}.to raise_error
129
+ end
130
+
112
131
  describe "to_csv" do
113
132
  it "call should create a populated csv file" do
114
133
  exporter.to_csv('mysql2', 'carts')
@@ -120,9 +139,6 @@ describe("export functionality") do
120
139
  expect(lines[1]).to eql(["1", "abby@example.com"])
121
140
  expect(lines[26]).to eql(["26", "zach@example.com"])
122
141
  end
123
- it "should error if specified table does not exist" do
124
- expect{exporter.to_csv('mysql2', 'cart')}.to raise_error #correct table is "carts"
125
- end
126
142
  end
127
143
 
128
144
  describe "to_yaml" do
@@ -137,8 +153,18 @@ describe("export functionality") do
137
153
  expect(output["carts"]["records"][0]).to eql([1,"abby@example.com"])
138
154
  expect(output["carts"]["records"][25]).to eql([26,"zach@example.com"])
139
155
  end
140
- it "should error if specified table does not exist" do
141
- expect{exporter.to_yaml('mysql2', 'cart')}.to raise_error #correct table is "carts"
156
+ end
157
+
158
+ describe "to_json" do
159
+ it "should create a correctly formatted json file" do
160
+ exporter.to_json('mysql2', 'carts')
161
+ file_path = File.expand_path("..", Dir.pwd) + "/spec/db/json/mysql2/carts.json"
162
+ file_content = File.read(file_path)
163
+ expect(File).to exist(file_path)
164
+ output = JSON.parse(file_content)
165
+ expect(output.length).to eql(26)
166
+ expect(output[0]["email"]).to eql("abby@example.com")
167
+ expect(output[25]["email"]).to eql("zach@example.com")
142
168
  end
143
169
  end
144
170
  end
@@ -2,13 +2,15 @@ importer = Ferry::Importer.new
2
2
 
3
3
  Dir.chdir("spec") unless Dir.pwd.split('/').last == "spec"
4
4
 
5
-
6
5
  describe "#import" do
6
+
7
7
  describe "sqlite3 db" do
8
+
8
9
  before(:all) do
9
10
  connect("sqlite3")
10
11
  Contexts.setup
11
12
  end
13
+
12
14
  after(:all) do
13
15
  Contexts.teardown
14
16
  Category.delete_all
@@ -26,7 +28,6 @@ describe "#import" do
26
28
  end
27
29
 
28
30
  #SQL INSERT tests
29
-
30
31
  it "should error if given a non-csv file" do
31
32
  expect{importer.import("sqlite3", "categories", File.expand_path("..",Dir.pwd) + "/spec/support/categories_import.xml")}.to raise_error
32
33
  end
@@ -52,10 +53,12 @@ describe "#import" do
52
53
  end
53
54
 
54
55
  describe "mass insert tests (sqlite)" do
56
+
55
57
  before(:each) do
56
58
  connect("sqlite3")
57
59
  Contexts.setup
58
60
  end
61
+
59
62
  after(:each) do
60
63
  Contexts.teardown
61
64
  Cart.delete_all
@@ -81,19 +84,21 @@ describe "#import" do
81
84
  expect(Cart.find_by(id: 2042)).to eql(nil)
82
85
  end
83
86
 
84
-
85
87
  end
86
88
 
87
89
  describe "postgresql db" do
90
+
88
91
  before(:all) do
89
92
  connect("postgresql")
90
93
  # requires you to have a ferry_test db in pg
91
94
  Contexts.setup
92
95
  end
96
+
93
97
  after(:all) do
94
98
  Contexts.teardown
95
99
  Category.delete_all
96
100
  end
101
+
97
102
  it "should import a valid csv into ActiveRecord" do
98
103
  import_path = File.expand_path("..",Dir.pwd) + "/spec/support/categories_import.csv"
99
104
  importer.import("postgresql", "categories", import_path)
@@ -104,13 +109,16 @@ describe "#import" do
104
109
  expect(Category.find_by(id: 42).active).to eql(true)
105
110
  expect(Category.find_by(id: 9).name).to eql("boys' clothing")
106
111
  end
112
+
107
113
  end
108
114
 
109
115
  describe "mass insert tests (postgresql)" do
116
+
110
117
  before(:each) do
111
118
  connect("postgresql")
112
119
  Contexts.setup
113
120
  end
121
+
114
122
  after(:each) do
115
123
  Contexts.teardown
116
124
  Cart.delete_all
@@ -136,19 +144,21 @@ describe "#import" do
136
144
  expect(Cart.find_by(id: 2042)).to eql(nil)
137
145
  end
138
146
 
139
-
140
147
  end
141
148
 
142
149
  describe "mysql2 db" do
150
+
143
151
  before(:all) do
144
152
  connect("mysql2")
145
153
  # requires you to have a ferry_test db in pg
146
154
  Contexts.setup
147
155
  end
156
+
148
157
  after(:all) do
149
158
  Contexts.teardown
150
159
  Category.delete_all
151
160
  end
161
+
152
162
  it "should import a valid csv values into ActiveRecord" do
153
163
  import_path = File.expand_path("..",Dir.pwd) + "/spec/support/categories_import.csv"
154
164
  importer.import("mysql2", "categories", import_path)
@@ -159,13 +169,16 @@ describe "#import" do
159
169
  expect(Category.find_by(id: 42).active).to eql(true)
160
170
  expect(Category.find_by(id: 9).name).to eql("boys' clothing")
161
171
  end
172
+
162
173
  end
163
174
 
164
175
  describe "mass insert tests (mysql2)" do
176
+
165
177
  before(:each) do
166
178
  connect("mysql2")
167
179
  Contexts.setup
168
180
  end
181
+
169
182
  after(:each) do
170
183
  Contexts.teardown
171
184
  Cart.delete_all
@@ -191,6 +204,6 @@ describe "#import" do
191
204
  expect(Cart.find_by(id: 2042)).to eql(nil)
192
205
  end
193
206
 
194
-
195
207
  end
208
+
196
209
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ferry
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Corletti
@@ -10,164 +10,178 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-02-04 00:00:00.000000000 Z
13
+ date: 2015-03-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - ~>
19
+ - - "~>"
20
20
  - !ruby/object:Gem::Version
21
21
  version: 4.1.7
22
22
  type: :development
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - ~>
26
+ - - "~>"
27
27
  - !ruby/object:Gem::Version
28
28
  version: 4.1.7
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: bundler
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - ~>
33
+ - - "~>"
34
34
  - !ruby/object:Gem::Version
35
35
  version: '1.6'
36
36
  type: :development
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - ~>
40
+ - - "~>"
41
41
  - !ruby/object:Gem::Version
42
42
  version: '1.6'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: rake
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - ~>
47
+ - - "~>"
48
48
  - !ruby/object:Gem::Version
49
49
  version: 10.3.2
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - ~>
54
+ - - "~>"
55
55
  - !ruby/object:Gem::Version
56
56
  version: 10.3.2
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: minitest
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - ~>
61
+ - - "~>"
62
62
  - !ruby/object:Gem::Version
63
63
  version: 5.4.1
64
64
  type: :development
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - ~>
68
+ - - "~>"
69
69
  - !ruby/object:Gem::Version
70
70
  version: 5.4.1
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: rspec
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - ~>
75
+ - - "~>"
76
76
  - !ruby/object:Gem::Version
77
77
  version: 3.1.0
78
78
  type: :development
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - ~>
82
+ - - "~>"
83
83
  - !ruby/object:Gem::Version
84
84
  version: 3.1.0
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: pg
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - ~>
89
+ - - "~>"
90
90
  - !ruby/object:Gem::Version
91
91
  version: 0.17.1
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - - ~>
96
+ - - "~>"
97
97
  - !ruby/object:Gem::Version
98
98
  version: 0.17.1
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: sqlite3
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
- - - ~>
103
+ - - "~>"
104
104
  - !ruby/object:Gem::Version
105
105
  version: 1.3.10
106
106
  type: :development
107
107
  prerelease: false
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
- - - ~>
110
+ - - "~>"
111
111
  - !ruby/object:Gem::Version
112
112
  version: 1.3.10
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: mysql2
115
115
  requirement: !ruby/object:Gem::Requirement
116
116
  requirements:
117
- - - ~>
117
+ - - "~>"
118
118
  - !ruby/object:Gem::Version
119
119
  version: 0.3.16
120
120
  type: :development
121
121
  prerelease: false
122
122
  version_requirements: !ruby/object:Gem::Requirement
123
123
  requirements:
124
- - - ~>
124
+ - - "~>"
125
125
  - !ruby/object:Gem::Version
126
126
  version: 0.3.16
127
127
  - !ruby/object:Gem::Dependency
128
128
  name: factory_girl
129
129
  requirement: !ruby/object:Gem::Requirement
130
130
  requirements:
131
- - - ~>
131
+ - - "~>"
132
132
  - !ruby/object:Gem::Version
133
133
  version: 4.5.0
134
134
  type: :development
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
137
137
  requirements:
138
- - - ~>
138
+ - - "~>"
139
139
  - !ruby/object:Gem::Version
140
140
  version: 4.5.0
141
+ - !ruby/object:Gem::Dependency
142
+ name: json
143
+ requirement: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ type: :development
149
+ prerelease: false
150
+ version_requirements: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ version: '0'
141
155
  - !ruby/object:Gem::Dependency
142
156
  name: progressbar
143
157
  requirement: !ruby/object:Gem::Requirement
144
158
  requirements:
145
- - - ~>
159
+ - - "~>"
146
160
  - !ruby/object:Gem::Version
147
161
  version: 0.21.0
148
162
  type: :runtime
149
163
  prerelease: false
150
164
  version_requirements: !ruby/object:Gem::Requirement
151
165
  requirements:
152
- - - ~>
166
+ - - "~>"
153
167
  - !ruby/object:Gem::Version
154
168
  version: 0.21.0
155
169
  - !ruby/object:Gem::Dependency
156
170
  name: highline
157
171
  requirement: !ruby/object:Gem::Requirement
158
172
  requirements:
159
- - - ~>
173
+ - - "~>"
160
174
  - !ruby/object:Gem::Version
161
175
  version: 1.6.21
162
176
  type: :runtime
163
177
  prerelease: false
164
178
  version_requirements: !ruby/object:Gem::Requirement
165
179
  requirements:
166
- - - ~>
180
+ - - "~>"
167
181
  - !ruby/object:Gem::Version
168
182
  version: 1.6.21
169
- description: Ferry is a data migration and data manipulation tool that seeks to simplify
170
- the increasingly prevalent big data problems for developers
183
+ description: Ferry is a data migration and visualization command line tool rubygem
184
+ that seeks to simplify the increasingly prevalent big data problems for developers
171
185
  email:
172
186
  - anthcor@gmail.com
173
187
  - loganwatanabe@gmail.com
@@ -177,9 +191,9 @@ executables:
177
191
  extensions: []
178
192
  extra_rdoc_files: []
179
193
  files:
180
- - .gitignore
181
- - .rspec
182
- - .travis.yml
194
+ - ".gitignore"
195
+ - ".rspec"
196
+ - ".travis.yml"
183
197
  - Gemfile
184
198
  - LICENSE.txt
185
199
  - README.md
@@ -229,20 +243,20 @@ require_paths:
229
243
  - lib
230
244
  required_ruby_version: !ruby/object:Gem::Requirement
231
245
  requirements:
232
- - - '>='
246
+ - - ">="
233
247
  - !ruby/object:Gem::Version
234
248
  version: '0'
235
249
  required_rubygems_version: !ruby/object:Gem::Requirement
236
250
  requirements:
237
- - - '>='
251
+ - - ">="
238
252
  - !ruby/object:Gem::Version
239
253
  version: '0'
240
254
  requirements: []
241
255
  rubyforge_project:
242
- rubygems_version: 2.0.14
256
+ rubygems_version: 2.4.5
243
257
  signing_key:
244
258
  specification_version: 4
245
- summary: Ferry is a data migration and data manipulation tool
259
+ summary: Ferry is a data migration and visualization command line tool rubygem
246
260
  test_files:
247
261
  - spec/config/database.yml
248
262
  - spec/contexts.rb