tdreyno-s6search 1.0.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.
- data/bin/s6search +70 -0
- data/s6search.gemspec +29 -0
- metadata +62 -0
data/bin/s6search
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems'
|
3
|
+
require 'thor'
|
4
|
+
require 'readline'
|
5
|
+
|
6
|
+
class SpinSix < Thor
|
7
|
+
LOCAL = ["~/Desktop", "~/Desktop/*"]
|
8
|
+
REMOTE = ["/Volumes/Shared/Clients/*/Active"]
|
9
|
+
|
10
|
+
desc "PROJECT#", "open the folder for the requested project"
|
11
|
+
def locate_single(number, opts)
|
12
|
+
paths = opts[:dirs] || LOCAL + REMOTE
|
13
|
+
matching_directories = paths.map do |path|
|
14
|
+
Dir["#{File.expand_path(path)}/#{number}*"]
|
15
|
+
end.flatten.select do |path|
|
16
|
+
File.directory? path
|
17
|
+
end
|
18
|
+
|
19
|
+
case matching_directories.length
|
20
|
+
when 0:
|
21
|
+
puts "Could not find project #{number}"
|
22
|
+
when 1:
|
23
|
+
open_dirs matching_directories[0]
|
24
|
+
else
|
25
|
+
puts "Found multiple projects:"
|
26
|
+
matching_directories.each_with_index do |dir, i|
|
27
|
+
parts = dir.split('/').last(2)
|
28
|
+
print (i+1).to_s.rjust(5) + ": "
|
29
|
+
print parts[0].rjust(7) + "/"
|
30
|
+
puts parts[1]
|
31
|
+
end
|
32
|
+
puts " *: Open all, s: Skip"
|
33
|
+
|
34
|
+
print "Action: "
|
35
|
+
response = Readline.readline
|
36
|
+
if response.to_i > 0
|
37
|
+
open_dirs matching_directories[response.to_i-1]
|
38
|
+
elsif !%w(s q).include? response
|
39
|
+
open_dirs *matching_directories
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def locate(numbers, opts = {})
|
45
|
+
numbers.uniq.each { |n| locate_single(n, opts) }
|
46
|
+
end
|
47
|
+
|
48
|
+
desc "local PROJECT#", "find project locally"
|
49
|
+
def local(*numbers)
|
50
|
+
locate(numbers, :dirs => LOCAL)
|
51
|
+
end
|
52
|
+
|
53
|
+
desc "remote PROJECT#", "find project remotely"
|
54
|
+
def remote(*numbers)
|
55
|
+
locate(numbers, :dirs => REMOTE)
|
56
|
+
end
|
57
|
+
|
58
|
+
protected
|
59
|
+
def method_missing(meth, *args)
|
60
|
+
return super if meth.to_s.split('-')[0].to_i.zero?
|
61
|
+
locate(args << meth.to_s)
|
62
|
+
end
|
63
|
+
|
64
|
+
def open_dirs(*paths)
|
65
|
+
paths = paths.map { |p| %Q{"#{p}"} }.join(" ")
|
66
|
+
`open #{paths}`
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
SpinSix.start
|
data/s6search.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = %q{s6search}
|
3
|
+
s.version = "1.0.0"
|
4
|
+
|
5
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
|
+
s.authors = ["Thomas Reynolds"]
|
7
|
+
s.date = %q{2008-09-25}
|
8
|
+
s.default_executable = %q{s6search}
|
9
|
+
s.email = %q{thomas.reynolds@spinsix.com}
|
10
|
+
s.executables = ["s6search"]
|
11
|
+
s.files = ["bin/s6search", "s6search.gemspec"]
|
12
|
+
s.homepage = %q{http://github.com/tdreyno/s6search}
|
13
|
+
s.require_paths = ["lib"]
|
14
|
+
s.rubygems_version = %q{1.2.0}
|
15
|
+
s.summary = %q{Searching the shared server}
|
16
|
+
|
17
|
+
if s.respond_to? :specification_version then
|
18
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
19
|
+
s.specification_version = 2
|
20
|
+
|
21
|
+
if current_version >= 3 then
|
22
|
+
s.add_runtime_dependency(%q<thor>, [">= 0"])
|
23
|
+
else
|
24
|
+
s.add_dependency(%q<thor>, [">= 0"])
|
25
|
+
end
|
26
|
+
else
|
27
|
+
s.add_dependency(%q<thor>, [">= 0"])
|
28
|
+
end
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tdreyno-s6search
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Thomas Reynolds
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-09-25 00:00:00 -07:00
|
13
|
+
default_executable: s6search
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: thor
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: "0"
|
23
|
+
version:
|
24
|
+
description:
|
25
|
+
email: thomas.reynolds@spinsix.com
|
26
|
+
executables:
|
27
|
+
- s6search
|
28
|
+
extensions: []
|
29
|
+
|
30
|
+
extra_rdoc_files: []
|
31
|
+
|
32
|
+
files:
|
33
|
+
- bin/s6search
|
34
|
+
- s6search.gemspec
|
35
|
+
has_rdoc: false
|
36
|
+
homepage: http://github.com/tdreyno/s6search
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options: []
|
39
|
+
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: "0"
|
47
|
+
version:
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: "0"
|
53
|
+
version:
|
54
|
+
requirements: []
|
55
|
+
|
56
|
+
rubyforge_project:
|
57
|
+
rubygems_version: 1.2.0
|
58
|
+
signing_key:
|
59
|
+
specification_version: 2
|
60
|
+
summary: Searching the shared server
|
61
|
+
test_files: []
|
62
|
+
|