unparser-cli_wrapper 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 67597135b91032bef9eeca6abbb4d73dedb5e5e4
4
+ data.tar.gz: a080633094d44e0f1f0fc24fa991b7b4464ce6ce
5
+ SHA512:
6
+ metadata.gz: 88da6a70c5501a7b76d8e8bee2afa35febc4aafade72f2ecb3374b36093efea0bbe5b94682a0e7af78b69e6214c0970e86e8490e37c669e6d20d0364169fa533
7
+ data.tar.gz: fb291a717df11064b692890509187146508d55cacdf40f7810df1649bf82087d2512f639b67c77ed3e34d46cf51244a22396816542489d85381238f78147f183
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/.rubocop.yml ADDED
@@ -0,0 +1,14 @@
1
+ inherit_from: rubocop-todo.yml
2
+ AllCops:
3
+ Include:
4
+ - '**/Rakefile'
5
+ - Gemfile
6
+ - unparser-cli_wrapper.gemspec
7
+ - bin/**
8
+ - lib/**/*.rake
9
+ Exclude:
10
+ - pkg/**
11
+ - repos/**
12
+ - vendor/**
13
+ StringLiterals:
14
+ EnforcedStyle: single_quotes
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in unparser-cli_wrapper.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 sanemat
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,115 @@
1
+ # Unparser::CliWrapper
2
+
3
+ Unparser::CliWrapper provides `ruby-unparse-wrapped` command.
4
+ `Unparser` gem provides `unparser`, but this don't accept _STDIN_.
5
+
6
+ This gem replaces '-' with _STDIN_ like unix option, the example below:
7
+
8
+ ```
9
+ $ cat Gemfile | ruby-unparse-wrapped - -v
10
+ Original-Source:
11
+ source 'https://rubygems.org'
12
+
13
+ # Specify your gem's dependencies in unparser-cli_wrapper.gemspec
14
+ gemspec
15
+
16
+ Original-AST:
17
+ (begin
18
+ (send nil :source
19
+ (str "https://rubygems.org"))
20
+ (send nil :gemspec))
21
+ Generated-Source:
22
+ source("https://rubygems.org")
23
+ gemspec
24
+ Generated-AST:
25
+ (begin
26
+ (send nil :source
27
+ (str "https://rubygems.org"))
28
+ (send nil :gemspec))
29
+ Success: (/var/folders/zk/y7bt0p5x67gg39k56bc7ykx00000gn/T/temp20141125-31638-1t53v4p)
30
+ ```
31
+
32
+ `*-wrapped` command accepts all existing options.
33
+
34
+ ```
35
+ $ ruby-unparse-wrapped Gemfile -v
36
+ Original-Source:
37
+ source 'https://rubygems.org'
38
+
39
+ # Specify your gem's dependencies in unparser-cli_wrapper.gemspec
40
+ gemspec
41
+
42
+ Original-AST:
43
+ (begin
44
+ (send nil :source
45
+ (str "https://rubygems.org"))
46
+ (send nil :gemspec))
47
+ Generated-Source:
48
+ source("https://rubygems.org")
49
+ gemspec
50
+ Generated-AST:
51
+ (begin
52
+ (send nil :source
53
+ (str "https://rubygems.org"))
54
+ (send nil :gemspec))
55
+ Success: (Gemfile)
56
+ ```
57
+
58
+ This is pareparation:
59
+
60
+ ```
61
+ $ cat Gemfile
62
+ source 'https://rubygems.org';
63
+
64
+ gemspec
65
+
66
+ $ unparser Gemfile -v
67
+ Original-Source:
68
+ source 'https://rubygems.org'
69
+
70
+ # Specify your gem's dependencies in unparser-cli_wrapper.gemspec
71
+ gemspec
72
+
73
+ Original-AST:
74
+ (begin
75
+ (send nil :source
76
+ (str "https://rubygems.org"))
77
+ (send nil :gemspec))
78
+ Generated-Source:
79
+ source("https://rubygems.org")
80
+ gemspec
81
+ Generated-AST:
82
+ (begin
83
+ (send nil :source
84
+ (str "https://rubygems.org"))
85
+ (send nil :gemspec))
86
+ Success: (Gemfile)
87
+ ```
88
+
89
+ ## Installation
90
+
91
+ Add this line to your application's Gemfile:
92
+
93
+ ```ruby
94
+ gem 'unparser-cli_wrapper'
95
+ ```
96
+
97
+ And then execute:
98
+
99
+ $ bundle
100
+
101
+ Or install it yourself as:
102
+
103
+ $ gem install unparser-cli_wrapper
104
+
105
+ ## Usage
106
+
107
+ TODO: Write usage instructions here
108
+
109
+ ## Contributing
110
+
111
+ 1. Fork it ( https://github.com/sanemat/unparser-cli_wrapper/fork )
112
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
113
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
114
+ 4. Push to the branch (`git push origin my-new-feature`)
115
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+
4
+ trap('INT') do |status|
5
+ exit! 128 + status
6
+ end
7
+
8
+ require 'tempfile'
9
+ require 'unparser/cli'
10
+
11
+ buff = []
12
+
13
+ flag_stdin = ARGV.delete('-')
14
+
15
+ if flag_stdin
16
+ while line = STDIN.gets
17
+ buff << line
18
+ end
19
+ end
20
+
21
+ if flag_stdin
22
+ Tempfile.open('temp') { |file|
23
+ file.print(buff.join)
24
+ file.rewind
25
+ exit Unparser::CLI.run(ARGV + [file.path])
26
+ }
27
+ else
28
+ exit Unparser::CLI.run(ARGV)
29
+ end
@@ -0,0 +1,5 @@
1
+ module Unparser
2
+ module CliWrapper
3
+ VERSION = '0.1.0'
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ require 'unparser/cli_wrapper/version'
2
+
3
+ module Unparser
4
+ module CliWrapper
5
+ # Your code goes here...
6
+ end
7
+ end
data/rubocop-todo.yml ADDED
@@ -0,0 +1,9 @@
1
+ # This configuration was generated by `rubocop --auto-gen-config`.
2
+ # The point is for the user to remove these configuration records
3
+ # one by one as the offences are removed from the code base.
4
+
5
+ Blocks:
6
+ Enabled: false
7
+
8
+ LineLength:
9
+ Enabled: false
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'unparser/cli_wrapper/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'unparser-cli_wrapper'
8
+ spec.version = Unparser::CliWrapper::VERSION
9
+ spec.authors = ['sanemat']
10
+ spec.email = ['o.gata.ken@gmail.com']
11
+ spec.summary = 'Enable stdin with ruby-unparse.'
12
+ spec.description = 'Replace "-" with STDIN like unix option.'
13
+ spec.homepage = 'https://github.com/sanemat/unparser-cli_wrapper'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency 'unparser'
22
+ spec.add_dependency 'diff-lcs' # until unparser v0.1.17
23
+ spec.add_development_dependency 'bundler', '~> 1.7'
24
+ spec.add_development_dependency 'rake', '~> 10.0'
25
+ end
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: unparser-cli_wrapper
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - sanemat
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: unparser
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
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: diff-lcs
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ description: Replace "-" with STDIN like unix option.
70
+ email:
71
+ - o.gata.ken@gmail.com
72
+ executables:
73
+ - ruby-unparse-wrapped
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - ".rubocop.yml"
79
+ - Gemfile
80
+ - LICENSE.txt
81
+ - README.md
82
+ - Rakefile
83
+ - bin/ruby-unparse-wrapped
84
+ - lib/unparser/cli_wrapper.rb
85
+ - lib/unparser/cli_wrapper/version.rb
86
+ - rubocop-todo.yml
87
+ - unparser-cli_wrapper.gemspec
88
+ homepage: https://github.com/sanemat/unparser-cli_wrapper
89
+ licenses:
90
+ - MIT
91
+ metadata: {}
92
+ post_install_message:
93
+ rdoc_options: []
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ requirements: []
107
+ rubyforge_project:
108
+ rubygems_version: 2.2.2
109
+ signing_key:
110
+ specification_version: 4
111
+ summary: Enable stdin with ruby-unparse.
112
+ test_files: []