utils 0.0.38 → 0.0.39
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.
- data/TODO +4 -3
- data/VERSION +1 -1
- data/bin/search +10 -2
- data/lib/utils/config/vim/colors/flori.vim +3 -0
- data/lib/utils/config/vimrc +4 -0
- data/lib/utils/finder.rb +4 -2
- data/lib/utils/grepper.rb +7 -3
- data/lib/utils/version.rb +1 -1
- data/utils.gemspec +5 -5
- metadata +13 -16
data/TODO
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
-
|
2
|
-
|
3
|
-
|
1
|
+
- option for search to display all files that would be searched
|
2
|
+
- make -I option take a list (comma <- or spaces seperated?)
|
3
|
+
|
4
|
+
CHECK
|
4
5
|
- When finding many places in the same file only jump to the first occurence if
|
5
6
|
a cli option is given.
|
6
7
|
- Make it configurable to find the same file many times via different symlinks
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.39
|
data/bin/search
CHANGED
@@ -6,11 +6,18 @@ include Utils
|
|
6
6
|
require 'tins/go'
|
7
7
|
include Tins::GO
|
8
8
|
|
9
|
+
def convert_ruby_to_vim_regexp(pattern)
|
10
|
+
regexp = pattern.source.dup
|
11
|
+
regexp.gsub!(/([^\\])\?/, '\1\\?')
|
12
|
+
pattern.casefold? and regexp << '\c'
|
13
|
+
regexp
|
14
|
+
end
|
15
|
+
|
9
16
|
def edit_files(pattern, pathes)
|
10
17
|
editor = Utils::Editor.new do |config|
|
11
18
|
config.wait = true
|
12
19
|
end
|
13
|
-
editor.edit_remote_send("<ESC>/#{pattern
|
20
|
+
editor.edit_remote_send("<ESC>/#{convert_ruby_to_vim_regexp(pattern)}<CR>")
|
14
21
|
for path in pathes
|
15
22
|
STDERR.puts "Edit #{path}"
|
16
23
|
editor.edit(path)
|
@@ -33,6 +40,7 @@ Options are
|
|
33
40
|
-A NUMBER displays NUMBER lines of context after the match
|
34
41
|
-B NUMBER displays NUMBER lines of context before the match
|
35
42
|
-C NUMBER displays NUMBER lines of context around the match
|
43
|
+
-f just list the pathes of the files that would be searched
|
36
44
|
-l just list the pathes of the files with matches
|
37
45
|
-L list only the path:linenumber of the files with matches
|
38
46
|
-R interpret PATTERN argument as fuzzy not regex
|
@@ -48,7 +56,7 @@ Version is #{File.basename($0)} #{Utils::VERSION}.
|
|
48
56
|
exit 1
|
49
57
|
end
|
50
58
|
|
51
|
-
args = go 'I:A:B:C:s:S:n:N:a:
|
59
|
+
args = go 'I:A:B:C:s:S:n:N:a:RciflLeh'
|
52
60
|
args['h'] and usage
|
53
61
|
pattern = ARGV.shift or usage
|
54
62
|
roots = (ARGV.empty? ? [ Dir.pwd ] : ARGV).map { |f| File.expand_path(f) }
|
@@ -111,3 +111,6 @@ hi DiffAdd guibg=green guifg=white ctermbg=green ctermfg=white
|
|
111
111
|
hi DiffChange guibg=blue guifg=white ctermbg=blue ctermfg=white
|
112
112
|
hi DiffText guifg=yellow ctermbg=yellow ctermfg=white
|
113
113
|
hi DiffDelete guibg=red guifg=white ctermbg=red ctermfg=white
|
114
|
+
|
115
|
+
hi ExtraWhitespace ctermbg=red guibg=#663333
|
116
|
+
match ExtraWhitespace /\s\+$/
|
data/lib/utils/config/vimrc
CHANGED
@@ -74,6 +74,7 @@ filetype on
|
|
74
74
|
filetype indent on
|
75
75
|
filetype plugin on
|
76
76
|
source $VIMRUNTIME/macros/matchit.vim
|
77
|
+
set t_Co=256
|
77
78
|
colorscheme flori
|
78
79
|
|
79
80
|
" Configure GUIs
|
@@ -514,5 +515,8 @@ iabbrev I_MFG Mit freundlichen Grüssen,<CR><CR>Florian Frank
|
|
514
515
|
iabbrev I_DATE <ESC>:call Itime("%F")<CR>
|
515
516
|
iabbrev I_DATETIME <ESC>:call Itime("%F %T")<CR>
|
516
517
|
iabbrev I_TIME <ESC>:call Itime("%T")<CR>
|
518
|
+
iabbrev I_CLASS <ESC>:call Iexec("classify -b " . expand('%'))<CR>
|
517
519
|
iabbrev I_KLASS <ESC>:call Iexec("classify -b " . expand('%'))<CR>
|
520
|
+
iabbrev I_MODULE <ESC>:call Iexec("classify -b " . expand('%'))<CR>
|
518
521
|
iabbrev I_PATH_KLASS <ESC>:call Iexec("classify " . expand('%'))<CR>
|
522
|
+
iabbrev I_ENCODE # encoding: utf-8
|
data/lib/utils/finder.rb
CHANGED
@@ -70,9 +70,11 @@ class Utils::Finder
|
|
70
70
|
end
|
71
71
|
pathes.uniq!
|
72
72
|
pathes.map! { |p| a = File.split(p) ; a.unshift(p) ; a }
|
73
|
-
@
|
73
|
+
@suffixes = @args['I'].ask_and_send(:split, /[\s,]+/).to_a
|
74
74
|
pathes = pathes.map! do |path, dir, file|
|
75
|
-
|
75
|
+
if @suffixes.full?
|
76
|
+
@suffixes.include?(File.extname(file)[1..-1]) or next
|
77
|
+
end
|
76
78
|
if do_match = attempt_match?(path) and $DEBUG
|
77
79
|
warn "Attempt match of #{path.inspect}"
|
78
80
|
end
|
data/lib/utils/grepper.rb
CHANGED
@@ -77,7 +77,11 @@ class Utils::Grepper
|
|
77
77
|
File.open(filename, 'rb') do |file|
|
78
78
|
if file.binary? != true
|
79
79
|
$DEBUG and warn "Matching #{filename.inspect}."
|
80
|
-
|
80
|
+
if @args['f']
|
81
|
+
@output << filename
|
82
|
+
else
|
83
|
+
match_lines file
|
84
|
+
end
|
81
85
|
else
|
82
86
|
$DEBUG and warn "Skipping binary file #{filename.inspect}."
|
83
87
|
end
|
@@ -141,10 +145,10 @@ class Utils::Grepper
|
|
141
145
|
end
|
142
146
|
|
143
147
|
def search
|
144
|
-
@
|
148
|
+
@suffixes = @args['I'].ask_and_send(:split, /[\s,]+/).to_a
|
145
149
|
for dir in @roots
|
146
150
|
Utils::Find.find(dir) do |filename|
|
147
|
-
if
|
151
|
+
if @suffixes.empty? || @suffixes.include?(File.extname(filename)[1..-1])
|
148
152
|
match(filename)
|
149
153
|
end
|
150
154
|
end
|
data/lib/utils/version.rb
CHANGED
data/utils.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "utils"
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.39"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Florian Frank"]
|
9
|
-
s.date = "2012-03-
|
9
|
+
s.date = "2012-03-16"
|
10
10
|
s.description = "This ruby gem provides some useful command line utilities"
|
11
11
|
s.email = "flori@ping.de"
|
12
12
|
s.executables = ["chroot-exec", "chroot-libs", "classify", "discover", "edit", "edit_wait", "enum", "errf", "git-empty", "myex", "number_files", "path", "probe", "same_files", "search", "sedit", "sshscreen", "strip_spaces", "unquarantine_apps", "untest", "utils-install-config", "utils-utilsrc", "vacuum_firefox_sqlite", "xmp"]
|
@@ -22,20 +22,20 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.specification_version = 3
|
23
23
|
|
24
24
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
25
|
-
s.add_development_dependency(%q<gem_hadar>, ["~> 0.1.
|
25
|
+
s.add_development_dependency(%q<gem_hadar>, ["~> 0.1.7"])
|
26
26
|
s.add_runtime_dependency(%q<tins>, ["~> 0.3"])
|
27
27
|
s.add_runtime_dependency(%q<term-ansicolor>, ["~> 1.0"])
|
28
28
|
s.add_runtime_dependency(%q<dslkit>, ["~> 0.2"])
|
29
29
|
s.add_runtime_dependency(%q<pry-editline>, [">= 0"])
|
30
30
|
else
|
31
|
-
s.add_dependency(%q<gem_hadar>, ["~> 0.1.
|
31
|
+
s.add_dependency(%q<gem_hadar>, ["~> 0.1.7"])
|
32
32
|
s.add_dependency(%q<tins>, ["~> 0.3"])
|
33
33
|
s.add_dependency(%q<term-ansicolor>, ["~> 1.0"])
|
34
34
|
s.add_dependency(%q<dslkit>, ["~> 0.2"])
|
35
35
|
s.add_dependency(%q<pry-editline>, [">= 0"])
|
36
36
|
end
|
37
37
|
else
|
38
|
-
s.add_dependency(%q<gem_hadar>, ["~> 0.1.
|
38
|
+
s.add_dependency(%q<gem_hadar>, ["~> 0.1.7"])
|
39
39
|
s.add_dependency(%q<tins>, ["~> 0.3"])
|
40
40
|
s.add_dependency(%q<term-ansicolor>, ["~> 1.0"])
|
41
41
|
s.add_dependency(%q<dslkit>, ["~> 0.2"])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.39
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gem_hadar
|
16
|
-
requirement: &
|
16
|
+
requirement: &2153332960 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.1.
|
21
|
+
version: 0.1.7
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2153332960
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: tins
|
27
|
-
requirement: &
|
27
|
+
requirement: &2153332460 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0.3'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2153332460
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: term-ansicolor
|
38
|
-
requirement: &
|
38
|
+
requirement: &2153331900 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '1.0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2153331900
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: dslkit
|
49
|
-
requirement: &
|
49
|
+
requirement: &2153331340 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0.2'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2153331340
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: pry-editline
|
60
|
-
requirement: &
|
60
|
+
requirement: &2153330840 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2153330840
|
69
69
|
description: This ruby gem provides some useful command line utilities
|
70
70
|
email: flori@ping.de
|
71
71
|
executables:
|
@@ -225,9 +225,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
225
225
|
- - ! '>='
|
226
226
|
- !ruby/object:Gem::Version
|
227
227
|
version: '0'
|
228
|
-
segments:
|
229
|
-
- 0
|
230
|
-
hash: 2842823016203684465
|
231
228
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
232
229
|
none: false
|
233
230
|
requirements:
|