parser-cli_wrapper 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -1
- data/bin/ruby-parse-wrapped +1 -0
- data/bin/ruby-rewrite-wrapped +24 -0
- data/lib/parser/cli_wrapper/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73c6c390543b605b36a3bb3d13251ccb895dc6de
|
4
|
+
data.tar.gz: 74fb8a3570253b8ced151b92d14d529c412427ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7bae0389ce57e3281669db771404c1493ecbeea209d884653877d8a11f403c7b7bd11e0c90ea5604a7df966ad2a10e53af0cbeb7be9592e39d787c48ad45600
|
7
|
+
data.tar.gz: c32cdecb0559f38c8213cf57fd0ed7b7656adf33e4f1c0a9f853b4e531b263a60690b76b271089a7eb867cd79aa5e6637ec01c49398af9710e5b7e9b59460675
|
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# Parser::CliWrapper
|
2
2
|
|
3
|
-
|
3
|
+
Parser::CliWrapper provides `ruby-parse-wrapped` and `ruby-rewrite-wrapped` command.
|
4
|
+
`Parser` gem provides both `ruby-parse` and `ruby-rewrite`, but these don't accept _STDIN_.
|
5
|
+
|
6
|
+
This replaces '-' with _STDIN_ like unix option, the example below:
|
4
7
|
|
5
8
|
```
|
6
9
|
$ cat Gemfile | ruby-parse-wrapped -
|
@@ -10,6 +13,16 @@ $ cat Gemfile | ruby-parse-wrapped -
|
|
10
13
|
(send nil :gemspec))
|
11
14
|
```
|
12
15
|
|
16
|
+
`*-wrapped` command accepts all existing options.
|
17
|
+
|
18
|
+
```
|
19
|
+
$ ruby-parse-wrapped Gemfile
|
20
|
+
(begin
|
21
|
+
(send nil :source
|
22
|
+
(str "https://rubygems.org"))
|
23
|
+
(send nil :gemspec))
|
24
|
+
```
|
25
|
+
|
13
26
|
This is pareparation:
|
14
27
|
|
15
28
|
```
|
data/bin/ruby-parse-wrapped
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'tempfile'
|
4
|
+
require 'parser/runner/ruby_rewrite'
|
5
|
+
|
6
|
+
buff = []
|
7
|
+
|
8
|
+
flag_stdin = ARGV.delete('-')
|
9
|
+
|
10
|
+
if flag_stdin
|
11
|
+
while line = STDIN.gets
|
12
|
+
buff << line
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
if flag_stdin
|
17
|
+
Tempfile.open(['temp', '.rb']) { |file|
|
18
|
+
file.print(buff.join)
|
19
|
+
file.rewind
|
20
|
+
Parser::Runner::RubyRewrite.go(ARGV + [file.path])
|
21
|
+
}
|
22
|
+
else
|
23
|
+
Parser::Runner::RubyRewrite.go(ARGV)
|
24
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parser-cli_wrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sanemat
|
@@ -63,6 +63,7 @@ email:
|
|
63
63
|
- o.gata.ken@gmail.com
|
64
64
|
executables:
|
65
65
|
- ruby-parse-wrapped
|
66
|
+
- ruby-rewrite-wrapped
|
66
67
|
extensions: []
|
67
68
|
extra_rdoc_files: []
|
68
69
|
files:
|
@@ -73,6 +74,7 @@ files:
|
|
73
74
|
- README.md
|
74
75
|
- Rakefile
|
75
76
|
- bin/ruby-parse-wrapped
|
77
|
+
- bin/ruby-rewrite-wrapped
|
76
78
|
- lib/parser/cli_wrapper.rb
|
77
79
|
- lib/parser/cli_wrapper/version.rb
|
78
80
|
- parser-cli_wrapper.gemspec
|