launchit 0.0.1

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.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in launchit.gemspec
4
+ gemspec
5
+ gem 'rake'
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
data/bin/launchit ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ require 'Launchit'
3
+
4
+
5
+ Launchit.execute! ARGV[0]
data/launchit.gemspec ADDED
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "launchit/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "launchit"
7
+ s.version = Launchit::VERSION
8
+ s.authors = ["Łukasz Korecki"]
9
+ s.email = ["lukasz@coffeesounds.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{Easily launch Mac applications from your terminal}
12
+ s.description = %q{Kinda like Quicksilver but from terminal}
13
+
14
+ s.rubyforge_project = "launchit"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+ end
@@ -0,0 +1,3 @@
1
+ module Launchit
2
+ VERSION = "0.0.1"
3
+ end
data/lib/launchit.rb ADDED
@@ -0,0 +1,44 @@
1
+ require "launchit/version"
2
+
3
+ module Launchit
4
+ APPS = Dir['/Applications/*'].select { |n| n =~ /.app$/ }.map do |n|
5
+ {
6
+ :name => n.sub('.app', '').downcase.sub(' ','_').split('/').last,
7
+ :path => n
8
+ }
9
+ end
10
+ def self.list
11
+ puts APPS.map { |a| "#{a[:name]} => #{a[:path].split('/').last}" }.join("\n")
12
+ exit 0
13
+ end
14
+
15
+ def self.help
16
+ puts 'launchit-l for list of available apps, launchit <name> to launch an app'
17
+
18
+ end
19
+
20
+ def self.open app
21
+ puts "Opening #{app[:path]}"
22
+ `open #{app[:path]}`
23
+ end
24
+
25
+ def self.fail app
26
+ puts "Couldn't find an app which matches #{args}"
27
+ exit 1
28
+ end
29
+
30
+ def self.execute! arg
31
+ help if arg.nil? or arg.empty?
32
+ list if arg == '-l'
33
+
34
+ app = APPS.select do |app|
35
+ app[:name] =~ /#{arg}/
36
+ end.first
37
+
38
+ unless app.nil?
39
+ open app
40
+ else
41
+ fail app
42
+ end
43
+ end
44
+ end
metadata ADDED
@@ -0,0 +1,59 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: launchit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Łukasz Korecki
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-09-19 00:00:00.000000000Z
13
+ dependencies: []
14
+ description: Kinda like Quicksilver but from terminal
15
+ email:
16
+ - lukasz@coffeesounds.com
17
+ executables:
18
+ - launchit
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - .gitignore
23
+ - Gemfile
24
+ - Rakefile
25
+ - bin/launchit
26
+ - launchit.gemspec
27
+ - lib/launchit.rb
28
+ - lib/launchit/version.rb
29
+ homepage: ''
30
+ licenses: []
31
+ post_install_message:
32
+ rdoc_options: []
33
+ require_paths:
34
+ - lib
35
+ required_ruby_version: !ruby/object:Gem::Requirement
36
+ none: false
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ segments:
42
+ - 0
43
+ hash: 2259529806538403527
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ! '>='
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ segments:
51
+ - 0
52
+ hash: 2259529806538403527
53
+ requirements: []
54
+ rubyforge_project: launchit
55
+ rubygems_version: 1.8.10
56
+ signing_key:
57
+ specification_version: 3
58
+ summary: Easily launch Mac applications from your terminal
59
+ test_files: []