sanky-pf 0.0.3 → 0.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b5fcb6f6e972de40fffd47d0f72cc17ccfe2efba
4
- data.tar.gz: 7212a2f12667bb4d5a571a4a4e9b131309777426
3
+ metadata.gz: c9ec9008b12e46dec86fe4455d5bdf3504bd9194
4
+ data.tar.gz: b5ef0973ce003ebc2b3006a2ab2acef39a3ef22e
5
5
  SHA512:
6
- metadata.gz: 37c6694e8b762493d0a23cad1e5c00dd743f8ae842582cac33cda55c1c49d2219f9c254ccbe0ac04b56f26ebeadc093e19995e96f530091c40965dd1e020030e
7
- data.tar.gz: 7e120ed6c4f8507fbeb65d4f60ca34c4b4b78f4d4f25f4d0820e682268d24a4087b4431c72800eec032cd5636d09a1230e0be1e9260a7487850743d6e8c84cd7
6
+ metadata.gz: a6f283860cb74d6934e731287e7ee5937c0a85e51c3bfe50837ba59ab7fea3467b4268e7f57e6ba9e2e55bca923c786c5e65855c8453b1d2b80236a66314a71e
7
+ data.tar.gz: 47a904550eb1898312471c305751420cb7261f5c4451b571067157511a09359869013a81b8e555fc1615e1a196c079b3ee9d62769c74309cd5a0ac141406c080
data/Gemfile ADDED
@@ -0,0 +1 @@
1
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,27 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ sanky-pf (0.0.3)
5
+ colorize
6
+
7
+ GEM
8
+ specs:
9
+ activesupport (3.2.12)
10
+ i18n (~> 0.6)
11
+ multi_json (~> 1.0)
12
+ colorize (0.6.0)
13
+ i18n (0.6.4)
14
+ multi_json (1.7.1)
15
+ shoulda (3.5.0)
16
+ shoulda-context (~> 1.0, >= 1.0.1)
17
+ shoulda-matchers (>= 1.4.1, < 3.0)
18
+ shoulda-context (1.1.6)
19
+ shoulda-matchers (2.4.0)
20
+ activesupport (>= 3.0.0)
21
+
22
+ PLATFORMS
23
+ ruby
24
+
25
+ DEPENDENCIES
26
+ sanky-pf!
27
+ shoulda
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require 'bundler'
2
+ require 'rake/testtask'
3
+ Bundler::GemHelper.install_tasks
4
+
5
+ Rake::TestTask.new do |t|
6
+ t.libs << 'test'
7
+ end
8
+
9
+ desc "Run tests"
10
+ task :default => :test
@@ -13,18 +13,19 @@ module Sanky
13
13
 
14
14
  def convert
15
15
  @arguments.map! do |original|
16
- # subsitute windows backslashes for forwardslashes and strip whitespace
16
+ # subsitute windows backslashes for forwardslashes and strip whitespace, add leading forwardslash
17
17
  original = original.strip.gsub(/\\/, "/")
18
- original.sub!(/L:/, "/Volumes/SankyNet Drive")
19
- original.sub!(/Z:/, "/Volumes/Sanky Direct Drive/Sanky Shared")
20
- original.sub!(/Z:/, "/Volumes/Sanky Direct Drive/Sanky Shared")
21
- original.sub!(/smb:\/\/sankycomserver/, "/Volumes")
22
- # if no leading / add one
23
- original.sub!(/^(?!\/)/, "/")
24
- # if it doesn't start with /Volumes add it
25
- original.sub!(/^(?!\/Volumes)/, "/Volumes")
26
- # String.sub returns nil if no sub was performed, always return the og
27
- original
18
+
19
+ set = {}
20
+
21
+ drive = /.{1,3}:/
22
+ # are we talking about sankynet or sanky direct drives here?
23
+ 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")
26
+ end
27
+
28
+ set
28
29
  end
29
30
 
30
31
  self
@@ -32,14 +33,17 @@ module Sanky
32
33
 
33
34
  def open
34
35
  @arguments.each do |target|
35
- begin
36
- # pipe STDERR to dev null in favor of custom prompt
37
- `open -g '#{target}' > /dev/null 2>/dev/null`
38
- ensure
39
- if $? == 0
40
- puts "Opening the file in the background...".yellow
41
- else
42
- puts "Failed to find #{target.red}!"
36
+ 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
46
+ end
43
47
  end
44
48
  end
45
49
  end
@@ -1,5 +1,5 @@
1
1
  module Sanky
2
2
  module PathFinder
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
Binary file
data/test/test_finder.rb CHANGED
@@ -22,16 +22,17 @@ class TestFinder < Test::Unit::TestCase
22
22
  context "conversion" do
23
23
  should "properly parse paths" do
24
24
  expected_results = [
25
- '/Volumes/test/doc1.txt',
26
- '/Volumes/test/doc2.txt',
27
- '/Volumes/volumes/doc3.txt',
28
- '/Volumes/doc4.txt',
29
- '/Volumes/SankyNet Drive/CCBQ/0-HTML-CCBQ/Email/2013/2013-12-11_CCBQ_Holiday_Appeal-2'
25
+ {}, {}, {}, {},
26
+ {
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",
29
+ }
30
30
  ]
31
31
 
32
32
  assert_equal expected_results, @finder.convert.to_s
33
33
  end
34
34
  end
35
+
35
36
  end
36
37
 
37
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sanky-pf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Ryan
@@ -55,10 +55,14 @@ extensions: []
55
55
  extra_rdoc_files: []
56
56
  files:
57
57
  - bin/sanky-pf
58
+ - Gemfile
59
+ - Gemfile.lock
58
60
  - lib/sanky/pathfinder/finder.rb
59
61
  - lib/sanky/pathfinder/options.rb
60
62
  - lib/sanky/pathfinder/runner.rb
61
63
  - lib/sanky/pathfinder/version.rb
64
+ - pkg/sanky-pf-0.0.3.gem
65
+ - Rakefile
62
66
  - README.md
63
67
  - sanky-pf.gemspec
64
68
  - test/test_finder.rb