after 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/bin/after +5 -3
- data/lib/after.rb +13 -9
- metadata +63 -36
- data/.gitignore +0 -21
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
require 'jeweler'
|
3
3
|
Jeweler::Tasks.new do |gemspec|
|
4
4
|
gemspec.name = "after"
|
5
|
-
gemspec.summary = "Command to allow you to
|
5
|
+
gemspec.summary = "Command to allow you to wait for a command in \"some other terminal window\" to finish before this one is run"
|
6
6
|
gemspec.description = gemspec.summary
|
7
7
|
gemspec.email = "rogerdpack@gmail.com"
|
8
8
|
gemspec.authors = ["rogerdpack"]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.8.0
|
data/bin/after
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
|
3
3
|
if ARGV.include?('-h') || ARGV.include?('--help') || ARGV.length == 0
|
4
|
-
puts 'syntax: [-v] [-l or --list
|
4
|
+
puts 'syntax: [-v : show output for when process ends] [-l or --list : only list matches] [-p pid] "command string to match" (some other command to run with its args on completion)'
|
5
|
+
puts 'ex: after ruby ls -l'
|
6
|
+
puts 'after -l # list all running processes'
|
7
|
+
puts "after irb \"ls | grep l\""
|
5
8
|
exit
|
6
9
|
end
|
7
10
|
|
8
11
|
require 'after'
|
9
|
-
require 'andand' # to avoid warnings
|
10
12
|
|
11
|
-
After.go
|
13
|
+
After.go
|
data/lib/after.rb
CHANGED
@@ -13,10 +13,10 @@ class After
|
|
13
13
|
if OS.windows?
|
14
14
|
procs = WMI::Win32_Process.find(:all)
|
15
15
|
for proc in procs
|
16
|
-
procs_by_pid[proc.ProcessId] = proc.CommandLine.to_s + proc.Name.to_s
|
16
|
+
procs_by_pid[proc.ProcessId] = proc.CommandLine.to_s + ' ' + proc.Name.to_s
|
17
17
|
end
|
18
18
|
else
|
19
|
-
a = `ps -ef`
|
19
|
+
a = `ps -ef` # my linux support isn't very good yet...
|
20
20
|
a.lines.to_a[1..-1].each{|l| pid = l.split(/\s+/)[1]; procs_by_pid[pid.to_i] = l}
|
21
21
|
end
|
22
22
|
|
@@ -26,7 +26,7 @@ class After
|
|
26
26
|
next if pid == Process.pid
|
27
27
|
good_pids << [pid, description]
|
28
28
|
if $VERBOSE
|
29
|
-
pps '
|
29
|
+
pps 'found', "% 5d" % pid, description
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -50,26 +50,30 @@ class After
|
|
50
50
|
|
51
51
|
# main, really
|
52
52
|
def self.go
|
53
|
-
if ARGV
|
54
|
-
ARGV.shift
|
53
|
+
if ARGV.delete('-v')
|
55
54
|
$VERBOSE = true
|
56
55
|
puts 'running in verbose mode'
|
57
56
|
end
|
58
57
|
|
59
|
-
if ARGV[0]
|
60
|
-
$VERBOSE = true # so it'll output the names...
|
58
|
+
if ARGV[0].in? ['-l', '--list']
|
61
59
|
ARGV.shift
|
62
|
-
|
60
|
+
$VERBOSE = true # so it'll output the names when searching...
|
61
|
+
query = ARGV.shift || ''
|
62
|
+
got = After.find_pids(query)
|
63
|
+
if got.empty?
|
64
|
+
puts "none found #{query}"
|
65
|
+
end
|
63
66
|
exit # premature exit
|
64
67
|
elsif ARGV[0] == '-p'
|
65
68
|
ARGV.shift
|
66
69
|
pid = ARGV.shift
|
70
|
+
puts "waiting for pid #{pid}" if $VERBOSE
|
67
71
|
After.wait_pid pid.to_i
|
68
72
|
else
|
69
73
|
After.find_and_wait_for(ARGV.shift)
|
70
74
|
end
|
71
75
|
|
72
|
-
puts 'running', ARGV if $VERBOSE
|
76
|
+
puts 'done waiting, now running:', ARGV if $VERBOSE
|
73
77
|
system(*ARGV) if ARGV.length > 0
|
74
78
|
end
|
75
79
|
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: after
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 63
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 8
|
9
|
+
- 0
|
10
|
+
version: 0.8.0
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- rogerdpack
|
@@ -9,60 +15,79 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
13
|
-
default_executable: after
|
18
|
+
date: 2011-10-04 00:00:00 Z
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: sane
|
17
|
-
|
18
|
-
|
19
|
-
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
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
|
33
|
+
version_requirements: *id001
|
25
34
|
- !ruby/object:Gem::Dependency
|
26
35
|
name: jeweler
|
27
|
-
|
28
|
-
|
29
|
-
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
30
39
|
requirements:
|
31
40
|
- - ">="
|
32
41
|
- !ruby/object:Gem::Version
|
42
|
+
hash: 3
|
43
|
+
segments:
|
44
|
+
- 0
|
33
45
|
version: "0"
|
34
|
-
|
46
|
+
type: :development
|
47
|
+
version_requirements: *id002
|
35
48
|
- !ruby/object:Gem::Dependency
|
36
49
|
name: rspec
|
37
|
-
|
38
|
-
|
39
|
-
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
40
53
|
requirements:
|
41
54
|
- - ">="
|
42
55
|
- !ruby/object:Gem::Version
|
56
|
+
hash: 3
|
57
|
+
segments:
|
58
|
+
- 0
|
43
59
|
version: "0"
|
44
|
-
|
60
|
+
type: :development
|
61
|
+
version_requirements: *id003
|
45
62
|
- !ruby/object:Gem::Dependency
|
46
63
|
name: rdp-ruby-wmi
|
47
|
-
|
48
|
-
|
49
|
-
|
64
|
+
prerelease: false
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
50
67
|
requirements:
|
51
68
|
- - ">="
|
52
69
|
- !ruby/object:Gem::Version
|
70
|
+
hash: 3
|
71
|
+
segments:
|
72
|
+
- 0
|
53
73
|
version: "0"
|
54
|
-
|
74
|
+
type: :runtime
|
75
|
+
version_requirements: *id004
|
55
76
|
- !ruby/object:Gem::Dependency
|
56
77
|
name: wait_pid
|
57
|
-
|
58
|
-
|
59
|
-
|
78
|
+
prerelease: false
|
79
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
60
81
|
requirements:
|
61
82
|
- - ">="
|
62
83
|
- !ruby/object:Gem::Version
|
84
|
+
hash: 3
|
85
|
+
segments:
|
86
|
+
- 0
|
63
87
|
version: "0"
|
64
|
-
|
65
|
-
|
88
|
+
type: :runtime
|
89
|
+
version_requirements: *id005
|
90
|
+
description: Command to allow you to wait for a command in "some other terminal window" to finish before this one is run
|
66
91
|
email: rogerdpack@gmail.com
|
67
92
|
executables:
|
68
93
|
- after
|
@@ -72,7 +97,6 @@ extra_rdoc_files:
|
|
72
97
|
- README
|
73
98
|
files:
|
74
99
|
- .document
|
75
|
-
- .gitignore
|
76
100
|
- README
|
77
101
|
- Rakefile
|
78
102
|
- VERSION
|
@@ -82,35 +106,38 @@ files:
|
|
82
106
|
- spec/sleep.bat
|
83
107
|
- spec/sleep.rb
|
84
108
|
- spec/spec.after.rb
|
85
|
-
has_rdoc: true
|
86
109
|
homepage:
|
87
110
|
licenses: []
|
88
111
|
|
89
112
|
post_install_message:
|
90
|
-
rdoc_options:
|
91
|
-
|
113
|
+
rdoc_options: []
|
114
|
+
|
92
115
|
require_paths:
|
93
116
|
- lib
|
94
117
|
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
95
119
|
requirements:
|
96
120
|
- - ">="
|
97
121
|
- !ruby/object:Gem::Version
|
122
|
+
hash: 3
|
123
|
+
segments:
|
124
|
+
- 0
|
98
125
|
version: "0"
|
99
|
-
version:
|
100
126
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
101
128
|
requirements:
|
102
129
|
- - ">="
|
103
130
|
- !ruby/object:Gem::Version
|
131
|
+
hash: 3
|
132
|
+
segments:
|
133
|
+
- 0
|
104
134
|
version: "0"
|
105
|
-
version:
|
106
135
|
requirements: []
|
107
136
|
|
108
137
|
rubyforge_project:
|
109
|
-
rubygems_version: 1.
|
138
|
+
rubygems_version: 1.7.2
|
110
139
|
signing_key:
|
111
140
|
specification_version: 3
|
112
|
-
summary: Command to allow you to
|
113
|
-
test_files:
|
114
|
-
|
115
|
-
- spec/sleep.rb
|
116
|
-
- spec/spec.after.rb
|
141
|
+
summary: Command to allow you to wait for a command in "some other terminal window" to finish before this one is run
|
142
|
+
test_files: []
|
143
|
+
|