gem-grep 0.6.2 → 0.7.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 +4 -4
- data/CHANGES.md +5 -0
- data/README.md +9 -6
- data/Rakefile +4 -4
- data/gem-grep.gemspec +28 -28
- data/lib/rubygems/commands/grep_command.rb +24 -4
- data/task/README.md +8 -8
- data/task/gemgem.rb +141 -71
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecbbf3ad67669f6f6513c2673c06c93066015cc9
|
4
|
+
data.tar.gz: e64d0fea2a56e08401360019481aeceea015bdaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f740d838d82bef80f9a2daa40ab582972188458de9ac93e936c4bde5e6b8e4dbdb5cbb056b577c416d06a7fca683a0627598a131377f6b5a6b95df7429882a8a
|
7
|
+
data.tar.gz: 216a491834432db2273ddd6d02beb3c1f4df66429a6d93e2defe8cbe6a5a938677c36b8aba37ccb6007513aec9b5ddbe610a0d976cec742127f54b722b82affd
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# CHANGES
|
2
2
|
|
3
|
+
## gem-grep 0.7.0 -- 2017-07-29
|
4
|
+
|
5
|
+
* Support and recommend ripgrep (rg)
|
6
|
+
* Try to show the command more faithfully by quoting and escaping arguments
|
7
|
+
|
3
8
|
## gem-grep 0.6.2 -- 2014-03-24
|
4
9
|
|
5
10
|
* Introduce method `grep_command` to make gem-grep more modular and therefore
|
data/README.md
CHANGED
@@ -17,9 +17,11 @@ Also checkout [gem-eit][].
|
|
17
17
|
|
18
18
|
## REQUIREMENTS:
|
19
19
|
|
20
|
-
* Tested with MRI (official CRuby)
|
20
|
+
* Tested with MRI (official CRuby), Rubinius and JRuby.
|
21
21
|
* [gem-path](https://github.com/godfat/gem-path)
|
22
|
-
* `grep` from shell, or set
|
22
|
+
* `grep` from shell, or set `$GEM_GREP` to `ag` ([The Silver Searcher][ag]),
|
23
|
+
`rg` ([ripgrep][rg]) or other compatible command.
|
24
|
+
* [rg][] is recommended.
|
23
25
|
|
24
26
|
## INSTALLATION:
|
25
27
|
|
@@ -27,15 +29,16 @@ Also checkout [gem-eit][].
|
|
27
29
|
|
28
30
|
## SYNOPSIS:
|
29
31
|
|
30
|
-
Please set
|
32
|
+
Please set `$GEM_GREP` to the command you want to search sources.
|
31
33
|
By default it would pick `grep` if nothing is set. However we recommend
|
32
|
-
[
|
34
|
+
[rg][] if you have it installed.
|
33
35
|
|
34
36
|
Use `--` to pass arguments to `$GEM_GREP`, such as `--color`, `-E`, or `-A`.
|
35
37
|
|
36
38
|
Also checkout [gem.fish][] for [fish][] completion.
|
37
39
|
|
38
40
|
[ag]: https://github.com/ggreer/the_silver_searcher
|
41
|
+
[rg]: https://github.com/BurntSushi/ripgrep
|
39
42
|
[gem.fish]: https://github.com/godfat/dev-tool/blob/master/.config/fish/completions/gem.fish
|
40
43
|
[fish]: http://fishshell.com/
|
41
44
|
|
@@ -74,9 +77,9 @@ Also checkout [gem.fish][] for [fish][] completion.
|
|
74
77
|
|
75
78
|
## LICENSE:
|
76
79
|
|
77
|
-
Apache License 2.0
|
80
|
+
Apache License 2.0 (Apache-2.0)
|
78
81
|
|
79
|
-
Copyright (c) 2013-
|
82
|
+
Copyright (c) 2013-2017, Lin Jen-Shin (godfat)
|
80
83
|
|
81
84
|
Licensed under the Apache License, Version 2.0 (the "License");
|
82
85
|
you may not use this file except in compliance with the License.
|
data/Rakefile
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
|
2
2
|
begin
|
3
|
-
require "#{
|
3
|
+
require "#{__dir__}/task/gemgem"
|
4
4
|
rescue LoadError
|
5
|
-
sh 'git submodule update --init'
|
5
|
+
sh 'git submodule update --init --recursive'
|
6
6
|
exec Gem.ruby, '-S', $PROGRAM_NAME, *ARGV
|
7
7
|
end
|
8
8
|
|
9
|
-
Gemgem.init(
|
9
|
+
Gemgem.init(__dir__) do |s|
|
10
10
|
s.name = 'gem-grep'
|
11
|
-
s.version = '0.
|
11
|
+
s.version = '0.7.0'
|
12
12
|
s.add_runtime_dependency('gem-path')
|
13
13
|
end
|
data/gem-grep.gemspec
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: gem-grep 0.
|
2
|
+
# stub: gem-grep 0.7.0 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
|
-
s.name = "gem-grep"
|
6
|
-
s.version = "0.
|
5
|
+
s.name = "gem-grep".freeze
|
6
|
+
s.version = "0.7.0"
|
7
7
|
|
8
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
|
-
s.require_paths = ["lib"]
|
10
|
-
s.authors = ["Lin Jen-Shin (godfat)"]
|
11
|
-
s.date = "
|
12
|
-
s.description = "grep the gem for a given name or grep the file for a given require path.\n\nAlso checkout [gem-eit][].\n\n[gem-eit]: https://github.com/godfat/gem-eit"
|
13
|
-
s.email = ["godfat (XD) godfat.org"]
|
8
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
|
+
s.require_paths = ["lib".freeze]
|
10
|
+
s.authors = ["Lin Jen-Shin (godfat)".freeze]
|
11
|
+
s.date = "2017-07-29"
|
12
|
+
s.description = "grep the gem for a given name or grep the file for a given require path.\n\nAlso checkout [gem-eit][].\n\n[gem-eit]: https://github.com/godfat/gem-eit".freeze
|
13
|
+
s.email = ["godfat (XD) godfat.org".freeze]
|
14
14
|
s.files = [
|
15
|
-
".gitignore",
|
16
|
-
".gitmodules",
|
17
|
-
".travis.yml",
|
18
|
-
"CHANGES.md",
|
19
|
-
"LICENSE",
|
20
|
-
"README.md",
|
21
|
-
"Rakefile",
|
22
|
-
"gem-grep.gemspec",
|
23
|
-
"lib/rubygems/commands/grep_command.rb",
|
24
|
-
"lib/rubygems_plugin.rb",
|
25
|
-
"task/README.md",
|
26
|
-
"task/gemgem.rb"]
|
27
|
-
s.homepage = "https://github.com/godfat/gem-grep"
|
28
|
-
s.licenses = ["Apache
|
29
|
-
s.rubygems_version = "2.
|
30
|
-
s.summary = "grep the gem for a given name or grep the file for a given require path."
|
15
|
+
".gitignore".freeze,
|
16
|
+
".gitmodules".freeze,
|
17
|
+
".travis.yml".freeze,
|
18
|
+
"CHANGES.md".freeze,
|
19
|
+
"LICENSE".freeze,
|
20
|
+
"README.md".freeze,
|
21
|
+
"Rakefile".freeze,
|
22
|
+
"gem-grep.gemspec".freeze,
|
23
|
+
"lib/rubygems/commands/grep_command.rb".freeze,
|
24
|
+
"lib/rubygems_plugin.rb".freeze,
|
25
|
+
"task/README.md".freeze,
|
26
|
+
"task/gemgem.rb".freeze]
|
27
|
+
s.homepage = "https://github.com/godfat/gem-grep".freeze
|
28
|
+
s.licenses = ["Apache-2.0".freeze]
|
29
|
+
s.rubygems_version = "2.6.12".freeze
|
30
|
+
s.summary = "grep the gem for a given name or grep the file for a given require path.".freeze
|
31
31
|
|
32
32
|
if s.respond_to? :specification_version then
|
33
33
|
s.specification_version = 4
|
34
34
|
|
35
35
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
36
|
-
s.add_runtime_dependency(%q<gem-path
|
36
|
+
s.add_runtime_dependency(%q<gem-path>.freeze, [">= 0"])
|
37
37
|
else
|
38
|
-
s.add_dependency(%q<gem-path
|
38
|
+
s.add_dependency(%q<gem-path>.freeze, [">= 0"])
|
39
39
|
end
|
40
40
|
else
|
41
|
-
s.add_dependency(%q<gem-path
|
41
|
+
s.add_dependency(%q<gem-path>.freeze, [">= 0"])
|
42
42
|
end
|
43
43
|
end
|
@@ -26,7 +26,7 @@ class Gem::Commands::GrepCommand < Gem::Command
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def grep_command path_args, grep_args
|
29
|
-
[grep_name, *grep_args,
|
29
|
+
[grep_name, *grep_args, *grep_default_args, capture_path(*path_args)]
|
30
30
|
end
|
31
31
|
|
32
32
|
private
|
@@ -39,11 +39,31 @@ class Gem::Commands::GrepCommand < Gem::Command
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def grep_name
|
42
|
-
ENV['GEM_GREP'] || 'grep'
|
42
|
+
@grep_name ||= ENV['GEM_GREP'] || 'grep'
|
43
43
|
end
|
44
44
|
|
45
|
-
def
|
46
|
-
|
45
|
+
def grep_default_args
|
46
|
+
case grep_name
|
47
|
+
when 'rg'
|
48
|
+
[]
|
49
|
+
else
|
50
|
+
['-nR']
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def exec cmd, *args
|
55
|
+
quoted_args = args.map(&method(:quote))
|
56
|
+
say("#{cmd} #{quoted_args.join(' ')}")
|
47
57
|
super
|
48
58
|
end
|
59
|
+
|
60
|
+
def quote arg
|
61
|
+
escaped = arg.gsub('\\', '\\\\\\').gsub("'", '\'').gsub('"', '\\"')
|
62
|
+
|
63
|
+
if escaped.include?(' ')
|
64
|
+
"'#{escaped}'"
|
65
|
+
else
|
66
|
+
escaped
|
67
|
+
end
|
68
|
+
end
|
49
69
|
end
|
data/task/README.md
CHANGED
@@ -4,16 +4,16 @@
|
|
4
4
|
|
5
5
|
Provided tasks:
|
6
6
|
|
7
|
-
rake clean #
|
7
|
+
rake clean # Trash ignored files
|
8
8
|
rake gem:build # Build gem
|
9
9
|
rake gem:install # Install gem
|
10
10
|
rake gem:release # Release gem
|
11
11
|
rake gem:spec # Generate gemspec
|
12
|
-
rake test # Run tests
|
12
|
+
rake test # Run tests
|
13
13
|
|
14
14
|
## REQUIREMENTS:
|
15
15
|
|
16
|
-
* Tested with MRI (official CRuby)
|
16
|
+
* Tested with MRI (official CRuby), Rubinius and JRuby.
|
17
17
|
|
18
18
|
## INSTALLATION:
|
19
19
|
|
@@ -23,13 +23,13 @@ And in Rakefile:
|
|
23
23
|
|
24
24
|
``` ruby
|
25
25
|
begin
|
26
|
-
require "#{
|
26
|
+
require "#{__dir__}/task/gemgem"
|
27
27
|
rescue LoadError
|
28
|
-
sh 'git submodule update --init'
|
28
|
+
sh 'git submodule update --init --recursive'
|
29
29
|
exec Gem.ruby, '-S', $PROGRAM_NAME, *ARGV
|
30
30
|
end
|
31
31
|
|
32
|
-
Gemgem.init(
|
32
|
+
Gemgem.init(__dir__, :submodules => %w[your-dep]) do |s|
|
33
33
|
s.name = 'your-gem'
|
34
34
|
s.version = '0.1.0'
|
35
35
|
end
|
@@ -37,9 +37,9 @@ end
|
|
37
37
|
|
38
38
|
## LICENSE:
|
39
39
|
|
40
|
-
Apache License 2.0
|
40
|
+
Apache License 2.0 (Apache-2.0)
|
41
41
|
|
42
|
-
Copyright (c) 2011-
|
42
|
+
Copyright (c) 2011-2017, Lin Jen-Shin (godfat)
|
43
43
|
|
44
44
|
Licensed under the Apache License, Version 2.0 (the "License");
|
45
45
|
you may not use this file except in compliance with the License.
|
data/task/gemgem.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
module Gemgem
|
3
3
|
class << self
|
4
|
-
attr_accessor :dir, :spec, :spec_create
|
4
|
+
attr_accessor :dir, :spec, :submodules, :spec_create
|
5
5
|
end
|
6
6
|
|
7
7
|
module_function
|
@@ -11,12 +11,14 @@ module Gemgem
|
|
11
11
|
def pkg_dir ; "#{dir}/pkg" ; end
|
12
12
|
def escaped_dir; @escaped_dir ||= Regexp.escape(dir); end
|
13
13
|
|
14
|
-
def init dir, &block
|
14
|
+
def init dir, options={}, &block
|
15
15
|
self.dir = dir
|
16
|
-
$LOAD_PATH.unshift("#{dir}/lib")
|
17
16
|
ENV['RUBYLIB'] = "#{dir}/lib:#{ENV['RUBYLIB']}"
|
18
17
|
ENV['PATH'] = "#{dir}/bin:#{ENV['PATH']}"
|
18
|
+
self.submodules = options[:submodules] || []
|
19
19
|
self.spec_create = block
|
20
|
+
|
21
|
+
$LOAD_PATH.unshift("#{dir}/lib", *submodules_libs)
|
20
22
|
end
|
21
23
|
|
22
24
|
def create
|
@@ -26,7 +28,7 @@ module Gemgem
|
|
26
28
|
|
27
29
|
s.description = description.join
|
28
30
|
s.summary = description.first
|
29
|
-
s.license =
|
31
|
+
s.license = license
|
30
32
|
|
31
33
|
s.date = Time.now.strftime('%Y-%m-%d')
|
32
34
|
s.files = gem_files
|
@@ -34,10 +36,113 @@ module Gemgem
|
|
34
36
|
s.executables = bin_files
|
35
37
|
end
|
36
38
|
spec_create.call(spec)
|
37
|
-
spec.homepage
|
39
|
+
spec.homepage ||= "https://github.com/godfat/#{spec.name}"
|
38
40
|
self.spec = spec
|
39
41
|
end
|
40
42
|
|
43
|
+
def gem_install
|
44
|
+
require 'rubygems/commands/install_command'
|
45
|
+
# read ~/.gemrc
|
46
|
+
Gem.use_paths(Gem.configuration[:gemhome], Gem.configuration[:gempath])
|
47
|
+
Gem::Command.extra_args = Gem.configuration[:gem]
|
48
|
+
|
49
|
+
# setup install options
|
50
|
+
cmd = Gem::Commands::InstallCommand.new
|
51
|
+
cmd.handle_options([])
|
52
|
+
|
53
|
+
# install
|
54
|
+
install = Gem::Installer.new(gem_path, cmd.options)
|
55
|
+
install.install
|
56
|
+
puts "\e[35mGem installed: \e[33m#{strip_path(install.gem_dir)}\e[0m"
|
57
|
+
end
|
58
|
+
|
59
|
+
def gem_spec
|
60
|
+
create
|
61
|
+
write
|
62
|
+
end
|
63
|
+
|
64
|
+
def gem_build
|
65
|
+
require 'fileutils'
|
66
|
+
require 'rubygems/package'
|
67
|
+
gem = nil
|
68
|
+
Dir.chdir(dir) do
|
69
|
+
gem = Gem::Package.build(Gem::Specification.load(spec_path))
|
70
|
+
FileUtils.mkdir_p(pkg_dir)
|
71
|
+
FileUtils.mv(gem, pkg_dir) # gem is relative path, but might be ok
|
72
|
+
end
|
73
|
+
puts "\e[35mGem built: \e[33m#{strip_path("#{pkg_dir}/#{gem}")}\e[0m"
|
74
|
+
end
|
75
|
+
|
76
|
+
def gem_release
|
77
|
+
sh_git('tag', gem_tag)
|
78
|
+
sh_git('push')
|
79
|
+
sh_git('push', '--tags')
|
80
|
+
sh_gem('push', gem_path)
|
81
|
+
end
|
82
|
+
|
83
|
+
def gem_check
|
84
|
+
unless git('status', '--porcelain').empty?
|
85
|
+
puts("\e[35mWorking copy is not clean.\e[0m")
|
86
|
+
exit(3)
|
87
|
+
end
|
88
|
+
|
89
|
+
ver = spec.version.to_s
|
90
|
+
|
91
|
+
if ENV['VERSION'].nil?
|
92
|
+
puts("\e[35mExpected " \
|
93
|
+
"\e[33mVERSION\e[35m=\e[33m#{ver}\e[0m")
|
94
|
+
exit(1)
|
95
|
+
|
96
|
+
elsif ENV['VERSION'] != ver
|
97
|
+
puts("\e[35mExpected \e[33mVERSION\e[35m=\e[33m#{ver} " \
|
98
|
+
"\e[35mbut got\n " \
|
99
|
+
"\e[33mVERSION\e[35m=\e[33m#{ENV['VERSION']}\e[0m")
|
100
|
+
exit(2)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def test
|
105
|
+
return if test_files.empty?
|
106
|
+
|
107
|
+
if ENV['COV'] || ENV['CI']
|
108
|
+
require 'simplecov'
|
109
|
+
if ENV['CI']
|
110
|
+
begin
|
111
|
+
require 'coveralls'
|
112
|
+
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
|
113
|
+
rescue LoadError => e
|
114
|
+
puts "Cannot load coveralls, skip: #{e}"
|
115
|
+
end
|
116
|
+
end
|
117
|
+
SimpleCov.start do
|
118
|
+
add_filter('test/')
|
119
|
+
add_filter('test.rb')
|
120
|
+
submodules_libs.each(&method(:add_filter))
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
test_files.each{ |file| require "#{dir}/#{file[0..-4]}" }
|
125
|
+
end
|
126
|
+
|
127
|
+
def clean
|
128
|
+
return if ignored_files.empty?
|
129
|
+
|
130
|
+
require 'fileutils'
|
131
|
+
trash = File.expand_path("~/.Trash/#{spec.name}")
|
132
|
+
puts "Move the following files into: \e[35m#{strip_path(trash)}\e[33m"
|
133
|
+
|
134
|
+
ignored_files.each do |file|
|
135
|
+
from = "#{dir}/#{file}"
|
136
|
+
to = "#{trash}/#{File.dirname(file)}"
|
137
|
+
puts strip_path(from)
|
138
|
+
|
139
|
+
FileUtils.mkdir_p(to)
|
140
|
+
FileUtils.mv(from, to)
|
141
|
+
end
|
142
|
+
|
143
|
+
print "\e[0m"
|
144
|
+
end
|
145
|
+
|
41
146
|
def write
|
42
147
|
File.open(spec_path, 'w'){ |f| f << split_lines(spec.to_ruby) }
|
43
148
|
end
|
@@ -57,11 +162,15 @@ module Gemgem
|
|
57
162
|
end
|
58
163
|
|
59
164
|
def strip_home_path path
|
60
|
-
path.sub(ENV['HOME']
|
165
|
+
path.sub(/\A#{Regexp.escape(ENV['HOME'])}\//, '~/')
|
61
166
|
end
|
62
167
|
|
63
168
|
def strip_cwd_path path
|
64
|
-
path.sub(Dir.pwd
|
169
|
+
path.sub(/\A#{Regexp.escape(Dir.pwd)}\//, '')
|
170
|
+
end
|
171
|
+
|
172
|
+
def submodules_libs
|
173
|
+
submodules.map{ |path| "#{dir}/#{path}/lib" }
|
65
174
|
end
|
66
175
|
|
67
176
|
def git *args
|
@@ -99,6 +208,11 @@ module Gemgem
|
|
99
208
|
@description ||= (readme['DESCRIPTION']||'').sub(/.+\n\n/, '').lines.to_a
|
100
209
|
end
|
101
210
|
|
211
|
+
def license
|
212
|
+
readme['LICENSE'].sub(/.+\n\n/, '').lines.first.
|
213
|
+
split(/[()]/).map(&:strip).reject(&:empty?).last
|
214
|
+
end
|
215
|
+
|
102
216
|
def all_files
|
103
217
|
@all_files ||= fold_files(glob).sort
|
104
218
|
end
|
@@ -119,7 +233,8 @@ module Gemgem
|
|
119
233
|
|
120
234
|
def gem_files
|
121
235
|
@gem_files ||= all_files.reject{ |f|
|
122
|
-
f =~
|
236
|
+
f =~ submodules_pattern ||
|
237
|
+
(f =~ ignored_pattern && !git_files.include?(f))
|
123
238
|
}
|
124
239
|
end
|
125
240
|
|
@@ -151,17 +266,20 @@ module Gemgem
|
|
151
266
|
end
|
152
267
|
end
|
153
268
|
|
269
|
+
def submodules_pattern
|
270
|
+
@submodules_pattern ||= if submodules.empty?
|
271
|
+
/^$/
|
272
|
+
else
|
273
|
+
Regexp.new(submodules.map{ |path|
|
274
|
+
"^#{Regexp.escape(path)}/" }.join('|'))
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
154
278
|
def expand_patterns pathes
|
155
279
|
# http://git-scm.com/docs/gitignore
|
156
280
|
pathes.flat_map{ |path|
|
157
|
-
|
158
|
-
|
159
|
-
Regexp.escape(path).gsub(/\\\*/, '[^/]*')
|
160
|
-
when %r{^/}
|
161
|
-
"^#{Regexp.escape(path[1..-1])}"
|
162
|
-
else # we didn't implement negative pattern for now
|
163
|
-
Regexp.escape(path)
|
164
|
-
end
|
281
|
+
# we didn't implement negative pattern for now
|
282
|
+
Regexp.escape(path).sub(%r{^/}, '^').gsub(/\\\*/, '[^/]*')
|
165
283
|
}
|
166
284
|
end
|
167
285
|
|
@@ -179,86 +297,38 @@ namespace :gem do
|
|
179
297
|
|
180
298
|
desc 'Install gem'
|
181
299
|
task :install => [:build] do
|
182
|
-
Gemgem.
|
300
|
+
Gemgem.gem_install
|
183
301
|
end
|
184
302
|
|
185
303
|
desc 'Build gem'
|
186
304
|
task :build => [:spec] do
|
187
|
-
|
188
|
-
require 'rubygems/package'
|
189
|
-
gem = nil
|
190
|
-
Dir.chdir(Gemgem.dir) do
|
191
|
-
gem = Gem::Package.build(Gem::Specification.load(Gemgem.spec_path))
|
192
|
-
FileUtils.mkdir_p(Gemgem.pkg_dir)
|
193
|
-
FileUtils.mv(gem, Gemgem.pkg_dir) # gem is relative path, but might be ok
|
194
|
-
end
|
195
|
-
puts "\e[35mGem built: \e[33m" \
|
196
|
-
"#{Gemgem.strip_path("#{Gemgem.pkg_dir}/#{gem}")}\e[0m"
|
305
|
+
Gemgem.gem_build
|
197
306
|
end
|
198
307
|
|
199
308
|
desc 'Generate gemspec'
|
200
309
|
task :spec do
|
201
|
-
Gemgem.
|
202
|
-
Gemgem.write
|
310
|
+
Gemgem.gem_spec
|
203
311
|
end
|
204
312
|
|
205
313
|
desc 'Release gem'
|
206
314
|
task :release => [:spec, :check, :build] do
|
207
|
-
Gemgem.
|
208
|
-
sh_git('tag', Gemgem.gem_tag)
|
209
|
-
sh_git('push')
|
210
|
-
sh_git('push', '--tags')
|
211
|
-
sh_gem('push', Gemgem.gem_path)
|
212
|
-
end
|
315
|
+
Gemgem.gem_release
|
213
316
|
end
|
214
317
|
|
215
318
|
task :check do
|
216
|
-
|
217
|
-
|
218
|
-
if ENV['VERSION'].nil?
|
219
|
-
puts("\e[35mExpected " \
|
220
|
-
"\e[33mVERSION\e[35m=\e[33m#{ver}\e[0m")
|
221
|
-
exit(1)
|
222
|
-
|
223
|
-
elsif ENV['VERSION'] != ver
|
224
|
-
puts("\e[35mExpected \e[33mVERSION\e[35m=\e[33m#{ver} " \
|
225
|
-
"\e[35mbut got\n " \
|
226
|
-
"\e[33mVERSION\e[35m=\e[33m#{ENV['VERSION']}\e[0m")
|
227
|
-
exit(2)
|
228
|
-
end
|
319
|
+
Gemgem.gem_check
|
229
320
|
end
|
230
321
|
|
231
322
|
end # of gem namespace
|
232
323
|
|
233
324
|
desc 'Run tests'
|
234
325
|
task :test do
|
235
|
-
|
236
|
-
|
237
|
-
require 'bacon'
|
238
|
-
Bacon.extend(Bacon::TestUnitOutput)
|
239
|
-
Bacon.summary_on_exit
|
240
|
-
Gemgem.test_files.each{ |file| require "#{Gemgem.dir}/#{file[0..-4]}" }
|
326
|
+
Gemgem.test
|
241
327
|
end
|
242
328
|
|
243
329
|
desc 'Trash ignored files'
|
244
330
|
task :clean => ['gem:spec'] do
|
245
|
-
|
246
|
-
|
247
|
-
require 'fileutils'
|
248
|
-
trash = File.expand_path("~/.Trash/#{Gemgem.spec.name}")
|
249
|
-
puts "Move the following files into:" \
|
250
|
-
" \e[35m#{Gemgem.strip_path(trash)}\e[33m"
|
251
|
-
|
252
|
-
Gemgem.ignored_files.each do |file|
|
253
|
-
from = "#{Gemgem.dir}/#{file}"
|
254
|
-
to = "#{trash}/#{File.dirname(file)}"
|
255
|
-
puts Gemgem.strip_path(from)
|
256
|
-
|
257
|
-
FileUtils.mkdir_p(to)
|
258
|
-
FileUtils.mv(from, to)
|
259
|
-
end
|
260
|
-
|
261
|
-
print "\e[0m"
|
331
|
+
Gemgem.clean
|
262
332
|
end
|
263
333
|
|
264
334
|
task :default do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem-grep
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lin Jen-Shin (godfat)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem-path
|
@@ -50,7 +50,7 @@ files:
|
|
50
50
|
- task/gemgem.rb
|
51
51
|
homepage: https://github.com/godfat/gem-grep
|
52
52
|
licenses:
|
53
|
-
- Apache
|
53
|
+
- Apache-2.0
|
54
54
|
metadata: {}
|
55
55
|
post_install_message:
|
56
56
|
rdoc_options: []
|
@@ -68,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
68
|
version: '0'
|
69
69
|
requirements: []
|
70
70
|
rubyforge_project:
|
71
|
-
rubygems_version: 2.
|
71
|
+
rubygems_version: 2.6.12
|
72
72
|
signing_key:
|
73
73
|
specification_version: 4
|
74
74
|
summary: grep the gem for a given name or grep the file for a given require path.
|