fruit_to_lime 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/fruit_to_lime/csv_helper.rb +7 -2
- data/spec/templating_spec.rb +0 -29
- metadata +12 -12
@@ -9,11 +9,16 @@ module FruitToLime
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
def self.text_to_hashes(text)
|
12
|
+
def self.text_to_hashes(text, column_separator = nil)
|
13
13
|
if !text
|
14
14
|
raise "Missing text"
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
|
+
if !column_separator
|
18
|
+
column_separator = self.detect_col_sep text
|
19
|
+
end
|
20
|
+
|
21
|
+
rows = CSV.parse(text.strip,{:col_sep => column_separator})
|
17
22
|
map = {}
|
18
23
|
first = rows.first
|
19
24
|
(0 .. first.length-1).each do |i|
|
data/spec/templating_spec.rb
CHANGED
@@ -1,14 +1,6 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
require 'tmpdir'
|
3
3
|
|
4
|
-
def execute_command_with_success_for_template(cmd, template)
|
5
|
-
system(cmd)
|
6
|
-
if ! $?.success?
|
7
|
-
puts "Failed with #{$?}"
|
8
|
-
raise "failed! #{cmd} for template #{template}"
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
4
|
describe 'Templating' do
|
13
5
|
let(:templating) { FruitToLime::Templating.new(File.expand_path("../templates", File.dirname(__FILE__))) }
|
14
6
|
|
@@ -17,25 +9,4 @@ describe 'Templating' do
|
|
17
9
|
templating.list().length.should > 0
|
18
10
|
end
|
19
11
|
end
|
20
|
-
|
21
|
-
describe 'unpack' do
|
22
|
-
unpack_path = File.expand_path("unpacked", Dir.tmpdir)
|
23
|
-
before {
|
24
|
-
FileUtils.remove_dir(unpack_path, true)
|
25
|
-
FileUtils.mkdir(unpack_path)
|
26
|
-
}
|
27
|
-
|
28
|
-
it 'can unpack all templates and run the template tests' do
|
29
|
-
templating.list().each {|t|
|
30
|
-
templating.unpack t, unpack_path
|
31
|
-
Dir.chdir(File.expand_path(t, unpack_path)) do
|
32
|
-
execute_command_with_success_for_template('rake spec', t)
|
33
|
-
end
|
34
|
-
}
|
35
|
-
end
|
36
|
-
|
37
|
-
after {
|
38
|
-
FileUtils.remove_dir(unpack_path, true)
|
39
|
-
}
|
40
|
-
end
|
41
12
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fruit_to_lime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2014-04-
|
14
|
+
date: 2014-04-24 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: iso_country_codes
|
@@ -62,30 +62,30 @@ dependencies:
|
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: '0'
|
64
64
|
- !ruby/object:Gem::Dependency
|
65
|
-
name:
|
65
|
+
name: roo
|
66
66
|
requirement: !ruby/object:Gem::Requirement
|
67
67
|
none: false
|
68
68
|
requirements:
|
69
69
|
- - ! '>='
|
70
70
|
- !ruby/object:Gem::Version
|
71
|
-
version: '
|
72
|
-
type: :
|
71
|
+
version: '0'
|
72
|
+
type: :runtime
|
73
73
|
prerelease: false
|
74
74
|
version_requirements: !ruby/object:Gem::Requirement
|
75
75
|
none: false
|
76
76
|
requirements:
|
77
77
|
- - ! '>='
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
version: '
|
79
|
+
version: '0'
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
|
-
name:
|
81
|
+
name: nokogiri
|
82
82
|
requirement: !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: '0'
|
88
|
-
type: :
|
88
|
+
type: :runtime
|
89
89
|
prerelease: false
|
90
90
|
version_requirements: !ruby/object:Gem::Requirement
|
91
91
|
none: false
|
@@ -94,13 +94,13 @@ dependencies:
|
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '0'
|
96
96
|
- !ruby/object:Gem::Dependency
|
97
|
-
name:
|
97
|
+
name: rspec
|
98
98
|
requirement: !ruby/object:Gem::Requirement
|
99
99
|
none: false
|
100
100
|
requirements:
|
101
101
|
- - ! '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '2.14'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -108,9 +108,9 @@ dependencies:
|
|
108
108
|
requirements:
|
109
109
|
- - ! '>='
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version: '
|
111
|
+
version: '2.14'
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
|
-
name:
|
113
|
+
name: rake
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
115
115
|
none: false
|
116
116
|
requirements:
|