ar_loader 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +9 -9
- data/README.markdown +221 -210
- data/Rakefile +76 -76
- data/lib/VERSION +1 -1
- data/lib/ar_loader.rb +66 -53
- data/lib/engine/file_definitions.rb +353 -353
- data/lib/engine/jruby/jexcel_file.rb +181 -181
- data/lib/engine/jruby/method_mapper_excel.rb +43 -43
- data/lib/engine/mapping_file_definitions.rb +87 -87
- data/lib/engine/method_detail.rb +140 -139
- data/lib/engine/method_mapper.rb +156 -156
- data/lib/engine/method_mapper_csv.rb +27 -27
- data/lib/engine/word.rb +70 -70
- data/lib/loaders/loader_base.rb +73 -60
- data/lib/loaders/spree/image_loader.rb +41 -46
- data/lib/loaders/spree/product_loader.rb +91 -92
- data/lib/to_b.rb +24 -24
- data/spec/database.yml +6 -0
- data/spec/db/migrate/20110803201325_create_testbed.rb +25 -0
- data/spec/excel_loader_spec.rb +98 -137
- data/spec/spec_helper.rb +18 -36
- data/spec/spree_loader_spec.rb +158 -0
- data/tasks/{seed_fu_product_template.erb → config/seed_fu_product_template.erb} +15 -15
- data/tasks/{tidy_config.txt → config/tidy_config.txt} +12 -12
- data/tasks/db_tasks.rake +64 -64
- data/tasks/excel_loader.rake +113 -100
- data/tasks/file_tasks.rake +37 -37
- data/tasks/spree/image_load.rake +107 -102
- data/tasks/spree/product_loader.rake +107 -106
- data/tasks/word_to_seedfu.rake +166 -166
- metadata +61 -47
data/lib/ar_loader.rb
CHANGED
@@ -1,53 +1,66 @@
|
|
1
|
-
# Copyright:: (c) Autotelik Media Ltd 2011
|
2
|
-
# Author :: Tom Statter
|
3
|
-
# Date :: Aug 2010
|
4
|
-
# License:: TBD. Free, Open Source. MIT ?
|
5
|
-
#
|
6
|
-
# Details:: Active Record Loader
|
7
|
-
#
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
|
1
|
+
# Copyright:: (c) Autotelik Media Ltd 2011
|
2
|
+
# Author :: Tom Statter
|
3
|
+
# Date :: Aug 2010
|
4
|
+
# License:: TBD. Free, Open Source. MIT ?
|
5
|
+
#
|
6
|
+
# Details:: Active Record Loader
|
7
|
+
#
|
8
|
+
require 'active_record'
|
9
|
+
|
10
|
+
module ArLoader
|
11
|
+
|
12
|
+
def self.gem_version
|
13
|
+
@gem_version ||= File.read( File.join( root_path, 'lib', 'VERSION') ).chomp
|
14
|
+
@gem_version
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.gem_name
|
18
|
+
"ar_loader"
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.root_path
|
22
|
+
File.expand_path("#{File.dirname(__FILE__)}/..")
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.require_libraries
|
26
|
+
|
27
|
+
loader_libs = %w{ lib }
|
28
|
+
|
29
|
+
# Base search paths - these will be searched recursively and any xxx.rake files autoimported
|
30
|
+
loader_paths = []
|
31
|
+
|
32
|
+
loader_libs.each {|l| loader_paths << File.join(root_path(), l) }
|
33
|
+
|
34
|
+
# Define require search paths, any dir in here will be added to LOAD_PATH
|
35
|
+
|
36
|
+
loader_paths.each do |base|
|
37
|
+
$:.unshift base if File.directory?(base)
|
38
|
+
Dir[File.join(base, '**', '**')].each do |p|
|
39
|
+
if File.directory? p
|
40
|
+
$:.unshift p
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
require__libs = %w{ loaders engine }
|
46
|
+
|
47
|
+
require__libs.each do |base|
|
48
|
+
Dir[File.join('lib', base, '*.rb')].each do |rb|
|
49
|
+
unless File.directory? rb
|
50
|
+
require rb
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.require_tasks
|
58
|
+
# Long parameter lists so ensure rake -T produces nice wide output
|
59
|
+
ENV['RAKE_COLUMNS'] = '180'
|
60
|
+
base = File.join(root_path, 'tasks', '**')
|
61
|
+
Dir["#{base}/*.rake"].sort.each { |ext| load ext }
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
ArLoader::require_libraries
|