epitools 0.5.72 → 0.5.73

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: 816705da66c484347dcb43b869dd3fdee82a9fb1
4
- data.tar.gz: 282198552de00f62d799d7cf5181a7d66b77aea8
3
+ metadata.gz: ec37ccba9b3b090251f5a096ed57ef7ee4c4e769
4
+ data.tar.gz: 9abd4684561e30e28bb23094fd2606e9ef1d8a24
5
5
  SHA512:
6
- metadata.gz: d58bbfe8e37974293691bef4f43d81be8704031e7d09d0a422019966137ebb9337cfc2c95a6acb00a16a7df8d51b51b95e7ee3a70d96f876ab83277b0266a0e8
7
- data.tar.gz: 4e1ad3abd189c7704d1b3c73321d11441137e450f897c58f8a5dc11705b1f9090e89b13a616ab48f411f5dc2073cb6bb32051e7d6a13a01291865993fa5a2dd2
6
+ metadata.gz: 80a9d929bd6fda00c1fa766af8cee4ebbbfc92dc0fba752c772976ed412c3a5fa1707f64944ebdb5bb2ff1ccb2f7977a9c00b5ddaaddc7de272ad796f6f3c1a4
7
+ data.tar.gz: c2d51d16d96359830af2ea2532708ed6362dff0b60610a709641e66d6718dcfadfafb6f28ba06ce7b4f7dde23bc6ad67fb8b741e04eb0e91cfc24cb3a160dcbe
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.72
1
+ 0.5.73
data/lib/epitools/path.rb CHANGED
@@ -291,18 +291,9 @@ class Path
291
291
  end
292
292
 
293
293
  def relative_to(anchor)
294
- # stage 1: go ".." until we find a common dir prefix
295
- # (discard everything and go '/' if there's no common dir)
296
- # stage 2: append the rest of the other path
297
-
298
- first_mismatch = dirs.zip(anchor.dirs).index { |a,b| a != b }
299
-
300
- num_dots = anchor.dirs.size - first_mismatch
301
-
302
- result = dup
303
- result.dirs = ([".."] * num_dots) + dirs[first_mismatch..-1]
304
-
305
- result
294
+ anchor = anchor.to_s
295
+ anchor += "/" unless anchor[/\/$/]
296
+ to_s.gsub(/^#{Regexp.escape(anchor)}/, '')
306
297
  end
307
298
 
308
299
  # The current directory (with a trailing /)
@@ -254,7 +254,8 @@ describe String do
254
254
  "What's Up" => "What's Up",
255
255
  "they're awesome" => "They're Awesome",
256
256
  "king of pain" => "King of Pain",
257
- "a-b-c 1-2-3" => "A-B-C 1-2-3"
257
+ "a-b-c 1-2-3" => "A-B-C 1-2-3",
258
+ "i'm the best" => "I'm the Best"
258
259
  }.each {|orig, titled| orig.titlecase.should == titled }
259
260
 
260
261
  s = "asdf asdf"
data/spec/path_spec.rb CHANGED
@@ -32,7 +32,8 @@ describe Path do
32
32
  end
33
33
 
34
34
  it "'relative_to's" do
35
- Path["/etc"].relative_to(Path["/tmp"]).should == "../etc/"
35
+ # Path["/etc"].relative_to(Path["/tmp"]).should == "../etc/"
36
+ Path["/etc/passwd"].relative_to("/etc").should == "passwd"
36
37
  end
37
38
 
38
39
  it "should glob with relative paths" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epitools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.72
4
+ version: 0.5.73
5
5
  platform: ruby
6
6
  authors:
7
7
  - epitron
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-23 00:00:00.000000000 Z
11
+ date: 2015-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec