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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3027d60e9351b3c7887e4e70e3d9bc22096b6f21
4
- data.tar.gz: 6d72ff655771fd8d7ae5ec0eac8de6baa3f23218
3
+ metadata.gz: 73c6c390543b605b36a3bb3d13251ccb895dc6de
4
+ data.tar.gz: 74fb8a3570253b8ced151b92d14d529c412427ac
5
5
  SHA512:
6
- metadata.gz: 2dbd23c1977f122caa85331836773a1ce1a8dee41357ca1ac8e0d4fac4df89a1359c177bb87cca1b6ea3c5be3be51f5055b7c0b6f820065d0495aaec5929532f
7
- data.tar.gz: 8c22daf0401200ef8e22d6172a5633aaaadc6d0cfe180adde1f43a3fb048e0766f58a4e1352cace9eeecceac2da5e41b1d478f6918a42e321ae90398267bf82f
6
+ metadata.gz: f7bae0389ce57e3281669db771404c1493ecbeea209d884653877d8a11f403c7b7bd11e0c90ea5604a7df966ad2a10e53af0cbeb7be9592e39d787c48ad45600
7
+ data.tar.gz: c32cdecb0559f38c8213cf57fd0ed7b7656adf33e4f1c0a9f853b4e531b263a60690b76b271089a7eb867cd79aa5e6637ec01c49398af9710e5b7e9b59460675
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Parser::CliWrapper
2
2
 
3
- This replaces '-' with STDIN like unix option, the example below:
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
  ```
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+
2
3
  require 'tempfile'
3
4
  require 'parser/runner/ruby_parse'
4
5
 
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Parser
2
2
  module CliWrapper
3
- VERSION = '0.1.0'
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  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.1.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