advance 0.3.10 → 0.3.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bin/concat_csv.rb +3 -3
- data/bin/concat_csv_nh.rb +1 -1
- data/bin/split_csv.rb +3 -3
- data/lib/advance/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdf46d870056e20495b4b92b9dfcd06c38d3ade3dae154c21eeff54aa7f2f5ab
|
4
|
+
data.tar.gz: c00f97812bf6edbd4d2ee7a271cf814657d184ef5e9a8ffc5d46d422b9abfd27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c0d111aa4ad70c433619fbc4e99b65f543799b67d271d9e502994bf3bd30e83a88a35415eb951e054ec2ee5e8f24f1dc468a24b85ea44b219a36d63adc94ee1
|
7
|
+
data.tar.gz: fd87fa0dc60c52e4962391f7b0aead58e8a6c9fbdc535ff4980086c1391b5ba785ef800274009e7ce4bdfe06de266d67ff3158c421e613859084a533001be679
|
data/Gemfile.lock
CHANGED
data/bin/concat_csv.rb
CHANGED
@@ -14,18 +14,18 @@ output_file = ARGV[1]
|
|
14
14
|
files = Find.find(files_dir_path).reject { |p| FileTest.directory?(p) || File.basename(p) == "log" }
|
15
15
|
|
16
16
|
# 1. capture the header from the first file
|
17
|
-
do_cmd "
|
17
|
+
do_cmd "head -n 1 #{files.first} > header"
|
18
18
|
|
19
19
|
# 2. strip the header from all files
|
20
20
|
TeamEffort.work(files) do |file_path|
|
21
21
|
file = File.basename(file_path)
|
22
|
-
do_cmd "
|
22
|
+
do_cmd "tail -n +2 #{file_path} > #{file}"
|
23
23
|
end
|
24
24
|
|
25
25
|
# 3. concate the header and all files
|
26
26
|
tmp_files = files.map{|f| File.basename(f)}
|
27
27
|
(["header"] + tmp_files).each_slice(20) do |files_to_concat|
|
28
28
|
file_list = files_to_concat.join(' ')
|
29
|
-
do_cmd "
|
29
|
+
do_cmd "cat #{file_list} >> #{output_file}"
|
30
30
|
do_cmd "rm #{file_list}"
|
31
31
|
end
|
data/bin/concat_csv_nh.rb
CHANGED
@@ -14,5 +14,5 @@ files = Find.find(files_dir_path).reject { |p| FileTest.directory?(p) || File.ba
|
|
14
14
|
|
15
15
|
files.each_slice(20) do |files_to_concat|
|
16
16
|
file_list = files_to_concat.join(' ')
|
17
|
-
do_cmd "
|
17
|
+
do_cmd "cat #{file_list} >> #{output_file}"
|
18
18
|
end
|
data/bin/split_csv.rb
CHANGED
@@ -9,12 +9,12 @@ end
|
|
9
9
|
csv_file = ARGV[0]
|
10
10
|
lines = ARGV[1]
|
11
11
|
csv_file_name = File.basename(csv_file)
|
12
|
-
system "
|
13
|
-
system "
|
12
|
+
system "head -n 1 #{csv_file} > #{csv_file_name}_header"
|
13
|
+
system "tail -n +2 #{csv_file} | split -l #{lines} -a 3 - #{csv_file_name}_"
|
14
14
|
files = Dir.entries(".").reject { |f| f =~ %r{^(\.\.?|log)$} }
|
15
15
|
TeamEffort.work(files, 1) do |file|
|
16
16
|
tmp_file = "tmp_#{file}"
|
17
|
-
do_cmd "
|
17
|
+
do_cmd "cat #{csv_file_name}_header #{file} >> #{tmp_file}"
|
18
18
|
do_cmd "mv #{tmp_file} #{file}"
|
19
19
|
end
|
20
20
|
do_cmd "rm #{csv_file_name}_header"
|
data/lib/advance/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: advance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- janemacfarlane
|
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
128
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.7.
|
129
|
+
rubygems_version: 2.7.8
|
130
130
|
signing_key:
|
131
131
|
specification_version: 4
|
132
132
|
summary: A framework for building data transformation pipelines
|