go_import 3.0.0 → 3.0.1
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/bin/go-import +6 -2
- data/lib/go_import/model/deal_class_settings.rb +2 -0
- data/lib/go_import/model/rootmodel.rb +1 -1
- data/lib/go_import.rb +0 -1
- data/sources/VISMA/.gitignore +14 -0
- data/sources/VISMA/.go_import/runner.rb +77 -0
- data/sources/VISMA/Database/KONTAKT.DBF +0 -0
- data/sources/VISMA/Database/KUND.DBF +0 -0
- data/sources/VISMA/Gemfile +5 -0
- data/sources/VISMA/converter.rb +104 -0
- data/sources/VISMA/tomodel.rb +202 -0
- data/sources/csv/Gemfile +1 -1
- data/sources/custom/.gitignore +14 -0
- data/sources/custom/.go_import/runner.rb +30 -0
- data/sources/custom/Gemfile +4 -0
- data/sources/custom/converter.rb +29 -0
- data/sources/easy/.go_import/runner.rb +74 -86
- data/sources/easy/Gemfile +1 -1
- data/sources/easy/converter.rb +21 -147
- data/sources/excel/Gemfile +1 -1
- data/sources/excel/converter.rb +1 -1
- metadata +14 -18
- data/sources/csv/Rakefile.rb +0 -7
- data/sources/csv/spec/exporter_spec.rb +0 -17
- data/sources/csv/spec/sample_data/coworkers.csv +0 -2
- data/sources/csv/spec/sample_data/deals.csv +0 -2
- data/sources/csv/spec/sample_data/organizations.csv +0 -2
- data/sources/csv/spec/sample_data/persons.csv +0 -2
- data/sources/csv/spec/spec_helper.rb +0 -30
- data/sources/easy/Rakefile.rb +0 -7
- data/sources/easy/spec/exporter_spec.rb +0 -10
- data/sources/easy/spec/sample_data/Company.txt +0 -649
- data/sources/easy/spec/spec_helper.rb +0 -30
- data/sources/excel/Rakefile.rb +0 -7
- data/sources/excel/spec/sample_data/sample.xlsx +0 -0
- data/sources/excel/spec/spec_helper.rb +0 -26
- data/sources/excel/spec/tomodel_spec.rb +0 -18
- /data/sources/excel/{template.xlsx → sample-data.xlsx} +0 -0
@@ -3,113 +3,101 @@
|
|
3
3
|
require 'go_import'
|
4
4
|
require_relative("../converter")
|
5
5
|
|
6
|
+
EXPORT_FOLDER = 'export'
|
7
|
+
COWORKER_FILE = "#{EXPORT_FOLDER}/User.txt"
|
8
|
+
ORGANIZATION_FILE = "#{EXPORT_FOLDER}/Company.txt"
|
9
|
+
ORGANIZATION_NOTE_FILE = "#{EXPORT_FOLDER}/Company-History.txt"
|
10
|
+
ORGANIZATION_DOCUMENT_FILE = "#{EXPORT_FOLDER}/Company-Document.txt"
|
11
|
+
PERSON_FILE = "#{EXPORT_FOLDER}/Company-Person.txt"
|
12
|
+
INCLUDE_FILE = "#{EXPORT_FOLDER}/Project-Included.txt"
|
13
|
+
DEAL_FILE = "#{EXPORT_FOLDER}/Project.txt"
|
14
|
+
DEAL_NOTE_FILE = "#{EXPORT_FOLDER}/Project-History.txt"
|
15
|
+
|
6
16
|
def convert_source
|
7
17
|
puts "Trying to convert LIME Easy source to LIME Go..."
|
8
18
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
#
|
13
|
-
# Modify the name of the sheets. Or add/remove sheets based on
|
14
|
-
# your Excel file.
|
15
|
-
|
16
|
-
# First we read each sheet from the excel file into separate
|
17
|
-
# variables
|
18
|
-
excel_workbook = GoImport::ExcelHelper.Open(EXCEL_FILE)
|
19
|
-
|
20
|
-
if defined?(COWORKER_SHEET)
|
21
|
-
if excel_workbook.has_sheet?(COWORKER_SHEET)
|
22
|
-
coworker_rows = excel_workbook.rows_for_sheet COWORKER_SHEET
|
23
|
-
else
|
24
|
-
puts "Warning: can't find sheet '#{COWORKER_SHEET}'"
|
25
|
-
end
|
19
|
+
if !make_sure_database_has_been_exported
|
20
|
+
puts "You must export KONTAKT.mdb to the #{EXPORT_FOLDER} folder."
|
21
|
+
raise
|
26
22
|
end
|
27
23
|
|
28
|
-
|
29
|
-
|
30
|
-
organization_rows = excel_workbook.rows_for_sheet ORGANIZATION_SHEET
|
31
|
-
else
|
32
|
-
puts "Warning: can't find sheet '#{ORGANIZATION_SHEET}'"
|
33
|
-
end
|
34
|
-
end
|
24
|
+
converter = Converter.new
|
25
|
+
rootmodel = GoImport::RootModel.new
|
35
26
|
|
36
|
-
|
37
|
-
if excel_workbook.has_sheet?(PERSON_SHEET)
|
38
|
-
person_rows = excel_workbook.rows_for_sheet PERSON_SHEET
|
39
|
-
else
|
40
|
-
puts "Warning: can't find sheet '#{PERSON_SHEET}'"
|
41
|
-
end
|
42
|
-
end
|
27
|
+
converter.configure rootmodel
|
43
28
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
else
|
48
|
-
puts "Warning: can't find sheet '#{DEAL_SHEET}'"
|
49
|
-
end
|
50
|
-
end
|
29
|
+
coworkers = Hash.new
|
30
|
+
includes = Hash.new
|
31
|
+
people = Hash.new
|
51
32
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
33
|
+
# coworkers
|
34
|
+
# start with these since they are referenced
|
35
|
+
# from everywhere....
|
36
|
+
process_rows COWORKER_FILE do |row|
|
37
|
+
coworkers[row['userIndex']] = row['userId']
|
38
|
+
rootmodel.add_coworker(converter.to_coworker(row))
|
58
39
|
end
|
59
40
|
|
60
|
-
#
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
# And configure the model if we have any custom fields
|
65
|
-
converter.configure rootmodel
|
41
|
+
# organizations
|
42
|
+
process_rows ORGANIZATION_FILE do |row|
|
43
|
+
rootmodel.add_organization(converter.to_organization(row, coworkers, rootmodel))
|
44
|
+
end
|
66
45
|
|
67
|
-
#
|
68
|
-
#
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
rootmodel.add_coworker(converter.to_coworker(row))
|
74
|
-
end
|
46
|
+
# persons
|
47
|
+
# depends on organizations
|
48
|
+
process_rows PERSON_FILE do |row|
|
49
|
+
people[row['personIndex']] = "#{row['PowerSellReferenceID']}-#{row['PowerSellCompanyID']}"
|
50
|
+
# adds it self to the employer
|
51
|
+
converter.to_person(row, rootmodel)
|
75
52
|
end
|
76
53
|
|
77
|
-
#
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
organization_rows.each do |row|
|
82
|
-
rootmodel.add_organization(converter.to_organization(row, rootmodel))
|
83
|
-
end
|
54
|
+
# organization notes
|
55
|
+
process_rows ORGANIZATION_NOTE_FILE do |row|
|
56
|
+
# adds itself if applicable
|
57
|
+
rootmodel.add_note(converter.to_organization_note(row, coworkers, people, rootmodel))
|
84
58
|
end
|
85
59
|
|
86
|
-
#
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
# the root model
|
92
|
-
converter.import_person_to_organization(row, rootmodel)
|
93
|
-
end
|
60
|
+
# Organization - Deal connection
|
61
|
+
# Reads the includes.txt and creats a hash
|
62
|
+
# that connect organizations to deals
|
63
|
+
process_rows INCLUDE_FILE do |row|
|
64
|
+
includes[row['PowerSellProjectID']] = row['PowerSellCompanyID']
|
94
65
|
end
|
95
66
|
|
96
|
-
#
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
end
|
67
|
+
# deals
|
68
|
+
# deals can reference coworkers (responsible), organizations
|
69
|
+
# and persons (contact)
|
70
|
+
process_rows DEAL_FILE do |row|
|
71
|
+
rootmodel.add_deal(converter.to_deal(row, includes, coworkers, rootmodel))
|
102
72
|
end
|
103
73
|
|
104
|
-
#
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
note_rows.each do |row|
|
109
|
-
rootmodel.add_note(converter.to_note(row, rootmodel))
|
110
|
-
end
|
74
|
+
# deal notes
|
75
|
+
process_rows DEAL_NOTE_FILE do |row|
|
76
|
+
# adds itself if applicable
|
77
|
+
rootmodel.add_note(converter.to_deal_note(row, coworkers, rootmodel))
|
111
78
|
end
|
112
79
|
|
113
80
|
return rootmodel
|
114
81
|
end
|
115
82
|
|
83
|
+
def process_rows(file_name)
|
84
|
+
data = File.open(file_name, 'r').read.encode('UTF-8',"ISO-8859-1").strip().gsub('"', '')
|
85
|
+
data = '"' + data.gsub("\t", "\"\t\"") + '"'
|
86
|
+
data = data.gsub("\n", "\"\n\"")
|
87
|
+
|
88
|
+
rows = GoImport::CsvHelper::text_to_hashes(data, "\t", "\n", '"')
|
89
|
+
rows.each do |row|
|
90
|
+
yield row
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def make_sure_database_has_been_exported()
|
95
|
+
return File.exists?(COWORKER_FILE) &&
|
96
|
+
File.exists?(ORGANIZATION_FILE) &&
|
97
|
+
File.exists?(ORGANIZATION_NOTE_FILE) &&
|
98
|
+
File.exists?(ORGANIZATION_DOCUMENT_FILE) &&
|
99
|
+
File.exists?(PERSON_FILE) &&
|
100
|
+
File.exists?(INCLUDE_FILE) &&
|
101
|
+
File.exists?(DEAL_FILE) &&
|
102
|
+
File.exists?(DEAL_NOTE_FILE)
|
103
|
+
end
|
data/sources/easy/Gemfile
CHANGED
data/sources/easy/converter.rb
CHANGED
@@ -30,7 +30,7 @@ require 'go_import'
|
|
30
30
|
#
|
31
31
|
# 4) Upload go.xml to LIME Go. First test your import on staging and
|
32
32
|
# when your customer has approved the import, run it on production.
|
33
|
-
class
|
33
|
+
class Converter
|
34
34
|
# Turns a user from the User.txt Easy Export file into
|
35
35
|
# a go_import coworker.
|
36
36
|
def to_coworker(row)
|
@@ -49,7 +49,7 @@ class Exporter
|
|
49
49
|
|
50
50
|
# Turns a row from the Easy exported Company.txt file into a
|
51
51
|
# go_import organization.
|
52
|
-
def to_organization(row, coworkers)
|
52
|
+
def to_organization(row, coworkers, rootmodel)
|
53
53
|
organization = GoImport::Organization.new
|
54
54
|
# integration_id is typically the company Id in Easy
|
55
55
|
# Must be set to be able to import the same file more
|
@@ -98,14 +98,14 @@ class Exporter
|
|
98
98
|
end
|
99
99
|
|
100
100
|
# Only set other Bisnode fields if the Bisnode Id is empty
|
101
|
-
if bisnode_id.empty?
|
101
|
+
if bisnode_id && bisnode_id.empty?
|
102
102
|
organization.web_site = row['website']
|
103
103
|
end
|
104
104
|
|
105
105
|
# Responsible coworker for the organization.
|
106
106
|
# For instance responsible sales rep.
|
107
107
|
coworker_id = coworkers[row['idUser-Responsible']]
|
108
|
-
organization.responsible_coworker =
|
108
|
+
organization.responsible_coworker = rootmodel.find_coworker_by_integration_id(coworker_id)
|
109
109
|
|
110
110
|
# Tags are set and defined at the same place
|
111
111
|
# Setting a tag: Imported is useful for the user
|
@@ -143,7 +143,7 @@ class Exporter
|
|
143
143
|
|
144
144
|
# Turns a row from the Easy exported Company-Person.txt file into
|
145
145
|
# a go_import model that is used to generate xml
|
146
|
-
def to_person(row)
|
146
|
+
def to_person(row, rootmodel)
|
147
147
|
person = GoImport::Person.new
|
148
148
|
|
149
149
|
# Easy standard fields created in configure method Easy
|
@@ -156,7 +156,7 @@ class Exporter
|
|
156
156
|
person.last_name = row['Last name']
|
157
157
|
|
158
158
|
# set employer connection
|
159
|
-
employer =
|
159
|
+
employer = rootmodel.find_organization_by_integration_id(row['PowerSellCompanyID'])
|
160
160
|
if employer
|
161
161
|
employer.add_employee person
|
162
162
|
end
|
@@ -194,7 +194,7 @@ class Exporter
|
|
194
194
|
# a go_import model that is used to generate xml.
|
195
195
|
# Uses includes hash to lookup organizations to connect
|
196
196
|
# Uses coworkers hash to lookup coworkers to connect
|
197
|
-
def to_deal(row, includes, coworkers)
|
197
|
+
def to_deal(row, includes, coworkers, rootmodel)
|
198
198
|
deal = GoImport::Deal.new
|
199
199
|
# Easy standard fields
|
200
200
|
deal.integration_id = row['PowerSellProjectID']
|
@@ -205,7 +205,7 @@ class Exporter
|
|
205
205
|
deal.order_date = row['order date']
|
206
206
|
|
207
207
|
coworker_id = coworkers[row['isUser-Ansvarig']]
|
208
|
-
deal.responsible_coworker =
|
208
|
+
deal.responsible_coworker = rootmodel.find_coworker_by_integration_id(coworker_id)
|
209
209
|
|
210
210
|
# Should be integer
|
211
211
|
# The currency used in Easy should match the one used in Go
|
@@ -219,7 +219,7 @@ class Exporter
|
|
219
219
|
# assumes that the status is already created in LIME Go. To
|
220
220
|
# create statuses during import add them to the settings
|
221
221
|
# during configure.
|
222
|
-
if !row['Status'].empty?
|
222
|
+
if !row['Status'].nil? && !row['Status'].empty?
|
223
223
|
deal.status = row['Status']
|
224
224
|
end
|
225
225
|
|
@@ -229,7 +229,7 @@ class Exporter
|
|
229
229
|
# Make the deal - organization connection
|
230
230
|
if includes
|
231
231
|
organization_id = includes[row['PowerSellProjectID']]
|
232
|
-
organization =
|
232
|
+
organization = rootmodel.find_organization_by_integration_id(organization_id)
|
233
233
|
if organization
|
234
234
|
deal.customer = organization
|
235
235
|
end
|
@@ -242,11 +242,11 @@ class Exporter
|
|
242
242
|
# a go_import model that is used to generate xml.
|
243
243
|
# Uses coworkers hash to lookup coworkers to connect
|
244
244
|
# Uses people hash to lookup persons to connect
|
245
|
-
def to_organization_note(row, coworkers, people)
|
246
|
-
organization =
|
245
|
+
def to_organization_note(row, coworkers, people, rootmodel)
|
246
|
+
organization = rootmodel.find_organization_by_integration_id(row['PowerSellCompanyID'])
|
247
247
|
|
248
248
|
coworker_id = coworkers[row['idUser']]
|
249
|
-
coworker =
|
249
|
+
coworker = rootmodel.find_coworker_by_integration_id(coworker_id)
|
250
250
|
|
251
251
|
if organization && coworker
|
252
252
|
note = GoImport::Note.new()
|
@@ -265,15 +265,15 @@ class Exporter
|
|
265
265
|
# Turns a row from the Easy exported Project-History.txt file into
|
266
266
|
# a go_import model that is used to generate xml
|
267
267
|
# Uses coworkers hash to lookup coworkers to connect
|
268
|
-
def to_deal_note(row, coworkers)
|
268
|
+
def to_deal_note(row, coworkers, rootmodel)
|
269
269
|
# TODO: This could be improved to read a person from an
|
270
270
|
# organization connected to this deal if any, but since it is
|
271
271
|
# a many to many connection between organizations and deals
|
272
272
|
# it's not a straight forward task
|
273
|
-
deal =
|
273
|
+
deal = rootmodel.find_deal_by_integration_id(row['PowerSellProjectID'])
|
274
274
|
|
275
275
|
coworker_id = coworkers[row['idUser']]
|
276
|
-
coworker =
|
276
|
+
coworker = rootmodel.find_coworker_by_integration_id(coworker_id)
|
277
277
|
|
278
278
|
if deal && coworker
|
279
279
|
note = GoImport::Note.new()
|
@@ -289,147 +289,21 @@ class Exporter
|
|
289
289
|
return nil
|
290
290
|
end
|
291
291
|
|
292
|
-
def configure(
|
293
|
-
# add custom field to your
|
294
|
-
# added to organization, deal and person. Valid types are
|
292
|
+
def configure(rootmodel)
|
293
|
+
# add custom field to your rootmodel here. Custom fields can
|
294
|
+
# be added to organization, deal and person. Valid types are
|
295
295
|
# :String and :Link. If no type is specified :String is used
|
296
296
|
# as default.
|
297
|
-
|
297
|
+
rootmodel.settings.with_person do |person|
|
298
298
|
person.set_custom_field( { :integration_id => 'shoe_size', :title => 'Shoe size', :type => :String} )
|
299
299
|
end
|
300
300
|
|
301
|
-
|
301
|
+
rootmodel.settings.with_deal do |deal|
|
302
302
|
# assessment is default DealState::NoEndState
|
303
303
|
deal.add_status( {:label => '1. Kvalificering' })
|
304
304
|
deal.add_status( {:label => '2. Deal closed', :assessment => GoImport::DealState::PositiveEndState })
|
305
305
|
deal.add_status( {:label => '4. Deal lost', :assessment => GoImport::DealState::NegativeEndState })
|
306
306
|
end
|
307
307
|
end
|
308
|
-
|
309
|
-
def process_rows(file_name)
|
310
|
-
data = File.open(file_name, 'r').read.encode('UTF-8',"ISO-8859-1").strip().gsub('"', '')
|
311
|
-
data = '"' + data.gsub("\t", "\"\t\"") + '"'
|
312
|
-
data = data.gsub("\n", "\"\n\"")
|
313
|
-
|
314
|
-
rows = GoImport::CsvHelper::text_to_hashes(data, "\t", "\n", '"')
|
315
|
-
rows.each do |row|
|
316
|
-
yield row
|
317
|
-
end
|
318
|
-
end
|
319
|
-
|
320
|
-
def to_model(coworkers_filename, organization_filename, persons_filename, orgnotes_filename, includes_filename, deals_filename, dealnotes_filename)
|
321
|
-
# A rootmodel is used to represent all entitite/models
|
322
|
-
# that is exported
|
323
|
-
@rootmodel = GoImport::RootModel.new
|
324
|
-
coworkers = Hash.new
|
325
|
-
includes = Hash.new
|
326
|
-
people = Hash.new
|
327
|
-
|
328
|
-
configure @rootmodel
|
329
|
-
|
330
|
-
# coworkers
|
331
|
-
# start with these since they are referenced
|
332
|
-
# from everywhere....
|
333
|
-
if coworkers_filename && !coworkers_filename.empty?
|
334
|
-
process_rows coworkers_filename do |row|
|
335
|
-
coworkers[row['userIndex']] = row['userId']
|
336
|
-
@rootmodel.add_coworker(to_coworker(row))
|
337
|
-
end
|
338
|
-
end
|
339
|
-
|
340
|
-
# organizations
|
341
|
-
if organization_filename && !organization_filename.empty?
|
342
|
-
process_rows organization_filename do |row|
|
343
|
-
@rootmodel.add_organization(to_organization(row, coworkers))
|
344
|
-
end
|
345
|
-
end
|
346
|
-
|
347
|
-
# persons
|
348
|
-
# depends on organizations
|
349
|
-
if persons_filename && !persons_filename.empty?
|
350
|
-
process_rows persons_filename do |row|
|
351
|
-
people[row['personIndex']] = "#{row['PowerSellReferenceID']}-#{row['PowerSellCompanyID']}"
|
352
|
-
# adds it self to the employer
|
353
|
-
to_person(row)
|
354
|
-
end
|
355
|
-
end
|
356
|
-
|
357
|
-
# organization notes
|
358
|
-
if orgnotes_filename && !orgnotes_filename.empty?
|
359
|
-
process_rows orgnotes_filename do |row|
|
360
|
-
# adds itself if applicable
|
361
|
-
@rootmodel.add_note(to_organization_note(row, coworkers, people))
|
362
|
-
end
|
363
|
-
end
|
364
|
-
|
365
|
-
# Organization - Deal connection
|
366
|
-
# Reads the includes.txt and creats a hash
|
367
|
-
# that connect organizations to deals
|
368
|
-
if includes_filename && !includes_filename.empty?
|
369
|
-
process_rows includes_filename do |row|
|
370
|
-
includes[row['PowerSellProjectID']] = row['PowerSellCompanyID']
|
371
|
-
end
|
372
|
-
end
|
373
|
-
|
374
|
-
# deals
|
375
|
-
# deals can reference coworkers (responsible), organizations
|
376
|
-
# and persons (contact)
|
377
|
-
if deals_filename && !deals_filename.empty?
|
378
|
-
process_rows deals_filename do |row|
|
379
|
-
@rootmodel.add_deal(to_deal(row, includes, coworkers))
|
380
|
-
end
|
381
|
-
end
|
382
|
-
|
383
|
-
# deal notes
|
384
|
-
if dealnotes_filename && !dealnotes_filename.empty?
|
385
|
-
process_rows dealnotes_filename do |row|
|
386
|
-
# adds itself if applicable
|
387
|
-
@rootmodel.add_note(to_deal_note(row, coworkers))
|
388
|
-
end
|
389
|
-
end
|
390
|
-
|
391
|
-
return @rootmodel
|
392
|
-
end
|
393
|
-
|
394
|
-
def save_xml(file)
|
395
|
-
File.open(file,'w') do |f|
|
396
|
-
f.write(GoImport::SerializeHelper::serialize(to_xml_model))
|
397
|
-
end
|
398
|
-
end
|
399
308
|
end
|
400
309
|
|
401
|
-
require "thor"
|
402
|
-
require "fileutils"
|
403
|
-
require 'pathname'
|
404
|
-
|
405
|
-
class Cli < Thor
|
406
|
-
desc "to_go", "Generates a Go XML file"
|
407
|
-
method_option :output, :desc => "Path to file where xml will be output", :default => "export.xml", :type => :string, :required => true
|
408
|
-
method_option :coworkers, :desc => "Path to coworkers csv file", :type => :string, :required => true
|
409
|
-
method_option :organizations, :desc => "Path to organization csv file", :type => :string, :required => true
|
410
|
-
method_option :persons, :desc => "Path to persons csv file", :type => :string, :required => true
|
411
|
-
method_option :orgnotes, :desc => "Path to organization notes file", :type => :string, :required => true
|
412
|
-
method_option :includes, :desc => "Path to include file", :type => :string, :required => true
|
413
|
-
method_option :deals, :desc => "Path to deals csv file", :type => :string, :required => true
|
414
|
-
method_option :dealnotes, :desc => "Path to deal notes file", :type => :string, :required => true
|
415
|
-
def to_go
|
416
|
-
output = options.output
|
417
|
-
exporter = Exporter.new()
|
418
|
-
model = exporter.to_model(options.coworkers, options.organizations, options.persons, options.orgnotes, options.includes, options.deals, options.dealnotes)
|
419
|
-
error = model.sanity_check
|
420
|
-
if error.empty?
|
421
|
-
validation_errors = model.validate
|
422
|
-
|
423
|
-
if validation_errors.empty?
|
424
|
-
model.serialize_to_file(output)
|
425
|
-
puts "Generated Go XML file: '#{output}'."
|
426
|
-
else
|
427
|
-
puts "Could not generate file due to"
|
428
|
-
puts validation_errors
|
429
|
-
end
|
430
|
-
else
|
431
|
-
puts "Could not generate file due to"
|
432
|
-
puts error
|
433
|
-
end
|
434
|
-
end
|
435
|
-
end
|
data/sources/excel/Gemfile
CHANGED
data/sources/excel/converter.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: go_import
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2014-09-
|
15
|
+
date: 2014-09-10 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: iso_country_codes
|
@@ -211,31 +211,27 @@ files:
|
|
211
211
|
- sources/csv/data/organizations.csv
|
212
212
|
- sources/csv/data/persons.csv
|
213
213
|
- sources/csv/Gemfile
|
214
|
-
- sources/
|
215
|
-
- sources/
|
216
|
-
- sources/
|
217
|
-
- sources/
|
218
|
-
- sources/csv/spec/sample_data/organizations.csv
|
219
|
-
- sources/csv/spec/sample_data/persons.csv
|
220
|
-
- sources/csv/spec/spec_helper.rb
|
214
|
+
- sources/custom/.gitignore
|
215
|
+
- sources/custom/.go_import/runner.rb
|
216
|
+
- sources/custom/converter.rb
|
217
|
+
- sources/custom/Gemfile
|
221
218
|
- sources/easy/.gitignore
|
222
219
|
- sources/easy/.go_import/runner.rb
|
223
220
|
- sources/easy/converter.rb
|
224
221
|
- sources/easy/Export/readme.txt
|
225
222
|
- sources/easy/Gemfile
|
226
|
-
- sources/easy/Rakefile.rb
|
227
|
-
- sources/easy/spec/exporter_spec.rb
|
228
|
-
- sources/easy/spec/sample_data/Company.txt
|
229
|
-
- sources/easy/spec/spec_helper.rb
|
230
223
|
- sources/excel/.gitignore
|
231
224
|
- sources/excel/.go_import/runner.rb
|
232
225
|
- sources/excel/converter.rb
|
233
226
|
- sources/excel/Gemfile
|
234
|
-
- sources/excel/
|
235
|
-
- sources/
|
236
|
-
- sources/
|
237
|
-
- sources/
|
238
|
-
- sources/
|
227
|
+
- sources/excel/sample-data.xlsx
|
228
|
+
- sources/VISMA/.gitignore
|
229
|
+
- sources/VISMA/.go_import/runner.rb
|
230
|
+
- sources/VISMA/converter.rb
|
231
|
+
- sources/VISMA/Database/KONTAKT.DBF
|
232
|
+
- sources/VISMA/Database/KUND.DBF
|
233
|
+
- sources/VISMA/Gemfile
|
234
|
+
- sources/VISMA/tomodel.rb
|
239
235
|
- lib/go_import/global_phone.json
|
240
236
|
- spec/address_spec.rb
|
241
237
|
- spec/class_settings_spec.rb
|
data/sources/csv/Rakefile.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'tomodel'
|
3
|
-
|
4
|
-
describe 'Exporter' do
|
5
|
-
before(:all) do
|
6
|
-
exporter = Exporter.new
|
7
|
-
organizations_file = File.join(File.dirname(__FILE__), 'sample_data', 'organizations.csv')
|
8
|
-
coworkers_file = File.join(File.dirname(__FILE__), 'sample_data', 'coworkers.csv')
|
9
|
-
persons_file = File.join(File.dirname(__FILE__), 'sample_data', 'persons.csv')
|
10
|
-
deals_file = File.join(File.dirname(__FILE__), 'sample_data', 'deals.csv')
|
11
|
-
@model = exporter.to_model(coworkers_file, organizations_file, persons_file, deals_file)
|
12
|
-
end
|
13
|
-
it "will find something with a name" do
|
14
|
-
organization = @model.organizations[0]
|
15
|
-
organization.name.length.should > 0
|
16
|
-
end
|
17
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
-
#require File.expand_path("../../config/environment", __FILE__)
|
3
|
-
#require 'rspec/rails'
|
4
|
-
#require 'rspec/autorun'
|
5
|
-
|
6
|
-
# Requires supporting ruby files with custom matchers and macros, etc,
|
7
|
-
# in spec/support/ and its subdirectories.
|
8
|
-
#Dir[File.join(File.dirname(File.absolute_path(__FILE__)),"support/**/*.rb")].each { |f| require f }
|
9
|
-
|
10
|
-
RSpec.configure do |config|
|
11
|
-
# ## Mock Framework
|
12
|
-
#
|
13
|
-
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
14
|
-
#
|
15
|
-
# config.mock_with :mocha
|
16
|
-
# config.mock_with :flexmock
|
17
|
-
# config.mock_with :rr
|
18
|
-
|
19
|
-
# Run specs in random order to surface order dependencies. If you find an
|
20
|
-
# order dependency and want to debug it, you can fix the order by providing
|
21
|
-
# the seed, which is printed after each run.
|
22
|
-
# --seed 1234
|
23
|
-
config.order = "random"
|
24
|
-
|
25
|
-
# Allow both should and expect syntax
|
26
|
-
# http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
27
|
-
config.expect_with :rspec do |c|
|
28
|
-
c.syntax = [:should, :expect]
|
29
|
-
end
|
30
|
-
end
|
data/sources/easy/Rakefile.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'tomodel'
|
3
|
-
|
4
|
-
describe 'Exporter' do
|
5
|
-
before(:all) do
|
6
|
-
exporter = Exporter.new
|
7
|
-
organizations_file = File.join(File.dirname(__FILE__), 'sample_data', 'company.txt')
|
8
|
-
@model = exporter.to_model(nil, organizations_file, nil, nil, nil, nil, nil)
|
9
|
-
end
|
10
|
-
end
|