chrislloyd-fancypath 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/Rakefile +1 -1
  2. data/lib/fancypath.rb +10 -2
  3. metadata +1 -1
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'date'
5
5
  require 'spec/rake/spectask'
6
6
 
7
7
  GEM = "fancypath"
8
- GEM_VERSION = "0.5.3"
8
+ GEM_VERSION = "0.5.4"
9
9
  AUTHORS = ["Myles Byrne", "Chris Lloyd"]
10
10
  EMAIL = "myles@ducknewmedia.com"
11
11
  HOMEPAGE = "http://ducknewmedia.com/fancypath"
data/lib/fancypath.rb CHANGED
@@ -50,12 +50,15 @@ class Fancypath < Pathname
50
50
  self
51
51
  end
52
52
 
53
+ alias_method :cp, :copy
54
+
53
55
  # file or dir
54
56
  def remove
55
57
  directory? ? rmtree : delete if exist?
56
58
  self.to_path
57
59
  end
58
60
 
61
+ alias_method :rm, :remove
59
62
  def write(contents, mode='wb')
60
63
  dirname.create
61
64
  open(mode) { |f| f.write contents }
@@ -71,10 +74,15 @@ class Fancypath < Pathname
71
74
  self.rename(dest)
72
75
  dest.to_path
73
76
  end
77
+
78
+ alias_method :mv, :move
74
79
 
75
80
  def set_extension(ext)
76
- base = self.to_s[/^ (.+?) (\. ([^\.]+))? $/x, 1]
77
- self.class.new(base + '.' + ext)
81
+ "#{without_extension}.#{ext}".to_path
82
+ end
83
+
84
+ def without_extension
85
+ to_s[/^ (.+?) (\. ([^\.]+))? $/x, 1].to_path
78
86
  end
79
87
 
80
88
  def parent
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chrislloyd-fancypath
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Myles Byrne