utils 0.0.2 → 0.0.3

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.2
1
+ 0.0.3
data/bin/chroot-exec CHANGED
@@ -1,12 +1,15 @@
1
- #!/bin/sh
2
- DIR=$1
3
- test -z "$DIR" && exit 1
4
- PRG=$2
5
- test -z "$PRG" && PRG=/bin/bash
6
- mount -t proc none $DIR/proc
7
- mount -o bind /dev $DIR/dev
8
- [ -e "$DIR/etc/resolv.conf" ] && cp -vLf "$DIR/etc/resolv.conf" "$DIR/etc/resolv.conf.bak"
9
- cp -vLf /etc/resolv.conf "$DIR/etc/resolv.conf"
10
- chroot $DIR $PRG
11
- umount $DIR/proc
12
- umount $DIR/dev
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'fileutils'
4
+ include FileUtils
5
+
6
+ dir = ARGV.shift or fail 'require directory to chroot into'
7
+ prg = ARGV.shift || '/bin/bash'
8
+ system "mount -t proc none #{dir}/proc"
9
+ system "mount -o bind /dev #{dir}/dev"
10
+ File.exist?(resolv = "#{dir}/etc/resolv.conf") and
11
+ cp resolv, resolv + '.bak'
12
+ cp '/etc/resolv.conf', resolv
13
+ system "chroot #{dir} #{prg}"
14
+ system "umount #{dir}/proc"
15
+ system "umount #{dir}/dev"
data/bin/git-empty CHANGED
@@ -1,8 +1,10 @@
1
- #!/bin/sh
1
+ #!/usr/bin/env ruby
2
2
 
3
- NAME=$1
4
- test "$NAME" || exit 1
3
+ require 'fileutils'
4
+ include FileUtils
5
5
 
6
- git symbolic-ref HEAD refs/heads/$NAME
7
- rm .git/index
8
- git clean -fdx
6
+ name = ARGV.shift or fail 'require a branch name'
7
+
8
+ system "git symbolic-ref HEAD refs/heads/#{name}"
9
+ rm '.git/index'
10
+ system 'git clean -fdx'
data/bin/sedit CHANGED
@@ -1,3 +1,3 @@
1
- #!/bin/sh
1
+ #!/usr/bin/env ruby
2
2
 
3
- exec sudo edit $*
3
+ exec 'sudo', 'edit', *$*
@@ -1,8 +1,13 @@
1
- #!/bin/sh
1
+ #!/usr/bin/env ruby
2
2
 
3
- prefix=$1
4
- if [ -d $prefix/Applications ]
5
- then
6
- cd $prefix/Applications
7
- xattr -rd com.apple.quarantine
8
- fi
3
+ require 'fileutils'
4
+ include FileUtils::Verbose
5
+
6
+ prefix = ARGV.shift || ''
7
+ directory = File.join(prefix, 'Applications')
8
+ if File.directory?(directory)
9
+ cd directory do
10
+ STDERR.puts 'xattr -rd com.apple.quarantine'
11
+ system 'xattr -rd com.apple.quarantine'
12
+ end
13
+ end
@@ -1,22 +1,23 @@
1
- #!/bin/sh
1
+ #!/usr/bin/env ruby
2
2
 
3
- case `uname -s` in
4
- Darwin)
5
- profiles="$HOME/Library/Application Support/Firefox/Profiles/"
6
- ;;
7
- *)
8
- profiles="$HOME/.mozilla/firefox/"
9
- ;;
10
- esac
3
+ require 'fileutils'
4
+ include FileUtils
11
5
 
12
- cd "$profiles"
13
- for p in *.default
14
- do
15
- cd $p
16
- for db in *.sqlite
17
- do
18
- echo "Vacuuming $db..."
19
- sqlite3 $db VACUUM
20
- done
21
- cd -
22
- done
6
+ case `uname -s`.chomp
7
+ when 'Darwin'
8
+ profiles="#{ENV['HOME']}/Library/Application Support/Firefox/Profiles"
9
+ else
10
+ profiles="#{ENV['HOME']}/.mozilla/firefox"
11
+ end
12
+
13
+ cd profiles do
14
+ for p in Dir['*.default']
15
+ cd p do
16
+ for db in Dir['*.sqlite']
17
+ print "Vacuuming #{db}..."
18
+ system "sqlite3 #{db} VACUUM"
19
+ puts "done."
20
+ end
21
+ end
22
+ end
23
+ end
data/lib/utils/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Utils
2
2
  # Utils version
3
- VERSION = '0.0.2'
3
+ VERSION = '0.0.3'
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,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{utils}
5
- s.version = "0.0.2"
5
+ s.version = "0.0.3"
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-06-14}
9
+ s.date = %q{2011-06-24}
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{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/config.rb}, %q{lib/utils/file_xt.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}]
12
+ s.executables = [%q{untest}, %q{chroot-libs}, %q{chroot-exec}, %q{number_files}, %q{search}, %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/config.rb}, %q{lib/utils/file_xt.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/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
14
  s.homepage = %q{http://flori.github.com/utils}
15
15
  s.require_paths = [%q{lib}]
16
16
  s.rubygems_version = %q{1.8.5}
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utils
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 25
4
5
  prerelease:
5
- version: 0.0.2
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 3
10
+ version: 0.0.3
6
11
  platform: ruby
7
12
  authors:
8
13
  - Florian Frank
@@ -10,7 +15,7 @@ autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2011-06-14 00:00:00 Z
18
+ date: 2011-06-24 00:00:00 Z
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: spruz
@@ -20,6 +25,9 @@ dependencies:
20
25
  requirements:
21
26
  - - ">="
22
27
  - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
23
31
  version: "0"
24
32
  type: :runtime
25
33
  version_requirements: *id001
@@ -31,6 +39,9 @@ dependencies:
31
39
  requirements:
32
40
  - - ">="
33
41
  - !ruby/object:Gem::Version
42
+ hash: 3
43
+ segments:
44
+ - 0
34
45
  version: "0"
35
46
  type: :runtime
36
47
  version_requirements: *id002
@@ -42,7 +53,6 @@ executables:
42
53
  - chroot-exec
43
54
  - number_files
44
55
  - search
45
- - term
46
56
  - edit
47
57
  - git-empty
48
58
  - classify
@@ -120,7 +130,6 @@ files:
120
130
  - bin/chroot-exec
121
131
  - bin/number_files
122
132
  - bin/search
123
- - bin/term
124
133
  - bin/edit
125
134
  - bin/git-empty
126
135
  - bin/classify
@@ -148,12 +157,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
148
157
  requirements:
149
158
  - - ">="
150
159
  - !ruby/object:Gem::Version
160
+ hash: 3
161
+ segments:
162
+ - 0
151
163
  version: "0"
152
164
  required_rubygems_version: !ruby/object:Gem::Requirement
153
165
  none: false
154
166
  requirements:
155
167
  - - ">="
156
168
  - !ruby/object:Gem::Version
169
+ hash: 3
170
+ segments:
171
+ - 0
157
172
  version: "0"
158
173
  requirements: []
159
174
 
data/bin/term DELETED
@@ -1,21 +0,0 @@
1
- #!/bin/sh
2
-
3
- if [ "x-x" = x"$1" ]; then
4
- EXIT="; exit"; shift;
5
- fi
6
-
7
- if [[ -d "$1" ]]; then
8
- WD=`cd "$1"; pwd`; shift;
9
- else
10
- WD="'`pwd`'";
11
- fi
12
-
13
- COMMAND="cd $WD; $@"
14
- echo "$COMMAND $EXIT"
15
-
16
- osascript 2>/dev/null <<EOF
17
- tell application "Terminal"
18
- activate
19
- do script with command "$COMMAND $EXIT"
20
- end tell
21
- EOF