datashift 0.2.1 → 0.2.2
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/.document +5 -5
- data/LICENSE.txt +26 -26
- data/README.markdown +326 -305
- data/README.rdoc +19 -19
- data/Rakefile +86 -93
- data/VERSION +1 -1
- data/datashift.gemspec +163 -152
- data/lib/applications/jruby/jexcel_file.rb +410 -408
- data/lib/applications/jruby/word.rb +79 -79
- data/lib/datashift.rb +183 -152
- data/lib/datashift/exceptions.rb +11 -11
- data/lib/datashift/file_definitions.rb +353 -353
- data/lib/datashift/mapping_file_definitions.rb +87 -87
- data/lib/datashift/method_detail.rb +293 -275
- data/lib/datashift/method_dictionary.rb +208 -209
- data/lib/datashift/method_mapper.rb +90 -90
- data/lib/datashift/model_mapper.rb +27 -0
- data/lib/exporters/csv_exporter.rb +36 -0
- data/lib/exporters/excel_exporter.rb +116 -0
- data/lib/exporters/exporter_base.rb +15 -0
- data/lib/generators/csv_generator.rb +36 -36
- data/lib/generators/excel_generator.rb +106 -122
- data/lib/generators/generator_base.rb +13 -13
- data/lib/helpers/core_ext/to_b.rb +24 -24
- data/lib/helpers/rake_utils.rb +42 -0
- data/lib/helpers/spree_helper.rb +194 -153
- data/lib/java/poi-3.7/LICENSE +507 -507
- data/lib/java/poi-3.7/NOTICE +21 -21
- data/lib/java/poi-3.7/RELEASE_NOTES.txt +115 -115
- data/lib/loaders/csv_loader.rb +98 -98
- data/lib/loaders/excel_loader.rb +155 -155
- data/lib/loaders/loader_base.rb +420 -420
- data/lib/loaders/spreadsheet_loader.rb +136 -136
- data/lib/loaders/spree/image_loader.rb +67 -63
- data/lib/loaders/spree/product_loader.rb +289 -248
- data/lib/thor/generate_excel.thor +54 -0
- data/sandbox/app/controllers/application_controller.rb +3 -0
- data/sandbox/config/application.rb +43 -0
- data/sandbox/config/database.yml +34 -0
- data/sandbox/config/environment.rb +7 -0
- data/sandbox/config/environments/development.rb +30 -0
- data/spec/csv_loader_spec.rb +30 -30
- data/spec/datashift_spec.rb +26 -26
- data/spec/db/migrate/20110803201325_create_test_bed.rb +85 -85
- data/spec/excel_exporter_spec.rb +78 -78
- data/spec/excel_generator_spec.rb +78 -78
- data/spec/excel_loader_spec.rb +223 -223
- data/spec/file_definitions.rb +141 -141
- data/spec/fixtures/ProjectsDefaults.yml +29 -29
- data/spec/fixtures/config/database.yml +27 -27
- data/spec/fixtures/datashift_Spree_db.sqlite +0 -0
- data/spec/fixtures/datashift_test_models_db.sqlite +0 -0
- data/spec/fixtures/negative/SpreeProdMiss1Mandatory.csv +4 -4
- data/spec/fixtures/negative/SpreeProdMissManyMandatory.csv +4 -4
- data/spec/fixtures/spree/SpreeProducts.csv +4 -4
- data/spec/fixtures/spree/SpreeProducts.xls +0 -0
- data/spec/fixtures/spree/SpreeProductsMultiColumn.csv +4 -4
- data/spec/fixtures/spree/SpreeProductsMultiColumn.xls +0 -0
- data/spec/fixtures/spree/SpreeProductsSimple.csv +4 -4
- data/spec/fixtures/spree/SpreeProductsWithImages.csv +4 -4
- data/spec/fixtures/spree/SpreeZoneExample.csv +5 -5
- data/spec/fixtures/test_model_defs.rb +57 -57
- data/spec/loader_spec.rb +120 -120
- data/spec/method_dictionary_spec.rb +242 -242
- data/spec/method_mapper_spec.rb +41 -41
- data/spec/spec_helper.rb +154 -116
- data/spec/spree_exporter_spec.rb +67 -0
- data/spec/spree_generator_spec.rb +77 -64
- data/spec/spree_loader_spec.rb +363 -324
- data/spec/spree_method_mapping_spec.rb +218 -214
- data/tasks/config/seed_fu_product_template.erb +15 -15
- data/tasks/config/tidy_config.txt +12 -12
- data/tasks/{excel_generator.rake → export/excel_generator.rake} +101 -78
- data/tasks/file_tasks.rake +36 -36
- data/tasks/import/csv.rake +50 -49
- data/tasks/import/excel.rake +74 -71
- data/tasks/spree/image_load.rake +108 -108
- data/tasks/spree/product_loader.rake +43 -43
- data/tasks/word_to_seedfu.rake +166 -166
- data/test/helper.rb +18 -18
- data/test/test_interact.rb +7 -7
- metadata +16 -8
- data/datashift-0.1.0.gem +0 -0
- data/tasks/db_tasks.rake +0 -66
data/test/helper.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler'
|
3
|
-
begin
|
4
|
-
Bundler.setup(:default, :development)
|
5
|
-
rescue Bundler::BundlerError => e
|
6
|
-
$stderr.puts e.message
|
7
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
-
exit e.status_code
|
9
|
-
end
|
10
|
-
require 'test/unit'
|
11
|
-
require 'shoulda'
|
12
|
-
|
13
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
-
require 'DataShift'
|
16
|
-
|
17
|
-
class Test::Unit::TestCase
|
18
|
-
end
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
require 'shoulda'
|
12
|
+
|
13
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
+
require 'DataShift'
|
16
|
+
|
17
|
+
class Test::Unit::TestCase
|
18
|
+
end
|
data/test/test_interact.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class TestDataShift < Test::Unit::TestCase
|
4
|
-
should "probably rename this file and start testing for real" do
|
5
|
-
flunk "hey buddy, you should probably rename this file and start testing for real"
|
6
|
-
end
|
7
|
-
end
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestDataShift < Test::Unit::TestCase
|
4
|
+
should "probably rename this file and start testing for real" do
|
5
|
+
flunk "hey buddy, you should probably rename this file and start testing for real"
|
6
|
+
end
|
7
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: datashift
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Thomas Statter
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-03-05 00:00:00 Z
|
14
14
|
dependencies: []
|
15
15
|
|
16
16
|
description: A suite of tools to move data between ActiveRecord models,databases,applications like Excel/Open Office, files and projects including Spree
|
@@ -30,7 +30,6 @@ files:
|
|
30
30
|
- README.rdoc
|
31
31
|
- Rakefile
|
32
32
|
- VERSION
|
33
|
-
- datashift-0.1.0.gem
|
34
33
|
- datashift.gemspec
|
35
34
|
- lib/applications/jruby/jexcel_file.rb
|
36
35
|
- lib/applications/jruby/word.rb
|
@@ -41,10 +40,15 @@ files:
|
|
41
40
|
- lib/datashift/method_detail.rb
|
42
41
|
- lib/datashift/method_dictionary.rb
|
43
42
|
- lib/datashift/method_mapper.rb
|
43
|
+
- lib/datashift/model_mapper.rb
|
44
|
+
- lib/exporters/csv_exporter.rb
|
45
|
+
- lib/exporters/excel_exporter.rb
|
46
|
+
- lib/exporters/exporter_base.rb
|
44
47
|
- lib/generators/csv_generator.rb
|
45
48
|
- lib/generators/excel_generator.rb
|
46
49
|
- lib/generators/generator_base.rb
|
47
50
|
- lib/helpers/core_ext/to_b.rb
|
51
|
+
- lib/helpers/rake_utils.rb
|
48
52
|
- lib/helpers/spree_helper.rb
|
49
53
|
- lib/java/poi-3.7/._poi-3.7-20101029.jar5645100390082102460.tmp
|
50
54
|
- lib/java/poi-3.7/LICENSE
|
@@ -67,6 +71,7 @@ files:
|
|
67
71
|
- lib/loaders/spreadsheet_loader.rb
|
68
72
|
- lib/loaders/spree/image_loader.rb
|
69
73
|
- lib/loaders/spree/product_loader.rb
|
74
|
+
- lib/thor/generate_excel.thor
|
70
75
|
- public/spree/products/large/DEMO_001_ror_bag.jpeg
|
71
76
|
- public/spree/products/large/DEMO_002_Powerstation.jpg
|
72
77
|
- public/spree/products/large/DEMO_003_ror_mug.jpeg
|
@@ -82,6 +87,11 @@ files:
|
|
82
87
|
- public/spree/products/small/DEMO_001_ror_bag.jpeg
|
83
88
|
- public/spree/products/small/DEMO_002_Powerstation.jpg
|
84
89
|
- public/spree/products/small/DEMO_003_ror_mug.jpeg
|
90
|
+
- sandbox/app/controllers/application_controller.rb
|
91
|
+
- sandbox/config/application.rb
|
92
|
+
- sandbox/config/database.yml
|
93
|
+
- sandbox/config/environment.rb
|
94
|
+
- sandbox/config/environments/development.rb
|
85
95
|
- spec/csv_loader_spec.rb
|
86
96
|
- spec/datashift_spec.rb
|
87
97
|
- spec/db/migrate/20110803201325_create_test_bed.rb
|
@@ -98,6 +108,7 @@ files:
|
|
98
108
|
- spec/fixtures/SimpleProjects.xls
|
99
109
|
- spec/fixtures/config/database.yml
|
100
110
|
- spec/fixtures/datashift_Spree_db.sqlite
|
111
|
+
- spec/fixtures/datashift_test_models_db.sqlite
|
101
112
|
- spec/fixtures/images/DEMO_001_ror_bag.jpeg
|
102
113
|
- spec/fixtures/images/DEMO_002_Powerstation.jpg
|
103
114
|
- spec/fixtures/images/DEMO_003_ror_mug.jpeg
|
@@ -124,13 +135,13 @@ files:
|
|
124
135
|
- spec/method_dictionary_spec.rb
|
125
136
|
- spec/method_mapper_spec.rb
|
126
137
|
- spec/spec_helper.rb
|
138
|
+
- spec/spree_exporter_spec.rb
|
127
139
|
- spec/spree_generator_spec.rb
|
128
140
|
- spec/spree_loader_spec.rb
|
129
141
|
- spec/spree_method_mapping_spec.rb
|
130
142
|
- tasks/config/seed_fu_product_template.erb
|
131
143
|
- tasks/config/tidy_config.txt
|
132
|
-
- tasks/
|
133
|
-
- tasks/excel_generator.rake
|
144
|
+
- tasks/export/excel_generator.rake
|
134
145
|
- tasks/file_tasks.rake
|
135
146
|
- tasks/import/csv.rake
|
136
147
|
- tasks/import/excel.rake
|
@@ -152,9 +163,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
152
163
|
requirements:
|
153
164
|
- - ">="
|
154
165
|
- !ruby/object:Gem::Version
|
155
|
-
hash: 2
|
156
|
-
segments:
|
157
|
-
- 0
|
158
166
|
version: "0"
|
159
167
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
168
|
none: false
|
data/datashift-0.1.0.gem
DELETED
Binary file
|
data/tasks/db_tasks.rake
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
# Author :: Tom Statter
|
2
|
-
# Date :: Mar 2011
|
3
|
-
#
|
4
|
-
# License:: The MIT License (Free and OpenSource)
|
5
|
-
#
|
6
|
-
# About:: Additional Rake tasks useful when testing seeding DB via DataShift
|
7
|
-
#
|
8
|
-
namespace :autotelik do
|
9
|
-
|
10
|
-
namespace :db do
|
11
|
-
|
12
|
-
SYSTEM_TABLE_EXCLUSION_LIST = ['schema_migrations']
|
13
|
-
|
14
|
-
desc "Purge the current database"
|
15
|
-
|
16
|
-
task :purge, [:exclude_system_tables] => [:environment] do |t, args|
|
17
|
-
require 'highline/import'
|
18
|
-
|
19
|
-
if(RAILS_ENV == 'production')
|
20
|
-
agree("WARNING: In Production database, REALLY PURGE ? [y]:")
|
21
|
-
end
|
22
|
-
|
23
|
-
config = ActiveRecord::Base.configurations[RAILS_ENV || 'development']
|
24
|
-
case config['adapter']
|
25
|
-
when "mysql", "jdbcmysql"
|
26
|
-
ActiveRecord::Base.establish_connection(config)
|
27
|
-
ActiveRecord::Base.connection.tables.each do |table|
|
28
|
-
next if(args[:exclude_system_tables] && SYSTEM_TABLE_EXCLUSION_LIST.include?(table) )
|
29
|
-
puts "purging table: #{table}"
|
30
|
-
ActiveRecord::Base.connection.execute("TRUNCATE #{table}")
|
31
|
-
end
|
32
|
-
when "sqlite","sqlite3"
|
33
|
-
dbfile = config["database"] || config["dbfile"]
|
34
|
-
File.delete(dbfile) if File.exist?(dbfile)
|
35
|
-
when "sqlserver"
|
36
|
-
dropfkscript = "#{config["host"]}.#{config["database"]}.DP1".gsub(/\\/,'-')
|
37
|
-
`osql -E -S #{config["host"]} -d #{config["database"]} -i db\\#{dropfkscript}`
|
38
|
-
`osql -E -S #{config["host"]} -d #{config["database"]} -i db\\#{RAILS_ENV}_structure.sql`
|
39
|
-
when "oci", "oracle"
|
40
|
-
ActiveRecord::Base.establish_connection(config)
|
41
|
-
ActiveRecord::Base.connection.structure_drop.split(";\n\n").each do |ddl|
|
42
|
-
ActiveRecord::Base.connection.execute(ddl)
|
43
|
-
end
|
44
|
-
when "firebird"
|
45
|
-
ActiveRecord::Base.establish_connection(config)
|
46
|
-
ActiveRecord::Base.connection.recreate_database!
|
47
|
-
else
|
48
|
-
raise "Task not supported by '#{config["adapter"]}'"
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
desc "Clear database and optional directories such as assets, then run db:seed"
|
53
|
-
task :seed_again, [:assets] => [:environment] do |t, args|
|
54
|
-
|
55
|
-
Rake::Task['autotelik:db:purge'].invoke( true ) # i.e ENV['exclude_system_tables'] = true
|
56
|
-
|
57
|
-
if(args[:assets])
|
58
|
-
assets = "#{Rails.root}/public/assets"
|
59
|
-
FileUtils::rm_rf(assets) if(File.exists?(assets))
|
60
|
-
end
|
61
|
-
|
62
|
-
Rake::Task['db:seed'].invoke
|
63
|
-
end
|
64
|
-
|
65
|
-
end # db
|
66
|
-
end # autotelik
|