utils 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f22ef57d6940146fca1afe065d634f6ab354dd60
4
- data.tar.gz: 5b865d549b37f5dc5c8f24c29461330eaa2aea20
3
+ metadata.gz: 89a3df48460cbab73ab5920232f548d286ad1687
4
+ data.tar.gz: 34635c93eddf0452bf25e41f1154d62ec6e72082
5
5
  SHA512:
6
- metadata.gz: 6b0c419748b621417ac3f6708de4b0642a715162f917c7303942ba3da71f0b3b0735fd4039692a75c12a7edc3f3fed1fbb63a0c92792062001de396965296ef5
7
- data.tar.gz: 1a3fe64cbf9086650c6436a5496dab2a05cc06c240eba10709e5d1a8c20a74bc767d195b5c74fa0e2fe516f5ade9fce92614381a4b1522358aaaa61263827c1b
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 rm found_first_in_path
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.3
1
+ 0.2.4
@@ -21,8 +21,8 @@ else
21
21
  end
22
22
 
23
23
  for line in lines
24
- (file, line = line.source_location) or next
25
- blame = `git blame -L #{line},+1 "#{file}"`
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
@@ -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']
@@ -11,6 +11,7 @@ module Utils
11
11
  require 'utils/probe_server'
12
12
  require 'utils/ssh_tunnel_specification'
13
13
  require 'utils/line_formatter'
14
+ require 'utils/line_blamer'
14
15
 
15
16
  require 'utils/xt/source_location_extension'
16
17
  class ::Object
@@ -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
@@ -1,6 +1,6 @@
1
1
  module Utils
2
2
  # Utils version
3
- VERSION = '0.2.3'
3
+ VERSION = '0.2.4'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -1,19 +1,19 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: utils 0.2.3 ruby lib
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.3"
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-01-14"
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", ".ruby-version", "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/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_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"]
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.3
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-01-14 00:00:00.000000000 Z
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
@@ -1 +0,0 @@
1
- 2.1.4