csvpp 0.3.0 → 0.3.1
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 -12
- data/README.md +41 -2
- data/csvpp.gemspec +0 -1
- data/lib/csvpp/version.rb +1 -1
- metadata +2 -33
- data/config.ru +0 -4
- data/lib/csvpp/api.rb +0 -25
- data/ui/.gitignore +0 -21
- data/ui/README.md +0 -2229
- data/ui/package.json +0 -19
- data/ui/public/favicon.ico +0 -0
- data/ui/public/index.html +0 -40
- data/ui/public/manifest.json +0 -15
- data/ui/src/App.css +0 -7
- data/ui/src/App.js +0 -105
- data/ui/src/App.test.js +0 -8
- data/ui/src/Editor.js +0 -20
- data/ui/src/index.css +0 -5
- data/ui/src/index.js +0 -8
- data/ui/src/logo.svg +0 -7
- data/ui/src/registerServiceWorker.js +0 -108
- data/ui/yarn.lock +0 -6642
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 880efa52b42f34d49e6aeeb59cfb05211f274ff6
|
4
|
+
data.tar.gz: 226688ad42678fdca218b2a2fcd047d08846aa62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b030f48cec237f995f2b1fec2912a0229cd6e0b224bbdac5cc007ff7db2121f0d7f8e0c79fae96c4eeabbb54d9f4c8b541bb410a60dbe632e4f1ef049bae795
|
7
|
+
data.tar.gz: 72c4d7c77acb0d0bffb903f1236e031434d5b8116ce73167f0be94f6b58d5033944427fca2c5fc39ec1e45f07ecead446f4375833e29b6e2e87336303a323415
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
csvpp (0.3.
|
4
|
+
csvpp (0.3.1)
|
5
5
|
oj (~> 3.3.9)
|
6
|
-
sinatra (~> 2.0)
|
7
6
|
|
8
7
|
GEM
|
9
8
|
remote: https://rubygems.org/
|
@@ -12,7 +11,6 @@ GEM
|
|
12
11
|
coderay (1.1.2)
|
13
12
|
method_source (0.9.0)
|
14
13
|
minitest (5.10.3)
|
15
|
-
mustermann (1.0.1)
|
16
14
|
oj (3.3.10)
|
17
15
|
pry (0.11.3)
|
18
16
|
coderay (~> 1.1.0)
|
@@ -23,16 +21,7 @@ GEM
|
|
23
21
|
pry-doc (0.11.1)
|
24
22
|
pry (~> 0.9)
|
25
23
|
yard (~> 0.9)
|
26
|
-
rack (2.0.3)
|
27
|
-
rack-protection (2.0.0)
|
28
|
-
rack
|
29
24
|
rake (12.3.0)
|
30
|
-
sinatra (2.0.0)
|
31
|
-
mustermann (~> 1.0)
|
32
|
-
rack (~> 2.0)
|
33
|
-
rack-protection (= 2.0.0)
|
34
|
-
tilt (~> 2.0)
|
35
|
-
tilt (2.0.8)
|
36
25
|
yard (0.9.11)
|
37
26
|
|
38
27
|
PLATFORMS
|
data/README.md
CHANGED
@@ -14,11 +14,15 @@ gem 'csvpp'
|
|
14
14
|
|
15
15
|
And then execute:
|
16
16
|
|
17
|
-
|
17
|
+
```
|
18
|
+
$ bundle
|
19
|
+
```
|
18
20
|
|
19
21
|
Or install it yourself as:
|
20
22
|
|
21
|
-
|
23
|
+
```
|
24
|
+
$ gem install csvpp
|
25
|
+
```
|
22
26
|
|
23
27
|
## Usage
|
24
28
|
|
@@ -29,6 +33,41 @@ CSVPP.parse(
|
|
29
33
|
) # => [{"v1"=>34, "line_number"=>1, "v2"=>"foobar"}, {"v1"=>99, "line_number"=>2, "v2"=>"hi there"}]
|
30
34
|
```
|
31
35
|
|
36
|
+
### CLI
|
37
|
+
|
38
|
+
CSV++ comes with a CLI. To print a JSON representation of an input file, pass a
|
39
|
+
file argument and provide a format specification file with `-f`, e.g.:
|
40
|
+
|
41
|
+
```
|
42
|
+
$ csvpp test/sample_inputs/simple.txt -f test/sample_formats/simple.json
|
43
|
+
|
44
|
+
{
|
45
|
+
"vars": [
|
46
|
+
{
|
47
|
+
"line_number": 1,
|
48
|
+
"v1": 34,
|
49
|
+
"v2": "foobar",
|
50
|
+
"v3": 1.1,
|
51
|
+
"v4": false
|
52
|
+
},
|
53
|
+
{
|
54
|
+
"line_number": 2,
|
55
|
+
"v1": 99,
|
56
|
+
"v2": "hi there",
|
57
|
+
"v3": 2.2,
|
58
|
+
"v4": true
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"line_number": 3,
|
62
|
+
"v1": null,
|
63
|
+
"v2": "Missing",
|
64
|
+
"v3": null,
|
65
|
+
"v4": true
|
66
|
+
}
|
67
|
+
]
|
68
|
+
}
|
69
|
+
```
|
70
|
+
|
32
71
|
## Development
|
33
72
|
|
34
73
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
data/csvpp.gemspec
CHANGED
@@ -30,7 +30,6 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
31
|
spec.require_paths = ["lib"]
|
32
32
|
|
33
|
-
spec.add_dependency 'sinatra', '~> 2.0'
|
34
33
|
spec.add_dependency 'oj', '~> 3.3.9'
|
35
34
|
|
36
35
|
spec.add_development_dependency "bundler"
|
data/lib/csvpp/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csvpp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SwissDRG AG
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: sinatra
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '2.0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '2.0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: oj
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -141,30 +127,13 @@ files:
|
|
141
127
|
- Rakefile
|
142
128
|
- bin/console
|
143
129
|
- bin/setup
|
144
|
-
- config.ru
|
145
130
|
- csvpp.gemspec
|
146
131
|
- exe/csvpp
|
147
132
|
- lib/csvpp.rb
|
148
|
-
- lib/csvpp/api.rb
|
149
133
|
- lib/csvpp/conversions.rb
|
150
134
|
- lib/csvpp/format.rb
|
151
135
|
- lib/csvpp/parser.rb
|
152
136
|
- lib/csvpp/version.rb
|
153
|
-
- ui/.gitignore
|
154
|
-
- ui/README.md
|
155
|
-
- ui/package.json
|
156
|
-
- ui/public/favicon.ico
|
157
|
-
- ui/public/index.html
|
158
|
-
- ui/public/manifest.json
|
159
|
-
- ui/src/App.css
|
160
|
-
- ui/src/App.js
|
161
|
-
- ui/src/App.test.js
|
162
|
-
- ui/src/Editor.js
|
163
|
-
- ui/src/index.css
|
164
|
-
- ui/src/index.js
|
165
|
-
- ui/src/logo.svg
|
166
|
-
- ui/src/registerServiceWorker.js
|
167
|
-
- ui/yarn.lock
|
168
137
|
homepage: https://www.swissdrg.org
|
169
138
|
licenses:
|
170
139
|
- MIT
|
data/config.ru
DELETED
data/lib/csvpp/api.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'sinatra/base'
|
2
|
-
|
3
|
-
module CSVPP
|
4
|
-
class API < Sinatra::Base
|
5
|
-
before do
|
6
|
-
headers 'Access-Control-Allow-Origin' => '*'
|
7
|
-
|
8
|
-
content_type :json
|
9
|
-
end
|
10
|
-
|
11
|
-
post '/parse' do
|
12
|
-
body = Oj.load(request.body.read)
|
13
|
-
input = body.fetch('input')
|
14
|
-
format = body.fetch('format')
|
15
|
-
|
16
|
-
CSVPP.json(input: input, format: format)
|
17
|
-
end
|
18
|
-
|
19
|
-
options "*" do
|
20
|
-
response.headers["Allow"] = "HEAD,GET,PUT,POST,DELETE,OPTIONS"
|
21
|
-
response.headers["Access-Control-Allow-Headers"] = "X-Requested-With, X-HTTP-Method-Override, Content-Type, Cache-Control, Accept"
|
22
|
-
200
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/ui/.gitignore
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# See https://help.github.com/ignore-files/ for more about ignoring files.
|
2
|
-
|
3
|
-
# dependencies
|
4
|
-
/node_modules
|
5
|
-
|
6
|
-
# testing
|
7
|
-
/coverage
|
8
|
-
|
9
|
-
# production
|
10
|
-
/build
|
11
|
-
|
12
|
-
# misc
|
13
|
-
.DS_Store
|
14
|
-
.env.local
|
15
|
-
.env.development.local
|
16
|
-
.env.test.local
|
17
|
-
.env.production.local
|
18
|
-
|
19
|
-
npm-debug.log*
|
20
|
-
yarn-debug.log*
|
21
|
-
yarn-error.log*
|