utils 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. data/Rakefile +68 -0
  2. data/VERSION +1 -0
  3. data/bin/chroot-exec +12 -0
  4. data/bin/chroot-libs +18 -0
  5. data/bin/classify +37 -0
  6. data/bin/discover +137 -0
  7. data/bin/edit +74 -0
  8. data/bin/errf +32 -0
  9. data/bin/git-empty +8 -0
  10. data/bin/myex +90 -0
  11. data/bin/number_files +26 -0
  12. data/bin/same_files +37 -0
  13. data/bin/search +205 -0
  14. data/bin/sedit +3 -0
  15. data/bin/sshscreen +68 -0
  16. data/bin/term +21 -0
  17. data/bin/unquarantine_apps +8 -0
  18. data/bin/untest +17 -0
  19. data/bin/utils-install-config +10 -0
  20. data/bin/vacuum_firefox_sqlite +22 -0
  21. data/bin/xmp +74 -0
  22. data/lib/utils.rb +8 -0
  23. data/lib/utils/config.rb +23 -0
  24. data/lib/utils/config/gdb/asm +179 -0
  25. data/lib/utils/config/gdb/ruby +528 -0
  26. data/lib/utils/config/gdbinit +8 -0
  27. data/lib/utils/config/irbrc +455 -0
  28. data/lib/utils/config/rdebugrc +2 -0
  29. data/lib/utils/config/screenrc +143 -0
  30. data/lib/utils/config/vim/autoload/Align.vim +1029 -0
  31. data/lib/utils/config/vim/autoload/AlignMaps.vim +330 -0
  32. data/lib/utils/config/vim/autoload/rails.vim +4744 -0
  33. data/lib/utils/config/vim/autoload/rubycomplete.vim +801 -0
  34. data/lib/utils/config/vim/autoload/sqlcomplete.vim +741 -0
  35. data/lib/utils/config/vim/autoload/vimball.vim +750 -0
  36. data/lib/utils/config/vim/colors/flori.vim +113 -0
  37. data/lib/utils/config/vim/compiler/eruby.vim +40 -0
  38. data/lib/utils/config/vim/compiler/ruby.vim +67 -0
  39. data/lib/utils/config/vim/compiler/rubyunit.vim +34 -0
  40. data/lib/utils/config/vim/ftdetect/ragel.vim +2 -0
  41. data/lib/utils/config/vim/ftdetect/ruby.vim +17 -0
  42. data/lib/utils/config/vim/ftplugin/eruby.vim +100 -0
  43. data/lib/utils/config/vim/ftplugin/ruby.vim +260 -0
  44. data/lib/utils/config/vim/ftplugin/xml.vim +941 -0
  45. data/lib/utils/config/vim/indent/IndentAnything_html.vim +35 -0
  46. data/lib/utils/config/vim/indent/eruby.vim +77 -0
  47. data/lib/utils/config/vim/indent/javascript.vim +116 -0
  48. data/lib/utils/config/vim/indent/ruby.vim +377 -0
  49. data/lib/utils/config/vim/plugin/AlignMapsPlugin.vim +242 -0
  50. data/lib/utils/config/vim/plugin/AlignPlugin.vim +41 -0
  51. data/lib/utils/config/vim/plugin/Decho.vim +592 -0
  52. data/lib/utils/config/vim/plugin/IndentAnything.vim +675 -0
  53. data/lib/utils/config/vim/plugin/bufexplorer.vim +1144 -0
  54. data/lib/utils/config/vim/plugin/cecutil.vim +482 -0
  55. data/lib/utils/config/vim/plugin/fugitive.vim +1703 -0
  56. data/lib/utils/config/vim/plugin/lusty-explorer.vim +1509 -0
  57. data/lib/utils/config/vim/plugin/rails.vim +340 -0
  58. data/lib/utils/config/vim/plugin/rubyextra.vim +193 -0
  59. data/lib/utils/config/vim/plugin/surround.vim +628 -0
  60. data/lib/utils/config/vim/plugin/taglist.vim +4546 -0
  61. data/lib/utils/config/vim/plugin/test/IndentAnything/test.js +131 -0
  62. data/lib/utils/config/vim/plugin/vimballPlugin.vim +40 -0
  63. data/lib/utils/config/vim/syntax/Decho.vim +101 -0
  64. data/lib/utils/config/vim/syntax/eruby.vim +73 -0
  65. data/lib/utils/config/vim/syntax/javascript.vim +246 -0
  66. data/lib/utils/config/vim/syntax/ragel.vim +165 -0
  67. data/lib/utils/config/vim/syntax/ruby.vim +367 -0
  68. data/lib/utils/config/vimrc +461 -0
  69. data/lib/utils/file.rb +49 -0
  70. data/lib/utils/find.rb +54 -0
  71. data/lib/utils/md5.rb +23 -0
  72. data/lib/utils/patterns.rb +34 -0
  73. data/lib/utils/version.rb +8 -0
  74. data/utils.gemspec +33 -0
  75. metadata +183 -0
data/lib/utils/file.rb ADDED
@@ -0,0 +1,49 @@
1
+ module Utils
2
+ module FileXt
3
+ include File::Constants
4
+
5
+ SEEK_SET = File::SEEK_SET
6
+
7
+ ZERO = "\x00"
8
+ BINARY = "\x01-\x1f\x7f-\xff"
9
+
10
+ if defined?(::Encoding)
11
+ ZERO.force_encoding(Encoding::ASCII_8BIT)
12
+ BINARY.force_encoding(Encoding::ASCII_8BIT)
13
+ end
14
+
15
+ def binary?
16
+ old_pos = tell
17
+ seek 0, SEEK_SET
18
+ data = read 2 ** 13
19
+ !data or data.empty? and return nil
20
+ data.count(ZERO) > 0 and return true
21
+ data.count(BINARY).to_f / data.size > 0.3
22
+ ensure
23
+ seek old_pos, SEEK_SET
24
+ end
25
+
26
+ def ascii?
27
+ case binary?
28
+ when true then false
29
+ when false then true
30
+ end
31
+ end
32
+
33
+ def self.included(modul)
34
+ modul.instance_eval do
35
+ extend ClassMethods
36
+ end
37
+ end
38
+
39
+ module ClassMethods
40
+ def binary?(name)
41
+ File.open(name, 'rb') { |f| f.binary? }
42
+ end
43
+
44
+ def ascii?(name)
45
+ File.open(name, 'rb') { |f| f.ascii? }
46
+ end
47
+ end
48
+ end
49
+ end
data/lib/utils/find.rb ADDED
@@ -0,0 +1,54 @@
1
+ module Utils
2
+ module Find
3
+ #
4
+ # Calls the associated block with the name of every file and directory listed
5
+ # as arguments, then recursively on their subdirectories, and so on.
6
+ #
7
+ # See the +Find+ module documentation for an example.
8
+ #
9
+ def find(*paths) # :yield: path
10
+ paths.collect!{|d| d.dup}
11
+ while file = paths.shift
12
+ catch(:prune) do
13
+ yield file.dup.taint
14
+ next unless File.exist? file
15
+ begin
16
+ if File.stat(file).directory? then
17
+ d = Dir.open(file)
18
+ begin
19
+ for f in d
20
+ next if f == "." or f == ".."
21
+ if File::ALT_SEPARATOR and file =~ /^(?:[\/\\]|[A-Za-z]:[\/\\]?)$/ then
22
+ f = file + f
23
+ elsif file == "/" then
24
+ f = "/" + f
25
+ else
26
+ f = File.join(file, f)
27
+ end
28
+ paths.unshift f.untaint
29
+ end
30
+ ensure
31
+ d.close
32
+ end
33
+ end
34
+ rescue Errno::ENOENT, Errno::EACCES
35
+ end
36
+ end
37
+ end
38
+ end
39
+
40
+ #
41
+ # Skips the current file or directory, restarting the loop with the next
42
+ # entry. If the current file is a directory, that directory will not be
43
+ # recursively entered. Meaningful only within the block associated with
44
+ # Find::find.
45
+ #
46
+ # See the +Find+ module documentation for an example.
47
+ #
48
+ def prune
49
+ throw :prune
50
+ end
51
+
52
+ module_function :find, :prune
53
+ end
54
+ end
data/lib/utils/md5.rb ADDED
@@ -0,0 +1,23 @@
1
+ require 'digest/md5'
2
+
3
+ module Utils
4
+ module_function
5
+
6
+ module MD5
7
+ class << self
8
+ attr_accessor :buffer_size
9
+ end
10
+ self.buffer_size = 2 ** 20 - 1
11
+
12
+ def md5(filename)
13
+ digest = Digest::MD5.new
14
+ digest.reset
15
+ File.open(filename, 'rb') do |f|
16
+ until f.eof?
17
+ digest << f.read(MD5.buffer_size)
18
+ end
19
+ end
20
+ digest.hexdigest
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,34 @@
1
+ module Utils
2
+ module Patterns
3
+ class Pattern
4
+ def initialize(opts = {})
5
+ @cset = opts[:cset]
6
+ @icase = opts[:icase]
7
+ @pattern = opts[:pattern] or
8
+ raise ArgumentError, "pattern option required"
9
+ @pattern = @pattern.gsub(/[^#{@cset}]/, '') if @cset
10
+ end
11
+
12
+ def method_missing(*a, &b)
13
+ @matcher.__send__(*a, &b)
14
+ end
15
+ end
16
+
17
+ class FuzzyPattern < Pattern
18
+ def initialize(opts ={})
19
+ super
20
+ r = @pattern.split(//).map { |x| "(#{Regexp.quote(x)})" } * '.*?'
21
+ @matcher = Regexp.new(
22
+ "\\A(?:.*/.*?#{r}|.*#{r})",
23
+ @icase ? Regexp::IGNORECASE : 0)
24
+ end
25
+ end
26
+
27
+ class RegexpPattern < Pattern
28
+ def initialize(opts = {})
29
+ super
30
+ @matcher = Regexp.new(@pattern, @icase ? Regexp::IGNORECASE : 0)
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,8 @@
1
+ module Utils
2
+ # Utils version
3
+ VERSION = '0.0.0'
4
+ VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
5
+ VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
+ VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
7
+ VERSION_BUILD = VERSION_ARRAY[2] # :nodoc:
8
+ end
data/utils.gemspec ADDED
@@ -0,0 +1,33 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{utils}
5
+ s.version = "0.0.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = [%q{Florian Frank}]
9
+ s.date = %q{2011-05-30}
10
+ s.description = %q{This ruby gem provides some useful command line utilities}
11
+ s.email = %q{flori@ping.de}
12
+ s.executables = [%q{untest}, %q{chroot-libs}, %q{chroot-exec}, %q{number_files}, %q{search}, %q{term}, %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.files = [%q{utils.gemspec}, %q{Rakefile}, %q{lib}, %q{lib/utils}, %q{lib/utils/config}, %q{lib/utils/config/screenrc}, %q{lib/utils/config/irbrc}, %q{lib/utils/config/rdebugrc}, %q{lib/utils/config/gdb}, %q{lib/utils/config/gdb/asm}, %q{lib/utils/config/gdb/ruby}, %q{lib/utils/config/vimrc}, %q{lib/utils/config/gdbinit}, %q{lib/utils/config/vim}, %q{lib/utils/config/vim/compiler}, %q{lib/utils/config/vim/compiler/rubyunit.vim}, %q{lib/utils/config/vim/compiler/ruby.vim}, %q{lib/utils/config/vim/compiler/eruby.vim}, %q{lib/utils/config/vim/syntax}, %q{lib/utils/config/vim/syntax/Decho.vim}, %q{lib/utils/config/vim/syntax/ruby.vim}, %q{lib/utils/config/vim/syntax/ragel.vim}, %q{lib/utils/config/vim/syntax/javascript.vim}, %q{lib/utils/config/vim/syntax/eruby.vim}, %q{lib/utils/config/vim/ftdetect}, %q{lib/utils/config/vim/ftdetect/ruby.vim}, %q{lib/utils/config/vim/ftdetect/ragel.vim}, %q{lib/utils/config/vim/autoload}, %q{lib/utils/config/vim/autoload/AlignMaps.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/autoload/Align.vim}, %q{lib/utils/config/vim/autoload/rails.vim}, %q{lib/utils/config/vim/indent}, %q{lib/utils/config/vim/indent/IndentAnything_html.vim}, %q{lib/utils/config/vim/indent/ruby.vim}, %q{lib/utils/config/vim/indent/javascript.vim}, %q{lib/utils/config/vim/indent/eruby.vim}, %q{lib/utils/config/vim/colors}, %q{lib/utils/config/vim/colors/flori.vim}, %q{lib/utils/config/vim/plugin}, %q{lib/utils/config/vim/plugin/bufexplorer.vim}, %q{lib/utils/config/vim/plugin/AlignMapsPlugin.vim}, %q{lib/utils/config/vim/plugin/AlignPlugin.vim}, %q{lib/utils/config/vim/plugin/cecutil.vim}, %q{lib/utils/config/vim/plugin/taglist.vim}, %q{lib/utils/config/vim/plugin/Decho.vim}, %q{lib/utils/config/vim/plugin/IndentAnything.vim}, %q{lib/utils/config/vim/plugin/fugitive.vim}, %q{lib/utils/config/vim/plugin/test}, %q{lib/utils/config/vim/plugin/test/IndentAnything}, %q{lib/utils/config/vim/plugin/test/IndentAnything/test.js}, %q{lib/utils/config/vim/plugin/surround.vim}, %q{lib/utils/config/vim/plugin/lusty-explorer.vim}, %q{lib/utils/config/vim/plugin/vimballPlugin.vim}, %q{lib/utils/config/vim/plugin/rubyextra.vim}, %q{lib/utils/config/vim/plugin/rails.vim}, %q{lib/utils/config/vim/ftplugin}, %q{lib/utils/config/vim/ftplugin/ruby.vim}, %q{lib/utils/config/vim/ftplugin/xml.vim}, %q{lib/utils/config/vim/ftplugin/eruby.vim}, %q{lib/utils/version.rb}, %q{lib/utils/find.rb}, %q{lib/utils/file.rb}, %q{lib/utils/config.rb}, %q{lib/utils/md5.rb}, %q{lib/utils/patterns.rb}, %q{lib/utils.rb}, %q{bin}, %q{bin/untest}, %q{bin/chroot-libs}, %q{bin/chroot-exec}, %q{bin/number_files}, %q{bin/search}, %q{bin/term}, %q{bin/edit}, %q{bin/git-empty}, %q{bin/classify}, %q{bin/utils-install-config}, %q{bin/xmp}, %q{bin/discover}, %q{bin/sshscreen}, %q{bin/myex}, %q{bin/errf}, %q{bin/same_files}, %q{bin/unquarantine_apps}, %q{bin/vacuum_firefox_sqlite}, %q{bin/sedit}, %q{VERSION}]
14
+ s.homepage = %q{http://flori.github.com/utils}
15
+ s.require_paths = [%q{lib}]
16
+ s.rubygems_version = %q{1.8.4}
17
+ s.summary = %q{Some useful command line utilities}
18
+
19
+ if s.respond_to? :specification_version then
20
+ s.specification_version = 3
21
+
22
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
23
+ s.add_runtime_dependency(%q<spruz>, [">= 0"])
24
+ s.add_runtime_dependency(%q<term-ansicolor>, [">= 0"])
25
+ else
26
+ s.add_dependency(%q<spruz>, [">= 0"])
27
+ s.add_dependency(%q<term-ansicolor>, [">= 0"])
28
+ end
29
+ else
30
+ s.add_dependency(%q<spruz>, [">= 0"])
31
+ s.add_dependency(%q<term-ansicolor>, [">= 0"])
32
+ end
33
+ end
metadata ADDED
@@ -0,0 +1,183 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: utils
3
+ version: !ruby/object:Gem::Version
4
+ hash: 31
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 0
10
+ version: 0.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Florian Frank
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-05-30 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: spruz
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: term-ansicolor
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ hash: 3
43
+ segments:
44
+ - 0
45
+ version: "0"
46
+ type: :runtime
47
+ version_requirements: *id002
48
+ description: This ruby gem provides some useful command line utilities
49
+ email: flori@ping.de
50
+ executables:
51
+ - untest
52
+ - chroot-libs
53
+ - chroot-exec
54
+ - number_files
55
+ - search
56
+ - term
57
+ - edit
58
+ - git-empty
59
+ - classify
60
+ - utils-install-config
61
+ - xmp
62
+ - discover
63
+ - sshscreen
64
+ - myex
65
+ - errf
66
+ - same_files
67
+ - unquarantine_apps
68
+ - vacuum_firefox_sqlite
69
+ - sedit
70
+ extensions: []
71
+
72
+ extra_rdoc_files: []
73
+
74
+ files:
75
+ - utils.gemspec
76
+ - Rakefile
77
+ - lib/utils/config/screenrc
78
+ - lib/utils/config/irbrc
79
+ - lib/utils/config/rdebugrc
80
+ - lib/utils/config/gdb/asm
81
+ - lib/utils/config/gdb/ruby
82
+ - lib/utils/config/vimrc
83
+ - lib/utils/config/gdbinit
84
+ - lib/utils/config/vim/compiler/rubyunit.vim
85
+ - lib/utils/config/vim/compiler/ruby.vim
86
+ - lib/utils/config/vim/compiler/eruby.vim
87
+ - lib/utils/config/vim/syntax/Decho.vim
88
+ - lib/utils/config/vim/syntax/ruby.vim
89
+ - lib/utils/config/vim/syntax/ragel.vim
90
+ - lib/utils/config/vim/syntax/javascript.vim
91
+ - lib/utils/config/vim/syntax/eruby.vim
92
+ - lib/utils/config/vim/ftdetect/ruby.vim
93
+ - lib/utils/config/vim/ftdetect/ragel.vim
94
+ - lib/utils/config/vim/autoload/AlignMaps.vim
95
+ - lib/utils/config/vim/autoload/rubycomplete.vim
96
+ - lib/utils/config/vim/autoload/sqlcomplete.vim
97
+ - lib/utils/config/vim/autoload/vimball.vim
98
+ - lib/utils/config/vim/autoload/Align.vim
99
+ - lib/utils/config/vim/autoload/rails.vim
100
+ - lib/utils/config/vim/indent/IndentAnything_html.vim
101
+ - lib/utils/config/vim/indent/ruby.vim
102
+ - lib/utils/config/vim/indent/javascript.vim
103
+ - lib/utils/config/vim/indent/eruby.vim
104
+ - lib/utils/config/vim/colors/flori.vim
105
+ - lib/utils/config/vim/plugin/bufexplorer.vim
106
+ - lib/utils/config/vim/plugin/AlignMapsPlugin.vim
107
+ - lib/utils/config/vim/plugin/AlignPlugin.vim
108
+ - lib/utils/config/vim/plugin/cecutil.vim
109
+ - lib/utils/config/vim/plugin/taglist.vim
110
+ - lib/utils/config/vim/plugin/Decho.vim
111
+ - lib/utils/config/vim/plugin/IndentAnything.vim
112
+ - lib/utils/config/vim/plugin/fugitive.vim
113
+ - lib/utils/config/vim/plugin/test/IndentAnything/test.js
114
+ - lib/utils/config/vim/plugin/surround.vim
115
+ - lib/utils/config/vim/plugin/lusty-explorer.vim
116
+ - lib/utils/config/vim/plugin/vimballPlugin.vim
117
+ - lib/utils/config/vim/plugin/rubyextra.vim
118
+ - lib/utils/config/vim/plugin/rails.vim
119
+ - lib/utils/config/vim/ftplugin/ruby.vim
120
+ - lib/utils/config/vim/ftplugin/xml.vim
121
+ - lib/utils/config/vim/ftplugin/eruby.vim
122
+ - lib/utils/version.rb
123
+ - lib/utils/find.rb
124
+ - lib/utils/file.rb
125
+ - lib/utils/config.rb
126
+ - lib/utils/md5.rb
127
+ - lib/utils/patterns.rb
128
+ - lib/utils.rb
129
+ - bin/untest
130
+ - bin/chroot-libs
131
+ - bin/chroot-exec
132
+ - bin/number_files
133
+ - bin/search
134
+ - bin/term
135
+ - bin/edit
136
+ - bin/git-empty
137
+ - bin/classify
138
+ - bin/utils-install-config
139
+ - bin/xmp
140
+ - bin/discover
141
+ - bin/sshscreen
142
+ - bin/myex
143
+ - bin/errf
144
+ - bin/same_files
145
+ - bin/unquarantine_apps
146
+ - bin/vacuum_firefox_sqlite
147
+ - bin/sedit
148
+ - VERSION
149
+ homepage: http://flori.github.com/utils
150
+ licenses: []
151
+
152
+ post_install_message:
153
+ rdoc_options: []
154
+
155
+ require_paths:
156
+ - lib
157
+ required_ruby_version: !ruby/object:Gem::Requirement
158
+ none: false
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ hash: 3
163
+ segments:
164
+ - 0
165
+ version: "0"
166
+ required_rubygems_version: !ruby/object:Gem::Requirement
167
+ none: false
168
+ requirements:
169
+ - - ">="
170
+ - !ruby/object:Gem::Version
171
+ hash: 3
172
+ segments:
173
+ - 0
174
+ version: "0"
175
+ requirements: []
176
+
177
+ rubyforge_project:
178
+ rubygems_version: 1.8.4
179
+ signing_key:
180
+ specification_version: 3
181
+ summary: Some useful command line utilities
182
+ test_files: []
183
+