utils 0.1.1 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c5b547cf406290382146927e3057400c01b6c001
4
- data.tar.gz: 4bf97877c8b11e88ddf767afe18f03d18dbfdb05
3
+ metadata.gz: fc523acb5d11f1bf702025f3ae3a74e9dd6ca199
4
+ data.tar.gz: 26e81baed7f99c8689dc4fc264debef8ec122f9d
5
5
  SHA512:
6
- metadata.gz: 06741b6943998d87daa246c7544c8adc4d960bd0afdca0c81fe722d779fabc36817ac54225139e5b6682d534f2ae142190d07f5b28109d37ce1998f5a8526ab6
7
- data.tar.gz: b4a63a0a46894cc768db10ace648d97a53a71ba12dbfb265c10fec3cd754f04ee210e32487d1bd239e7ebcb306e714fac0d72d2e1975f45795966600a122f567
6
+ metadata.gz: 6a2282e2cb9f8381cb37516a80a82a9bd9a5b2b8e3a7ecb035752519080394c0e03ba8f98ab93b90f41f41add78689986bf79c20b2202356c062b30d7c556cb3
7
+ data.tar.gz: 5cfbef82c7b132b1d36868567594559608923ced513e446b50bb8f55e394e7999a71968dafc970f6cf2ef770a2004525a8affb3cba952900e19bb13d4827f3f3
data/Rakefile CHANGED
@@ -35,5 +35,6 @@ GemHadar do
35
35
  install(file, bindir, :mode => 0755)
36
36
  end
37
37
  end
38
+ sh 'gem install tins term-ansicolor pstree pry-editline'
38
39
  end
39
40
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.2.0
data/bin/probe CHANGED
@@ -20,6 +20,7 @@ Options are
20
20
  -C start probe as a client console
21
21
  -l start probe as a server
22
22
  -p PORT listen on/connect to local port PORT
23
+ -z use zeus
23
24
  -h display this help
24
25
 
25
26
  Version is #{File.basename($0)} #{Utils::VERSION}.
@@ -37,19 +38,9 @@ def find_cmd(*cmds)
37
38
  raise fail "no #{cmds * '|'} command found"
38
39
  end
39
40
 
40
- $config = Utils::Config::ConfigFile.new
41
- $config.configure_from_paths
42
- testrunner_args = []
43
- if i = ARGV.index('--')
44
- testrunner_args.concat ARGV[(i + 1)..-1]
45
- $args = ARGV[0...i]
46
- else
47
- $args = ARGV.dup
41
+ def zeus?
42
+ $config.probe.zeus && !`which zeus`.empty?
48
43
  end
49
- $opt = go 'lcCp:t:n:h', $args
50
- $opt['h'] and usage
51
-
52
- $uri = "druby://localhost:#{$opt['p'] || 6623}"
53
44
 
54
45
  def start_server
55
46
  Thread.abort_on_exception = $DEBUG
@@ -88,6 +79,24 @@ def connect_server
88
79
  end
89
80
  end
90
81
 
82
+ $config = Utils::Config::ConfigFile.new
83
+ $config.configure_from_paths
84
+ testrunner_args = []
85
+ if i = ARGV.index('--')
86
+ testrunner_args.concat ARGV[(i + 1)..-1]
87
+ $args = ARGV[0...i]
88
+ else
89
+ $args = ARGV.dup
90
+ end
91
+ $opt = go 'zlcCp:t:n:h', $args
92
+ $opt['h'] and usage
93
+ $opt['z'] ||= $config.probe.zeus
94
+ if $opt['z'] && !zeus?
95
+ warn "Zeus support was enabled, but is not installed!"
96
+ end
97
+
98
+ $uri = "druby://localhost:#{$opt['p'] || 6623}"
99
+
91
100
  case
92
101
  when $opt['l']
93
102
  start_server
@@ -100,9 +109,13 @@ puts "Running tests in #{$args.inspect}"
100
109
 
101
110
  case ($opt['t'] || $config.probe.test_framework).to_sym
102
111
  when :rspec
103
- rspec = find_cmd('rspec', 'spec')
112
+ if zeus?
113
+ rspec = %w[-S zeus rspec]
114
+ else
115
+ rspec = find_cmd('rspec', 'spec')
116
+ end
104
117
  if linenumber = $opt['n']
105
- cmd 'ruby', '-I', $config.probe.include_dirs_argument, rspec, '-l',
118
+ cmd 'ruby', '-I', $config.probe.include_dirs_argument, *rspec, '-l',
106
119
  linenumber, *($args + testrunner_args)
107
120
  else
108
121
  $args = $args.map do |a|
@@ -112,13 +125,17 @@ when :rspec
112
125
  a
113
126
  end
114
127
  end
115
- cmd 'ruby', '-I', $config.probe.include_dirs_argument, rspec,
128
+ cmd 'ruby', '-I', $config.probe.include_dirs_argument, *rspec,
116
129
  *($args + testrunner_args)
117
130
  end
118
131
  when :'test-unit'
119
- testrb = find_cmd('testrb')
132
+ if zeus?
133
+ testrb = %w[-S zeus testrb]
134
+ else
135
+ testrb = find_cmd('testrb')
136
+ end
120
137
  if testname = $opt['n']
121
- cmd 'ruby', '-I', $config.probe.include_dirs_argument, testrb,
138
+ cmd 'ruby', '-I', $config.probe.include_dirs_argument, *testrb,
122
139
  '-n', testname, *($args + testrunner_args)
123
140
  else
124
141
  for filename in $args
@@ -126,13 +143,13 @@ when :'test-unit'
126
143
  if sl.linenumber
127
144
  lf = Tins::LinesFile.for_filename(*sl)
128
145
  if testname = lf.match_backward(/def\s+(\S+?)(?:\(|\s*$)/).full?(:first)
129
- cmd 'ruby', '-I', $config.probe.include_dirs_argument, testrb,
146
+ cmd 'ruby', '-I', $config.probe.include_dirs_argument, *testrb,
130
147
  '-n', testname, sl.filename, *testrunner_args
131
148
  else
132
149
  warn "no test found before line #{sl.linenumber}"
133
150
  end
134
151
  else
135
- cmd 'ruby', '-I', $config.probe.include_dirs_argument, testrb,
152
+ cmd 'ruby', '-I', $config.probe.include_dirs_argument, *testrb,
136
153
  sl.filename, *testrunner_args
137
154
  end
138
155
  end
@@ -1,4 +1,4 @@
1
- require 'dslkit/polite'
1
+ require 'tins'
2
2
  require 'tins/xt/string'
3
3
 
4
4
  class Utils::Config::ConfigFile
@@ -82,6 +82,8 @@ class Utils::Config::ConfigFile
82
82
 
83
83
  config :include_dirs, %w[lib test tests ext spec]
84
84
 
85
+ config :zeus, false
86
+
85
87
  def include_dirs_argument
86
88
  Array(include_dirs) * ':'
87
89
  end
data/lib/utils/file_xt.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'dslkit/polite'
1
+ require 'tins'
2
2
 
3
3
  module Utils
4
4
  module FileXt
data/lib/utils/irb.rb CHANGED
@@ -107,6 +107,13 @@ module Utils
107
107
  end.compact.sort!
108
108
  end
109
109
 
110
+ def irb_clipboard
111
+ case RUBY_PLATFORM
112
+ when /darwin/
113
+ 'reattach-to-user-namespace pbcopy'
114
+ end
115
+ end
116
+
110
117
  class WrapperBase
111
118
  include Comparable
112
119
 
@@ -88,14 +88,19 @@ module Utils
88
88
  end
89
89
  alias enqueue job_enqueue
90
90
 
91
+ doc 'Send the <signal> to the process that is working on the current job, if any.'
92
+ def job_kill(signal)
93
+ @pid and Process.kill signal, @pid
94
+ end
95
+
91
96
  doc 'Stop the process that is working on the current job, if any.'
92
97
  def job_stop
93
- @pid and Process.kill :STOP, @pid
98
+ job_kill :STOP
94
99
  end
95
100
 
96
101
  doc 'Continue the process that is working on the current job, if any.'
97
102
  def job_continue
98
- @pid and Process.kill :CONT, @pid
103
+ job_kill :CONT
99
104
  end
100
105
 
101
106
  doc 'Shutdown the server.'
data/lib/utils/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Utils
2
2
  # Utils version
3
- VERSION = '0.1.1'
3
+ VERSION = '0.2.0'
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:
data/utils.gemspec CHANGED
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: utils 0.1.1 ruby lib
2
+ # stub: utils 0.2.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "utils"
6
- s.version = "0.1.1"
6
+ s.version = "0.2.0"
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-03-14"
11
+ s.date = "2014-06-05"
12
12
  s.description = "This ruby gem provides some useful command line utilities"
13
13
  s.email = "flori@ping.de"
14
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"]
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
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-03-14 00:00:00.000000000 Z
11
+ date: 2014-06-05 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
@@ -130,7 +130,7 @@ extra_rdoc_files:
130
130
  - lib/utils/ssh_tunnel_specification.rb
131
131
  - lib/utils/version.rb
132
132
  files:
133
- - ".gitignore"
133
+ - .gitignore
134
134
  - COPYING
135
135
  - Gemfile
136
136
  - README.rdoc
@@ -194,20 +194,20 @@ licenses: []
194
194
  metadata: {}
195
195
  post_install_message:
196
196
  rdoc_options:
197
- - "--title"
197
+ - --title
198
198
  - Utils - Some useful command line utilities
199
- - "--main"
199
+ - --main
200
200
  - README.rdoc
201
201
  require_paths:
202
202
  - lib
203
203
  required_ruby_version: !ruby/object:Gem::Requirement
204
204
  requirements:
205
- - - ">="
205
+ - - '>='
206
206
  - !ruby/object:Gem::Version
207
207
  version: '0'
208
208
  required_rubygems_version: !ruby/object:Gem::Requirement
209
209
  requirements:
210
- - - ">="
210
+ - - '>='
211
211
  - !ruby/object:Gem::Version
212
212
  version: '0'
213
213
  requirements: []