structured_csv 0.1.0 → 0.1.1
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/.editorconfig +18 -0
- data/.gitattributes +1 -0
- data/.github/workflows/main.yml +6 -2
- data/.gitignore +256 -6
- data/.hound.yml +3 -0
- data/.rubocop.yml +40 -3
- data/Gemfile +7 -5
- data/README.adoc +29 -3
- data/exe/csv_join +27 -0
- data/exe/csv_join.rb +1 -0
- data/exe/structured_csv_to_yaml +30 -0
- data/exe/structured_csv_to_yaml.rb +1 -0
- data/lib/structured_csv.rb +3 -5
- data/lib/structured_csv/common.rb +12 -0
- data/lib/structured_csv/csv2yaml.rb +239 -0
- data/lib/structured_csv/csv_join.rb +78 -0
- data/lib/structured_csv/version.rb +1 -1
- data/structured_csv.gemspec +16 -5
- metadata +127 -5
- data/exe/csv_join.rb +0 -95
- data/exe/structured_csv_to_yaml.rb +0 -254
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2be5d95ae78c40e2e0060fbb04fd7df15bcbd80cd94b72a51a7ede81783fabf
|
4
|
+
data.tar.gz: 258a09fb19ecb5f0a784c0b742806975c8d085ecb938cc49bb098eb6f5571b7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83e5fd945dab4fa147e147565980418198f3f298d23d266a4051d70229f0739a91f8c29b8ed634703944f991bc9e48eb7a9aecd0edb410e49905af3b25026eef
|
7
|
+
data.tar.gz: 479cedec9f895269e238df4685279e6300864056f516bdcd699854a0c3310c0d634888d70b43ff4bf3d5d31e326d3c19a8171cf90d94ecdf2172ecb02722538c
|
data/.editorconfig
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# top-most EditorConfig file
|
2
|
+
root = true
|
3
|
+
|
4
|
+
# Unix-style newlines with a newline ending every file
|
5
|
+
[*]
|
6
|
+
charset = utf-8
|
7
|
+
end_of_line = lf
|
8
|
+
insert_final_newline = true
|
9
|
+
indent_style = space
|
10
|
+
indent_size = 2
|
11
|
+
|
12
|
+
[Makefile]
|
13
|
+
indent_style = tab
|
14
|
+
indent_size = 8
|
15
|
+
|
16
|
+
# Tab indentation (no size specified)
|
17
|
+
[*.sh]
|
18
|
+
indent_style = tab
|
data/.gitattributes
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
.gitignore -text
|
data/.github/workflows/main.yml
CHANGED
@@ -4,15 +4,19 @@ on: [push,pull_request]
|
|
4
4
|
|
5
5
|
jobs:
|
6
6
|
build:
|
7
|
+
continue-on-error: true
|
7
8
|
runs-on: ubuntu-latest
|
9
|
+
strategy:
|
10
|
+
matrix:
|
11
|
+
ruby-version: [2.6.7, 2.7.3, 3.0.1]
|
8
12
|
steps:
|
9
13
|
- uses: actions/checkout@v2
|
10
14
|
- name: Set up Ruby
|
11
15
|
uses: ruby/setup-ruby@v1
|
12
16
|
with:
|
13
|
-
ruby-version:
|
17
|
+
ruby-version: ${{ matrix.ruby-version }}
|
14
18
|
- name: Run the default task
|
15
19
|
run: |
|
16
20
|
gem install bundler -v 2.2.15
|
17
21
|
bundle install
|
18
|
-
bundle exec rake
|
22
|
+
bundle exec rake spec
|
data/.gitignore
CHANGED
@@ -1,11 +1,261 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
# rspec failure tracking
|
2
|
+
.rspec_status
|
3
|
+
|
4
|
+
.rubocop-http*
|
5
|
+
|
6
|
+
# Created by https://www.toptal.com/developers/gitignore/api/macos,windows,linux,vim,emacs,textmate,sublimetext,visualstudiocode,ruby,direnv
|
7
|
+
# Edit at https://www.toptal.com/developers/gitignore?templates=macos,windows,linux,vim,emacs,textmate,sublimetext,visualstudiocode,ruby,direnv
|
8
|
+
|
9
|
+
### direnv ###
|
10
|
+
.direnv
|
11
|
+
.envrc
|
12
|
+
|
13
|
+
### Emacs ###
|
14
|
+
# -*- mode: gitignore; -*-
|
15
|
+
*~
|
16
|
+
\#*\#
|
17
|
+
/.emacs.desktop
|
18
|
+
/.emacs.desktop.lock
|
19
|
+
*.elc
|
20
|
+
auto-save-list
|
21
|
+
tramp
|
22
|
+
.\#*
|
23
|
+
|
24
|
+
# Org-mode
|
25
|
+
.org-id-locations
|
26
|
+
*_archive
|
27
|
+
ltximg/**
|
28
|
+
|
29
|
+
# flymake-mode
|
30
|
+
*_flymake.*
|
31
|
+
|
32
|
+
# eshell files
|
33
|
+
/eshell/history
|
34
|
+
/eshell/lastdir
|
35
|
+
|
36
|
+
# elpa packages
|
37
|
+
/elpa/
|
38
|
+
|
39
|
+
# reftex files
|
40
|
+
*.rel
|
41
|
+
|
42
|
+
# AUCTeX auto folder
|
43
|
+
/auto/
|
44
|
+
|
45
|
+
# cask packages
|
46
|
+
.cask/
|
47
|
+
dist/
|
48
|
+
|
49
|
+
# Flycheck
|
50
|
+
flycheck_*.el
|
51
|
+
|
52
|
+
# server auth directory
|
53
|
+
/server/
|
54
|
+
|
55
|
+
# projectiles files
|
56
|
+
.projectile
|
57
|
+
|
58
|
+
# directory configuration
|
59
|
+
.dir-locals.el
|
60
|
+
|
61
|
+
# network security
|
62
|
+
/network-security.data
|
63
|
+
|
64
|
+
|
65
|
+
### Linux ###
|
66
|
+
|
67
|
+
# temporary files which can be created if a process still has a handle open of a deleted file
|
68
|
+
.fuse_hidden*
|
69
|
+
|
70
|
+
# KDE directory preferences
|
71
|
+
.directory
|
72
|
+
|
73
|
+
# Linux trash folder which might appear on any partition or disk
|
74
|
+
.Trash-*
|
75
|
+
|
76
|
+
# .nfs files are created when an open file is removed but is still being accessed
|
77
|
+
.nfs*
|
78
|
+
|
79
|
+
### macOS ###
|
80
|
+
# General
|
81
|
+
.DS_Store
|
82
|
+
.AppleDouble
|
83
|
+
.LSOverride
|
84
|
+
|
85
|
+
# Icon must end with two \r
|
86
|
+
Icon
|
87
|
+
|
88
|
+
# Thumbnails
|
89
|
+
._*
|
90
|
+
|
91
|
+
# Files that might appear in the root of a volume
|
92
|
+
.DocumentRevisions-V100
|
93
|
+
.fseventsd
|
94
|
+
.Spotlight-V100
|
95
|
+
.TemporaryItems
|
96
|
+
.Trashes
|
97
|
+
.VolumeIcon.icns
|
98
|
+
.com.apple.timemachine.donotpresent
|
99
|
+
|
100
|
+
# Directories potentially created on remote AFP share
|
101
|
+
.AppleDB
|
102
|
+
.AppleDesktop
|
103
|
+
Network Trash Folder
|
104
|
+
Temporary Items
|
105
|
+
.apdisk
|
106
|
+
|
107
|
+
### Ruby ###
|
108
|
+
*.gem
|
109
|
+
*.rbc
|
110
|
+
/.config
|
4
111
|
/coverage/
|
5
|
-
/
|
112
|
+
/InstalledFiles
|
6
113
|
/pkg/
|
7
114
|
/spec/reports/
|
115
|
+
/spec/examples.txt
|
116
|
+
/test/tmp/
|
117
|
+
/test/version_tmp/
|
8
118
|
/tmp/
|
9
119
|
|
10
|
-
#
|
11
|
-
.
|
120
|
+
# Used by dotenv library to load environment variables.
|
121
|
+
# .env
|
122
|
+
|
123
|
+
# Ignore Byebug command history file.
|
124
|
+
.byebug_history
|
125
|
+
|
126
|
+
## Specific to RubyMotion:
|
127
|
+
.dat*
|
128
|
+
.repl_history
|
129
|
+
build/
|
130
|
+
*.bridgesupport
|
131
|
+
build-iPhoneOS/
|
132
|
+
build-iPhoneSimulator/
|
133
|
+
|
134
|
+
## Specific to RubyMotion (use of CocoaPods):
|
135
|
+
#
|
136
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
137
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
138
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
139
|
+
# vendor/Pods/
|
140
|
+
|
141
|
+
## Documentation cache and generated files:
|
142
|
+
/.yardoc/
|
143
|
+
/_yardoc/
|
144
|
+
/doc/
|
145
|
+
/rdoc/
|
146
|
+
|
147
|
+
## Environment normalization:
|
148
|
+
/.bundle/
|
149
|
+
/vendor/bundle
|
150
|
+
/lib/bundler/man/
|
151
|
+
|
152
|
+
# for a library or gem, you might want to ignore these files since the code is
|
153
|
+
# intended to run in multiple environments; otherwise, check them in:
|
154
|
+
# Gemfile.lock
|
155
|
+
# .ruby-version
|
156
|
+
# .ruby-gemset
|
157
|
+
|
158
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
159
|
+
.rvmrc
|
160
|
+
|
161
|
+
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
162
|
+
# .rubocop-https?--*
|
163
|
+
|
164
|
+
### SublimeText ###
|
165
|
+
# Cache files for Sublime Text
|
166
|
+
*.tmlanguage.cache
|
167
|
+
*.tmPreferences.cache
|
168
|
+
*.stTheme.cache
|
169
|
+
|
170
|
+
# Workspace files are user-specific
|
171
|
+
*.sublime-workspace
|
172
|
+
|
173
|
+
# Project files should be checked into the repository, unless a significant
|
174
|
+
# proportion of contributors will probably not be using Sublime Text
|
175
|
+
# *.sublime-project
|
176
|
+
|
177
|
+
# SFTP configuration file
|
178
|
+
sftp-config.json
|
179
|
+
|
180
|
+
# Package control specific files
|
181
|
+
Package Control.last-run
|
182
|
+
Package Control.ca-list
|
183
|
+
Package Control.ca-bundle
|
184
|
+
Package Control.system-ca-bundle
|
185
|
+
Package Control.cache/
|
186
|
+
Package Control.ca-certs/
|
187
|
+
Package Control.merged-ca-bundle
|
188
|
+
Package Control.user-ca-bundle
|
189
|
+
oscrypto-ca-bundle.crt
|
190
|
+
bh_unicode_properties.cache
|
191
|
+
|
192
|
+
# Sublime-github package stores a github token in this file
|
193
|
+
# https://packagecontrol.io/packages/sublime-github
|
194
|
+
GitHub.sublime-settings
|
195
|
+
|
196
|
+
### TextMate ###
|
197
|
+
*.tmproj
|
198
|
+
*.tmproject
|
199
|
+
tmtags
|
200
|
+
|
201
|
+
### Vim ###
|
202
|
+
# Swap
|
203
|
+
[._]*.s[a-v][a-z]
|
204
|
+
!*.svg # comment out if you don't need vector files
|
205
|
+
[._]*.sw[a-p]
|
206
|
+
[._]s[a-rt-v][a-z]
|
207
|
+
[._]ss[a-gi-z]
|
208
|
+
[._]sw[a-p]
|
209
|
+
|
210
|
+
# Session
|
211
|
+
Session.vim
|
212
|
+
Sessionx.vim
|
213
|
+
|
214
|
+
# Temporary
|
215
|
+
.netrwhist
|
216
|
+
# Auto-generated tag files
|
217
|
+
tags
|
218
|
+
# Persistent undo
|
219
|
+
[._]*.un~
|
220
|
+
|
221
|
+
### VisualStudioCode ###
|
222
|
+
.vscode/*
|
223
|
+
!.vscode/settings.json
|
224
|
+
!.vscode/tasks.json
|
225
|
+
!.vscode/launch.json
|
226
|
+
!.vscode/extensions.json
|
227
|
+
*.code-workspace
|
228
|
+
|
229
|
+
### VisualStudioCode Patch ###
|
230
|
+
# Ignore all local history of files
|
231
|
+
.history
|
232
|
+
.ionide
|
233
|
+
|
234
|
+
### Windows ###
|
235
|
+
# Windows thumbnail cache files
|
236
|
+
Thumbs.db
|
237
|
+
Thumbs.db:encryptable
|
238
|
+
ehthumbs.db
|
239
|
+
ehthumbs_vista.db
|
240
|
+
|
241
|
+
# Dump file
|
242
|
+
*.stackdump
|
243
|
+
|
244
|
+
# Folder config file
|
245
|
+
[Dd]esktop.ini
|
246
|
+
|
247
|
+
# Recycle Bin used on file shares
|
248
|
+
$RECYCLE.BIN/
|
249
|
+
|
250
|
+
# Windows Installer files
|
251
|
+
*.cab
|
252
|
+
*.msi
|
253
|
+
*.msix
|
254
|
+
*.msm
|
255
|
+
*.msp
|
256
|
+
|
257
|
+
# Windows shortcuts
|
258
|
+
*.lnk
|
259
|
+
|
260
|
+
# End of https://www.toptal.com/developers/gitignore/api/macos,windows,linux,
|
261
|
+
# vim,emacs,textmate,sublimetext,visualstudiocode,ruby,direnv
|
data/.hound.yml
ADDED
data/.rubocop.yml
CHANGED
@@ -1,5 +1,42 @@
|
|
1
|
+
# inherit_from:
|
2
|
+
# - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
|
3
|
+
|
4
|
+
# Override
|
5
|
+
require:
|
6
|
+
- rubocop-performance
|
7
|
+
- rubocop-rspec
|
8
|
+
- rubocop-rake
|
9
|
+
|
10
|
+
# local repo-specific modifications
|
1
11
|
AllCops:
|
2
|
-
TargetRubyVersion: 2.
|
12
|
+
TargetRubyVersion: 2.6
|
13
|
+
|
14
|
+
Layout/DotPosition:
|
15
|
+
EnforcedStyle: leading
|
16
|
+
|
17
|
+
# Layout/EmptyLinesAroundBlockBody:
|
18
|
+
# Enabled: false
|
19
|
+
|
20
|
+
# # https://github.com/rubocop-hq/rubocop/issues/6259#issuecomment-420734217
|
21
|
+
# Layout/ExtraSpacing:
|
22
|
+
# ForceEqualSignAlignment: true
|
23
|
+
|
24
|
+
Layout/HashAlignment:
|
25
|
+
EnforcedColonStyle: table
|
26
|
+
EnforcedHashRocketStyle: table
|
27
|
+
|
28
|
+
Layout/LineLength:
|
29
|
+
Max: 120
|
30
|
+
|
31
|
+
Lint/PercentStringArray:
|
32
|
+
# AutoCorrect: false
|
33
|
+
Enabled: false
|
34
|
+
|
35
|
+
Security/YAMLLoad:
|
36
|
+
AutoCorrect: false
|
37
|
+
|
38
|
+
Style/ParenthesesAroundCondition:
|
39
|
+
AutoCorrect: false
|
3
40
|
|
4
41
|
Style/StringLiterals:
|
5
42
|
Enabled: true
|
@@ -9,5 +46,5 @@ Style/StringLiteralsInInterpolation:
|
|
9
46
|
Enabled: true
|
10
47
|
EnforcedStyle: double_quotes
|
11
48
|
|
12
|
-
|
13
|
-
|
49
|
+
Style/TrailingCommaInArguments:
|
50
|
+
EnforcedStyleForMultiline: comma
|
data/Gemfile
CHANGED
@@ -5,8 +5,10 @@ source "https://rubygems.org"
|
|
5
5
|
# Specify your gem's dependencies in structured_csv.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
gem "
|
11
|
-
|
12
|
-
gem "rubocop",
|
8
|
+
group :test do
|
9
|
+
gem "rubocop", "~> 1.14", require: false
|
10
|
+
gem "rubocop-performance", require: false
|
11
|
+
gem "rubocop-rails", require: false
|
12
|
+
gem "rubocop-rake", require: false
|
13
|
+
gem "rubocop-rspec", require: false
|
14
|
+
end
|
data/README.adoc
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
= Process Structured CSV files (`structured_csv`)
|
2
2
|
|
3
|
+
image:https://badge.fury.io/rb/structured_csv.svg["Gem Version", link="https://badge.fury.io/rb/structured_csv"]
|
4
|
+
image:https://github.com/riboseinc/structured_csv/actions/workflows/main.yml/badge.svg["Tests", link="https://github.com/riboseinc/structured_csv/actions/workflows/main.yml"]
|
5
|
+
|
3
6
|
== Purpose
|
4
7
|
|
5
|
-
The `structured_csv_to_yaml
|
8
|
+
The `structured_csv_to_yaml` script converts a "`Structured CSV`" file into a YAML file.
|
6
9
|
|
7
10
|
When you have data of a yet-undefined data structure, it is useful to manage
|
8
11
|
them inside a CSV file which can be viewed and edited by a CSV editor,
|
@@ -19,11 +22,35 @@ This script supports UTF-8 CSV files.
|
|
19
22
|
NOTE: This was originally developed to create over 50 normalized data models for ITU Operational Bulletin data. See https://github.com/ituob/ for more details.
|
20
23
|
|
21
24
|
|
25
|
+
== Installation
|
26
|
+
|
27
|
+
Add this line to your application's `Gemfile`:
|
28
|
+
|
29
|
+
[source,ruby]
|
30
|
+
----
|
31
|
+
gem 'structured_csv'
|
32
|
+
----
|
33
|
+
|
34
|
+
and then run:
|
35
|
+
|
36
|
+
[source,sh]
|
37
|
+
----
|
38
|
+
bundle install
|
39
|
+
----
|
40
|
+
|
41
|
+
Or install it without a `Gemfile`:
|
42
|
+
|
43
|
+
[source,sh]
|
44
|
+
----
|
45
|
+
gem install structured_csv
|
46
|
+
----
|
47
|
+
|
48
|
+
|
22
49
|
== Usage
|
23
50
|
|
24
51
|
[source,sh]
|
25
52
|
----
|
26
|
-
$
|
53
|
+
$ structured_csv_to_yaml [input-file.csv]
|
27
54
|
----
|
28
55
|
|
29
56
|
Where,
|
@@ -202,4 +229,3 @@ data:
|
|
202
229
|
== Examples
|
203
230
|
|
204
231
|
The `samples/` folder contains a number of complex examples.
|
205
|
-
|