sanky-pf 0.0.4 → 0.0.5
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bin/sanky-pf +1 -1
- data/lib/sanky/pathfinder/finder.rb +18 -14
- data/lib/sanky/pathfinder/version.rb +1 -1
- data/pkg/sanky-pf-0.0.4.gem +0 -0
- data/pkg/sanky-pf-0.0.5.gem +0 -0
- data/test/test_finder.rb +7 -3
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d69e0316447ee19f9139704b6302c9cbb932eb4
|
4
|
+
data.tar.gz: 3a22ad6fc4cd4d5e26e355aa96c573b43285d909
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d12be9132b93ce02978d659c53cb744516cd7635b10c21f2d8f987fc97f61837559e3d7e188c9b001f7f1600e28101ba0251a23b6c7053538b631c8d21026418
|
7
|
+
data.tar.gz: 3464e2f8715f003820ec8c6a3a448b76a7d983a79cb0d83168066756fc63edaaee629b2c76a0f8e08a57107a930612988cf449694e085aa83f4e142a2b0692ff
|
data/Gemfile.lock
CHANGED
data/bin/sanky-pf
CHANGED
@@ -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
|
-
|
17
|
-
original = original.strip.gsub(/\\/, "/")
|
17
|
+
set = Hash.new()
|
18
18
|
|
19
|
-
|
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
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
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
|
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
|
-
:
|
28
|
-
:
|
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
|
+
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-
|
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
|