nebulous 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +34 -0
- data/.rspec +1 -0
- data/.rubocop.yml +265 -0
- data/.travis.yml +5 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +54 -0
- data/LICENSE +22 -0
- data/README.md +29 -0
- data/lib/nebulous.rb +15 -0
- data/lib/nebulous/chunk.rb +14 -0
- data/lib/nebulous/delimiter_detector.rb +68 -0
- data/lib/nebulous/parser.rb +129 -0
- data/lib/nebulous/row.rb +47 -0
- data/lib/nebulous/version.rb +3 -0
- data/nebulous.gemspec +27 -0
- data/spec/nebulous/chunk_spec.rb +6 -0
- data/spec/nebulous/delimiter_detector_spec.rb +161 -0
- data/spec/nebulous/parser_spec.rb +287 -0
- data/spec/nebulous/row_spec.rb +6 -0
- data/spec/spec_helper.rb +7 -0
- data/spec/support/assets/clrf-batches.csv +1001 -0
- data/spec/support/assets/cr-comma-delimited.csv +1 -0
- data/spec/support/assets/cr-lf-comma-delimited.csv +1 -0
- data/spec/support/assets/crlf-comma-delimited.csv +21 -0
- data/spec/support/assets/crlf-dolla-delimited.csv +21 -0
- data/spec/support/assets/crlf-pipe-delimited.csv +21 -0
- data/spec/support/assets/crlf-semicolon-delimited.csv +21 -0
- data/spec/support/assets/crlf-tab-delimited.tsv +21 -0
- data/spec/support/assets/no-headers.csv +20 -0
- metadata +171 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e16fcc8e895cd4078d1ea39ab8553ee3246cd5fa
|
4
|
+
data.tar.gz: 46b62d5133aff6cea1cec0370af683834f16fe28
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7dd3e249cb5b64e7477c85bd0e34f44750b14d02ae0fafaeb6a33e93decab821c6798b66bfccfd87a10811c1115a008a94f4786c34ab1e72fd87c448aeeab705
|
7
|
+
data.tar.gz: 8791db72af0fd20b251382fd88982abd0af2a60c6bee83890efdfc8ac68576789783c9a6c1395ebf4c234a14f3db8f3a5dfe6d6d697b2c2d24e34aa0b82ab0b6
|
data/.gitignore
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/.bundle/
|
25
|
+
/lib/bundler/man/
|
26
|
+
|
27
|
+
# for a library or gem, you might want to ignore these files since the code is
|
28
|
+
# intended to run in multiple environments; otherwise, check them in:
|
29
|
+
# Gemfile.lock
|
30
|
+
# .ruby-version
|
31
|
+
# .ruby-gemset
|
32
|
+
|
33
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
34
|
+
.rvmrc
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,265 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- db/schema.rb
|
4
|
+
|
5
|
+
AccessorMethodName:
|
6
|
+
Enabled: false
|
7
|
+
|
8
|
+
ActionFilter:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
Alias:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
ArrayJoin:
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
AsciiComments:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
AsciiIdentifiers:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
Attr:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
BlockNesting:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
CaseEquality:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
CharacterLiteral:
|
33
|
+
Enabled: false
|
34
|
+
|
35
|
+
ClassAndModuleChildren:
|
36
|
+
Enabled: false
|
37
|
+
|
38
|
+
ClassLength:
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
ClassVars:
|
42
|
+
Enabled: false
|
43
|
+
|
44
|
+
CollectionMethods:
|
45
|
+
PreferredMethods:
|
46
|
+
find: detect
|
47
|
+
reduce: inject
|
48
|
+
collect: map
|
49
|
+
find_all: select
|
50
|
+
|
51
|
+
ColonMethodCall:
|
52
|
+
Enabled: false
|
53
|
+
|
54
|
+
CommentAnnotation:
|
55
|
+
Enabled: false
|
56
|
+
|
57
|
+
CyclomaticComplexity:
|
58
|
+
Enabled: true
|
59
|
+
|
60
|
+
Delegate:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
DeprecatedHashMethods:
|
64
|
+
Enabled: false
|
65
|
+
|
66
|
+
Documentation:
|
67
|
+
Enabled: false
|
68
|
+
|
69
|
+
DotPosition:
|
70
|
+
EnforcedStyle: trailing
|
71
|
+
|
72
|
+
DoubleNegation:
|
73
|
+
Enabled: false
|
74
|
+
|
75
|
+
EachWithObject:
|
76
|
+
Enabled: false
|
77
|
+
|
78
|
+
EmptyLiteral:
|
79
|
+
Enabled: false
|
80
|
+
|
81
|
+
Encoding:
|
82
|
+
Enabled: false
|
83
|
+
|
84
|
+
EvenOdd:
|
85
|
+
Enabled: false
|
86
|
+
|
87
|
+
FileName:
|
88
|
+
Enabled: false
|
89
|
+
|
90
|
+
FlipFlop:
|
91
|
+
Enabled: false
|
92
|
+
|
93
|
+
FormatString:
|
94
|
+
Enabled: false
|
95
|
+
|
96
|
+
GlobalVars:
|
97
|
+
Enabled: false
|
98
|
+
|
99
|
+
GuardClause:
|
100
|
+
Enabled: false
|
101
|
+
|
102
|
+
IfUnlessModifier:
|
103
|
+
Enabled: false
|
104
|
+
|
105
|
+
IfWithSemicolon:
|
106
|
+
Enabled: false
|
107
|
+
|
108
|
+
InlineComment:
|
109
|
+
Enabled: false
|
110
|
+
|
111
|
+
Lambda:
|
112
|
+
Enabled: false
|
113
|
+
|
114
|
+
LambdaCall:
|
115
|
+
Enabled: false
|
116
|
+
|
117
|
+
LineEndConcatenation:
|
118
|
+
Enabled: false
|
119
|
+
|
120
|
+
LineLength:
|
121
|
+
Max: 80
|
122
|
+
|
123
|
+
MethodLength:
|
124
|
+
Enabled: false
|
125
|
+
|
126
|
+
ModuleFunction:
|
127
|
+
Enabled: false
|
128
|
+
|
129
|
+
NegatedIf:
|
130
|
+
Enabled: false
|
131
|
+
|
132
|
+
NegatedWhile:
|
133
|
+
Enabled: false
|
134
|
+
|
135
|
+
Next:
|
136
|
+
Enabled: false
|
137
|
+
|
138
|
+
NilComparison:
|
139
|
+
Enabled: false
|
140
|
+
|
141
|
+
Not:
|
142
|
+
Enabled: false
|
143
|
+
|
144
|
+
NumericLiterals:
|
145
|
+
Enabled: false
|
146
|
+
|
147
|
+
OneLineConditional:
|
148
|
+
Enabled: false
|
149
|
+
|
150
|
+
OpMethod:
|
151
|
+
Enabled: false
|
152
|
+
|
153
|
+
ParameterLists:
|
154
|
+
Enabled: false
|
155
|
+
|
156
|
+
PercentLiteralDelimiters:
|
157
|
+
Enabled: false
|
158
|
+
|
159
|
+
PerlBackrefs:
|
160
|
+
Enabled: false
|
161
|
+
|
162
|
+
PredicateName:
|
163
|
+
NamePrefixBlacklist:
|
164
|
+
- is_
|
165
|
+
|
166
|
+
Proc:
|
167
|
+
Enabled: false
|
168
|
+
|
169
|
+
RaiseArgs:
|
170
|
+
Enabled: false
|
171
|
+
|
172
|
+
RegexpLiteral:
|
173
|
+
Enabled: false
|
174
|
+
|
175
|
+
SelfAssignment:
|
176
|
+
Enabled: false
|
177
|
+
|
178
|
+
SingleLineBlockParams:
|
179
|
+
Enabled: false
|
180
|
+
|
181
|
+
SingleLineMethods:
|
182
|
+
Enabled: false
|
183
|
+
|
184
|
+
SignalException:
|
185
|
+
Enabled: false
|
186
|
+
|
187
|
+
SpecialGlobalVars:
|
188
|
+
Enabled: false
|
189
|
+
|
190
|
+
StringLiterals:
|
191
|
+
Enabled: false
|
192
|
+
|
193
|
+
VariableInterpolation:
|
194
|
+
Enabled: false
|
195
|
+
|
196
|
+
TrailingComma:
|
197
|
+
Enabled: false
|
198
|
+
|
199
|
+
TrivialAccessors:
|
200
|
+
Enabled: false
|
201
|
+
|
202
|
+
VariableInterpolation:
|
203
|
+
Enabled: false
|
204
|
+
|
205
|
+
WhenThen:
|
206
|
+
Enabled: false
|
207
|
+
|
208
|
+
WhileUntilModifier:
|
209
|
+
Enabled: false
|
210
|
+
|
211
|
+
WordArray:
|
212
|
+
Enabled: false
|
213
|
+
|
214
|
+
# Lint
|
215
|
+
|
216
|
+
AmbiguousOperator:
|
217
|
+
Enabled: false
|
218
|
+
|
219
|
+
AmbiguousRegexpLiteral:
|
220
|
+
Enabled: false
|
221
|
+
|
222
|
+
AssignmentInCondition:
|
223
|
+
Enabled: false
|
224
|
+
|
225
|
+
ConditionPosition:
|
226
|
+
Enabled: false
|
227
|
+
|
228
|
+
DeprecatedClassMethods:
|
229
|
+
Enabled: false
|
230
|
+
|
231
|
+
ElseLayout:
|
232
|
+
Enabled: false
|
233
|
+
|
234
|
+
HandleExceptions:
|
235
|
+
Enabled: false
|
236
|
+
|
237
|
+
InvalidCharacterLiteral:
|
238
|
+
Enabled: false
|
239
|
+
|
240
|
+
LiteralInCondition:
|
241
|
+
Enabled: false
|
242
|
+
|
243
|
+
LiteralInInterpolation:
|
244
|
+
Enabled: false
|
245
|
+
|
246
|
+
Loop:
|
247
|
+
Enabled: false
|
248
|
+
|
249
|
+
ParenthesesAsGroupedExpression:
|
250
|
+
Enabled: false
|
251
|
+
|
252
|
+
RequireParentheses:
|
253
|
+
Enabled: false
|
254
|
+
|
255
|
+
UnderscorePrefixedVariableName:
|
256
|
+
Enabled: false
|
257
|
+
|
258
|
+
Void:
|
259
|
+
Enabled: false
|
260
|
+
|
261
|
+
Style/MultilineOperationIndentation:
|
262
|
+
EnforcedStyle: indented
|
263
|
+
|
264
|
+
Style/ExtraSpacing:
|
265
|
+
Enabled: true
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
nebulous (0.0.1)
|
5
|
+
activesupport
|
6
|
+
cocaine (~> 0.5)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activesupport (4.2.0)
|
12
|
+
i18n (~> 0.7)
|
13
|
+
json (~> 1.7, >= 1.7.7)
|
14
|
+
minitest (~> 5.1)
|
15
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
16
|
+
tzinfo (~> 1.1)
|
17
|
+
byebug (4.0.2)
|
18
|
+
columnize (= 0.9.0)
|
19
|
+
climate_control (0.0.3)
|
20
|
+
activesupport (>= 3.0)
|
21
|
+
cocaine (0.5.7)
|
22
|
+
climate_control (>= 0.0.3, < 1.0)
|
23
|
+
columnize (0.9.0)
|
24
|
+
diff-lcs (1.2.5)
|
25
|
+
i18n (0.7.0)
|
26
|
+
json (1.8.2)
|
27
|
+
minitest (5.5.1)
|
28
|
+
rake (10.4.2)
|
29
|
+
rspec (3.2.0)
|
30
|
+
rspec-core (~> 3.2.0)
|
31
|
+
rspec-expectations (~> 3.2.0)
|
32
|
+
rspec-mocks (~> 3.2.0)
|
33
|
+
rspec-core (3.2.2)
|
34
|
+
rspec-support (~> 3.2.0)
|
35
|
+
rspec-expectations (3.2.0)
|
36
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
+
rspec-support (~> 3.2.0)
|
38
|
+
rspec-mocks (3.2.1)
|
39
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
+
rspec-support (~> 3.2.0)
|
41
|
+
rspec-support (3.2.2)
|
42
|
+
thread_safe (0.3.5)
|
43
|
+
tzinfo (1.2.2)
|
44
|
+
thread_safe (~> 0.1)
|
45
|
+
|
46
|
+
PLATFORMS
|
47
|
+
ruby
|
48
|
+
|
49
|
+
DEPENDENCIES
|
50
|
+
bundler (~> 1.6)
|
51
|
+
byebug
|
52
|
+
nebulous!
|
53
|
+
rake
|
54
|
+
rspec
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Zach Graves
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Nebulous
|
2
|
+
|
3
|
+
Easily read CSV files. Less murderous rage.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'nebulous'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install nebulous
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TBD
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( https://github.com/zachgraves/nebulous/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b feature/my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin feature/my-new-feature`)
|
29
|
+
5. Create a new Pull Request targetting `develop`
|
data/lib/nebulous.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'csv'
|
2
|
+
require 'ostruct'
|
3
|
+
require 'cocaine'
|
4
|
+
require 'active_support/all'
|
5
|
+
require 'nebulous/version'
|
6
|
+
require 'nebulous/parser'
|
7
|
+
require 'nebulous/row'
|
8
|
+
require 'nebulous/chunk'
|
9
|
+
require 'nebulous/delimiter_detector'
|
10
|
+
|
11
|
+
module Nebulous
|
12
|
+
def self.process(file, *args, &block)
|
13
|
+
Parser.new(file, *args).process(&block)
|
14
|
+
end
|
15
|
+
end
|