tdreyno-s6search 1.0.0 → 1.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/bin/s6search +19 -25
- data/s6search.gemspec +5 -3
- metadata +1 -1
data/bin/s6search
CHANGED
@@ -1,15 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require 'rubygems'
|
3
|
-
require 'thor'
|
4
2
|
require 'readline'
|
5
3
|
|
6
|
-
class SpinSix
|
7
|
-
|
8
|
-
|
4
|
+
class SpinSix
|
5
|
+
CONFIG = '~/.s6search'
|
6
|
+
PATHS = ["~/Desktop", "~/Desktop/*", # Local
|
7
|
+
"/Volumes/Shared/Clients/*/Active"] # Remote
|
9
8
|
|
10
|
-
|
11
|
-
def locate_single(number, opts)
|
12
|
-
paths = opts[:dirs] || LOCAL + REMOTE
|
9
|
+
def self.locate_single(number)
|
13
10
|
matching_directories = paths.map do |path|
|
14
11
|
Dir["#{File.expand_path(path)}/#{number}*"]
|
15
12
|
end.flatten.select do |path|
|
@@ -41,30 +38,27 @@ class SpinSix < Thor
|
|
41
38
|
end
|
42
39
|
end
|
43
40
|
|
44
|
-
def locate(numbers
|
45
|
-
numbers.uniq.each { |n| locate_single(n
|
41
|
+
def self.locate(numbers)
|
42
|
+
numbers.uniq.each { |n| locate_single(n) }
|
46
43
|
end
|
47
44
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
45
|
+
def self.paths
|
46
|
+
@@paths ||= begin
|
47
|
+
config_file = File.expand_path(CONFIG)
|
48
|
+
return PATHS unless File.exists?(config_file)
|
49
|
+
|
50
|
+
File.open(config_file) do |f|
|
51
|
+
@@paths = f.readlines.map { |line| line.chomp }.select{ |path| !path.empty? }
|
52
|
+
end
|
53
|
+
@@paths
|
54
|
+
end
|
56
55
|
end
|
57
56
|
|
58
57
|
protected
|
59
|
-
def
|
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)
|
58
|
+
def self.open_dirs(*paths)
|
65
59
|
paths = paths.map { |p| %Q{"#{p}"} }.join(" ")
|
66
60
|
`open #{paths}`
|
67
61
|
end
|
68
62
|
end
|
69
63
|
|
70
|
-
SpinSix.
|
64
|
+
SpinSix.locate(ARGV)
|
data/s6search.gemspec
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
1
3
|
Gem::Specification.new do |s|
|
2
4
|
s.name = %q{s6search}
|
3
|
-
s.version = "1.0.
|
5
|
+
s.version = "1.0.1"
|
4
6
|
|
5
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
8
|
s.authors = ["Thomas Reynolds"]
|
@@ -11,14 +13,14 @@ Gem::Specification.new do |s|
|
|
11
13
|
s.files = ["bin/s6search", "s6search.gemspec"]
|
12
14
|
s.homepage = %q{http://github.com/tdreyno/s6search}
|
13
15
|
s.require_paths = ["lib"]
|
14
|
-
s.rubygems_version = %q{1.
|
16
|
+
s.rubygems_version = %q{1.3.0}
|
15
17
|
s.summary = %q{Searching the shared server}
|
16
18
|
|
17
19
|
if s.respond_to? :specification_version then
|
18
20
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
19
21
|
s.specification_version = 2
|
20
22
|
|
21
|
-
if
|
23
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
22
24
|
s.add_runtime_dependency(%q<thor>, [">= 0"])
|
23
25
|
else
|
24
26
|
s.add_dependency(%q<thor>, [">= 0"])
|