gem-grep 0.6.1 → 0.6.2

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: c8ab504a4ad7b9aabc8c337fe6bf184ad9ecda66
4
- data.tar.gz: 5a8cd415fe17fe298e28abc909ca4cba96ecdbd6
3
+ metadata.gz: c0e202343d2656a46a51114ee7309babaf0df4e1
4
+ data.tar.gz: 89640c71f9e8219ad7733b01c3ae44812bd745fc
5
5
  SHA512:
6
- metadata.gz: 5b12807e58dd32cbf6c4272e6e6d8f78822e913859b2bc9b10aed3b0ca638aaced3dc79fcf0fb053931b3a4ece20a50da11ef8bddf647f9a6118711413bd6cc8
7
- data.tar.gz: 244c5f898dea2b8945a6bdcae9c5faf65b3e08a9265a0aaf4d928e61356996b7282eaf3717272ec565a58486438d796401f7c9fedb3fec0f474243c195ae672b
6
+ metadata.gz: 7734f187e32b6ace6ba7b2ebe4faa6211f54e0f0a095addf5ec3a21f6c1958d2860798015058eac411122467ab0b937fd6069cf6a2617aa6d91e50fefdcf1449
7
+ data.tar.gz: 10de66d403f932a5917ad03754aa9dcd113bac681c1ef1108e624938a509fad5e3e4240850c516e571eae0dd6e95f6c0eeb752efa6cb992c97022609ac62871a
data/CHANGES.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGES
2
2
 
3
+ ## gem-grep 0.6.2 -- 2014-03-24
4
+
5
+ * Introduce method `grep_command` to make gem-grep more modular and therefore
6
+ make gem-bgrep easier to reuse codes in gem-grep.
7
+
3
8
  ## gem-grep 0.6.1 -- 2014-03-24
4
9
 
5
10
  * Fixed gem command description.
data/Rakefile CHANGED
@@ -8,6 +8,6 @@ end
8
8
 
9
9
  Gemgem.init(dir) do |s|
10
10
  s.name = 'gem-grep'
11
- s.version = '0.6.1'
11
+ s.version = '0.6.2'
12
12
  s.add_runtime_dependency('gem-path')
13
13
  end
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: gem-grep 0.6.1 ruby lib
2
+ # stub: gem-grep 0.6.2 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "gem-grep"
6
- s.version = "0.6.1"
6
+ s.version = "0.6.2"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib"]
@@ -17,25 +17,33 @@ class Gem::Commands::GrepCommand < Gem::Command
17
17
  end
18
18
 
19
19
  def execute
20
- ui = CapturedUI.new
21
- Gem::DefaultUserInteraction.use_ui(ui) do
22
- Gem::GemRunner.new.run(['path'] + options[:args])
23
- end
24
-
25
20
  if options[:build_args].empty?
26
21
  alert_error('No pattern specified')
27
22
  terminate_interaction(1)
28
- else
29
- exec(grep, *options[:build_args], '-nR', ui.outs.string.strip)
30
23
  end
24
+
25
+ exec(*grep_command(options[:args], options[:build_args]))
31
26
  end
32
27
 
33
- def exec *args
34
- say(args.join(' '))
35
- super
28
+ def grep_command path_args, grep_args
29
+ [grep_name, *grep_args, '-nR', capture_path(*path_args)]
30
+ end
31
+
32
+ private
33
+ def capture_path *path_args
34
+ ui = CapturedUI.new
35
+ Gem::DefaultUserInteraction.use_ui(ui) do
36
+ Gem::GemRunner.new.run(['path', *path_args])
37
+ end
38
+ ui.outs.string.strip
36
39
  end
37
40
 
38
- def grep
41
+ def grep_name
39
42
  ENV['GEM_GREP'] || 'grep'
40
43
  end
44
+
45
+ def exec *args
46
+ say(args.join(' '))
47
+ super
48
+ end
41
49
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem-grep
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lin Jen-Shin (godfat)