utils 0.0.8 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.0.10
@@ -54,7 +54,9 @@ class Finder
54
54
  pathes.flatten!
55
55
  pathes.uniq!
56
56
  pathes.map! { |p| a = File.split(p) ; a.unshift(p) ; a }
57
+ @suffix = @args['I']
57
58
  pathes = pathes.map! do |path, dir, file|
59
+ @suffix && @suffix != File.extname(file)[1..-1] and next
58
60
  if do_match = attempt_match?(path) and $DEBUG
59
61
  warn "Attempt match of #{path.inspect}"
60
62
  end
@@ -107,19 +109,20 @@ directory and file pathes that are searched.
107
109
  Options are
108
110
 
109
111
  -r interpret PATTERN argument as regex not fuzzy
110
- -d discover directorіes as well
112
+ -d discover directories as well
111
113
  -D discover only directories
112
114
  -c disable color output
113
115
  -i use case insensitive matches
114
116
  -e open the matching files with edit command
115
117
  -a CSET use only character set CSET from PATTERN
118
+ -I SUFFIX only include files with suffix SUFFIX during finding
116
119
  -h display this help
117
120
 
118
121
  EOT
119
122
  exit 1
120
123
  end
121
124
 
122
- args = go 'a:rdDcieh'
125
+ args = go 'I:a:rdDcieh'
123
126
  args['h'] and usage
124
127
  pattern = ARGV.shift or usage
125
128
  roots = (ARGV.empty? ? [ Dir.pwd ] : ARGV).map { |f| File.expand_path(f) }
data/bin/search CHANGED
@@ -143,8 +143,13 @@ class Grepper
143
143
  end
144
144
 
145
145
  def search
146
+ @suffix = @args['I']
146
147
  for dir in @roots
147
- Utils::Find.find(dir) { |filename| match(filename) }
148
+ Utils::Find.find(dir) do |filename|
149
+ if !@suffix || @suffix == File.extname(filename)[1..-1]
150
+ match(filename)
151
+ end
152
+ end
148
153
  end
149
154
  @pathes.sort!
150
155
  self
@@ -178,6 +183,7 @@ Options are
178
183
  -R interpret PATTERN argument as fuzzy not regex
179
184
  -c disable color output
180
185
  -i use case insensitive matches
186
+ -I SUFFIX only include files with suffix SUFFIX in search
181
187
  -e open the matching files with edit command
182
188
  -a CSET use only character set CSET from PATTERN
183
189
  -h display this help
@@ -186,7 +192,7 @@ Options are
186
192
  exit 1
187
193
  end
188
194
 
189
- args = go 'A:B:C:s:S:n:N:a:RcilLeh'
195
+ args = go 'I:A:B:C:s:S:n:N:a:RcilLeh'
190
196
  args['h'] and usage
191
197
  pattern = ARGV.shift or usage
192
198
  roots = (ARGV.empty? ? [ Dir.pwd ] : ARGV).map { |f| File.expand_path(f) }
@@ -448,8 +448,17 @@ def ls(*args)
448
448
  puts `ls #{args.map { |x| "'#{x}'" } * ' '}`
449
449
  end
450
450
 
451
- if ENV['RAILS_LOG'].to_i == 1
452
- require 'logger'
453
- Object.const_defined?(:RAILS_DEFAULT_LOGGER) or
454
- Object.const_set :RAILS_DEFAULT_LOGGER, Logger.new(STDOUT)
451
+ if defined?(ActiveRecord::Base)
452
+ $logger = Logger.new(STDERR)
453
+ def irb_toggle_logging
454
+ require 'logger'
455
+ if ActiveRecord::Base.logger != $logger
456
+ $old_logger = ActiveRecord::Base.logger
457
+ ActiveRecord::Base.logger = $logger
458
+ true
459
+ else
460
+ ActiveRecord::Base.logger = $old_logger
461
+ false
462
+ end
463
+ end
455
464
  end
@@ -1,6 +1,6 @@
1
1
  module Utils
2
2
  # Utils version
3
- VERSION = '0.0.8'
3
+ VERSION = '0.0.10'
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,20 +2,20 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{utils}
5
- s.version = "0.0.8"
5
+ s.version = "0.0.10"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = [%q{Florian Frank}]
9
- s.date = %q{2011-07-25}
9
+ s.date = %q{2011-08-01}
10
10
  s.description = %q{This ruby gem provides some useful command line utilities}
11
11
  s.email = %q{flori@ping.de}
12
- s.executables = [%q{untest}, %q{chroot-libs}, %q{edit_wait}, %q{chroot-exec}, %q{number_files}, %q{search}, %q{strip_spaces}, %q{path}, %q{edit}, %q{git-empty}, %q{classify}, %q{utils-install-config}, %q{xmp}, %q{discover}, %q{sshscreen}, %q{myex}, %q{errf}, %q{same_files}, %q{unquarantine_apps}, %q{vacuum_firefox_sqlite}, %q{sedit}]
13
- s.extra_rdoc_files = [%q{README.rdoc}, %q{lib/utils/version.rb}, %q{lib/utils/find.rb}, %q{lib/utils/config.rb}, %q{lib/utils/edit.rb}, %q{lib/utils/file_xt.rb}, %q{lib/utils/md5.rb}, %q{lib/utils/patterns.rb}, %q{lib/utils.rb}]
12
+ s.executables = [%q{chroot-exec}, %q{chroot-libs}, %q{classify}, %q{discover}, %q{edit}, %q{edit_wait}, %q{errf}, %q{git-empty}, %q{myex}, %q{number_files}, %q{path}, %q{same_files}, %q{search}, %q{sedit}, %q{sshscreen}, %q{strip_spaces}, %q{unquarantine_apps}, %q{untest}, %q{utils-install-config}, %q{vacuum_firefox_sqlite}, %q{xmp}]
13
+ s.extra_rdoc_files = [%q{README.rdoc}, %q{lib/utils/config.rb}, %q{lib/utils/edit.rb}, %q{lib/utils/file_xt.rb}, %q{lib/utils/find.rb}, %q{lib/utils/md5.rb}, %q{lib/utils/patterns.rb}, %q{lib/utils/version.rb}, %q{lib/utils.rb}]
14
14
  s.files = [%q{.gitignore}, %q{COPYING}, %q{Gemfile}, %q{README.rdoc}, %q{Rakefile}, %q{VERSION}, %q{bin/chroot-exec}, %q{bin/chroot-libs}, %q{bin/classify}, %q{bin/discover}, %q{bin/edit}, %q{bin/edit_wait}, %q{bin/errf}, %q{bin/git-empty}, %q{bin/myex}, %q{bin/number_files}, %q{bin/path}, %q{bin/same_files}, %q{bin/search}, %q{bin/sedit}, %q{bin/sshscreen}, %q{bin/strip_spaces}, %q{bin/unquarantine_apps}, %q{bin/untest}, %q{bin/utils-install-config}, %q{bin/vacuum_firefox_sqlite}, %q{bin/xmp}, %q{lib/utils.rb}, %q{lib/utils/config.rb}, %q{lib/utils/config/gdb/asm}, %q{lib/utils/config/gdb/ruby}, %q{lib/utils/config/gdbinit}, %q{lib/utils/config/irbrc}, %q{lib/utils/config/rdebugrc}, %q{lib/utils/config/screenrc}, %q{lib/utils/config/vim/autoload/Align.vim}, %q{lib/utils/config/vim/autoload/AlignMaps.vim}, %q{lib/utils/config/vim/autoload/rails.vim}, %q{lib/utils/config/vim/autoload/rubycomplete.vim}, %q{lib/utils/config/vim/autoload/sqlcomplete.vim}, %q{lib/utils/config/vim/autoload/vimball.vim}, %q{lib/utils/config/vim/colors/flori.vim}, %q{lib/utils/config/vim/compiler/eruby.vim}, %q{lib/utils/config/vim/compiler/ruby.vim}, %q{lib/utils/config/vim/compiler/rubyunit.vim}, %q{lib/utils/config/vim/ftdetect/ragel.vim}, %q{lib/utils/config/vim/ftdetect/ruby.vim}, %q{lib/utils/config/vim/ftplugin/eruby.vim}, %q{lib/utils/config/vim/ftplugin/ruby.vim}, %q{lib/utils/config/vim/ftplugin/xml.vim}, %q{lib/utils/config/vim/indent/IndentAnything_html.vim}, %q{lib/utils/config/vim/indent/eruby.vim}, %q{lib/utils/config/vim/indent/javascript.vim}, %q{lib/utils/config/vim/indent/ruby.vim}, %q{lib/utils/config/vim/plugin/AlignMapsPlugin.vim}, %q{lib/utils/config/vim/plugin/AlignPlugin.vim}, %q{lib/utils/config/vim/plugin/Decho.vim}, %q{lib/utils/config/vim/plugin/IndentAnything.vim}, %q{lib/utils/config/vim/plugin/bufexplorer.vim}, %q{lib/utils/config/vim/plugin/cecutil.vim}, %q{lib/utils/config/vim/plugin/fugitive.vim}, %q{lib/utils/config/vim/plugin/lusty-explorer.vim}, %q{lib/utils/config/vim/plugin/rails.vim}, %q{lib/utils/config/vim/plugin/rubyextra.vim}, %q{lib/utils/config/vim/plugin/surround.vim}, %q{lib/utils/config/vim/plugin/taglist.vim}, %q{lib/utils/config/vim/plugin/test/IndentAnything/test.js}, %q{lib/utils/config/vim/plugin/vimballPlugin.vim}, %q{lib/utils/config/vim/syntax/Decho.vim}, %q{lib/utils/config/vim/syntax/eruby.vim}, %q{lib/utils/config/vim/syntax/javascript.vim}, %q{lib/utils/config/vim/syntax/ragel.vim}, %q{lib/utils/config/vim/syntax/ruby.vim}, %q{lib/utils/config/vimrc}, %q{lib/utils/edit.rb}, %q{lib/utils/file_xt.rb}, %q{lib/utils/find.rb}, %q{lib/utils/md5.rb}, %q{lib/utils/patterns.rb}, %q{lib/utils/version.rb}, %q{utils.gemspec}]
15
15
  s.homepage = %q{http://github.com/flori/utils}
16
16
  s.rdoc_options = [%q{--title}, %q{Utils - Some useful command line utilities}, %q{--main}, %q{README.rdoc}]
17
17
  s.require_paths = [%q{lib}]
18
- s.rubygems_version = %q{1.8.5}
18
+ s.rubygems_version = %q{1.8.6}
19
19
  s.summary = %q{Some useful command line utilities}
20
20
 
21
21
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utils
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
9
+ - 10
10
+ version: 0.0.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Florian Frank
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-25 00:00:00 Z
18
+ date: 2011-08-01 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: gem_hadar
@@ -68,38 +68,38 @@ dependencies:
68
68
  description: This ruby gem provides some useful command line utilities
69
69
  email: flori@ping.de
70
70
  executables:
71
- - untest
72
- - chroot-libs
73
- - edit_wait
74
71
  - chroot-exec
75
- - number_files
76
- - search
77
- - strip_spaces
78
- - path
79
- - edit
80
- - git-empty
72
+ - chroot-libs
81
73
  - classify
82
- - utils-install-config
83
- - xmp
84
74
  - discover
85
- - sshscreen
86
- - myex
75
+ - edit
76
+ - edit_wait
87
77
  - errf
78
+ - git-empty
79
+ - myex
80
+ - number_files
81
+ - path
88
82
  - same_files
83
+ - search
84
+ - sedit
85
+ - sshscreen
86
+ - strip_spaces
89
87
  - unquarantine_apps
88
+ - untest
89
+ - utils-install-config
90
90
  - vacuum_firefox_sqlite
91
- - sedit
91
+ - xmp
92
92
  extensions: []
93
93
 
94
94
  extra_rdoc_files:
95
95
  - README.rdoc
96
- - lib/utils/version.rb
97
- - lib/utils/find.rb
98
96
  - lib/utils/config.rb
99
97
  - lib/utils/edit.rb
100
98
  - lib/utils/file_xt.rb
99
+ - lib/utils/find.rb
101
100
  - lib/utils/md5.rb
102
101
  - lib/utils/patterns.rb
102
+ - lib/utils/version.rb
103
103
  - lib/utils.rb
104
104
  files:
105
105
  - .gitignore
@@ -215,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
215
  requirements: []
216
216
 
217
217
  rubyforge_project:
218
- rubygems_version: 1.8.5
218
+ rubygems_version: 1.8.6
219
219
  signing_key:
220
220
  specification_version: 3
221
221
  summary: Some useful command line utilities