sanky-pf 0.0.4 → 0.0.5

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: c9ec9008b12e46dec86fe4455d5bdf3504bd9194
4
- data.tar.gz: b5ef0973ce003ebc2b3006a2ab2acef39a3ef22e
3
+ metadata.gz: 9d69e0316447ee19f9139704b6302c9cbb932eb4
4
+ data.tar.gz: 3a22ad6fc4cd4d5e26e355aa96c573b43285d909
5
5
  SHA512:
6
- metadata.gz: a6f283860cb74d6934e731287e7ee5937c0a85e51c3bfe50837ba59ab7fea3467b4268e7f57e6ba9e2e55bca923c786c5e65855c8453b1d2b80236a66314a71e
7
- data.tar.gz: 47a904550eb1898312471c305751420cb7261f5c4451b571067157511a09359869013a81b8e555fc1615e1a196c079b3ee9d62769c74309cd5a0ac141406c080
6
+ metadata.gz: d12be9132b93ce02978d659c53cb744516cd7635b10c21f2d8f987fc97f61837559e3d7e188c9b001f7f1600e28101ba0251a23b6c7053538b631c8d21026418
7
+ data.tar.gz: 3464e2f8715f003820ec8c6a3a448b76a7d983a79cb0d83168066756fc63edaaee629b2c76a0f8e08a57107a930612988cf449694e085aa83f4e142a2b0692ff
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sanky-pf (0.0.3)
4
+ sanky-pf (0.0.4)
5
5
  colorize
6
6
 
7
7
  GEM
data/bin/sanky-pf CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
- require 'sanky/pathfinder/runner'
2
+ require_relative '../lib/sanky/pathfinder/runner'
3
3
  Sanky::PathFinder::Runner.new(ARGV).run
@@ -4,6 +4,7 @@ module Sanky
4
4
  module PathFinder
5
5
  class Finder
6
6
  def initialize(arguments)
7
+ @found = nil
7
8
  @arguments = arguments
8
9
  end
9
10
 
@@ -13,16 +14,16 @@ module Sanky
13
14
 
14
15
  def convert
15
16
  @arguments.map! do |original|
16
- # subsitute windows backslashes for forwardslashes and strip whitespace, add leading forwardslash
17
- original = original.strip.gsub(/\\/, "/")
17
+ set = Hash.new()
18
18
 
19
- set = {}
19
+ # subsitute windows backslashes for forwardslashes and strip whitespace, add leading forwardslash
20
+ set[:original] = original.strip.gsub(/\\/, "/")
20
21
 
21
22
  drive = /.{1,3}:/
22
23
  # are we talking about sankynet or sanky direct drives here?
23
24
  if original.match(drive)
24
- set[:sanky_net] = original.sub(drive, "/Volumes/SankyNet Drive")
25
- set[:sanky_direct] = original.sub(drive, "/Volumes/Sanky Direct Drive/Sanky Shared")
25
+ set[:sanky_net] = set[:original].sub(drive, "/Volumes/SankyNet Drive")
26
+ set[:sanky_direct] = set[:original].sub(drive, "/Volumes/Sanky Direct Drive/Sanky Shared")
26
27
  end
27
28
 
28
29
  set
@@ -34,15 +35,18 @@ module Sanky
34
35
  def open
35
36
  @arguments.each do |target|
36
37
  target.each do |drive, file|
37
- begin
38
- # pipe STDERR to dev null in favor of custom prompt
39
- `open -g '#{file}' > /dev/null 2>/dev/null`
40
- ensure
41
- if $? == 0
42
- puts "Opening the file in the background...".yellow
43
- else
44
- puts "Failed to find #{file}!".red
45
- puts "Trying another likely location...".red
38
+ unless @found
39
+ begin
40
+ # pipe STDERR to dev null in favor of custom prompt
41
+ `open -g '#{file}' > /dev/null 2>/dev/null`
42
+ ensure
43
+ if $? == 0
44
+ @found = true
45
+ puts "Opening the file in the background...".yellow
46
+ else
47
+ puts "Failed to find #{file}!".red
48
+ puts "Trying another likely location...".red
49
+ end
46
50
  end
47
51
  end
48
52
  end
@@ -1,5 +1,5 @@
1
1
  module Sanky
2
2
  module PathFinder
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
Binary file
Binary file
data/test/test_finder.rb CHANGED
@@ -22,10 +22,14 @@ class TestFinder < Test::Unit::TestCase
22
22
  context "conversion" do
23
23
  should "properly parse paths" do
24
24
  expected_results = [
25
- {}, {}, {}, {},
25
+ { :original => "/test/doc1.txt" },
26
+ { :original => "test/doc2.txt" },
27
+ { :original => "volumes/doc3.txt" },
28
+ { :original => "/Volumes/doc4.txt" },
26
29
  {
27
- :sanky_net => "/Volumes/SankyNet Drive/CCBQ/0-HTML-CCBQ/Email/2013/2013-12-11_CCBQ_Holiday_Appeal-2",
28
- :sanky_direct => "/Volumes/Sanky Direct Drive/Sanky Shared/CCBQ/0-HTML-CCBQ/Email/2013/2013-12-11_CCBQ_Holiday_Appeal-2",
30
+ :original => "L:/CCBQ/0-HTML-CCBQ/Email/2013/2013-12-11_CCBQ_Holiday_Appeal-2",
31
+ :sanky_net => "/Volumes/SankyNet Drive/CCBQ/0-HTML-CCBQ/Email/2013/2013-12-11_CCBQ_Holiday_Appeal-2",
32
+ :sanky_direct => "/Volumes/Sanky Direct Drive/Sanky Shared/CCBQ/0-HTML-CCBQ/Email/2013/2013-12-11_CCBQ_Holiday_Appeal-2"
29
33
  }
30
34
  ]
31
35
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sanky-pf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Ryan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-16 00:00:00.000000000 Z
11
+ date: 2013-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -62,6 +62,8 @@ files:
62
62
  - lib/sanky/pathfinder/runner.rb
63
63
  - lib/sanky/pathfinder/version.rb
64
64
  - pkg/sanky-pf-0.0.3.gem
65
+ - pkg/sanky-pf-0.0.4.gem
66
+ - pkg/sanky-pf-0.0.5.gem
65
67
  - Rakefile
66
68
  - README.md
67
69
  - sanky-pf.gemspec