utils 0.2.2 → 0.2.3

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: 8514a94586fa480b82deb20918d1d40ac89d284d
4
- data.tar.gz: e53cac57b84397754de9291f73076d498b50c408
3
+ metadata.gz: f22ef57d6940146fca1afe065d634f6ab354dd60
4
+ data.tar.gz: 5b865d549b37f5dc5c8f24c29461330eaa2aea20
5
5
  SHA512:
6
- metadata.gz: 3ed309d7fe82e8145414f1af30ef2b516d0742af071ec638a70fb21d83a0db1f04cac671da74b651cf17a14cb121e37f873ce85adbb9d02e96f2e27d34ec75c6
7
- data.tar.gz: f59099c146fba8e204f6ba185dfceea62ddd4018d4f12a3027b38b75d4888af1e17ad9a03c08e1ca9f7f95bb31487f053df71ec0c60c737230e7e5e43265e699
6
+ metadata.gz: 6b0c419748b621417ac3f6708de4b0642a715162f917c7303942ba3da71f0b3b0735fd4039692a75c12a7edc3f3fed1fbb63a0c92792062001de396965296ef5
7
+ data.tar.gz: 1a3fe64cbf9086650c6436a5496dab2a05cc06c240eba10709e5d1a8c20a74bc767d195b5c74fa0e2fe516f5ade9fce92614381a4b1522358aaaa61263827c1b
@@ -0,0 +1 @@
1
+ 2.1.4
data/Gemfile CHANGED
@@ -3,7 +3,3 @@
3
3
  source 'https://rubygems.org'
4
4
 
5
5
  gemspec
6
-
7
- group :developer do
8
- gem 'byebug', :platform => :ruby
9
- end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.2.3
@@ -0,0 +1,29 @@
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 'sh'
9
+
10
+ if $opts[?h]
11
+ puts <<USAGE
12
+ #{File.basename($0)} [OPTIONS] [LINES|FILES]
13
+ USAGE
14
+ exit
15
+ end
16
+
17
+ if $opts[?s]
18
+ lines = ARGF
19
+ else
20
+ lines = ARGV
21
+ end
22
+
23
+ for line in lines
24
+ (file, line = line.source_location) or next
25
+ blame = `git blame -L #{line},+1 "#{file}"`
26
+ blame.sub!(/^[0-9a-f]+/) { Term::ANSIColor.yellow($&) }
27
+ blame.sub!(/\(([^)]+)\)/) { "(#{Term::ANSIColor.red($1)})" }
28
+ puts blame
29
+ end
@@ -11,4 +11,9 @@ module Utils
11
11
  require 'utils/probe_server'
12
12
  require 'utils/ssh_tunnel_specification'
13
13
  require 'utils/line_formatter'
14
+
15
+ require 'utils/xt/source_location_extension'
16
+ class ::Object
17
+ include Utils::Xt::SourceLocationExtension
18
+ end
14
19
  end
@@ -1,53 +1,10 @@
1
1
  require 'tins/xt/full'
2
- require 'tins/deep_const_get'
3
2
  require 'fileutils'
4
3
  require 'rbconfig'
5
4
  require 'pstree'
6
5
 
7
6
  module Utils
8
7
  class Editor
9
- FILE_LINENUMBER_REGEXP = /\A\s*([^:]+):(\d+)/
10
- CLASS_METHOD_REGEXP = /\A([A-Z][\w:]+)([#.])([\w!?]+)/
11
-
12
- module SourceLocationExtension
13
- include Tins::DeepConstGet
14
-
15
- def source_location
16
- filename = nil
17
- linenumber = nil
18
- if respond_to?(:to_str)
19
- string = to_str
20
- case
21
- when string =~ FILE_LINENUMBER_REGEXP && File.exist?($1)
22
- filename = $1
23
- linenumber = $2.to_i
24
- when string =~ CLASS_METHOD_REGEXP && !File.exist?(string)
25
- klassname = $1
26
- method_kind = $2 == '#' ? :instance_method : :method
27
- methodname = $3
28
- filename, linenumber =
29
- deep_const_get(klassname).__send__(method_kind, methodname).source_location
30
- else
31
- filename = string
32
- end
33
- else
34
- filename = to_s
35
- end
36
- array = linenumber ? [ filename, linenumber ] : [ filename, 1 ]
37
- array_singleton_class = class << array; self; end
38
- array_singleton_class.instance_eval do
39
- define_method(:filename) { filename }
40
- define_method(:linenumber) { linenumber }
41
- define_method(:to_s) { [ filename, linenumber ].compact * ':' }
42
- end
43
- array
44
- end
45
- end
46
-
47
- class ::Object
48
- include SourceLocationExtension
49
- end
50
-
51
8
  def initialize
52
9
  self.wait = false
53
10
  self.pause_duration = 1
@@ -108,7 +65,7 @@ module Utils
108
65
  end
109
66
 
110
67
  def file_linenumber?(filename)
111
- filename.match(FILE_LINENUMBER_REGEXP)
68
+ filename.match(Utils::Xt::SourceLocationExtension::FILE_LINENUMBER_REGEXP)
112
69
  end
113
70
 
114
71
  def expand_globs(filenames)
@@ -1,12 +1,16 @@
1
1
  require 'tins/terminal'
2
2
  require 'term/ansicolor'
3
+
3
4
  begin
4
- require 'rpsec'
5
+ begin
6
+ require 'rspec'
7
+ rescue LoadError
8
+ end
5
9
  require 'rspec/core/formatters/base_text_formatter'
6
10
  rescue LoadError
7
11
  end
8
12
 
9
- if defined? RSpec
13
+ if defined?(RSpec) && defined?(RSpec::Core::Formatters::BaseTextFormatter)
10
14
  module Utils
11
15
  class LineFormatter < RSpec::Core::Formatters::BaseTextFormatter
12
16
  def start(example_count)
@@ -1,6 +1,6 @@
1
1
  module Utils
2
2
  # Utils version
3
- VERSION = '0.2.2'
3
+ VERSION = '0.2.3'
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:
@@ -0,0 +1,44 @@
1
+ require 'tins/deep_const_get'
2
+
3
+ module Utils
4
+ module Xt
5
+ module SourceLocationExtension
6
+ include Tins::DeepConstGet
7
+
8
+ CLASS_METHOD_REGEXP = /\A([A-Z][\w:]+)([#.])([\w!?]+)/
9
+
10
+ FILE_LINENUMBER_REGEXP = /\A\s*([^:]+):(\d+)/
11
+
12
+ def source_location
13
+ filename = nil
14
+ linenumber = nil
15
+ if respond_to?(:to_str)
16
+ string = to_str
17
+ case
18
+ when string =~ FILE_LINENUMBER_REGEXP && File.exist?($1)
19
+ filename = $1
20
+ linenumber = $2.to_i
21
+ when string =~ CLASS_METHOD_REGEXP && !File.exist?(string)
22
+ klassname = $1
23
+ method_kind = $2 == '#' ? :instance_method : :method
24
+ methodname = $3
25
+ filename, linenumber =
26
+ deep_const_get(klassname).__send__(method_kind, methodname).source_location
27
+ else
28
+ filename = string
29
+ end
30
+ else
31
+ filename = to_s
32
+ end
33
+ array = linenumber ? [ filename, linenumber ] : [ filename, 1 ]
34
+ array_singleton_class = class << array; self; end
35
+ array_singleton_class.instance_eval do
36
+ define_method(:filename) { filename }
37
+ define_method(:linenumber) { linenumber }
38
+ define_method(:to_s) { [ filename, linenumber ].compact * ':' }
39
+ end
40
+ array
41
+ end
42
+ end
43
+ end
44
+ end
@@ -1,22 +1,22 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: utils 0.2.2 ruby lib
2
+ # stub: utils 0.2.3 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "utils"
6
- s.version = "0.2.2"
6
+ s.version = "0.2.3"
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 = "2014-08-25"
11
+ s.date = "2015-01-14"
12
12
  s.description = "This ruby gem provides some useful command line utilities"
13
13
  s.email = "flori@ping.de"
14
- s.executables = ["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"]
16
- s.files = [".gitignore", "COPYING", "Gemfile", "README.md", "Rakefile", "VERSION", "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", "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", "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"]
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
- s.rubygems_version = "2.2.2"
19
+ s.rubygems_version = "2.4.5"
20
20
  s.summary = "Some useful command line utilities"
21
21
 
22
22
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,88 +1,89 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-25 00:00:00.000000000 Z
11
+ date: 2015-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.0.0
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: tins
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: term-ansicolor
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.3'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pstree
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0.1'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.1'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: pry-editline
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: This ruby gem provides some useful command line utilities
84
84
  email: flori@ping.de
85
85
  executables:
86
+ - blameline
86
87
  - brakeman2err
87
88
  - chroot-exec
88
89
  - chroot-libs
@@ -130,13 +131,16 @@ extra_rdoc_files:
130
131
  - lib/utils/probe_server.rb
131
132
  - lib/utils/ssh_tunnel_specification.rb
132
133
  - lib/utils/version.rb
134
+ - lib/utils/xt/source_location_extension.rb
133
135
  files:
134
- - .gitignore
136
+ - ".gitignore"
137
+ - ".ruby-version"
135
138
  - COPYING
136
139
  - Gemfile
137
140
  - README.md
138
141
  - Rakefile
139
142
  - VERSION
143
+ - bin/blameline
140
144
  - bin/brakeman2err
141
145
  - bin/chroot-exec
142
146
  - bin/chroot-libs
@@ -189,31 +193,32 @@ files:
189
193
  - lib/utils/probe_server.rb
190
194
  - lib/utils/ssh_tunnel_specification.rb
191
195
  - lib/utils/version.rb
196
+ - lib/utils/xt/source_location_extension.rb
192
197
  - utils.gemspec
193
198
  homepage: http://github.com/flori/utils
194
199
  licenses: []
195
200
  metadata: {}
196
201
  post_install_message:
197
202
  rdoc_options:
198
- - --title
203
+ - "--title"
199
204
  - Utils - Some useful command line utilities
200
- - --main
205
+ - "--main"
201
206
  - README.md
202
207
  require_paths:
203
208
  - lib
204
209
  required_ruby_version: !ruby/object:Gem::Requirement
205
210
  requirements:
206
- - - '>='
211
+ - - ">="
207
212
  - !ruby/object:Gem::Version
208
213
  version: '0'
209
214
  required_rubygems_version: !ruby/object:Gem::Requirement
210
215
  requirements:
211
- - - '>='
216
+ - - ">="
212
217
  - !ruby/object:Gem::Version
213
218
  version: '0'
214
219
  requirements: []
215
220
  rubyforge_project:
216
- rubygems_version: 2.2.2
221
+ rubygems_version: 2.4.5
217
222
  signing_key:
218
223
  specification_version: 4
219
224
  summary: Some useful command line utilities