utils 0.0.48 → 0.0.49

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ GemHadar do
15
15
  ignore '.*.sw[pon]', 'pkg', 'Gemfile.lock', '.rvmrc', '.AppleDouble'
16
16
  readme 'README.rdoc'
17
17
 
18
- dependency 'tins'
18
+ dependency 'tins', '~>0.5.0'
19
19
  dependency 'term-ansicolor', '~>1.0'
20
20
  dependency 'dslkit', '~>0.2.10'
21
21
  dependency 'pry-editline'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.48
1
+ 0.0.49
@@ -5,19 +5,19 @@ include Utils
5
5
  require 'tins/go'
6
6
  include Tins::GO
7
7
 
8
- def edit_files(pathes)
8
+ def edit_files(paths)
9
9
  editor = Utils::Editor.new do |config|
10
10
  config.wait = true
11
11
  end
12
- editor.edit(*pathes)
12
+ editor.edit(*paths)
13
13
  end
14
14
 
15
15
  def usage
16
16
  puts <<-EOT
17
- Usage: #{File.basename($0)} [OPTS] PATTERN [PATHES]
17
+ Usage: #{File.basename($0)} [OPTS] PATTERN [PATHS]
18
18
 
19
- PATTERN is a pattern expression which is find the files. PATHES are the
20
- directory and file pathes that are searched.
19
+ PATTERN is a pattern expression which is find the files. PATHS are the
20
+ directory and file paths that are searched.
21
21
 
22
22
  Options are
23
23
 
@@ -56,5 +56,5 @@ finder = Finder.new(
56
56
  puts output
57
57
  end
58
58
  if args['e']
59
- edit_files finder.pathes
59
+ edit_files finder.paths
60
60
  end
data/bin/edit CHANGED
@@ -8,9 +8,9 @@ require 'tempfile'
8
8
 
9
9
  def usage
10
10
  puts <<-EOT
11
- Usage: #{File.basename($0)} [OPTS] [PATHES]
11
+ Usage: #{File.basename($0)} [OPTS] [PATHS]
12
12
 
13
- PATHES are the directory and file pathes that are opened in the vim.
13
+ PATHS are the directory and file paths that are opened in the vim.
14
14
 
15
15
  Options are
16
16
 
@@ -1,11 +1,12 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'utils'
4
+ require 'tins/find'
4
5
  include Utils::MD5
5
6
 
6
- def find_same(*pathes)
7
+ def find_same(*paths)
7
8
  files = Hash.new { |h,k| h[k] = {} }
8
- Utils::Find.find(*pathes) do |filename|
9
+ Tins::Find.find(*paths) do |filename|
9
10
  file_stat = File.stat(filename)
10
11
  if file_stat.file?
11
12
  size = file_stat.size
data/bin/search CHANGED
@@ -13,12 +13,12 @@ def convert_ruby_to_vim_regexp(pattern)
13
13
  regexp
14
14
  end
15
15
 
16
- def edit_files(pattern, pathes)
16
+ def edit_files(pattern, paths)
17
17
  editor = Utils::Editor.new do |config|
18
18
  config.wait = true
19
19
  end
20
20
  editor.edit_remote_send("<ESC>/#{convert_ruby_to_vim_regexp(pattern)}<CR>")
21
- for path in pathes
21
+ for path in paths
22
22
  STDERR.puts "Edit #{path}"
23
23
  editor.edit(path)
24
24
  end
@@ -26,10 +26,10 @@ end
26
26
 
27
27
  def usage
28
28
  puts <<-EOT
29
- Usage: #{File.basename($0)} [OPTS] PATTERN [PATHES]
29
+ Usage: #{File.basename($0)} [OPTS] PATTERN [PATHS]
30
30
 
31
31
  PATTERN is a pattern expression which is used to match against the content of
32
- the files. PATHES are the directory and file pathes that are searched.
32
+ the files. PATHS are the directory and file paths that are searched.
33
33
 
34
34
  Options are
35
35
 
@@ -40,8 +40,8 @@ Options are
40
40
  -A NUMBER displays NUMBER lines of context after the match
41
41
  -B NUMBER displays NUMBER lines of context before the match
42
42
  -C NUMBER displays NUMBER lines of context around the match
43
- -f just list the pathes of the files that would be searched
44
- -l just list the pathes of the files with matches
43
+ -f just list the paths of the files that would be searched
44
+ -l just list the paths of the files with matches
45
45
  -L list only the path:linenumber of the files with matches
46
46
  -R interpret PATTERN argument as fuzzy not regex
47
47
  -c disable color output
@@ -72,6 +72,6 @@ grepper = Grepper.new(
72
72
  :config => config
73
73
  ).search
74
74
  case
75
- when args['e'] then edit_files grepper.pattern, grepper.pathes
76
- when args['l'] then puts grepper.pathes
75
+ when args['e'] then edit_files grepper.pattern, grepper.paths
76
+ when args['l'] then puts grepper.paths
77
77
  end
@@ -4,8 +4,9 @@ require 'tins/go'
4
4
  include Tins::GO
5
5
  require 'tins/secure_write'
6
6
  include Tins::SecureWrite
7
+ require 'tins/find'
8
+ include Tins::Find
7
9
  require 'utils'
8
- include Utils::Find
9
10
 
10
11
  class ::File
11
12
  include Utils::FileXt
@@ -13,9 +14,9 @@ end
13
14
 
14
15
  def usage
15
16
  puts <<-EOT
16
- Usage: #{File.basename($0)} [OPTS] [PATHES]
17
+ Usage: #{File.basename($0)} [OPTS] [PATHS]
17
18
 
18
- PATHES are the directory and file pathes that are search for files to be
19
+ PATHS are the directory and file paths that are search for files to be
19
20
  stripped.
20
21
 
21
22
  Options are
@@ -31,15 +32,15 @@ end
31
32
  args = go 'I:h'
32
33
  args['h'] and usage
33
34
 
34
- pathes = ARGV.empty? ? %w[.] : ARGV
35
- pathes = pathes.map { |p| File.expand_path(p) }
35
+ paths = ARGV.empty? ? %w[.] : ARGV
36
+ paths = paths.map { |p| File.expand_path(p) }
36
37
 
37
38
  suffix = args['I'].ask_and_send(:split, /[\s,]+/).to_a
38
39
 
39
40
  config = Utils::Config::ConfigFile.new
40
41
  config.parse_config_file File.expand_path('~/.utilsrc')
41
42
 
42
- find(*pathes, :suffix => suffix) do |filename|
43
+ find(*paths, :suffix => suffix) do |filename|
43
44
  bn, s = File.basename(filename), File.stat(filename)
44
45
  s.symlink? and next
45
46
  if s.directory?
@@ -1,7 +1,6 @@
1
1
  module Utils
2
2
  require 'utils/version'
3
3
  require 'utils/file_xt'
4
- require 'utils/find'
5
4
  require 'utils/md5'
6
5
  require 'utils/patterns'
7
6
  require 'utils/config'
@@ -6,7 +6,7 @@ class ::File
6
6
  end
7
7
 
8
8
  class Utils::Finder
9
- include Utils::Find
9
+ include Tins::Find
10
10
  include Utils::Patterns
11
11
  include Term::ANSIColor
12
12
 
@@ -24,10 +24,10 @@ class Utils::Finder
24
24
  FuzzyPattern.new(pattern_opts)
25
25
  @directory = @args['d']
26
26
  @only_directory = @args['D']
27
- @pathes = []
27
+ @paths = []
28
28
  end
29
29
 
30
- attr_reader :pathes
30
+ attr_reader :paths
31
31
 
32
32
  attr_reader :output
33
33
 
@@ -51,12 +51,12 @@ class Utils::Finder
51
51
  end
52
52
 
53
53
  def search
54
- pathes = []
54
+ paths = []
55
55
  suffixes = @args['I'].ask_and_send(:split, /[\s,]+/).to_a
56
56
  find(*(@roots + [ { :suffix => suffixes } ])) do |filename|
57
57
  begin
58
58
  bn, s = filename.pathname.basename, filename.stat
59
- if s.directory? && @config.discover.prune?(bn)
59
+ if !s || s.directory? && @config.discover.prune?(bn)
60
60
  $DEBUG and warn "Pruning #{filename.inspect}."
61
61
  prune
62
62
  end
@@ -64,14 +64,12 @@ class Utils::Finder
64
64
  $DEBUG and warn "Skipping #{filename.inspect}."
65
65
  next
66
66
  end
67
- pathes << filename
68
- rescue SystemCallError => e
69
- warn "Caught #{e.class}: #{e}"
67
+ paths << filename
70
68
  end
71
69
  end
72
- pathes.uniq!
73
- pathes.map! { |p| a = File.split(p) ; a.unshift(p) ; a }
74
- pathes = pathes.map! do |path, dir, file|
70
+ paths.uniq!
71
+ paths.map! { |p| a = File.split(p) ; a.unshift(p) ; a }
72
+ paths = paths.map! do |path, dir, file|
75
73
  if do_match = attempt_match?(path) and $DEBUG
76
74
  warn "Attempt match of #{path.inspect}"
77
75
  end
@@ -99,8 +97,8 @@ class Utils::Finder
99
97
  end
100
98
  end
101
99
  end
102
- pathes.compact!
103
- @pathes, @output = pathes.sort.transpose.values_at(-2, -1)
100
+ paths.compact!
101
+ @paths, @output = paths.sort.transpose.values_at(-2, -1)
104
102
  if !@args['e'] && @output && !@output.empty?
105
103
  yield @output if block_given?
106
104
  end
@@ -6,7 +6,7 @@ class ::File
6
6
  end
7
7
 
8
8
  class Utils::Grepper
9
- include Utils::Find
9
+ include Tins::Find
10
10
  include Utils::Patterns
11
11
  include Term::ANSIColor
12
12
 
@@ -40,7 +40,7 @@ class Utils::Grepper
40
40
  raise ArgumentError, "needs to be an integer number >= 1"
41
41
  end
42
42
  end
43
- @pathes = []
43
+ @paths = []
44
44
  pattern_opts = opts.subhash(:pattern) | {
45
45
  :cset => @args['a'],
46
46
  :icase => @args['i'],
@@ -62,7 +62,7 @@ class Utils::Grepper
62
62
  end
63
63
  end
64
64
 
65
- attr_reader :pathes
65
+ attr_reader :paths
66
66
 
67
67
  attr_reader :pattern
68
68
 
@@ -70,7 +70,7 @@ class Utils::Grepper
70
70
  @filename = filename
71
71
  @output = []
72
72
  bn, s = File.basename(filename), File.stat(filename)
73
- if s.directory? && @config.search.prune?(bn)
73
+ if !s || s.directory? && @config.search.prune?(bn)
74
74
  $DEBUG and warn "Pruning #{filename.inspect}."
75
75
  prune
76
76
  end
@@ -96,16 +96,13 @@ class Utils::Grepper
96
96
  case
97
97
  when @args['l'], @args['e']
98
98
  @output.uniq!
99
- @pathes.concat @output
99
+ @paths.concat @output
100
100
  else
101
101
  STDOUT.puts @output
102
102
  end
103
103
  @output.clear
104
104
  end
105
105
  self
106
- rescue SystemCallError => e
107
- warn "Caught #{e.class}: #{e}"
108
- nil
109
106
  end
110
107
 
111
108
  def match_lines(file)
@@ -153,13 +150,13 @@ class Utils::Grepper
153
150
  match(filename)
154
151
  end
155
152
  if @args['L'] or @args['e']
156
- @pathes = @pathes.sort_by do |path|
153
+ @paths = @paths.sort_by do |path|
157
154
  pair = path.split(':')
158
155
  pair[1] = pair[1].to_i
159
156
  pair
160
157
  end
161
158
  else
162
- @pathes.sort!
159
+ @paths.sort!
163
160
  end
164
161
  self
165
162
  end
@@ -27,8 +27,7 @@ module Utils
27
27
  module Shell
28
28
  require 'fileutils'
29
29
  include FileUtils
30
- require 'utils/find'
31
- include Utils::Find
30
+ include Tins::Find
32
31
 
33
32
  # Start _ri_ for +pattern+. If +pattern+ is not string like, call it with
34
33
  # pattern.class.name as argument.
@@ -1,6 +1,6 @@
1
1
  module Utils
2
2
  # Utils version
3
- VERSION = '0.0.48'
3
+ VERSION = '0.0.49'
4
4
  VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -2,16 +2,16 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "utils"
5
- s.version = "0.0.48"
5
+ s.version = "0.0.49"
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-07-05"
9
+ s.date = "2012-07-11"
10
10
  s.description = "This ruby gem provides some useful command line utilities"
11
11
  s.email = "flori@ping.de"
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"]
13
- s.extra_rdoc_files = ["README.rdoc", "lib/utils/config/config_file.rb", "lib/utils/config.rb", "lib/utils/editor.rb", "lib/utils/file_xt.rb", "lib/utils/find.rb", "lib/utils/finder.rb", "lib/utils/grepper.rb", "lib/utils/irb.rb", "lib/utils/md5.rb", "lib/utils/patterns.rb", "lib/utils/version.rb", "lib/utils.rb"]
14
- s.files = [".gitignore", "COPYING", "Gemfile", "README.rdoc", "Rakefile", "TODO", "VERSION", "bin/chroot-exec", "bin/chroot-libs", "bin/classify", "bin/discover", "bin/edit", "bin/edit_wait", "bin/enum", "bin/errf", "bin/git-empty", "bin/myex", "bin/number_files", "bin/path", "bin/probe", "bin/same_files", "bin/search", "bin/sedit", "bin/sshscreen", "bin/strip_spaces", "bin/unquarantine_apps", "bin/untest", "bin/utils-install-config", "bin/utils-utilsrc", "bin/vacuum_firefox_sqlite", "bin/xmp", "lib/utils.rb", "lib/utils/config.rb", "lib/utils/config/config_file.rb", "lib/utils/config/gdb/asm", "lib/utils/config/gdb/ruby", "lib/utils/config/gdbinit", "lib/utils/config/irbrc", "lib/utils/config/rdebugrc", "lib/utils/config/rvmrc", "lib/utils/config/screenrc", "lib/utils/config/utilsrc", "lib/utils/config/vim/autoload/Align.vim", "lib/utils/config/vim/autoload/AlignMaps.vim", "lib/utils/config/vim/autoload/rails.vim", "lib/utils/config/vim/autoload/rubycomplete.vim", "lib/utils/config/vim/autoload/sqlcomplete.vim", "lib/utils/config/vim/autoload/vimball.vim", "lib/utils/config/vim/colors/flori.vim", "lib/utils/config/vim/compiler/eruby.vim", "lib/utils/config/vim/compiler/ruby.vim", "lib/utils/config/vim/compiler/rubyunit.vim", "lib/utils/config/vim/ftdetect/ragel.vim", "lib/utils/config/vim/ftdetect/ruby.vim", "lib/utils/config/vim/ftplugin/eruby.vim", "lib/utils/config/vim/ftplugin/ruby.vim", "lib/utils/config/vim/ftplugin/xml.vim", "lib/utils/config/vim/indent/IndentAnything_html.vim", "lib/utils/config/vim/indent/eruby.vim", "lib/utils/config/vim/indent/javascript.vim", "lib/utils/config/vim/indent/ruby.vim", "lib/utils/config/vim/plugin/AlignMapsPlugin.vim", "lib/utils/config/vim/plugin/AlignPlugin.vim", "lib/utils/config/vim/plugin/Decho.vim", "lib/utils/config/vim/plugin/IndentAnything.vim", "lib/utils/config/vim/plugin/bufexplorer.vim", "lib/utils/config/vim/plugin/cecutil.vim", "lib/utils/config/vim/plugin/fugitive.vim", "lib/utils/config/vim/plugin/lusty-explorer.vim", "lib/utils/config/vim/plugin/rails.vim", "lib/utils/config/vim/plugin/rubyextra.vim", "lib/utils/config/vim/plugin/surround.vim", "lib/utils/config/vim/plugin/taglist.vim", "lib/utils/config/vim/plugin/test/IndentAnything/test.js", "lib/utils/config/vim/plugin/vimballPlugin.vim", "lib/utils/config/vim/syntax/Decho.vim", "lib/utils/config/vim/syntax/eruby.vim", "lib/utils/config/vim/syntax/javascript.vim", "lib/utils/config/vim/syntax/ragel.vim", "lib/utils/config/vim/syntax/ruby.vim", "lib/utils/config/vimrc", "lib/utils/editor.rb", "lib/utils/file_xt.rb", "lib/utils/find.rb", "lib/utils/finder.rb", "lib/utils/grepper.rb", "lib/utils/irb.rb", "lib/utils/md5.rb", "lib/utils/patterns.rb", "lib/utils/version.rb", "utils.gemspec"]
12
+ s.executables = ["untest", "chroot-libs", "edit_wait", "chroot-exec", "number_files", "search", "strip_spaces", "path", "enum", "edit", "git-empty", "classify", "utils-install-config", "xmp", "discover", "sshscreen", "myex", "probe", "errf", "same_files", "utils-utilsrc", "unquarantine_apps", "vacuum_firefox_sqlite", "sedit"]
13
+ s.extra_rdoc_files = ["README.rdoc", "lib/utils/config/config_file.rb", "lib/utils/finder.rb", "lib/utils/version.rb", "lib/utils/irb.rb", "lib/utils/config.rb", "lib/utils/editor.rb", "lib/utils/grepper.rb", "lib/utils/file_xt.rb", "lib/utils/md5.rb", "lib/utils/patterns.rb", "lib/utils.rb"]
14
+ s.files = [".gitignore", "COPYING", "Gemfile", "README.rdoc", "Rakefile", "TODO", "VERSION", "bin/chroot-exec", "bin/chroot-libs", "bin/classify", "bin/discover", "bin/edit", "bin/edit_wait", "bin/enum", "bin/errf", "bin/git-empty", "bin/myex", "bin/number_files", "bin/path", "bin/probe", "bin/same_files", "bin/search", "bin/sedit", "bin/sshscreen", "bin/strip_spaces", "bin/unquarantine_apps", "bin/untest", "bin/utils-install-config", "bin/utils-utilsrc", "bin/vacuum_firefox_sqlite", "bin/xmp", "lib/utils.rb", "lib/utils/config.rb", "lib/utils/config/config_file.rb", "lib/utils/config/gdb/asm", "lib/utils/config/gdb/ruby", "lib/utils/config/gdbinit", "lib/utils/config/irbrc", "lib/utils/config/rdebugrc", "lib/utils/config/rvmrc", "lib/utils/config/screenrc", "lib/utils/config/utilsrc", "lib/utils/config/vim/autoload/Align.vim", "lib/utils/config/vim/autoload/AlignMaps.vim", "lib/utils/config/vim/autoload/rails.vim", "lib/utils/config/vim/autoload/rubycomplete.vim", "lib/utils/config/vim/autoload/sqlcomplete.vim", "lib/utils/config/vim/autoload/vimball.vim", "lib/utils/config/vim/colors/flori.vim", "lib/utils/config/vim/compiler/eruby.vim", "lib/utils/config/vim/compiler/ruby.vim", "lib/utils/config/vim/compiler/rubyunit.vim", "lib/utils/config/vim/ftdetect/ragel.vim", "lib/utils/config/vim/ftdetect/ruby.vim", "lib/utils/config/vim/ftplugin/eruby.vim", "lib/utils/config/vim/ftplugin/ruby.vim", "lib/utils/config/vim/ftplugin/xml.vim", "lib/utils/config/vim/indent/IndentAnything_html.vim", "lib/utils/config/vim/indent/eruby.vim", "lib/utils/config/vim/indent/javascript.vim", "lib/utils/config/vim/indent/ruby.vim", "lib/utils/config/vim/plugin/AlignMapsPlugin.vim", "lib/utils/config/vim/plugin/AlignPlugin.vim", "lib/utils/config/vim/plugin/Decho.vim", "lib/utils/config/vim/plugin/IndentAnything.vim", "lib/utils/config/vim/plugin/bufexplorer.vim", "lib/utils/config/vim/plugin/cecutil.vim", "lib/utils/config/vim/plugin/fugitive.vim", "lib/utils/config/vim/plugin/lusty-explorer.vim", "lib/utils/config/vim/plugin/rails.vim", "lib/utils/config/vim/plugin/rubyextra.vim", "lib/utils/config/vim/plugin/surround.vim", "lib/utils/config/vim/plugin/taglist.vim", "lib/utils/config/vim/plugin/test/IndentAnything/test.js", "lib/utils/config/vim/plugin/vimballPlugin.vim", "lib/utils/config/vim/syntax/Decho.vim", "lib/utils/config/vim/syntax/eruby.vim", "lib/utils/config/vim/syntax/javascript.vim", "lib/utils/config/vim/syntax/ragel.vim", "lib/utils/config/vim/syntax/ruby.vim", "lib/utils/config/vimrc", "lib/utils/editor.rb", "lib/utils/file_xt.rb", "lib/utils/finder.rb", "lib/utils/grepper.rb", "lib/utils/irb.rb", "lib/utils/md5.rb", "lib/utils/patterns.rb", "lib/utils/version.rb", "utils.gemspec"]
15
15
  s.homepage = "http://github.com/flori/utils"
16
16
  s.rdoc_options = ["--title", "Utils - Some useful command line utilities", "--main", "README.rdoc"]
17
17
  s.require_paths = ["lib"]
@@ -23,20 +23,20 @@ Gem::Specification.new do |s|
23
23
 
24
24
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
25
25
  s.add_development_dependency(%q<gem_hadar>, ["~> 0.1.8"])
26
- s.add_runtime_dependency(%q<tins>, [">= 0"])
26
+ s.add_runtime_dependency(%q<tins>, ["~> 0.5.0"])
27
27
  s.add_runtime_dependency(%q<term-ansicolor>, ["~> 1.0"])
28
28
  s.add_runtime_dependency(%q<dslkit>, ["~> 0.2.10"])
29
29
  s.add_runtime_dependency(%q<pry-editline>, [">= 0"])
30
30
  else
31
31
  s.add_dependency(%q<gem_hadar>, ["~> 0.1.8"])
32
- s.add_dependency(%q<tins>, [">= 0"])
32
+ s.add_dependency(%q<tins>, ["~> 0.5.0"])
33
33
  s.add_dependency(%q<term-ansicolor>, ["~> 1.0"])
34
34
  s.add_dependency(%q<dslkit>, ["~> 0.2.10"])
35
35
  s.add_dependency(%q<pry-editline>, [">= 0"])
36
36
  end
37
37
  else
38
38
  s.add_dependency(%q<gem_hadar>, ["~> 0.1.8"])
39
- s.add_dependency(%q<tins>, [">= 0"])
39
+ s.add_dependency(%q<tins>, ["~> 0.5.0"])
40
40
  s.add_dependency(%q<term-ansicolor>, ["~> 1.0"])
41
41
  s.add_dependency(%q<dslkit>, ["~> 0.2.10"])
42
42
  s.add_dependency(%q<pry-editline>, [">= 0"])
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.48
4
+ version: 0.0.49
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-05 00:00:00.000000000 Z
12
+ date: 2012-07-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gem_hadar
@@ -32,17 +32,17 @@ dependencies:
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
- - - ! '>='
35
+ - - ~>
36
36
  - !ruby/object:Gem::Version
37
- version: '0'
37
+ version: 0.5.0
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
- - - ! '>='
43
+ - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: '0'
45
+ version: 0.5.0
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: term-ansicolor
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -94,45 +94,55 @@ dependencies:
94
94
  description: This ruby gem provides some useful command line utilities
95
95
  email: flori@ping.de
96
96
  executables:
97
- - chroot-exec
97
+ - untest
98
98
  - chroot-libs
99
- - classify
100
- - discover
101
- - edit
102
99
  - edit_wait
100
+ - chroot-exec
101
+ - number_files
102
+ - search
103
+ - strip_spaces
104
+ - path
103
105
  - enum
104
- - errf
106
+ - edit
105
107
  - git-empty
108
+ - classify
109
+ - utils-install-config
110
+ - xmp
111
+ - discover
112
+ - sshscreen
106
113
  - myex
107
- - number_files
108
- - path
109
114
  - probe
115
+ - errf
110
116
  - same_files
111
- - search
112
- - sedit
113
- - sshscreen
114
- - strip_spaces
115
- - unquarantine_apps
116
- - untest
117
- - utils-install-config
118
117
  - utils-utilsrc
118
+ - unquarantine_apps
119
119
  - vacuum_firefox_sqlite
120
- - xmp
120
+ - sedit
121
121
  extensions: []
122
122
  extra_rdoc_files:
123
123
  - README.rdoc
124
- - lib/utils/config/config_file.rb
125
- - lib/utils/config.rb
126
- - lib/utils/editor.rb
127
- - lib/utils/file_xt.rb
128
- - lib/utils/find.rb
129
- - lib/utils/finder.rb
130
- - lib/utils/grepper.rb
131
- - lib/utils/irb.rb
132
- - lib/utils/md5.rb
133
- - lib/utils/patterns.rb
134
- - lib/utils/version.rb
135
- - lib/utils.rb
124
+ - !binary |-
125
+ bGliL3V0aWxzL2NvbmZpZy9jb25maWdfZmlsZS5yYg==
126
+ - !binary |-
127
+ bGliL3V0aWxzL2ZpbmRlci5yYg==
128
+ - !binary |-
129
+ bGliL3V0aWxzL3ZlcnNpb24ucmI=
130
+ - !binary |-
131
+ bGliL3V0aWxzL2lyYi5yYg==
132
+ - !binary |-
133
+ bGliL3V0aWxzL2NvbmZpZy5yYg==
134
+ - !binary |-
135
+ bGliL3V0aWxzL2VkaXRvci5yYg==
136
+ - !binary |-
137
+ bGliL3V0aWxzL2dyZXBwZXIucmI=
138
+ - !binary |-
139
+ bGliL3V0aWxzL2ZpbGVfeHQucmI=
140
+ - !binary |-
141
+ bGliL3V0aWxzL21kNS5yYg==
142
+ - !binary |-
143
+ bGliL3V0aWxzL3BhdHRlcm5zLnJi
144
+ - !binary |-
145
+ bGliL3V0aWxzLnJi
136
146
  files:
137
147
  - .gitignore
138
148
  - COPYING
@@ -217,7 +227,6 @@ files:
217
227
  - lib/utils/config/vimrc
218
228
  - lib/utils/editor.rb
219
229
  - lib/utils/file_xt.rb
220
- - lib/utils/find.rb
221
230
  - lib/utils/finder.rb
222
231
  - lib/utils/grepper.rb
223
232
  - lib/utils/irb.rb
@@ -243,7 +252,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
243
252
  version: '0'
244
253
  segments:
245
254
  - 0
246
- hash: 4366140309337476609
255
+ hash: 2588173863943120101
247
256
  required_rubygems_version: !ruby/object:Gem::Requirement
248
257
  none: false
249
258
  requirements:
@@ -1,158 +0,0 @@
1
- require 'pathname'
2
-
3
- module Utils
4
- module Find
5
- class ConfigurableFinder
6
- module PathExtension
7
- attr_writer :finder
8
-
9
- def file
10
- begin
11
- @finder.open_file(self)
12
- rescue Errno::ENOENT, Errno::EACCES
13
- return
14
- end
15
- end
16
-
17
- def pathname
18
- Pathname.new(self)
19
- end
20
-
21
- def suffix
22
- pathname.extname[1..-1]
23
- end
24
-
25
- def exist?
26
- !!file
27
- end
28
-
29
- def stat
30
- file and file.stat
31
- end
32
-
33
- def lstat
34
- file and file.lstat
35
- end
36
- end
37
-
38
- def initialize(opts = {})
39
- @files = {}
40
- opts[:suffix].full? { |s| @suffix = [*s] }
41
- @follow_symlinks = opts.fetch(:follow_symlinks, false)
42
- end
43
-
44
- def include_suffix?(suffix)
45
- @suffix.nil? || @suffix.include?(suffix)
46
- end
47
-
48
- def visit_file?(file)
49
- suffix = File.extname(file).full?(:[], 1..-1) || ''
50
- include_suffix?(suffix)
51
- end
52
-
53
- def prepare_file(file)
54
- path = file.dup.taint
55
- path.extend PathExtension
56
- path.finder = self
57
- path
58
- end
59
-
60
- def open_file(path, opts = {})
61
- retried = false
62
- mode = opts.fetch(:mode, 'rb')
63
- if file = @files[path]
64
- if file.closed?
65
- file.reopen(file.path, mode)
66
- end
67
- else
68
- file = File.new(path, mode)
69
- add_file path, file
70
- end
71
- file
72
- rescue Errno::EMFILE
73
- retried and raise
74
- close_files
75
- retried = true
76
- retry
77
- end
78
-
79
- def add_file(path, file)
80
- @files[path] = file
81
- self
82
- end
83
-
84
- def current_open_files
85
- @files.inject(0) { |c, f| c + f.closed? ? 0 : 1 }
86
- end
87
-
88
- def close_files
89
- @files.each_value do |f|
90
- f.closed? or f.close
91
- end
92
- nil
93
- end
94
-
95
- def stat(file)
96
- @follow_symlinks ? file.stat : file.lstat
97
- end
98
-
99
- def find(*paths, &block)
100
- block_given? or return enum_for(__method__, *paths)
101
-
102
- paths.map! do |d|
103
- File.exist?(d) or raise Errno::ENOENT
104
- d.dup
105
- end
106
-
107
- while file = paths.shift
108
- catch(:prune) do
109
- file = prepare_file(file)
110
- visit_file?(file) and yield file
111
- begin
112
- s = stat(file) or next
113
- rescue Errno::ENOENT, Errno::EACCES, Errno::ENOTDIR, Errno::ELOOP, Errno::ENAMETOOLONG
114
- next
115
- end
116
- if s.directory? then
117
- begin
118
- fs = Dir.entries(file)
119
- rescue Errno::ENOENT, Errno::EACCES, Errno::ENOTDIR, Errno::ELOOP, Errno::ENAMETOOLONG
120
- next
121
- end
122
- fs.sort!
123
- fs.reverse_each do |f|
124
- next if f == "." or f == ".."
125
- f = File.join(file, f)
126
- paths.unshift f.untaint
127
- end
128
- end
129
- end
130
- end
131
- end
132
- end
133
-
134
- # Calls the associated block with the name of every file and directory
135
- # listed as arguments, then recursively on their subdirectories, and so on.
136
- #
137
- # See the +Find+ module documentation for an example.
138
- #
139
- def find(*paths, &block) # :yield: path
140
- paths, options = paths.extract_last_argument_options
141
- ConfigurableFinder.new(options).find(*paths, &block)
142
- end
143
-
144
- #
145
- # Skips the current file or directory, restarting the loop with the next
146
- # entry. If the current file is a directory, that directory will not be
147
- # recursively entered. Meaningful only within the block associated with
148
- # Find::find.
149
- #
150
- # See the +Find+ module documentation for an example.
151
- #
152
- def prune
153
- throw :prune
154
- end
155
-
156
- module_function :find, :prune
157
- end
158
- end