utils 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/bin/blameline +2 -2
- data/bin/long_lines +33 -0
- data/bin/myex +2 -0
- data/lib/utils.rb +1 -0
- data/lib/utils/line_blamer.rb +15 -0
- data/lib/utils/version.rb +1 -1
- data/utils.gemspec +6 -6
- metadata +6 -3
- data/.ruby-version +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89a3df48460cbab73ab5920232f548d286ad1687
|
4
|
+
data.tar.gz: 34635c93eddf0452bf25e41f1154d62ec6e72082
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ab3f1c6025817ac0be2d4b649a1afe085e3bbcb76b41b0596c77023a12be7eea54fc98e8c7297c75704bfc02f62e37790834aed93d7836ec2b8ee3d5e6fe8d2
|
7
|
+
data.tar.gz: 71f338cd751118381ea9bb1c88581ec68745e9993ceeb046b922e283a45968f614be11197c796b45575e60cf2d3e98652afba03958b9b1c4a47d2b4235fdce00
|
data/Rakefile
CHANGED
@@ -33,7 +33,7 @@ GemHadar do
|
|
33
33
|
cd 'bin' do
|
34
34
|
for file in executables
|
35
35
|
found_first_in_path = `which #{file}`.chomp
|
36
|
-
found_first_in_path.empty? or
|
36
|
+
found_first_in_path.empty? or rm_f found_first_in_path
|
37
37
|
install(file, bindir, :mode => 0755)
|
38
38
|
end
|
39
39
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.4
|
data/bin/blameline
CHANGED
@@ -21,8 +21,8 @@ else
|
|
21
21
|
end
|
22
22
|
|
23
23
|
for line in lines
|
24
|
-
|
25
|
-
blame =
|
24
|
+
blamer = Utils::LineBlamer.for_line(line) or next
|
25
|
+
blame = blamer.perform
|
26
26
|
blame.sub!(/^[0-9a-f]+/) { Term::ANSIColor.yellow($&) }
|
27
27
|
blame.sub!(/\(([^)]+)\)/) { "(#{Term::ANSIColor.red($1)})" }
|
28
28
|
puts blame
|
data/bin/long_lines
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'tins/go'
|
4
|
+
include Tins::GO
|
5
|
+
require 'utils'
|
6
|
+
require 'term/ansicolor'
|
7
|
+
|
8
|
+
$opts = go 'm:h'
|
9
|
+
|
10
|
+
if $opts[?h]
|
11
|
+
puts <<USAGE
|
12
|
+
#{File.basename($0)} [OPTIONS] [FILES]
|
13
|
+
USAGE
|
14
|
+
exit
|
15
|
+
end
|
16
|
+
max = ($opts[?m] || 80).to_i
|
17
|
+
|
18
|
+
files = ARGV
|
19
|
+
|
20
|
+
for file in files
|
21
|
+
File.open(file) do |f|
|
22
|
+
for line in f
|
23
|
+
size = line.size
|
24
|
+
if size > max
|
25
|
+
lineno = f.lineno + 1
|
26
|
+
blamer = Utils::LineBlamer.new(file, lineno) or next
|
27
|
+
blame = blamer.perform
|
28
|
+
author = blame[/\((.*?)\d{4}/, 1]
|
29
|
+
puts [ author, size, "#{file}:#{lineno}" ] * ?\t
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/bin/myex
CHANGED
@@ -62,6 +62,7 @@ when 'create'
|
|
62
62
|
warn "Created table #{table}."
|
63
63
|
end
|
64
64
|
when 'truncate'
|
65
|
+
puts "SET FOREIGN_KEY_CHECKS = 0;"
|
65
66
|
STDIN.grep(/^CREATE TABLE `([^`]+)` \(/) do |stmt|
|
66
67
|
table = $1
|
67
68
|
next unless ARGV.empty? or ARGV.member?(table)
|
@@ -70,6 +71,7 @@ when 'truncate'
|
|
70
71
|
end
|
71
72
|
when 'insert'
|
72
73
|
truncated = {}
|
74
|
+
puts "SET FOREIGN_KEY_CHECKS = 0;"
|
73
75
|
STDIN.grep(/^INSERT (?:IGNORE )?INTO `(#{ARGV.empty? ? '[^`]+' : ARGV * '|'})`/) do |stmt|
|
74
76
|
table = $1
|
75
77
|
stmt.sub!(/(^INSERT) (INTO)/, '\1 IGNORE \2') if opts['i']
|
data/lib/utils.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
module Utils
|
2
|
+
class LineBlamer
|
3
|
+
def initialize(file, lineno = 1)
|
4
|
+
@file, @lineno = file, lineno
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.for_line(line)
|
8
|
+
location = line.source_location and new *location
|
9
|
+
end
|
10
|
+
|
11
|
+
def perform(options = '')
|
12
|
+
`git blame #{options} -L #@lineno,+1 "#@file"`
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/utils/version.rb
CHANGED
data/utils.gemspec
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: utils 0.2.
|
2
|
+
# stub: utils 0.2.4 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "utils"
|
6
|
-
s.version = "0.2.
|
6
|
+
s.version = "0.2.4"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib"]
|
10
10
|
s.authors = ["Florian Frank"]
|
11
|
-
s.date = "2015-
|
11
|
+
s.date = "2015-02-09"
|
12
12
|
s.description = "This ruby gem provides some useful command line utilities"
|
13
13
|
s.email = "flori@ping.de"
|
14
|
-
s.executables = ["blameline", "brakeman2err", "chroot-exec", "chroot-libs", "classify", "create_tags", "discover", "edit", "edit_wait", "enum", "errf", "git-empty", "irb_connect", "json_check", "myex", "number_files", "on_change", "path", "probe", "remote_copy", "same_files", "search", "sedit", "ssh-tunnel", "strip_spaces", "unquarantine_apps", "untest", "utils-install-config", "utils-utilsrc", "vacuum_firefox_sqlite", "xmp"]
|
15
|
-
s.extra_rdoc_files = ["README.md", "lib/utils.rb", "lib/utils/config.rb", "lib/utils/config/config_file.rb", "lib/utils/editor.rb", "lib/utils/file_xt.rb", "lib/utils/finder.rb", "lib/utils/grepper.rb", "lib/utils/irb.rb", "lib/utils/line_formatter.rb", "lib/utils/md5.rb", "lib/utils/patterns.rb", "lib/utils/probe_server.rb", "lib/utils/ssh_tunnel_specification.rb", "lib/utils/version.rb", "lib/utils/xt/source_location_extension.rb"]
|
16
|
-
s.files = [".gitignore", "
|
14
|
+
s.executables = ["blameline", "brakeman2err", "chroot-exec", "chroot-libs", "classify", "create_tags", "discover", "edit", "edit_wait", "enum", "errf", "git-empty", "irb_connect", "json_check", "long_lines", "myex", "number_files", "on_change", "path", "probe", "remote_copy", "same_files", "search", "sedit", "ssh-tunnel", "strip_spaces", "unquarantine_apps", "untest", "utils-install-config", "utils-utilsrc", "vacuum_firefox_sqlite", "xmp"]
|
15
|
+
s.extra_rdoc_files = ["README.md", "lib/utils.rb", "lib/utils/config.rb", "lib/utils/config/config_file.rb", "lib/utils/editor.rb", "lib/utils/file_xt.rb", "lib/utils/finder.rb", "lib/utils/grepper.rb", "lib/utils/irb.rb", "lib/utils/line_blamer.rb", "lib/utils/line_formatter.rb", "lib/utils/md5.rb", "lib/utils/patterns.rb", "lib/utils/probe_server.rb", "lib/utils/ssh_tunnel_specification.rb", "lib/utils/version.rb", "lib/utils/xt/source_location_extension.rb"]
|
16
|
+
s.files = [".gitignore", "COPYING", "Gemfile", "README.md", "Rakefile", "VERSION", "bin/blameline", "bin/brakeman2err", "bin/chroot-exec", "bin/chroot-libs", "bin/classify", "bin/create_tags", "bin/discover", "bin/edit", "bin/edit_wait", "bin/enum", "bin/errf", "bin/git-empty", "bin/irb_connect", "bin/json_check", "bin/long_lines", "bin/myex", "bin/number_files", "bin/on_change", "bin/path", "bin/probe", "bin/remote_copy", "bin/same_files", "bin/search", "bin/sedit", "bin/ssh-tunnel", "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/editor.rb", "lib/utils/file_xt.rb", "lib/utils/finder.rb", "lib/utils/grepper.rb", "lib/utils/irb.rb", "lib/utils/line_blamer.rb", "lib/utils/line_formatter.rb", "lib/utils/md5.rb", "lib/utils/patterns.rb", "lib/utils/probe_server.rb", "lib/utils/ssh_tunnel_specification.rb", "lib/utils/version.rb", "lib/utils/xt/source_location_extension.rb", "utils.gemspec"]
|
17
17
|
s.homepage = "http://github.com/flori/utils"
|
18
18
|
s.rdoc_options = ["--title", "Utils - Some useful command line utilities", "--main", "README.md"]
|
19
19
|
s.rubygems_version = "2.4.5"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Frank
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_hadar
|
@@ -97,6 +97,7 @@ executables:
|
|
97
97
|
- git-empty
|
98
98
|
- irb_connect
|
99
99
|
- json_check
|
100
|
+
- long_lines
|
100
101
|
- myex
|
101
102
|
- number_files
|
102
103
|
- on_change
|
@@ -125,6 +126,7 @@ extra_rdoc_files:
|
|
125
126
|
- lib/utils/finder.rb
|
126
127
|
- lib/utils/grepper.rb
|
127
128
|
- lib/utils/irb.rb
|
129
|
+
- lib/utils/line_blamer.rb
|
128
130
|
- lib/utils/line_formatter.rb
|
129
131
|
- lib/utils/md5.rb
|
130
132
|
- lib/utils/patterns.rb
|
@@ -134,7 +136,6 @@ extra_rdoc_files:
|
|
134
136
|
- lib/utils/xt/source_location_extension.rb
|
135
137
|
files:
|
136
138
|
- ".gitignore"
|
137
|
-
- ".ruby-version"
|
138
139
|
- COPYING
|
139
140
|
- Gemfile
|
140
141
|
- README.md
|
@@ -154,6 +155,7 @@ files:
|
|
154
155
|
- bin/git-empty
|
155
156
|
- bin/irb_connect
|
156
157
|
- bin/json_check
|
158
|
+
- bin/long_lines
|
157
159
|
- bin/myex
|
158
160
|
- bin/number_files
|
159
161
|
- bin/on_change
|
@@ -187,6 +189,7 @@ files:
|
|
187
189
|
- lib/utils/finder.rb
|
188
190
|
- lib/utils/grepper.rb
|
189
191
|
- lib/utils/irb.rb
|
192
|
+
- lib/utils/line_blamer.rb
|
190
193
|
- lib/utils/line_formatter.rb
|
191
194
|
- lib/utils/md5.rb
|
192
195
|
- lib/utils/patterns.rb
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.1.4
|