textlint-ruby 0.1.1 → 2.0.2
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/.ruby-version +1 -0
- data/CHANGELOG.md +14 -0
- data/CODE_OF_CONDUCT.md +0 -2
- data/LICENSE.txt +1 -1
- data/README.md +7 -8
- data/bin/textlint-ruby +1 -18
- data/lib/textlint/cli.rb +92 -0
- data/lib/textlint/parser.rb +108 -27
- data/lib/textlint/server.rb +115 -0
- data/lib/textlint/version.rb +7 -1
- data/lib/textlint.rb +5 -1
- data/textlint.gemspec +4 -4
- metadata +13 -12
- data/bin/textlint-ruby-optimized +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f766982ec45b8b0f8d59e148320890f29294eaac2855c02f516fe80c720b4e15
|
4
|
+
data.tar.gz: 1afebad572f53700aef161d9e650b3ad50ed9343e7100ce43bc67dd3dd6e7d0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b15d75e4d88a06984a53e49b47138a8c96c9e2024f0cc2636111d68d88423e76a69cb4707c61d225e2db034717df7307253a373548f668a75c663f7d044dd995
|
7
|
+
data.tar.gz: eb7f82b3fc2256ae5f5a83dfc30f49d7cd02284bb29d7b7f4ba6323ce29b77dfdb1ef6e98e3d9141b5ca7cc7a310c011fbaffec26ed390af34c16a97b853a549
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.7.4
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [2.0.2]
|
4
|
+
|
5
|
+
- Support heredoc #4
|
6
|
+
|
7
|
+
## [2.0.1]
|
8
|
+
|
9
|
+
- Support `on_ignored_nl` event in Ruby 2.6
|
10
|
+
- Changed the repository owner from alpaca-tc to kufu
|
11
|
+
|
12
|
+
## [2.0.0]
|
13
|
+
|
14
|
+
- Add stdio server mode. textlint-plugin-ruby(>= v2.0.0) can connect with textlint-ruby via stdio.
|
15
|
+
- Remove textlint-ruby-optimized command
|
16
|
+
|
3
17
|
## [0.1.1]
|
4
18
|
|
5
19
|
- Support ruby 2.5
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -39,8 +39,6 @@ This Code of Conduct applies within all community spaces, and also applies when
|
|
39
39
|
|
40
40
|
## Enforcement
|
41
41
|
|
42
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at alpaca-tc@alpaca.tc. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
-
|
44
42
|
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
43
|
|
46
44
|
## Enforcement Guidelines
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
# textlint-ruby
|
2
2
|
|
3
|
-
Ruby AST parser for [textlint-ruby
|
3
|
+
Ruby AST parser for [textlint-plugin-ruby](https://github.com/kufu/textlint-plugin-ruby).
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
**TODO: release gems**
|
8
|
-
|
9
7
|
Add this line to your application's Gemfile:
|
10
8
|
|
11
9
|
```ruby
|
@@ -25,11 +23,12 @@ Or install it yourself as:
|
|
25
23
|
Parse ruby to textlint AST
|
26
24
|
|
27
25
|
```sh
|
26
|
+
# Parse specific file
|
28
27
|
$ textlint-ruby ./path/to/file.rb
|
29
28
|
{"type":"Document","raw":"...","range":[0,465],"loc":{"start":{"line":1,"column":0},"end":{"line":26,"column":0}},"children":[...]}
|
30
29
|
|
31
|
-
# textlint-ruby
|
32
|
-
$ textlint-ruby
|
30
|
+
# Boot textlint-ruby server for textlint-plugin-ruby
|
31
|
+
$ textlint-ruby --stdio
|
33
32
|
```
|
34
33
|
|
35
34
|
### Supported nodes
|
@@ -69,7 +68,7 @@ Supported node types are only `Document` and `Str` because this plugin is used t
|
|
69
68
|
| ASTNodeTypes.ImageExit | TxtNode | |
|
70
69
|
| ASTNodeTypes.HorizontalRule | TxtNode | |
|
71
70
|
| ASTNodeTypes.HorizontalRuleExit | TxtNode | |
|
72
|
-
| ASTNodeTypes.Comment | TxtTextNode |
|
71
|
+
| ASTNodeTypes.Comment | TxtTextNode | yes |
|
73
72
|
| ASTNodeTypes.CommentExit | TxtTextNode | |
|
74
73
|
| ASTNodeTypes.Str | TxtTextNode | yes |
|
75
74
|
| ASTNodeTypes.StrExit | TxtTextNode | |
|
@@ -84,7 +83,7 @@ Run `bundle exec rspec` to run the tests.
|
|
84
83
|
|
85
84
|
## Contributing
|
86
85
|
|
87
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
86
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/kufu/textlint-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/kufu/textlint-ruby/blob/master/CODE_OF_CONDUCT.md).
|
88
87
|
|
89
88
|
## License
|
90
89
|
|
@@ -92,4 +91,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
92
91
|
|
93
92
|
## Code of Conduct
|
94
93
|
|
95
|
-
Everyone interacting in the `textlint-ruby` project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
94
|
+
Everyone interacting in the `textlint-ruby` project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/kufu/textlint-ruby/blob/master/CODE_OF_CONDUCT.md).
|
data/bin/textlint-ruby
CHANGED
@@ -5,21 +5,4 @@ $LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
|
|
5
5
|
|
6
6
|
require 'textlint'
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
unless File.exist?(path.to_s)
|
11
|
-
warn("Error: No such file or directory: #{path}")
|
12
|
-
exit(1)
|
13
|
-
end
|
14
|
-
|
15
|
-
content = File.read(path)
|
16
|
-
|
17
|
-
begin
|
18
|
-
ast = Textlint::Parser.parse(content)
|
19
|
-
puts(ast.as_textlint_json.to_json)
|
20
|
-
rescue Textlint::SyntaxError => error
|
21
|
-
warn("Failed to compile: #{path}")
|
22
|
-
warn('')
|
23
|
-
warn(error)
|
24
|
-
exit(1)
|
25
|
-
end
|
8
|
+
Textlint::Cli.run(ARGV.clone)
|
data/lib/textlint/cli.rb
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
|
5
|
+
module Textlint
|
6
|
+
class Cli
|
7
|
+
attr_reader :options
|
8
|
+
|
9
|
+
DEFAULT_OPTIONS = {
|
10
|
+
stdio: false,
|
11
|
+
paths: []
|
12
|
+
}.freeze
|
13
|
+
|
14
|
+
# @param argv [Array] ARGV
|
15
|
+
def self.run(argv)
|
16
|
+
new(argv).run
|
17
|
+
end
|
18
|
+
|
19
|
+
# @param argv [Array] ARGV
|
20
|
+
def initialize(argv)
|
21
|
+
@options = DEFAULT_OPTIONS.dup
|
22
|
+
parse_options(argv)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Run textlint-ruby
|
26
|
+
#
|
27
|
+
# @return [void]
|
28
|
+
def run
|
29
|
+
if @options[:stdio]
|
30
|
+
run_stdio_server
|
31
|
+
else
|
32
|
+
run_file_parser
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def run_stdio_server
|
39
|
+
Textlint::Server.new.start
|
40
|
+
end
|
41
|
+
|
42
|
+
def run_file_parser
|
43
|
+
path = @options[:path]
|
44
|
+
|
45
|
+
unless File.exist?(path.to_s)
|
46
|
+
warn("Error: No such file or directory: #{path}")
|
47
|
+
exit(1)
|
48
|
+
end
|
49
|
+
|
50
|
+
content = File.read(path)
|
51
|
+
|
52
|
+
begin
|
53
|
+
ast = Textlint::Parser.parse(content)
|
54
|
+
puts(ast.as_textlint_json.to_json)
|
55
|
+
rescue Textlint::SyntaxError => error
|
56
|
+
warn("Failed to compile: #{path}")
|
57
|
+
warn('')
|
58
|
+
warn(error)
|
59
|
+
exit(1)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def parse_options(argv)
|
64
|
+
option_parser = ::OptionParser.new do |parser|
|
65
|
+
parser.banner = 'Usage: textlint-ruby [rubyfile_path] [options]'
|
66
|
+
parser.program_name = 'textlint-ruby'
|
67
|
+
|
68
|
+
parser.version = [
|
69
|
+
Textlint::VERSION::MAJOR,
|
70
|
+
Textlint::VERSION::MINOR,
|
71
|
+
Textlint::VERSION::TINY
|
72
|
+
]
|
73
|
+
|
74
|
+
parser.on('--stdio', 'use stdio') do
|
75
|
+
@options[:stdio] = true
|
76
|
+
end
|
77
|
+
|
78
|
+
parser.on_tail('-h', '--help') do
|
79
|
+
puts option_parser.help
|
80
|
+
exit
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
@options[:path] = option_parser.parse(argv).first
|
85
|
+
|
86
|
+
if !@options[:stdio] && !@options[:path]
|
87
|
+
puts option_parser.help
|
88
|
+
exit(1)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
data/lib/textlint/parser.rb
CHANGED
@@ -5,6 +5,9 @@ require 'ripper'
|
|
5
5
|
module Textlint
|
6
6
|
class Parser
|
7
7
|
class RubyToTextlintAST < ::Ripper::Filter
|
8
|
+
EVENT_RE = /\Aon_(?<name>\w*)_(?:beg|end)\z/.freeze
|
9
|
+
TSTRING_BEG_EVENTS = %w[tstring qwords heredoc].freeze
|
10
|
+
|
8
11
|
# @param src [String]
|
9
12
|
# @param lines [Array<String>]
|
10
13
|
def initialize(src)
|
@@ -12,20 +15,23 @@ module Textlint
|
|
12
15
|
@src = src
|
13
16
|
@pos = 0
|
14
17
|
@lines = @src.lines
|
18
|
+
@events = []
|
15
19
|
end
|
16
20
|
|
17
21
|
private
|
18
22
|
|
23
|
+
# All events call this method
|
19
24
|
# NOTE: Instance variables are allowed to assign only here to readable code.
|
20
25
|
def on_default(event, token, node)
|
21
|
-
@token = token
|
26
|
+
@token = token.to_s
|
27
|
+
@event = event
|
22
28
|
|
23
29
|
method_name = :"custom_#{event}"
|
24
30
|
|
25
31
|
if respond_to?(method_name, true)
|
26
32
|
@range = @pos...(@pos + @token.size)
|
27
33
|
@raw = @src[@range]
|
28
|
-
|
34
|
+
send(method_name, node)
|
29
35
|
end
|
30
36
|
|
31
37
|
@pos += @token.size
|
@@ -34,6 +40,14 @@ module Textlint
|
|
34
40
|
end
|
35
41
|
|
36
42
|
def default_node_attributes(type:, **attributes)
|
43
|
+
break_count = @token.scan(Textlint::BREAK_RE).size
|
44
|
+
|
45
|
+
last_column = if break_count == 0
|
46
|
+
column + @token.size
|
47
|
+
else
|
48
|
+
@token.match(LAST_LINE_RE).to_s.size
|
49
|
+
end
|
50
|
+
|
37
51
|
{
|
38
52
|
type: type,
|
39
53
|
raw: @raw,
|
@@ -43,12 +57,21 @@ module Textlint
|
|
43
57
|
line: lineno,
|
44
58
|
column: column
|
45
59
|
),
|
46
|
-
end:
|
60
|
+
end: Textlint::Nodes::TxtNodePosition.new(
|
61
|
+
line: lineno + break_count,
|
62
|
+
column: last_column
|
63
|
+
)
|
47
64
|
)
|
48
65
|
}.merge(attributes)
|
49
66
|
end
|
50
67
|
|
68
|
+
# "hello world"
|
69
|
+
# 'hello world'
|
70
|
+
# %q{hello world}
|
51
71
|
def custom_on_tstring_content(parentNode)
|
72
|
+
begin_event_name, _begin_node = @events.last
|
73
|
+
return unless TSTRING_BEG_EVENTS.include?(begin_event_name)
|
74
|
+
|
52
75
|
node = Textlint::Nodes::TxtTextNode.new(
|
53
76
|
**default_node_attributes(
|
54
77
|
type: Textlint::Nodes::STR,
|
@@ -61,20 +84,70 @@ module Textlint
|
|
61
84
|
parentNode
|
62
85
|
end
|
63
86
|
|
64
|
-
|
65
|
-
|
87
|
+
# # hello world
|
88
|
+
def custom_on_comment(parentNode)
|
89
|
+
node = Textlint::Nodes::TxtTextNode.new(
|
90
|
+
**default_node_attributes(
|
91
|
+
type: Textlint::Nodes::COMMENT,
|
92
|
+
value: @token.gsub(/\A#/, '')
|
93
|
+
)
|
94
|
+
)
|
66
95
|
|
67
|
-
|
68
|
-
|
69
|
-
else
|
70
|
-
@token.match(LAST_LINE_RE).to_s.size
|
71
|
-
end
|
96
|
+
parentNode.children.push(node)
|
97
|
+
end
|
72
98
|
|
73
|
-
|
74
|
-
|
75
|
-
|
99
|
+
# =begin
|
100
|
+
# hello world
|
101
|
+
# =end
|
102
|
+
def custom_on_embdoc(parentNode)
|
103
|
+
_begin_event_name, begin_node = @events.last
|
104
|
+
|
105
|
+
node = Textlint::Nodes::TxtTextNode.new(
|
106
|
+
type: Textlint::Nodes::COMMENT,
|
107
|
+
loc: begin_node.loc,
|
108
|
+
range: begin_node.range,
|
109
|
+
raw: begin_node.raw,
|
110
|
+
value: @token
|
76
111
|
)
|
112
|
+
|
113
|
+
parentNode.children.push(node)
|
77
114
|
end
|
115
|
+
|
116
|
+
def event_name
|
117
|
+
matched = EVENT_RE.match(@event)
|
118
|
+
matched[:name] if matched
|
119
|
+
end
|
120
|
+
|
121
|
+
def on_beg_event(*)
|
122
|
+
@events.push(
|
123
|
+
[
|
124
|
+
event_name,
|
125
|
+
Textlint::Nodes::TxtTextNode.new(
|
126
|
+
**default_node_attributes(
|
127
|
+
type: nil, # NOTE: beg event has no type
|
128
|
+
value: @token
|
129
|
+
)
|
130
|
+
)
|
131
|
+
]
|
132
|
+
)
|
133
|
+
end
|
134
|
+
|
135
|
+
def on_end_event(*)
|
136
|
+
@events.pop
|
137
|
+
end
|
138
|
+
|
139
|
+
alias custom_on_tstring_beg on_beg_event
|
140
|
+
alias custom_on_regexp_beg on_beg_event
|
141
|
+
alias custom_on_embexpr_beg on_beg_event
|
142
|
+
alias custom_on_qwords_beg on_beg_event
|
143
|
+
alias custom_on_embdoc_beg on_beg_event
|
144
|
+
alias custom_on_heredoc_beg on_beg_event
|
145
|
+
|
146
|
+
alias custom_on_tstring_end on_end_event
|
147
|
+
alias custom_on_regexp_end on_end_event
|
148
|
+
alias custom_on_embexpr_end on_end_event
|
149
|
+
alias custom_on_embdoc_end on_end_event
|
150
|
+
alias custom_on_heredoc_end on_end_event
|
78
151
|
end
|
79
152
|
|
80
153
|
# Parse ruby code to AST for textlint
|
@@ -86,33 +159,41 @@ module Textlint
|
|
86
159
|
new(src).call
|
87
160
|
end
|
88
161
|
|
89
|
-
#
|
90
|
-
|
91
|
-
|
92
|
-
end
|
93
|
-
|
94
|
-
# Parse ruby code to AST for textlint
|
162
|
+
# Parse ruby code to TxtParentNode
|
163
|
+
#
|
164
|
+
# @param src [String]
|
95
165
|
#
|
96
166
|
# @return [Textlint::Nodes::TxtParentNode]
|
97
|
-
def
|
98
|
-
|
99
|
-
|
100
|
-
document = Textlint::Nodes::TxtParentNode.new(
|
167
|
+
def self.build_document(src)
|
168
|
+
Textlint::Nodes::TxtParentNode.new(
|
101
169
|
type: Textlint::Nodes::DOCUMENT,
|
102
|
-
raw:
|
103
|
-
range: 0
|
170
|
+
raw: src,
|
171
|
+
range: 0...src.size,
|
104
172
|
loc: Textlint::Nodes::TxtNodeLineLocation.new(
|
105
173
|
start: Textlint::Nodes::TxtNodePosition.new(
|
106
174
|
line: 1,
|
107
175
|
column: 0
|
108
176
|
),
|
109
177
|
end: Textlint::Nodes::TxtNodePosition.new(
|
110
|
-
line:
|
111
|
-
column:
|
178
|
+
line: src.split(Textlint::BREAK_RE).size + 1,
|
179
|
+
column: src.match(LAST_LINE_RE).to_s.size # extract last line
|
112
180
|
)
|
113
181
|
)
|
114
182
|
)
|
183
|
+
end
|
184
|
+
|
185
|
+
# @param src [String] ruby source code
|
186
|
+
def initialize(src)
|
187
|
+
@src = src
|
188
|
+
end
|
189
|
+
|
190
|
+
# Parse ruby code to AST for textlint
|
191
|
+
#
|
192
|
+
# @return [Textlint::Nodes::TxtParentNode]
|
193
|
+
def call
|
194
|
+
check_syntax!
|
115
195
|
|
196
|
+
document = self.class.build_document(@src)
|
116
197
|
RubyToTextlintAST.new(@src).parse(document)
|
117
198
|
end
|
118
199
|
|
@@ -0,0 +1,115 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Textlint
|
6
|
+
class Server
|
7
|
+
REQUIRED_VERSION = '2.0.0'
|
8
|
+
|
9
|
+
AVAILABLE_ACTIONS = %w[
|
10
|
+
parse
|
11
|
+
info
|
12
|
+
].freeze
|
13
|
+
|
14
|
+
# @param stdin [IO]
|
15
|
+
# @param stdout [IO]
|
16
|
+
# @param stderr [IO]
|
17
|
+
def initialize(stdin: $stdin, stdout: $stdout, stderr: $stderr)
|
18
|
+
@stdin = stdin
|
19
|
+
@stdout = stdout
|
20
|
+
@stderr = stderr
|
21
|
+
end
|
22
|
+
|
23
|
+
# Start stdio server
|
24
|
+
#
|
25
|
+
# @return [void]
|
26
|
+
def start
|
27
|
+
@stdout.sync = true
|
28
|
+
trap_signals
|
29
|
+
start_server
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def start_server
|
35
|
+
receive_stdin do |json|
|
36
|
+
action = json['action']
|
37
|
+
result = send(:"do_#{action}", json)
|
38
|
+
request_seq = json['seq']
|
39
|
+
response = { request_seq: request_seq, result: result }
|
40
|
+
|
41
|
+
@stdout.puts(JSON.dump(response))
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def validate_request(json)
|
46
|
+
if Gem::Version.create(json['version'].to_s) < Gem::Version.create(REQUIRED_VERSION)
|
47
|
+
raise(Textlint::RequestError, "textlint-ruby requires textlin-plugin-ruby version >= #{REQUIRED_VERSION}")
|
48
|
+
elsif !AVAILABLE_ACTIONS.include?(json['action'])
|
49
|
+
raise(Textlint::RequestError, "Unknown action(#{json['action']}) given. Available actions are #{AVAILABLE_ACTIONS}")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# request spec
|
54
|
+
# { "seq": number, "action": string, "version": string, [key: string]: any }
|
55
|
+
#
|
56
|
+
# response spec
|
57
|
+
# action "info"
|
58
|
+
# { "request_seq": number, "version": string, result: string(version) }
|
59
|
+
#
|
60
|
+
# action "parse"
|
61
|
+
# { "request_seq": number, "version": string, result: string(AST for textlint) }
|
62
|
+
def receive_stdin
|
63
|
+
loop do
|
64
|
+
return if @stdin.eof?
|
65
|
+
|
66
|
+
line = @stdin.readline
|
67
|
+
|
68
|
+
begin
|
69
|
+
json = JSON.parse(line)
|
70
|
+
validate_request(json)
|
71
|
+
yield(json)
|
72
|
+
rescue JSON::JSONError
|
73
|
+
warn("Can't parse request to JSON")
|
74
|
+
rescue StandardError => error
|
75
|
+
warn(error.message)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def warn(message)
|
81
|
+
@stderr.puts(message)
|
82
|
+
end
|
83
|
+
|
84
|
+
def trap_signals
|
85
|
+
::Signal.trap(:SIGINT) do
|
86
|
+
exit
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def do_info(_json)
|
91
|
+
Textlint::VERSION::STRING
|
92
|
+
end
|
93
|
+
|
94
|
+
def do_parse(json)
|
95
|
+
path = json['path'].to_s
|
96
|
+
|
97
|
+
unless File.exist?(path)
|
98
|
+
raise(Textlint::RequestError, "Error: No such file or directory: #{path}")
|
99
|
+
end
|
100
|
+
|
101
|
+
content = File.read(path)
|
102
|
+
|
103
|
+
ast = begin
|
104
|
+
Textlint::Parser.parse(content)
|
105
|
+
rescue Textlint::SyntaxError
|
106
|
+
error = Textlint::RequestError.new("Failed to parse: #{path}. syntax error or the file is incompatible with the ruby(#{RUBY_VERSION}) running textlint-ruby")
|
107
|
+
warn(error)
|
108
|
+
|
109
|
+
Textlint::Parser.build_document(content)
|
110
|
+
end
|
111
|
+
|
112
|
+
ast.as_textlint_json
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
data/lib/textlint/version.rb
CHANGED
data/lib/textlint.rb
CHANGED
@@ -4,10 +4,14 @@ require 'json'
|
|
4
4
|
require 'textlint/version'
|
5
5
|
require 'textlint/nodes'
|
6
6
|
require 'textlint/parser'
|
7
|
+
require 'textlint/cli'
|
8
|
+
require 'textlint/server'
|
7
9
|
|
8
10
|
module Textlint
|
9
11
|
BREAK_RE = /\r?\n/.freeze
|
10
12
|
LAST_LINE_RE = /(?!\r?\n).*\z/.freeze
|
11
13
|
|
12
|
-
class
|
14
|
+
class Error < StandardError; end
|
15
|
+
class SyntaxError < Error; end
|
16
|
+
class RequestError < Error; end
|
13
17
|
end
|
data/textlint.gemspec
CHANGED
@@ -4,19 +4,19 @@ require_relative 'lib/textlint/version'
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'textlint-ruby'
|
7
|
-
spec.version = Textlint::VERSION
|
7
|
+
spec.version = Textlint::VERSION::STRING
|
8
8
|
spec.authors = ['alpaca-tc']
|
9
9
|
spec.email = ['alpaca-tc@alpaca.tc']
|
10
10
|
|
11
11
|
spec.summary = 'ruby source code parser for textlint'
|
12
12
|
spec.description = ''
|
13
|
-
spec.homepage = 'https://github.com/
|
13
|
+
spec.homepage = 'https://github.com/kufu/textlint-ruby'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
spec.required_ruby_version = '>= 2.5.0'
|
16
16
|
|
17
17
|
spec.metadata['homepage_uri'] = spec.homepage
|
18
|
-
spec.metadata['source_code_uri'] = 'https://github.com/
|
19
|
-
spec.metadata['changelog_uri'] = 'https://github.com/
|
18
|
+
spec.metadata['source_code_uri'] = 'https://github.com/kufu/textlint-ruby'
|
19
|
+
spec.metadata['changelog_uri'] = 'https://github.com/kufu/textlint-ruby/blob/main/CHANGELOG.md'
|
20
20
|
|
21
21
|
# Specify which files should be added to the gem when it is released.
|
22
22
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
metadata
CHANGED
@@ -1,21 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: textlint-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- alpaca-tc
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: ''
|
14
14
|
email:
|
15
15
|
- alpaca-tc@alpaca.tc
|
16
16
|
executables:
|
17
17
|
- textlint-ruby
|
18
|
-
- textlint-ruby-optimized
|
19
18
|
extensions: []
|
20
19
|
extra_rdoc_files: []
|
21
20
|
files:
|
@@ -23,6 +22,7 @@ files:
|
|
23
22
|
- ".gitignore"
|
24
23
|
- ".rspec"
|
25
24
|
- ".rubocop.yml"
|
25
|
+
- ".ruby-version"
|
26
26
|
- CHANGELOG.md
|
27
27
|
- CODE_OF_CONDUCT.md
|
28
28
|
- Gemfile
|
@@ -31,21 +31,22 @@ files:
|
|
31
31
|
- README.md
|
32
32
|
- Rakefile
|
33
33
|
- bin/textlint-ruby
|
34
|
-
- bin/textlint-ruby-optimized
|
35
34
|
- lib/textlint-ruby.rb
|
36
35
|
- lib/textlint.rb
|
36
|
+
- lib/textlint/cli.rb
|
37
37
|
- lib/textlint/nodes.rb
|
38
38
|
- lib/textlint/parser.rb
|
39
|
+
- lib/textlint/server.rb
|
39
40
|
- lib/textlint/version.rb
|
40
41
|
- textlint.gemspec
|
41
|
-
homepage: https://github.com/
|
42
|
+
homepage: https://github.com/kufu/textlint-ruby
|
42
43
|
licenses:
|
43
44
|
- MIT
|
44
45
|
metadata:
|
45
|
-
homepage_uri: https://github.com/
|
46
|
-
source_code_uri: https://github.com/
|
47
|
-
changelog_uri: https://github.com/
|
48
|
-
post_install_message:
|
46
|
+
homepage_uri: https://github.com/kufu/textlint-ruby
|
47
|
+
source_code_uri: https://github.com/kufu/textlint-ruby
|
48
|
+
changelog_uri: https://github.com/kufu/textlint-ruby/blob/main/CHANGELOG.md
|
49
|
+
post_install_message:
|
49
50
|
rdoc_options: []
|
50
51
|
require_paths:
|
51
52
|
- lib
|
@@ -60,8 +61,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
61
|
- !ruby/object:Gem::Version
|
61
62
|
version: '0'
|
62
63
|
requirements: []
|
63
|
-
rubygems_version: 3.
|
64
|
-
signing_key:
|
64
|
+
rubygems_version: 3.1.6
|
65
|
+
signing_key:
|
65
66
|
specification_version: 4
|
66
67
|
summary: ruby source code parser for textlint
|
67
68
|
test_files: []
|
data/bin/textlint-ruby-optimized
DELETED