lunchy 0.7.0 → 0.8.0

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: fe9904b30b68e92d860ede29932192a4f8131c15
4
- data.tar.gz: 173bd3acfad8b595e078dfa7fd5163e71595bc68
3
+ metadata.gz: 6ce0c016e1ab90df8712085757b64b4aa1374206
4
+ data.tar.gz: 0c7b03c566499c87a36f293fe9fc026bf9dde41e
5
5
  SHA512:
6
- metadata.gz: 65ce72ab1bbe94e21883ba1bf5ba2e5924a596c10d083aa103e0840cc6a0bbedac9a0815d8c481605d329abc7d22a671db687f23e0952346c17960b653e367d2
7
- data.tar.gz: a3c84055cce932ddb7a1530182cd639bfb0754c57c3385871798ffd97ac3da93535b268b9903c5c4bfeeca555a2e501b8cfdf93e77bc2fff25a604fddb176480
6
+ metadata.gz: 0dffc33645c389fa885dd7a7fc03f844307e592b0195dcb4737ebd2c4703e8abfca3d984d059f17f67ee04b69207c1698324dfe4882b073ed4c5c5a89d66f8f3
7
+ data.tar.gz: 1b3a6035f38b14d1f11e98480edb472faa1af3a9b28e2ad8eb02143714c974d16de366c26c65087084f63bae95eb7e945fa8000423db1a3a0e0cfc8382e3a945
data/.gitignore ADDED
@@ -0,0 +1,34 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /.bundle/
25
+ /lib/bundler/man/
26
+
27
+ # for a library or gem, you might want to ignore these files since the code is
28
+ # intended to run in multiple environments; otherwise, check them in:
29
+ Gemfile.lock
30
+ # .ruby-version
31
+ # .ruby-gemset
32
+
33
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
34
+ .rvmrc
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in lunchy.gemspec
4
+ gemspec
data/History.md CHANGED
@@ -1,6 +1,15 @@
1
1
  Changes
2
2
  ================
3
3
 
4
+ 0.8.0
5
+ ----
6
+
7
+ - Add 'uninstall' command to remove installed plist
8
+ - Add '-s, --symlink' option to symlink on install
9
+ - Add Rakefile for development
10
+ - Make clear that license is MIT, thanks [bf4!](https://github.com/bf4)
11
+ - Ignore case on ls, thanks [jpcirrus!](https://github.com/jpcirrus)
12
+
4
13
  0.7.0
5
14
  ----
6
15
 
data/LICENSE CHANGED
@@ -1,20 +1,21 @@
1
+ The MIT License (MIT)
2
+
1
3
  Copyright (c) 2011 Mike Perham
2
4
 
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
10
11
 
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
13
14
 
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -13,6 +13,7 @@ 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
+ - uninstall [pattern]
16
17
  - show [pattern]
17
18
  - edit [pattern]
18
19
 
@@ -51,7 +52,7 @@ Thanks
51
52
 
52
53
  Thanks to all the individual contributors who've improved Lunchy, see credits in History.md.
53
54
 
54
- Lunchy was written as part of my project time at [Carbon Five](http://carbonfive.com). [They're hiring](http://carbonfive.com/view/page.basic/jobs) if you love working on Ruby and open source.
55
+ Lunchy was written as part of my project time at [Carbon Five](http://carbonfive.com). [They're hiring](http://carbonfive.com/jobs) if you love working on Ruby and open source.
55
56
 
56
57
 
57
58
  About
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/lunchy CHANGED
@@ -5,7 +5,7 @@ require 'optparse'
5
5
  require 'lunchy'
6
6
 
7
7
  CONFIG = {}
8
- OPERATIONS = %w(start stop restart ls list status install show edit)
8
+ OPERATIONS = %w(start stop restart ls list status install uninstall rm show edit)
9
9
 
10
10
  option_parser = OptionParser.new do |opts|
11
11
  opts.banner = "Lunchy #{Lunchy::VERSION}, the friendly launchctl wrapper\n" \
@@ -27,6 +27,10 @@ option_parser = OptionParser.new do |opts|
27
27
  CONFIG[:long] = true
28
28
  end
29
29
 
30
+ opts.on("-s", "--symlink", "Use a symlink for installation") do |verbose|
31
+ CONFIG[:symlink] = true
32
+ end
33
+
30
34
  opts.separator <<-EOS
31
35
 
32
36
  Supported commands:
@@ -37,7 +41,8 @@ Supported commands:
37
41
  stop [-w] [pattern] Stop the first agent matching [pattern]
38
42
  restart [pattern] Stop and start the first agent matching [pattern]
39
43
  status [pattern] Show the PID and label for all agents, with optional [pattern] filter
40
- install [file] Install [file] to ~/Library/LaunchAgents or /Library/LaunchAgents (whichever it finds first)
44
+ install [-s] [file] Install [file] to ~/Library/LaunchAgents or /Library/LaunchAgents (whichever it finds first)
45
+ uninstall [name] Uninstall [name] from ~/Library/LaunchAgents or /Library/LaunchAgents (whichever it finds first)
41
46
  show [pattern] Show the contents of the launchctl daemon file
42
47
  edit [pattern] Open the launchctl daemon file in the default editor (EDITOR environment variable)
43
48
 
data/lib/lunchy.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'fileutils'
2
2
 
3
3
  class Lunchy
4
- VERSION = '0.7.0'
4
+ VERSION = '0.8.0'
5
5
 
6
6
  def start(params)
7
7
  raise ArgumentError, "start [-wF] [name]" if params.empty?
@@ -42,7 +42,7 @@ class Lunchy
42
42
 
43
43
  def ls(params)
44
44
  agents = plists.keys
45
- agents = agents.grep(/#{params[0]}/) if !params.empty?
45
+ agents = agents.grep(/#{params[0]}/i) if !params.empty?
46
46
  if long
47
47
  puts agents.map { |agent| plists[agent] }.sort.join("\n")
48
48
  else
@@ -52,16 +52,35 @@ class Lunchy
52
52
  alias_method :list, :ls
53
53
 
54
54
  def install(params)
55
- raise ArgumentError, "install [file]" if params.empty?
55
+ raise ArgumentError, "install [-s] [file]" if params.empty?
56
56
  filename = params[0]
57
57
  %w(~/Library/LaunchAgents /Library/LaunchAgents).each do |dir|
58
58
  if File.exist?(File.expand_path(dir))
59
- FileUtils.cp filename, File.join(File.expand_path(dir), File.basename(filename))
60
- return puts "#{filename} installed to #{dir}"
59
+ if symlink
60
+ FileUtils.ln_s filename, File.join(File.expand_path(dir), File.basename(filename)), force: true
61
+ return puts "#{filename} installed to #{dir}"
62
+ else
63
+ FileUtils.cp filename, File.join(File.expand_path(dir), File.basename(filename))
64
+ return puts "#{filename} installed to #{dir}"
65
+ end
61
66
  end
62
67
  end
63
68
  end
64
69
 
70
+ def uninstall(params)
71
+ raise ArgumentError, "uninstall [name]" if params.empty?
72
+
73
+ stop(params.dup)
74
+
75
+ with_match params[0] do |name, path|
76
+ if File.exist?(path)
77
+ FileUtils.rm(path)
78
+ puts "uninstalled #{name}"
79
+ end
80
+ end
81
+ end
82
+ alias_method :rm, :uninstall
83
+
65
84
  def show(params)
66
85
  raise ArgumentError, "show [name]" if params.empty?
67
86
 
@@ -97,7 +116,11 @@ class Lunchy
97
116
  CONFIG[:long]
98
117
  end
99
118
 
100
- def with_match name
119
+ def symlink
120
+ CONFIG[:symlink]
121
+ end
122
+
123
+ def with_match(name)
101
124
  files = plists.select {|k,_| k =~ /#{name}/i }
102
125
  files = Hash[files] if files.is_a?(Array) # ruby 1.8
103
126
 
data/lunchy.gemspec CHANGED
@@ -9,6 +9,9 @@ Gem::Specification.new do |s|
9
9
  s.email = ["mperham@gmail.com"]
10
10
  s.homepage = "http://github.com/mperham/lunchy"
11
11
  s.summary = s.description = %q{Friendly wrapper around launchctl}
12
+ s.licenses = ['MIT']
13
+
14
+ s.add_development_dependency "rake"
12
15
 
13
16
  s.files = `git ls-files`.split("\n")
14
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lunchy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Perham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-22 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2014-06-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  description: Friendly wrapper around launchctl
14
28
  email:
15
29
  - mperham@gmail.com
@@ -18,14 +32,18 @@ executables:
18
32
  extensions: []
19
33
  extra_rdoc_files: []
20
34
  files:
35
+ - ".gitignore"
36
+ - Gemfile
21
37
  - History.md
22
38
  - LICENSE
23
39
  - README.md
40
+ - Rakefile
24
41
  - bin/lunchy
25
42
  - lib/lunchy.rb
26
43
  - lunchy.gemspec
27
44
  homepage: http://github.com/mperham/lunchy
28
- licenses: []
45
+ licenses:
46
+ - MIT
29
47
  metadata: {}
30
48
  post_install_message:
31
49
  rdoc_options: []
@@ -33,17 +51,17 @@ require_paths:
33
51
  - lib
34
52
  required_ruby_version: !ruby/object:Gem::Requirement
35
53
  requirements:
36
- - - '>='
54
+ - - ">="
37
55
  - !ruby/object:Gem::Version
38
56
  version: '0'
39
57
  required_rubygems_version: !ruby/object:Gem::Requirement
40
58
  requirements:
41
- - - '>='
59
+ - - ">="
42
60
  - !ruby/object:Gem::Version
43
61
  version: '0'
44
62
  requirements: []
45
63
  rubyforge_project:
46
- rubygems_version: 2.0.2
64
+ rubygems_version: 2.2.2
47
65
  signing_key:
48
66
  specification_version: 4
49
67
  summary: Friendly wrapper around launchctl