oddb2xml 0.0.1 → 0.0.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/bin/oddb2xml +10 -2
- data/lib/oddb2xml/cli.rb +12 -2
- data/lib/oddb2xml/version.rb +1 -1
- data/oddb2xml.gemspec +1 -0
- metadata +5 -5
data/bin/oddb2xml
CHANGED
@@ -7,8 +7,16 @@ $:.unshift root.join('lib') if $0 == __FILE__
|
|
7
7
|
|
8
8
|
require 'oddb2xml'
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
# TODO: Parse option
|
11
|
+
args = ARGV.dup
|
12
|
+
opts = {}
|
13
|
+
if args == ['-c', 'tar.gz']
|
14
|
+
opts = {:compress => 'tar.gz'}
|
15
|
+
args = {}
|
16
|
+
end
|
17
|
+
|
18
|
+
ui = Oddb2xml::Cli.new(opts)
|
19
|
+
unless args.empty?
|
12
20
|
ui.help
|
13
21
|
else
|
14
22
|
begin
|
data/lib/oddb2xml/cli.rb
CHANGED
@@ -4,12 +4,14 @@ require 'thread'
|
|
4
4
|
require 'oddb2xml/builder'
|
5
5
|
require 'oddb2xml/downloader'
|
6
6
|
require 'oddb2xml/extractor'
|
7
|
+
require 'oddb2xml/compressor'
|
7
8
|
|
8
9
|
module Oddb2xml
|
9
10
|
class Cli
|
10
11
|
SUBJECTS = %w[product article]
|
11
12
|
LANGUAGES = %w[DE FR] # EN does not exist
|
12
|
-
def initialize
|
13
|
+
def initialize(args)
|
14
|
+
@options = args
|
13
15
|
#@mutex = Mutex.new
|
14
16
|
@items = {} # Preparations.xml in BAG
|
15
17
|
@index = {}
|
@@ -21,7 +23,8 @@ module Oddb2xml
|
|
21
23
|
puts <<EOS
|
22
24
|
#$0 ver.#{Oddb2xml::VERSION}
|
23
25
|
Usage:
|
24
|
-
oddb2xml
|
26
|
+
oddb2xml [option]
|
27
|
+
-c compress option. currently only 'tar.gz' is available.
|
25
28
|
EOS
|
26
29
|
end
|
27
30
|
def run
|
@@ -64,6 +67,13 @@ EOS
|
|
64
67
|
xml = builder.to_xml
|
65
68
|
File.open(file, 'w:utf-8'){ |fh| fh << xml }
|
66
69
|
end
|
70
|
+
unless @options[:compress].empty?
|
71
|
+
compressor = Compressor.new(@options[:compress])
|
72
|
+
files.values.each do |file|
|
73
|
+
compressor.contents << file
|
74
|
+
end
|
75
|
+
compressor.finalize!
|
76
|
+
end
|
67
77
|
rescue Interrupt
|
68
78
|
files.values.each do |file|
|
69
79
|
if File.exist? file
|
data/lib/oddb2xml/version.rb
CHANGED
data/oddb2xml.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oddb2xml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-09-17 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rdoc
|
16
|
-
requirement: &
|
16
|
+
requirement: &12716700 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '3.10'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *12716700
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: hoe
|
27
|
-
requirement: &
|
27
|
+
requirement: &12716180 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '2.13'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *12716180
|
36
36
|
description: ''
|
37
37
|
email:
|
38
38
|
- yasaka@ywesee.com, zdavatz@ywesee.com
|