lunchy 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +7 -1
- data/README.md +2 -1
- data/bin/lunchy +12 -8
- data/lib/lunchy.rb +6 -5
- metadata +12 -6
data/History.md
CHANGED
@@ -1,9 +1,15 @@
|
|
1
1
|
Changes
|
2
2
|
================
|
3
3
|
|
4
|
-
0.
|
4
|
+
0.6.0
|
5
5
|
----
|
6
6
|
|
7
|
+
- Fix 'regular expression too big' (jmazzi)
|
8
|
+
- Allow to force start disabled agents (koraktor)
|
9
|
+
|
10
|
+
0.5.0
|
11
|
+
-----
|
12
|
+
|
7
13
|
- Add default output to start and stop (joncooper)
|
8
14
|
- Add 'edit' command to edit the matching plist file (AndreyChernyh)
|
9
15
|
- Allow management of daemons in /System/Library/LaunchDaemons when lunchy is run as root (fhemberger)
|
data/README.md
CHANGED
@@ -13,7 +13,8 @@ Lunchy aims to be that friendly tool by wrapping launchctl and providing a few s
|
|
13
13
|
- restart [pattern]
|
14
14
|
- status [pattern]
|
15
15
|
- install [file]
|
16
|
-
|
16
|
+
- edit [pattern]
|
17
|
+
|
17
18
|
where pattern is just a substring that matches the agent's plist filename. If you don't use a unique pattern, Lunchy will warn you of this and give you a list of the matching items instead.
|
18
19
|
|
19
20
|
So instead of:
|
data/bin/lunchy
CHANGED
@@ -10,6 +10,10 @@ OPERATIONS = %w(start stop restart ls list status install edit)
|
|
10
10
|
option_parser = OptionParser.new do |opts|
|
11
11
|
opts.banner = "Lunchy #{Lunchy::VERSION}, the friendly launchctl wrapper\nUsage: #{__FILE__} [#{OPERATIONS.join('|')}] [options]"
|
12
12
|
|
13
|
+
opts.on("-F", "--force", "Force start (disabled) agents") do |verbose|
|
14
|
+
CONFIG[:force] = true
|
15
|
+
end
|
16
|
+
|
13
17
|
opts.on("-v", "--verbose", "Show command executions") do |verbose|
|
14
18
|
CONFIG[:verbose] = true
|
15
19
|
end
|
@@ -22,14 +26,14 @@ option_parser = OptionParser.new do |opts|
|
|
22
26
|
|
23
27
|
Supported commands:
|
24
28
|
|
25
|
-
ls [pattern]
|
26
|
-
list [pattern]
|
27
|
-
start [-
|
28
|
-
stop [-w] [pattern]
|
29
|
-
restart [pattern]
|
30
|
-
status [pattern]
|
31
|
-
install [file]
|
32
|
-
edit [pattern]
|
29
|
+
ls [pattern] Show the list of installed agents, with optional [pattern] filter
|
30
|
+
list [pattern] Alias for 'ls'
|
31
|
+
start [-wF] [pattern] Start the first agent matching [pattern]
|
32
|
+
stop [-w] [pattern] Stop the first agent matching [pattern]
|
33
|
+
restart [pattern] Stop and start the first agent matching [pattern]
|
34
|
+
status [pattern] Show the PID and label for all agents, with optional [pattern] filter
|
35
|
+
install [file] Installs [file] to ~/Library/LaunchAgents or /Library/LaunchAgents (whichever it finds first)
|
36
|
+
edit [pattern] Opens the launchctl daemon file in the default editor (EDITOR environment variable)
|
33
37
|
|
34
38
|
-w will persist the start/stop command so the agent will load on startup or never load, respectively.
|
35
39
|
|
data/lib/lunchy.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
|
3
3
|
class Lunchy
|
4
|
-
VERSION = '0.
|
4
|
+
VERSION = '0.6.0'
|
5
5
|
|
6
6
|
def start(params)
|
7
|
-
raise ArgumentError, "start [-
|
7
|
+
raise ArgumentError, "start [-wF] [name]" if params.empty?
|
8
8
|
name = params[0]
|
9
9
|
files = plists.select {|k,v| k =~ /#{name}/i }
|
10
10
|
files = Hash[files] if files.is_a?(Array) # ruby 1.8
|
@@ -13,7 +13,7 @@ class Lunchy
|
|
13
13
|
elsif files.size == 0
|
14
14
|
return puts "No daemon found matching '#{name}'" if !name
|
15
15
|
else
|
16
|
-
execute("launchctl load #{CONFIG[:write] ? '-w ' : ''}#{files.values.first.inspect}")
|
16
|
+
execute("launchctl load #{CONFIG[:force] ? '-F ' : ''}#{CONFIG[:write] ? '-w ' : ''}#{files.values.first.inspect}")
|
17
17
|
puts "started #{files.keys.first}"
|
18
18
|
end
|
19
19
|
end
|
@@ -42,9 +42,10 @@ class Lunchy
|
|
42
42
|
pattern = params[0]
|
43
43
|
cmd = "launchctl list"
|
44
44
|
if !verbose?
|
45
|
-
agents =
|
46
|
-
cmd << " | grep -i
|
45
|
+
agents = plists.keys.map { |k| "-e \"#{k}\"" }.join(" ")
|
46
|
+
cmd << " | grep -i #{agents}"
|
47
47
|
end
|
48
|
+
cmd.gsub!('.','\.')
|
48
49
|
cmd << " | grep -i \"#{pattern}\"" if pattern
|
49
50
|
execute(cmd)
|
50
51
|
end
|
metadata
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lunchy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 6
|
8
|
+
- 0
|
9
|
+
version: 0.6.0
|
6
10
|
platform: ruby
|
7
11
|
authors:
|
8
12
|
- Mike Perham
|
@@ -10,7 +14,7 @@ autorequire:
|
|
10
14
|
bindir: bin
|
11
15
|
cert_chain: []
|
12
16
|
|
13
|
-
date:
|
17
|
+
date: 2012-01-25 00:00:00 -08:00
|
14
18
|
default_executable:
|
15
19
|
dependencies: []
|
16
20
|
|
@@ -40,21 +44,23 @@ rdoc_options: []
|
|
40
44
|
require_paths:
|
41
45
|
- lib
|
42
46
|
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
-
none: false
|
44
47
|
requirements:
|
45
48
|
- - ">="
|
46
49
|
- !ruby/object:Gem::Version
|
50
|
+
segments:
|
51
|
+
- 0
|
47
52
|
version: "0"
|
48
53
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
54
|
requirements:
|
51
55
|
- - ">="
|
52
56
|
- !ruby/object:Gem::Version
|
57
|
+
segments:
|
58
|
+
- 0
|
53
59
|
version: "0"
|
54
60
|
requirements: []
|
55
61
|
|
56
62
|
rubyforge_project:
|
57
|
-
rubygems_version: 1.
|
63
|
+
rubygems_version: 1.3.6
|
58
64
|
signing_key:
|
59
65
|
specification_version: 3
|
60
66
|
summary: Friendly wrapper around launchctl
|