front_matter_parser 0.0.4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.codeclimate.yml +19 -0
- data/.gitignore +1 -0
- data/.rspec +1 -0
- data/.rubocop.yml +50 -0
- data/.travis.yml +19 -1
- data/CHANGELOG.md +30 -0
- data/Dockerfile +5 -0
- data/Gemfile +0 -2
- data/README.md +76 -38
- data/Rakefile +5 -3
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/docker-compose.yml +12 -0
- data/front_matter_parser.gemspec +12 -6
- data/lib/front_matter_parser.rb +10 -114
- data/lib/front_matter_parser/loader.rb +11 -0
- data/lib/front_matter_parser/loader/yaml.rb +26 -0
- data/lib/front_matter_parser/parsed.rb +25 -14
- data/lib/front_matter_parser/parser.rb +82 -0
- data/lib/front_matter_parser/syntax_parser.rb +28 -0
- data/lib/front_matter_parser/syntax_parser/factorizable.rb +30 -0
- data/lib/front_matter_parser/syntax_parser/indentation_comment.rb +49 -0
- data/lib/front_matter_parser/syntax_parser/multi_line_comment.rb +50 -0
- data/lib/front_matter_parser/syntax_parser/single_line_comment.rb +64 -0
- data/lib/front_matter_parser/version.rb +3 -1
- data/spec/fixtures/example +6 -0
- data/spec/front_matter_parser/loader/yaml_spec.rb +24 -0
- data/spec/front_matter_parser/parsed_spec.rb +11 -21
- data/spec/front_matter_parser/parser_spec.rb +111 -0
- data/spec/front_matter_parser/syntax_parser/indentation_comment_spec.rb +166 -0
- data/spec/front_matter_parser/syntax_parser/multi_line_comment_spec.rb +267 -0
- data/spec/front_matter_parser/syntax_parser/single_line_comment_spec.rb +175 -0
- data/spec/front_matter_parser_spec.rb +3 -296
- data/spec/spec_helper.rb +9 -3
- data/spec/support/matcher.rb +8 -0
- metadata +110 -46
- data/spec/fixtures/example.coffee +0 -4
- data/spec/fixtures/example.erb +0 -6
- data/spec/fixtures/example.foo +0 -0
- data/spec/fixtures/example.haml +0 -5
- data/spec/fixtures/example.liquid +0 -6
- data/spec/fixtures/example.md +0 -4
- data/spec/fixtures/example.sass +0 -4
- data/spec/fixtures/example.scss +0 -4
- data/spec/fixtures/example.slim +0 -5
- data/spec/support/strings.rb +0 -41
- data/spec/support/syntaxs.rb +0 -14
- data/spec/support/utils.rb +0 -6
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'simplecov'
|
4
|
+
|
5
|
+
SimpleCov.start
|
6
|
+
|
7
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
|
2
8
|
require 'front_matter_parser'
|
3
|
-
require '
|
4
|
-
Dir["#{File.expand_path('
|
9
|
+
require 'pry-byebug'
|
10
|
+
Dir["#{File.expand_path('support', __dir__)}/*.rb"].each do |file|
|
5
11
|
require file
|
6
12
|
end
|
metadata
CHANGED
@@ -1,103 +1,175 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: front_matter_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- marc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
31
|
- - "~>"
|
18
32
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
-
|
33
|
+
version: '12.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '12.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
21
46
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
47
|
+
version: '3.8'
|
23
48
|
type: :development
|
24
49
|
prerelease: false
|
25
50
|
version_requirements: !ruby/object:Gem::Requirement
|
26
51
|
requirements:
|
27
52
|
- - "~>"
|
28
53
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
30
|
-
|
54
|
+
version: '3.8'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry-byebug
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
31
60
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
61
|
+
version: '3.7'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.7'
|
33
69
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
70
|
+
name: rubocop
|
35
71
|
requirement: !ruby/object:Gem::Requirement
|
36
72
|
requirements:
|
37
73
|
- - "~>"
|
38
74
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
75
|
+
version: '1.9'
|
40
76
|
type: :development
|
41
77
|
prerelease: false
|
42
78
|
version_requirements: !ruby/object:Gem::Requirement
|
43
79
|
requirements:
|
44
80
|
- - "~>"
|
45
81
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
82
|
+
version: '1.9'
|
47
83
|
- !ruby/object:Gem::Dependency
|
48
|
-
name: rspec
|
84
|
+
name: rubocop-rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.2'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.2'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.17'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.17'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: codeclimate-test-reporter
|
49
113
|
requirement: !ruby/object:Gem::Requirement
|
50
114
|
requirements:
|
51
115
|
- - "~>"
|
52
116
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
117
|
+
version: '1.0'
|
54
118
|
type: :development
|
55
119
|
prerelease: false
|
56
120
|
version_requirements: !ruby/object:Gem::Requirement
|
57
121
|
requirements:
|
58
122
|
- - "~>"
|
59
123
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
61
|
-
description:
|
62
|
-
autodetection.
|
124
|
+
version: '1.0'
|
125
|
+
description: Parse a front matter from syntactically correct strings or files
|
63
126
|
email:
|
64
127
|
- marc@lamarciana.com
|
65
128
|
executables: []
|
66
129
|
extensions: []
|
67
130
|
extra_rdoc_files: []
|
68
131
|
files:
|
132
|
+
- ".codeclimate.yml"
|
69
133
|
- ".gitignore"
|
70
134
|
- ".rspec"
|
135
|
+
- ".rubocop.yml"
|
71
136
|
- ".ruby-version"
|
72
137
|
- ".travis.yml"
|
73
138
|
- ".yardopts"
|
139
|
+
- CHANGELOG.md
|
74
140
|
- COPYING.LESSER
|
75
141
|
- COPYING.txt
|
142
|
+
- Dockerfile
|
76
143
|
- Gemfile
|
77
144
|
- LICENSE.txt
|
78
145
|
- README.md
|
79
146
|
- Rakefile
|
147
|
+
- bin/console
|
148
|
+
- bin/setup
|
149
|
+
- docker-compose.yml
|
80
150
|
- front_matter_parser.gemspec
|
81
151
|
- lib/front_matter_parser.rb
|
152
|
+
- lib/front_matter_parser/loader.rb
|
153
|
+
- lib/front_matter_parser/loader/yaml.rb
|
82
154
|
- lib/front_matter_parser/parsed.rb
|
155
|
+
- lib/front_matter_parser/parser.rb
|
156
|
+
- lib/front_matter_parser/syntax_parser.rb
|
157
|
+
- lib/front_matter_parser/syntax_parser/factorizable.rb
|
158
|
+
- lib/front_matter_parser/syntax_parser/indentation_comment.rb
|
159
|
+
- lib/front_matter_parser/syntax_parser/multi_line_comment.rb
|
160
|
+
- lib/front_matter_parser/syntax_parser/single_line_comment.rb
|
83
161
|
- lib/front_matter_parser/version.rb
|
84
162
|
- spec/fixtures/example
|
85
|
-
- spec/fixtures/example.coffee
|
86
|
-
- spec/fixtures/example.erb
|
87
|
-
- spec/fixtures/example.foo
|
88
|
-
- spec/fixtures/example.haml
|
89
163
|
- spec/fixtures/example.html
|
90
|
-
- spec/
|
91
|
-
- spec/fixtures/example.md
|
92
|
-
- spec/fixtures/example.sass
|
93
|
-
- spec/fixtures/example.scss
|
94
|
-
- spec/fixtures/example.slim
|
164
|
+
- spec/front_matter_parser/loader/yaml_spec.rb
|
95
165
|
- spec/front_matter_parser/parsed_spec.rb
|
166
|
+
- spec/front_matter_parser/parser_spec.rb
|
167
|
+
- spec/front_matter_parser/syntax_parser/indentation_comment_spec.rb
|
168
|
+
- spec/front_matter_parser/syntax_parser/multi_line_comment_spec.rb
|
169
|
+
- spec/front_matter_parser/syntax_parser/single_line_comment_spec.rb
|
96
170
|
- spec/front_matter_parser_spec.rb
|
97
171
|
- spec/spec_helper.rb
|
98
|
-
- spec/support/
|
99
|
-
- spec/support/syntaxs.rb
|
100
|
-
- spec/support/utils.rb
|
172
|
+
- spec/support/matcher.rb
|
101
173
|
homepage: https://github.com/waiting-for-dev/front_matter_parser
|
102
174
|
licenses:
|
103
175
|
- LGPL3
|
@@ -117,29 +189,21 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
189
|
- !ruby/object:Gem::Version
|
118
190
|
version: '0'
|
119
191
|
requirements: []
|
120
|
-
|
121
|
-
rubygems_version: 2.2.2
|
192
|
+
rubygems_version: 3.2.3
|
122
193
|
signing_key:
|
123
194
|
specification_version: 4
|
124
|
-
summary:
|
125
|
-
|
126
|
-
|
127
|
-
comments.
|
195
|
+
summary: Library to parse a front matter from strings or files. It allows writing
|
196
|
+
syntactically correct source files, marking front matters as comments in the source
|
197
|
+
file language.
|
128
198
|
test_files:
|
129
199
|
- spec/fixtures/example
|
130
|
-
- spec/fixtures/example.coffee
|
131
|
-
- spec/fixtures/example.erb
|
132
|
-
- spec/fixtures/example.foo
|
133
|
-
- spec/fixtures/example.haml
|
134
200
|
- spec/fixtures/example.html
|
135
|
-
- spec/
|
136
|
-
- spec/fixtures/example.md
|
137
|
-
- spec/fixtures/example.sass
|
138
|
-
- spec/fixtures/example.scss
|
139
|
-
- spec/fixtures/example.slim
|
201
|
+
- spec/front_matter_parser/loader/yaml_spec.rb
|
140
202
|
- spec/front_matter_parser/parsed_spec.rb
|
203
|
+
- spec/front_matter_parser/parser_spec.rb
|
204
|
+
- spec/front_matter_parser/syntax_parser/indentation_comment_spec.rb
|
205
|
+
- spec/front_matter_parser/syntax_parser/multi_line_comment_spec.rb
|
206
|
+
- spec/front_matter_parser/syntax_parser/single_line_comment_spec.rb
|
141
207
|
- spec/front_matter_parser_spec.rb
|
142
208
|
- spec/spec_helper.rb
|
143
|
-
- spec/support/
|
144
|
-
- spec/support/syntaxs.rb
|
145
|
-
- spec/support/utils.rb
|
209
|
+
- spec/support/matcher.rb
|
data/spec/fixtures/example.erb
DELETED
data/spec/fixtures/example.foo
DELETED
File without changes
|
data/spec/fixtures/example.haml
DELETED
data/spec/fixtures/example.md
DELETED
data/spec/fixtures/example.sass
DELETED
data/spec/fixtures/example.scss
DELETED
data/spec/fixtures/example.slim
DELETED
data/spec/support/strings.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
def string
|
2
|
-
"---
|
3
|
-
title: hello
|
4
|
-
---
|
5
|
-
Content"
|
6
|
-
end
|
7
|
-
|
8
|
-
def string_no_front_matter
|
9
|
-
"Content"
|
10
|
-
end
|
11
|
-
|
12
|
-
def string_no_content
|
13
|
-
"---
|
14
|
-
title: hello
|
15
|
-
---
|
16
|
-
"
|
17
|
-
end
|
18
|
-
|
19
|
-
def string_comment(comment)
|
20
|
-
"#{comment} ---
|
21
|
-
#{comment} title: hello
|
22
|
-
#{comment} ---
|
23
|
-
Content"
|
24
|
-
end
|
25
|
-
|
26
|
-
def string_start_comment(start_comment)
|
27
|
-
"#{start_comment}
|
28
|
-
---
|
29
|
-
title: hello
|
30
|
-
---
|
31
|
-
Content"
|
32
|
-
end
|
33
|
-
|
34
|
-
def string_start_end_comment(start_comment, end_comment)
|
35
|
-
"#{start_comment}
|
36
|
-
---
|
37
|
-
title: hello
|
38
|
-
---
|
39
|
-
#{end_comment}
|
40
|
-
Content"
|
41
|
-
end
|
data/spec/support/syntaxs.rb
DELETED