cureutils 0.1.3 → 0.1.4

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: 33299ec5caf69d03b6fb07e9460205cabdb4fa72
4
- data.tar.gz: b12a44d2bfea16d16923e93da602ba7e0c212d9f
3
+ metadata.gz: bc63c6680e85d32c4f482a6b7143ed547b5254ff
4
+ data.tar.gz: 0312bf5915a8cc686893e57bad63b9f8a95de76a
5
5
  SHA512:
6
- metadata.gz: 04f8324ab4cfc50ee1d25080bbe0c9a2986dc3eaf6a04ccb10d5deda4f63eb063922840603641bee37698e4c2c0daeb537dc7b171858947d77ac5a69c495e61d
7
- data.tar.gz: 59d1ff77aa4aa177c1194e149d3b3d5c7104c795581c58c13bb6d76ea352a654bd636df16d279b27c4138cd4215df582876e93be1186c1f36453059a4228807e
6
+ metadata.gz: 2ff49a261c99d507eed2d0f8c3ded219c055d0ccb846e63f5cf22f75931980a3dad54c39664a57210ad8c8c2a2e886b4ad40ab0b63290412724f4f67d5a8839a
7
+ data.tar.gz: a83f4bb95fd8ec8bde4e9019527ef5062d671078ac3900156346253223abbd3ffcef06d223ecc531ba387fae3af0749dcb458d4cf04b21a2d42442def613053b
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "test/shunit2"]
2
+ path = test/shunit2
3
+ url = https://github.com/zandev/shunit2.git
data/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  </p>
4
4
 
5
5
  # Cureutils
6
+ [![Gem Version](https://badge.fury.io/rb/cureutils.svg)](https://badge.fury.io/rb/cureutils)
6
7
 
7
8
  Useful command line tool for Japanese battle heroine "Pretty Cure (Precure)".
8
9
 
@@ -13,7 +14,7 @@ Install it yourself as:
13
14
  $ gem install cureutils
14
15
 
15
16
 
16
- After that, `cure` command is availabe.
17
+ After that, `cure` command is available.
17
18
 
18
19
  $ cure
19
20
 
data/cureutils.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.add_development_dependency 'rake', '~> 10.0'
21
21
  spec.add_development_dependency 'rspec', '~> 3.0'
22
22
  spec.add_dependency 'thor', ['>= 0.19.1', '< 2']
23
- spec.add_dependency 'rubicure', '~> 0.4.4'
23
+ spec.add_dependency 'rubicure', '~> 0.4'
24
24
  spec.add_dependency 'colorize', '~> 0.7.7'
25
25
  spec.add_dependency 'activesupport', '~> 4.2.6'
26
26
  end
data/lib/cureutils/cli.rb CHANGED
@@ -49,43 +49,43 @@ module Cureutils
49
49
  end
50
50
 
51
51
  desc 'grep [OPTIONS] PATTERN', 'Print lines matching a pattern.'
52
- option 'extended-regexp', aliases: 'E'
53
- option 'only-matching', aliases: 'o'
54
- def grep(pat = '[:precure_name:]', filename = nil)
52
+ option 'extended-regexp', aliases: 'E',
53
+ type: :boolean,
54
+ desc: 'Disable Precure Bracket Expression.'
55
+ option 'only-matching', aliases: 'o',
56
+ type: :boolean,
57
+ desc: 'Print only the matched parts of a matching line.'
58
+ def grep(default_pat = '[:precure_name:]', filename = nil)
55
59
  # Check whether the file is given or not
56
60
  @input = input_from(filename)
57
- extended_pat = options['extended-regexp'.to_sym]
58
- if extended_pat
59
- cure_pat = extended_pat
60
- else
61
- cure_pat = pregex2regex(pat)
62
- end
61
+ pat = default_pat.clone
62
+ pat = pregex2regex(default_pat) unless options['extended-regexp'.to_sym]
63
63
  # Check the file discriptor and check the pipe exists or not.
64
- pipe_flg = !$stdout.isatty
64
+ enable_color = !$stdout.isatty
65
65
  if options['only-matching'.to_sym]
66
- if pipe_flg
66
+ if enable_color
67
67
  @input.each do |line|
68
- matched_strs = line.scan(/#{cure_pat}/)
68
+ matched_strs = line.scan(/#{pat}/)
69
69
  matched_strs.empty? || matched_strs.each do |str|
70
70
  puts str
71
71
  end
72
72
  end
73
73
  else
74
74
  @input.each do |line|
75
- matched_strs = line.scan(/#{cure_pat}/)
75
+ matched_strs = line.scan(/#{pat}/)
76
76
  matched_strs.empty? || matched_strs.each do |str|
77
77
  puts str.red
78
78
  end
79
79
  end
80
80
  end
81
81
  else
82
- if pipe_flg
82
+ if enable_color
83
83
  @input.each do |line|
84
- puts line.gsub(/#{cure_pat}/, '\0') if line =~ /#{cure_pat}/
84
+ puts line.gsub(/#{pat}/, '\0') if line =~ /#{pat}/
85
85
  end
86
86
  else
87
87
  @input.each do |line|
88
- puts line.gsub(/#{cure_pat}/, '\0'.red) if line =~ /#{cure_pat}/
88
+ puts line.gsub(/#{pat}/, '\0'.red) if line =~ /#{pat}/
89
89
  end
90
90
  end
91
91
  end
@@ -2,7 +2,7 @@ module Cureutils
2
2
  class Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 3
5
+ PATCH = 4
6
6
  PRE = nil
7
7
 
8
8
  class << self
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cureutils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yamada, Yasuhiro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-18 00:00:00.000000000 Z
11
+ date: 2016-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -78,14 +78,14 @@ dependencies:
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: 0.4.4
81
+ version: '0.4'
82
82
  type: :runtime
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: 0.4.4
88
+ version: '0.4'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: colorize
91
91
  requirement: !ruby/object:Gem::Requirement
@@ -123,6 +123,7 @@ extensions: []
123
123
  extra_rdoc_files: []
124
124
  files:
125
125
  - ".gitignore"
126
+ - ".gitmodules"
126
127
  - ".rspec"
127
128
  - ".travis.yml"
128
129
  - CODE_OF_CONDUCT.md