idata 0.1.9 → 0.1.10
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.
- checksums.yaml +4 -4
- data/bin/ieval +0 -0
- data/bin/iexport +1 -2
- data/bin/iload +0 -0
- data/bin/ipatch +0 -0
- data/bin/isanitize +0 -0
- data/bin/ivalidate +5 -5
- data/idata.gemspec +6 -6
- data/lib/idata/version.rb +1 -1
- metadata +16 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f5c5667e60fb0a43146b3fc6a045630d1ed69f1
|
4
|
+
data.tar.gz: cb9097668d4ffc86e0bfa9218a4c419c5ce4abf8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 754588b80cef006891a65a8104b349d4095022669f1bcaffdfd293c75a3a29e23855dcd59760fda28e59f12810f747a653749210ea7815e6a5082e96221ddd1e
|
7
|
+
data.tar.gz: f736326c5de831e18bd76d57e32bb96069c355b9a601a8e4b9b3afa5a7d2b12016b0bd9d258a16d351e6115b826292ec10c433d319f16ea8accd285788d41e9b
|
data/bin/ieval
CHANGED
File without changes
|
data/bin/iexport
CHANGED
@@ -182,8 +182,6 @@ end
|
|
182
182
|
|
183
183
|
$options[:select] = [$options[:select].split(/\s*,\s*/) + $options[:include].split(/\s*,\s*/)].join(", ")
|
184
184
|
|
185
|
-
p $options[:select]
|
186
|
-
|
187
185
|
#$options = {host: 'localhost', database: 'db', username: 'postgres', password: 'postgres', table: 'products', listen: 5432}
|
188
186
|
ActiveRecord::Base.establish_connection(
|
189
187
|
'adapter' => 'postgresql',
|
@@ -221,3 +219,4 @@ CSV.open($options[:output], "wb", :quote_char => $options[:quote_char], :col_sep
|
|
221
219
|
end
|
222
220
|
|
223
221
|
puts "\nFile #{$options[:output]} created!\n\n"
|
222
|
+
|
data/bin/iload
CHANGED
File without changes
|
data/bin/ipatch
CHANGED
File without changes
|
data/bin/isanitize
CHANGED
File without changes
|
data/bin/ivalidate
CHANGED
@@ -179,7 +179,7 @@ $options[:unique].each do |field|
|
|
179
179
|
puts "Checking unique fields: #{field}"
|
180
180
|
|
181
181
|
uniq_sql = <<-eos
|
182
|
-
UPDATE #{$options[:table]} SET #{$options[:log_to]} = array_to_string(string_to_array(#{$options[:log_to]}, ' || ') || string_to_array('#{field} not unique', ' || '), ' || ')
|
182
|
+
UPDATE #{$options[:table]} SET #{$options[:log_to]} = array_to_string(string_to_array(#{$options[:log_to]}, ' || ') || string_to_array('#{field} is not unique', ' || '), ' || ')
|
183
183
|
WHERE #{field} IN (
|
184
184
|
SELECT #{field} FROM #{$options[:table]} GROUP BY #{field}
|
185
185
|
HAVING count(*) > 1
|
@@ -196,7 +196,7 @@ $options[:not_null].each do |field|
|
|
196
196
|
puts "Checking not-null fields: #{field}"
|
197
197
|
|
198
198
|
not_null_sql = <<-eos
|
199
|
-
UPDATE #{$options[:table]} SET #{$options[:log_to]} = array_to_string(string_to_array(#{$options[:log_to]}, ' || ') || string_to_array('#{field} null', ' || '), ' || ')
|
199
|
+
UPDATE #{$options[:table]} SET #{$options[:log_to]} = array_to_string(string_to_array(#{$options[:log_to]}, ' || ') || string_to_array('#{field} is null', ' || '), ' || ')
|
200
200
|
WHERE #{field} IS NULL OR length(trim(#{field})) = 0;
|
201
201
|
eos
|
202
202
|
|
@@ -212,7 +212,7 @@ $options[:match].each do |value|
|
|
212
212
|
puts "Checking REGEXP matching: #{regexp}"
|
213
213
|
|
214
214
|
match_sql = <<-eos
|
215
|
-
UPDATE #{$options[:table]} SET #{$options[:log_to]} = array_to_string(string_to_array(#{$options[:log_to]}, ' || ') || string_to_array('#{field} not match [#{regexp.gsub("'", "''")}]', ' || '), ' || ')
|
215
|
+
UPDATE #{$options[:table]} SET #{$options[:log_to]} = array_to_string(string_to_array(#{$options[:log_to]}, ' || ') || string_to_array('#{field} does not match [#{regexp.gsub("'", "''")}]', ' || '), ' || ')
|
216
216
|
WHERE #{field} IS NOT NULL AND length(trim(#{field})) <> 0 AND #{field} !~ '#{regexp}';
|
217
217
|
eos
|
218
218
|
|
@@ -228,7 +228,7 @@ $options[:not_match].each do |value|
|
|
228
228
|
puts "Checking REGEXP not matching: #{regexp}"
|
229
229
|
|
230
230
|
not_match_sql = <<-eos
|
231
|
-
UPDATE #{$options[:table]} SET #{$options[:log_to]} = array_to_string(string_to_array(#{$options[:log_to]}, ' || ') || string_to_array('#{field} match [#{regexp.gsub("'", "''")}]', ' || '), ' || ')
|
231
|
+
UPDATE #{$options[:table]} SET #{$options[:log_to]} = array_to_string(string_to_array(#{$options[:log_to]}, ' || ') || string_to_array('#{field} does match [#{regexp.gsub("'", "''")}]', ' || '), ' || ')
|
232
232
|
WHERE #{field} IS NOT NULL AND length(trim(#{field})) <> 0 AND #{field} ~ '#{regexp}';
|
233
233
|
eos
|
234
234
|
|
@@ -254,7 +254,7 @@ $options[:cross_reference].each do |value|
|
|
254
254
|
|
255
255
|
# @todo: poor performance here, think of a better SQL!!!
|
256
256
|
ref_sql = <<-eos
|
257
|
-
UPDATE #{$options[:table]} SET #{$options[:log_to]} = array_to_string(string_to_array(#{$options[:log_to]}, ' || ') || string_to_array('#{field} not
|
257
|
+
UPDATE #{$options[:table]} SET #{$options[:log_to]} = array_to_string(string_to_array(#{$options[:log_to]}, ' || ') || string_to_array('#{field} does not reference #{values[1]}.#{values[2]}', ' || '), ' || ')
|
258
258
|
WHERE #{field} NOT IN (
|
259
259
|
SELECT #{ref_field} FROM #{ref_table}
|
260
260
|
) AND #{field} IS NOT NULL AND length(trim(#{field})) <> 0;
|
data/idata.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Nghi Pham"]
|
10
10
|
spec.email = ["minhnghivn@gmail.com"]
|
11
11
|
spec.description = %q{Tools for importing data from raw files}
|
12
|
-
spec.summary = %q{Tools
|
13
|
-
spec.homepage = ""
|
12
|
+
spec.summary = %q{Tools include: iload, ivalidate, isanitize, ipatch, ieval, iexport}
|
13
|
+
spec.homepage = "http://bolero.vn"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
@@ -19,9 +19,9 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_development_dependency "bundler", "
|
23
|
-
spec.add_development_dependency "rake", "
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
24
|
|
25
|
-
spec.add_dependency "rails", "
|
26
|
-
spec.add_dependency "pg"
|
25
|
+
spec.add_dependency "rails", "~> 4.0"
|
26
|
+
spec.add_dependency "pg", "~> 0.16"
|
27
27
|
end
|
data/lib/idata/version.rb
CHANGED
metadata
CHANGED
@@ -1,71 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: idata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nghi Pham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0
|
33
|
+
version: '10.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0
|
40
|
+
version: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '4.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '4.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: pg
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
61
|
+
version: '0.16'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
68
|
+
version: '0.16'
|
69
69
|
description: Tools for importing data from raw files
|
70
70
|
email:
|
71
71
|
- minhnghivn@gmail.com
|
@@ -94,7 +94,7 @@ files:
|
|
94
94
|
- idata.gemspec
|
95
95
|
- lib/idata.rb
|
96
96
|
- lib/idata/version.rb
|
97
|
-
homepage:
|
97
|
+
homepage: http://bolero.vn
|
98
98
|
licenses:
|
99
99
|
- MIT
|
100
100
|
metadata: {}
|
@@ -117,5 +117,5 @@ rubyforge_project:
|
|
117
117
|
rubygems_version: 2.2.1
|
118
118
|
signing_key:
|
119
119
|
specification_version: 4
|
120
|
-
summary: Tools
|
120
|
+
summary: 'Tools include: iload, ivalidate, isanitize, ipatch, ieval, iexport'
|
121
121
|
test_files: []
|