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.
Files changed (3) hide show
  1. data/bin/s6search +19 -25
  2. data/s6search.gemspec +5 -3
  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 < Thor
7
- LOCAL = ["~/Desktop", "~/Desktop/*"]
8
- REMOTE = ["/Volumes/Shared/Clients/*/Active"]
4
+ class SpinSix
5
+ CONFIG = '~/.s6search'
6
+ PATHS = ["~/Desktop", "~/Desktop/*", # Local
7
+ "/Volumes/Shared/Clients/*/Active"] # Remote
9
8
 
10
- desc "PROJECT#", "open the folder for the requested project"
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, opts = {})
45
- numbers.uniq.each { |n| locate_single(n, opts) }
41
+ def self.locate(numbers)
42
+ numbers.uniq.each { |n| locate_single(n) }
46
43
  end
47
44
 
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)
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 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)
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.start
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.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.2.0}
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 current_version >= 3 then
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"])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdreyno-s6search
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Reynolds