utils 0.0.24 → 0.0.25

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  .*.sw[pon]
2
+ .rvmrc
2
3
  Gemfile.lock
3
4
  pkg
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ GemHadar do
12
12
  bindir 'bin'
13
13
  executables Dir['bin/*'].map(&File.method(:basename))
14
14
  test_dir 'tests'
15
- ignore '.*.sw[pon]', 'pkg', 'Gemfile.lock'
15
+ ignore '.*.sw[pon]', 'pkg', 'Gemfile.lock', '.rvmrc'
16
16
  readme 'README.rdoc'
17
17
 
18
18
  dependency 'tins', '~>0.3'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.24
1
+ 0.0.25
data/bin/discover CHANGED
@@ -29,6 +29,7 @@ Options are
29
29
  -e open the matching files with edit command
30
30
  -a CSET use only character set CSET from PATTERN
31
31
  -I SUFFIX only include files with suffix SUFFIX during finding
32
+ -b match also binary files
32
33
  -h display this help
33
34
 
34
35
  Version is #{File.basename($0)} #{Utils::VERSION}.
@@ -36,7 +37,7 @@ Version is #{File.basename($0)} #{Utils::VERSION}.
36
37
  exit 1
37
38
  end
38
39
 
39
- args = go 'I:a:rdDcieh'
40
+ args = go 'I:a:rdDciebh'
40
41
  args['h'] and usage
41
42
  pattern = ARGV.shift or usage
42
43
  roots = (ARGV.empty? ? [ Dir.pwd ] : ARGV).map { |f| File.expand_path(f) }
@@ -45,6 +46,7 @@ Term::ANSIColor.coloring = (STDIN.tty? && ENV['TERM'] !~ /dumb/) && !args['c']
45
46
  STDOUT.sync = true
46
47
  config = Utils::Config::ConfigFile.new
47
48
  config.parse_config_file File.expand_path('~/.utilsrc')
49
+ args['b'] ||= config.discover.binary
48
50
  finder = Finder.new(
49
51
  :pattern => pattern,
50
52
  :args => args,
data/bin/utils-utilsrc CHANGED
@@ -24,6 +24,8 @@ when 'show'
24
24
  else
25
25
  puts $config.to_ruby
26
26
  end
27
+ when 'default'
28
+ puts $config.to_ruby
27
29
  when 'diff'
28
30
  create_default_utilsrc do |default_utilsrc, utilsrc|
29
31
  system "diff -u #{default_utilsrc.inspect} #{utilsrc.inspect} | cdiff"
@@ -106,6 +106,8 @@ class Utils::Config::ConfigFile
106
106
  config :prune_dirs, /\A(\.svn|\.git|CVS|tmp)\Z/
107
107
 
108
108
  config :skip_files, /(\A\.|\.sw[pon]\Z|\.log\Z|~\Z)/
109
+
110
+ config :binary, false
109
111
  end
110
112
 
111
113
  def discover(&block)
data/lib/utils/finder.rb CHANGED
@@ -18,6 +18,7 @@ class Utils::Finder
18
18
  :cset => @args['a'],
19
19
  :icase => @args['i'],
20
20
  }
21
+ @binary = @args['b']
21
22
  @pattern = @args['r'] ?
22
23
  RegexpPattern.new(pattern_opts) :
23
24
  FuzzyPattern.new(pattern_opts)
@@ -30,15 +31,19 @@ class Utils::Finder
30
31
 
31
32
  attr_reader :output
32
33
 
34
+ def ascii_file?(stat, path)
35
+ stat.file? && (@binary || stat.size == 0 || File.ascii?(path))
36
+ end
37
+
33
38
  def attempt_match?(path)
34
39
  stat = File.stat(path)
35
40
  stat.symlink? and stat = File.lstat(path)
36
41
  if @only_directory
37
42
  stat.directory?
38
43
  elsif @directory
39
- stat.directory? || stat.file? && (stat.size == 0 || File.ascii?(path))
44
+ stat.directory? || ascii_file?(stat, path)
40
45
  else
41
- stat.file? && (stat.size == 0 || File.ascii?(path))
46
+ ascii_file?(stat, path)
42
47
  end
43
48
  rescue SystemCallError => e
44
49
  warn "Caught #{e.class}: #{e}"
data/lib/utils/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Utils
2
2
  # Utils version
3
- VERSION = '0.0.24'
3
+ VERSION = '0.0.25'
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:
data/utils.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "utils"
5
- s.version = "0.0.24"
5
+ s.version = "0.0.25"
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 = "2011-10-27"
9
+ s.date = "2011-11-07"
10
10
  s.description = "This ruby gem provides some useful command line utilities"
11
11
  s.email = "flori@ping.de"
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/find.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", ".rvmrc", "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/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/md5.rb", "lib/utils/patterns.rb", "lib/utils/version.rb", "utils.gemspec"]
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/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/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/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"]
@@ -22,18 +22,18 @@ 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.0"])
25
+ s.add_development_dependency(%q<gem_hadar>, ["~> 0.1.1"])
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
  else
30
- s.add_dependency(%q<gem_hadar>, ["~> 0.1.0"])
30
+ s.add_dependency(%q<gem_hadar>, ["~> 0.1.1"])
31
31
  s.add_dependency(%q<tins>, ["~> 0.3"])
32
32
  s.add_dependency(%q<term-ansicolor>, ["~> 1.0"])
33
33
  s.add_dependency(%q<dslkit>, ["~> 0.2"])
34
34
  end
35
35
  else
36
- s.add_dependency(%q<gem_hadar>, ["~> 0.1.0"])
36
+ s.add_dependency(%q<gem_hadar>, ["~> 0.1.1"])
37
37
  s.add_dependency(%q<tins>, ["~> 0.3"])
38
38
  s.add_dependency(%q<term-ansicolor>, ["~> 1.0"])
39
39
  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.24
4
+ version: 0.0.25
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: 2011-10-27 00:00:00.000000000Z
12
+ date: 2011-11-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gem_hadar
16
- requirement: &2152566620 !ruby/object:Gem::Requirement
16
+ requirement: &2158031260 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 0.1.0
21
+ version: 0.1.1
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2152566620
24
+ version_requirements: *2158031260
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: tins
27
- requirement: &2152566160 !ruby/object:Gem::Requirement
27
+ requirement: &2158030820 !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: *2152566160
35
+ version_requirements: *2158030820
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: term-ansicolor
38
- requirement: &2152565740 !ruby/object:Gem::Requirement
38
+ requirement: &2158030400 !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: *2152565740
46
+ version_requirements: *2158030400
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: dslkit
49
- requirement: &2152565320 !ruby/object:Gem::Requirement
49
+ requirement: &2158029980 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,51 +54,50 @@ dependencies:
54
54
  version: '0.2'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2152565320
57
+ version_requirements: *2158029980
58
58
  description: This ruby gem provides some useful command line utilities
59
59
  email: flori@ping.de
60
60
  executables:
61
- - untest
61
+ - chroot-exec
62
62
  - chroot-libs
63
+ - classify
64
+ - discover
65
+ - edit
63
66
  - edit_wait
64
- - chroot-exec
65
- - number_files
66
- - search
67
- - strip_spaces
68
- - path
69
67
  - enum
70
- - edit
68
+ - errf
71
69
  - git-empty
72
- - classify
73
- - utils-install-config
74
- - xmp
75
- - discover
76
- - sshscreen
77
70
  - myex
71
+ - number_files
72
+ - path
78
73
  - probe
79
- - errf
80
74
  - same_files
81
- - utils-utilsrc
75
+ - search
76
+ - sedit
77
+ - sshscreen
78
+ - strip_spaces
82
79
  - unquarantine_apps
80
+ - untest
81
+ - utils-install-config
82
+ - utils-utilsrc
83
83
  - vacuum_firefox_sqlite
84
- - sedit
84
+ - xmp
85
85
  extensions: []
86
86
  extra_rdoc_files:
87
87
  - README.rdoc
88
88
  - lib/utils/config/config_file.rb
89
- - lib/utils/finder.rb
90
- - lib/utils/version.rb
91
- - lib/utils/find.rb
92
89
  - lib/utils/config.rb
93
90
  - lib/utils/editor.rb
94
- - lib/utils/grepper.rb
95
91
  - lib/utils/file_xt.rb
92
+ - lib/utils/find.rb
93
+ - lib/utils/finder.rb
94
+ - lib/utils/grepper.rb
96
95
  - lib/utils/md5.rb
97
96
  - lib/utils/patterns.rb
97
+ - lib/utils/version.rb
98
98
  - lib/utils.rb
99
99
  files:
100
100
  - .gitignore
101
- - .rvmrc
102
101
  - COPYING
103
102
  - Gemfile
104
103
  - README.rdoc
data/.rvmrc DELETED
@@ -1,3 +0,0 @@
1
- rvm use ruby-1.9.2-p290
2
- rvm gemset create utils
3
- rvm gemset use utils