rubysl-pathname 2.2 → 2.3

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: 1711bc330655a4c67642ea15561a4ece6a132bd4
4
- data.tar.gz: 336e6b7e565abe4669d0536eacd2b23d0d8b7d54
3
+ metadata.gz: 65cf9cbc8e563ba4b10c8d9e5c814831b9308934
4
+ data.tar.gz: 2cc26e849b2d3bf36e68ff773350ac10e464f889
5
5
  SHA512:
6
- metadata.gz: d293d3b8944be8a1bb20a0df55a66c55d72335d0852d14af73a23a93b3ae4b8045220e3f805329b42dafe97a048dfca9b4d22fd7cb198f2adb4b33dc4acc02e6
7
- data.tar.gz: 395241e9f0a18c8e4f401616bdb0370d75046ff86dee7939fcdcc716ed56bb3d48b7d35d84af5e7be0246891a446a3fb275062d06132121c24cf4ea8244dd442
6
+ metadata.gz: e98284b904f10e22b4647116cd5516ac2ffdb7c7c161cd73cb8fb3bd5b04d2e6bb08ad5c7b1014a35eec95f2d5dd84e448aac1f1647e92c96e6dab8d171de060
7
+ data.tar.gz: 7004611a45bfed97319cf0b262e7505250b34236535553e025b070f47817a1e0a81fb04ea4d9481dd0a7ffdf54f004c75abc3c86f8c2b8b28e46cd5a36ff0655
@@ -7,15 +7,15 @@ env:
7
7
  - RUBYLIB=
8
8
  script: mspec spec
9
9
  rvm:
10
- - 2.3
10
+ - 2.2
11
11
  - rbx
12
12
  matrix:
13
13
  exclude:
14
- - rvm: 2.3
14
+ - rvm: 2.2
15
15
  env: RUBYLIB=lib
16
16
  - rvm: rbx
17
17
  env: RUBYLIB=
18
- - rvm: 2.3
18
+ - rvm: 2.2
19
19
  os: osx
20
20
  os:
21
21
  - linux
@@ -201,7 +201,25 @@ class Pathname
201
201
  proc {|a, b| a == b}
202
202
  end
203
203
 
204
- # :startdoc:
204
+ # See <tt>Dir.glob</tt>. Returns or yields Pathname objects.
205
+ def self.glob(*args) # :yield: pathname
206
+ if block_given?
207
+ Dir.glob(*args) {|f| yield self.new(f) }
208
+ else
209
+ Dir.glob(*args).map {|f| self.new(f) }
210
+ end
211
+ end
212
+
213
+ # See <tt>Dir.getwd</tt>. Returns the current working directory as a Pathname.
214
+ def self.getwd() self.new(Dir.getwd) end
215
+
216
+ class << self
217
+ alias pwd getwd
218
+ end
219
+
220
+ def self.birthtime(file)
221
+ File.birthtime(file)
222
+ end
205
223
 
206
224
  #
207
225
  # Create a Pathname object from the given String (or String-like object).
@@ -588,6 +606,8 @@ class Pathname
588
606
  Pathname.new(plus(@path, other.to_s))
589
607
  end
590
608
 
609
+ alias_method :/, :+
610
+
591
611
  def plus(path1, path2) # -> path
592
612
  prefix2 = path2
593
613
  index_list2 = []
@@ -760,9 +780,7 @@ class Pathname
760
780
  Pathname.new(File.join(*relpath_names))
761
781
  end
762
782
  end
763
- end
764
783
 
765
- class Pathname # * IO *
766
784
  #
767
785
  # #each_line iterates over the line in the file. It yields a String object
768
786
  # for each line.
@@ -792,10 +810,6 @@ class Pathname # * IO *
792
810
 
793
811
  # See <tt>IO.sysopen</tt>.
794
812
  def sysopen(*args) IO.sysopen(@path, *args) end
795
- end
796
-
797
-
798
- class Pathname # * File *
799
813
 
800
814
  # See <tt>File.atime</tt>. Returns last access time.
801
815
  def atime() File.atime(@path) end
@@ -873,10 +887,6 @@ class Pathname # * File *
873
887
  # See <tt>File.split</tt>. Returns the #dirname and the #basename in an
874
888
  # Array.
875
889
  def split() File.split(@path).map {|f| self.class.new(f) } end
876
- end
877
-
878
-
879
- class Pathname # * FileTest *
880
890
 
881
891
  # See <tt>FileTest.blockdev?</tt>.
882
892
  def blockdev?() FileTest.blockdev?(@path) end
@@ -949,22 +959,6 @@ class Pathname # * FileTest *
949
959
 
950
960
  # See <tt>FileTest.zero?</tt>.
951
961
  def zero?() FileTest.zero?(@path) end
952
- end
953
-
954
-
955
- class Pathname # * Dir *
956
- # See <tt>Dir.glob</tt>. Returns or yields Pathname objects.
957
- def Pathname.glob(*args) # :yield: pathname
958
- if block_given?
959
- Dir.glob(*args) {|f| yield self.new(f) }
960
- else
961
- Dir.glob(*args).map {|f| self.new(f) }
962
- end
963
- end
964
-
965
- # See <tt>Dir.getwd</tt>. Returns the current working directory as a Pathname.
966
- def Pathname.getwd() self.new(Dir.getwd) end
967
- class << self; alias pwd getwd end
968
962
 
969
963
  # Return the entries (files and subdirectories) in the directory, each as a
970
964
  # Pathname object.
@@ -988,10 +982,7 @@ class Pathname # * Dir *
988
982
  def opendir(&block) # :yield: dir
989
983
  Dir.open(@path, &block)
990
984
  end
991
- end
992
-
993
985
 
994
- class Pathname # * Find *
995
986
  #
996
987
  # Pathname#find is an iterator to traverse a directory tree in a depth first
997
988
  # manner. It yields a Pathname for each file under "this" directory.
@@ -1013,10 +1004,7 @@ class Pathname # * Find *
1013
1004
  Find.find(@path) {|f| yield self.class.new(f) }
1014
1005
  end
1015
1006
  end
1016
- end
1017
1007
 
1018
-
1019
- class Pathname # * FileUtils *
1020
1008
  # See <tt>FileUtils.mkpath</tt>. Creates a full path, including any
1021
1009
  # intermediate directories that don't yet exist.
1022
1010
  def mkpath
@@ -1033,10 +1021,7 @@ class Pathname # * FileUtils *
1033
1021
  FileUtils.rm_r(@path)
1034
1022
  nil
1035
1023
  end
1036
- end
1037
1024
 
1038
-
1039
- class Pathname # * mixed *
1040
1025
  # Removes a file or directory, using <tt>File.unlink</tt> or
1041
1026
  # <tt>Dir.unlink</tt> as necessary.
1042
1027
  def unlink()
@@ -1047,10 +1032,12 @@ class Pathname # * mixed *
1047
1032
  end
1048
1033
  end
1049
1034
  alias delete unlink
1050
- end
1051
1035
 
1052
- class Pathname
1053
1036
  undef =~
1037
+
1038
+ def birthtime
1039
+ File.birthtime(@path)
1040
+ end
1054
1041
  end
1055
1042
 
1056
1043
  module Kernel
@@ -1,5 +1,5 @@
1
1
  module RubySL
2
2
  module Pathname
3
- VERSION = '2.2'
3
+ VERSION = '2.3'
4
4
  end
5
5
  end
@@ -0,0 +1,21 @@
1
+ require 'pathname'
2
+
3
+ describe 'Pathname.birthtime' do
4
+ platform_is :osx do
5
+ it 'returns a Time instance' do
6
+ time = Pathname.birthtime(__FILE__)
7
+
8
+ time.should be_an_instance_of(Time)
9
+ end
10
+ end
11
+ end
12
+
13
+ describe 'Pathname#birthtime' do
14
+ platform_is :osx do
15
+ it 'returns a Time instance' do
16
+ time = Pathname.new(__FILE__).birthtime
17
+
18
+ time.should be_an_instance_of(Time)
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,10 @@
1
+ require 'pathname'
2
+
3
+ describe 'Pathname#/' do
4
+ it 'returns a new Pathname' do
5
+ p1 = Pathname.new('foo')
6
+ p2 = Pathname.new('bar')
7
+
8
+ (p1 / p2).should == Pathname.new('foo/bar')
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ require 'pathname'
2
+
3
+ describe 'Pathname#+' do
4
+ it 'returns a new Pathname' do
5
+ p1 = Pathname.new('foo')
6
+ p2 = Pathname.new('bar')
7
+
8
+ (p1 + p2).should == Pathname.new('foo/bar')
9
+ end
10
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubysl-pathname
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.2'
4
+ version: '2.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Shirai
@@ -86,12 +86,15 @@ files:
86
86
  - lib/rubysl/pathname/version.rb
87
87
  - rubysl-pathname.gemspec
88
88
  - spec/absolute_spec.rb
89
+ - spec/birthtime_spec.rb
90
+ - spec/divide_spec.rb
89
91
  - spec/equal_value_spec.rb
90
92
  - spec/find_spec.rb
91
93
  - spec/hash_spec.rb
92
94
  - spec/kernel_spec.rb
93
95
  - spec/new_spec.rb
94
96
  - spec/parent_spec.rb
97
+ - spec/plus_spec.rb
95
98
  - spec/relative_spec.rb
96
99
  - spec/root_spec.rb
97
100
  - spec/sub_spec.rb
@@ -121,12 +124,15 @@ specification_version: 4
121
124
  summary: Ruby standard library pathname.
122
125
  test_files:
123
126
  - spec/absolute_spec.rb
127
+ - spec/birthtime_spec.rb
128
+ - spec/divide_spec.rb
124
129
  - spec/equal_value_spec.rb
125
130
  - spec/find_spec.rb
126
131
  - spec/hash_spec.rb
127
132
  - spec/kernel_spec.rb
128
133
  - spec/new_spec.rb
129
134
  - spec/parent_spec.rb
135
+ - spec/plus_spec.rb
130
136
  - spec/relative_spec.rb
131
137
  - spec/root_spec.rb
132
138
  - spec/sub_spec.rb