wcr 0.0.1 → 0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 09d0b31bef4260cd4a1867bdf50971ea44ab9bbf
4
- data.tar.gz: 1e4f94572a9f1985d5dcd914dc1fe64c97d79fb2
3
+ metadata.gz: 1ddd31588bcd3e72963fd5fadb3a4a67936f6d06
4
+ data.tar.gz: c2d154f33a0519ccda63eaa74db4038e5b4cc561
5
5
  SHA512:
6
- metadata.gz: c8b7973c3d1659b729a4205467ff65e4774612d05f89483189544cfce41c0126bee3405047ef471517b7f2eab542b5ae70efe0b5b76757b5401492f1e895a400
7
- data.tar.gz: 601fa886bc43550eee5e21d5af01e5f675b20d757b0f3b7c30a4cb20d71948c698333b1626faf286c55628b445e6825f1a67c2a8075bb35993f1d58599258fad
6
+ metadata.gz: 1bb6cbe70bc156d06bada4c32e189bcc4d8310e43feacdb3d7cb6b800cb32469ee943fd8b824b74d39909e859760b290608109b76e6fb3d9ffd9c8a7880905b7
7
+ data.tar.gz: 40990e07c59cb7f7a523926f17e21a0d6b9d3fb31078d5acf02f5720fed7e3f6456ce231119fb9bae7bfda7f43cd5ff592a7c779455c0ba153527966acb00054
data/.gitignore ADDED
@@ -0,0 +1,34 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /.bundle/
25
+ /lib/bundler/man/
26
+
27
+ # for a library or gem, you might want to ignore these files since the code is
28
+ # intended to run in multiple environments; otherwise, check them in:
29
+ # Gemfile.lock
30
+ # .ruby-version
31
+ # .ruby-gemset
32
+
33
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
34
+ .rvmrc
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Mehdi FARSI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ wcr
2
+ ===
3
+
4
+ A wrapper on `wc` command. Permit to execute `wc` recursively with a more flexible argument parser.
data/bin/wcr ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ wcr_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
4
+ $LOAD_PATH.unshift(wcr_dir) unless $LOAD_PATH.include?(wcr_dir)
5
+
6
+ require 'wcr'
7
+
8
+ WordCountRecursive::Command.new.wcr
data/lib/wcr.rb ADDED
@@ -0,0 +1 @@
1
+ require 'wcr/command'
@@ -0,0 +1,37 @@
1
+ require 'optparse'
2
+
3
+ module WordCountRecursive
4
+ class ArgumentsParser
5
+ def parse
6
+ options = {command_opts: ""}
7
+
8
+ o = ::OptionParser.new do |opts|
9
+ opts.banner = "usage: wc [-clmw] [file ...]"
10
+
11
+ opts.on("-c") do |c|
12
+ options[:command_opts] += " -c"
13
+ end
14
+
15
+ opts.on("-l") do |l|
16
+ options[:command_opts] += " -l"
17
+ end
18
+
19
+ opts.on("-m") do |m|
20
+ options[:command_opts] += " -m"
21
+ end
22
+
23
+ opts.on("-w") do |w|
24
+ options[:command_opts] += " -w"
25
+ end
26
+ end
27
+ begin
28
+ o.parse!
29
+ rescue ::OptionParser::InvalidOption => e
30
+ $stderr.puts e
31
+ $stderr.puts o.banner
32
+ exit
33
+ end
34
+ [(ARGV.length > 0 ? ARGV.join(' ') : nil), options]
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,14 @@
1
+ require 'wcr/arguments_parser'
2
+
3
+ module WordCountRecursive
4
+ class Command
5
+ def initialize
6
+ @paths, @options = ::WordCountRecursive::ArgumentsParser.new.parse
7
+ @command = `wc #{@options[:command_opts]} #{"\`find #{@paths || '.'} -type f\`"}`
8
+ end
9
+
10
+ def wcr
11
+ @command.each_line {|line| puts line.chomp }
12
+ end
13
+ end
14
+ end
data/wcr.gemspec ADDED
@@ -0,0 +1,18 @@
1
+ # encoding: utf-8
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'wcr'
6
+ s.version = '0.0.2'
7
+ s.date = '2014-11-18'
8
+ s.summary = "wc-recursive"
9
+ s.description = "A wrapper on wc command. Permit to execute wc recursively with a more flexible argument parser."
10
+ s.authors = ["Mehdi Farsi"]
11
+ s.email = 'mehdifarsi.pro@gmail.com'
12
+ s.files = `git ls-files`.split("\n")
13
+ s.require_paths = ["lib"]
14
+ s.homepage = 'http://rubygems.org/gems/wcr'
15
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
+ s.required_ruby_version = '>= 1.9.3'
17
+ s.license = 'MIT'
18
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wcr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mehdi Farsi
@@ -13,10 +13,19 @@ dependencies: []
13
13
  description: A wrapper on wc command. Permit to execute wc recursively with a more
14
14
  flexible argument parser.
15
15
  email: mehdifarsi.pro@gmail.com
16
- executables: []
16
+ executables:
17
+ - wcr
17
18
  extensions: []
18
19
  extra_rdoc_files: []
19
- files: []
20
+ files:
21
+ - ".gitignore"
22
+ - LICENSE
23
+ - README.md
24
+ - bin/wcr
25
+ - lib/wcr.rb
26
+ - lib/wcr/arguments_parser.rb
27
+ - lib/wcr/command.rb
28
+ - wcr.gemspec
20
29
  homepage: http://rubygems.org/gems/wcr
21
30
  licenses:
22
31
  - MIT
@@ -29,7 +38,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
29
38
  requirements:
30
39
  - - ">="
31
40
  - !ruby/object:Gem::Version
32
- version: '0'
41
+ version: 1.9.3
33
42
  required_rubygems_version: !ruby/object:Gem::Requirement
34
43
  requirements:
35
44
  - - ">="