rubysl-pathname 2.0.0 → 2.1.0

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: a50a6a72a8ab5c76d641f4c59963970a0351ee82
4
- data.tar.gz: f73a1000db8a4010a902b2f0449a0d1ccd93a4b3
3
+ metadata.gz: 54a2bc4f3f622b955a0b81c1cd46a2133043d828
4
+ data.tar.gz: 5e2e1ac68be016180cb4958ccb94a6d21d8b4e82
5
5
  SHA512:
6
- metadata.gz: 512d80c9c7dd0cb61a0b902081920c98a7f5002e18ffcf3194dd43cdc2481facc9ceabe80ee005d8cb7a2511296235f4b330dc57bf0c262f8abf50bfb5caed29
7
- data.tar.gz: a4bb9aa419adebc7aac773fe7f0936f22349e93d97f91f9f050dbd7b96cdf99489ee7c9066091aed835541b0aeb01dc11c5244ffe4f0183fb24850761de3b181
6
+ metadata.gz: 72bb5b43513ae64e507938200d46e6f1fb464171b2d6903c68609c7b35a5ebd21e04701e6b048001be2429caf39f4b6c7dad0c32401e7a9f4722733bc559c0fe
7
+ data.tar.gz: 8dc631055ee12d3a0f588106853d9893d83d51d6874a4f6e18269f557824a94303c846c34d6090652107cc68991e67324da89cd3e6bee8a91ea255dfb13b0733
data/.travis.yml CHANGED
@@ -1,7 +1,12 @@
1
1
  language: ruby
2
2
  env:
3
- - RUBYLIB=lib
4
- script: bundle exec mspec
3
+ - RUBYLIB=lib:.
4
+ script: mspec spec
5
+ branches:
6
+ only:
7
+ - 1.0
8
+ - 2.0
5
9
  rvm:
6
- - 1.9.3
7
- - rbx-nightly-19mode
10
+ - 2.1.0
11
+ - rbx-2
12
+
@@ -168,6 +168,8 @@
168
168
  # - #each_line(*args, &block)
169
169
  # - #read(*args)
170
170
  # - #binread(*args)
171
+ # - #write(*args)
172
+ # - #binwrite(*args)
171
173
  # - #readlines(*args)
172
174
  # - #sysopen(*args)
173
175
  #
@@ -211,7 +213,12 @@ class Pathname
211
213
  # If +path+ contains a NUL character (<tt>\0</tt>), an ArgumentError is raised.
212
214
  #
213
215
  def initialize(path)
214
- path = path.__send__(TO_PATH) if path.respond_to? TO_PATH
216
+ if path.respond_to? TO_PATH
217
+ path = path.__send__(TO_PATH)
218
+ elsif path.respond_to? :to_str
219
+ path = path.__send__(:to_str)
220
+ end
221
+
215
222
  @path = path.dup
216
223
 
217
224
  if /\0/ =~ @path
@@ -779,6 +786,12 @@ class Pathname # * IO *
779
786
  # if specified.
780
787
  def binread(*args) IO.binread(@path, *args) end
781
788
 
789
+ # See <tt>IO.write</tt>. Returns the number of bytes written to the file.
790
+ def write(*args) IO.write(@path, *args) end
791
+
792
+ # See <tt>IO.binwrite</tt>. Returns the number of bytes written to the file.
793
+ def binwrite(*args) IO.binwrite(@path, *args) end
794
+
782
795
  # See <tt>IO.readlines</tt>. Returns all the lines from the file.
783
796
  def readlines(*args) IO.readlines(@path, *args) end
784
797
 
@@ -1049,5 +1062,4 @@ module Kernel
1049
1062
  def Pathname(path) # :doc:
1050
1063
  Pathname.new(path)
1051
1064
  end
1052
- private :Pathname
1053
1065
  end
@@ -1,5 +1,5 @@
1
1
  module RubySL
2
2
  module Pathname
3
- VERSION = "2.0.0"
3
+ VERSION = "2.1.0"
4
4
  end
5
5
  end
@@ -16,7 +16,10 @@ Gem::Specification.new do |spec|
16
16
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
17
  spec.require_paths = ["lib"]
18
18
 
19
+ spec.required_ruby_version = "~> 2.0"
20
+
19
21
  spec.add_development_dependency "bundler", "~> 1.3"
20
22
  spec.add_development_dependency "rake", "~> 10.0"
21
23
  spec.add_development_dependency "mspec", "~> 1.5"
22
- end
24
+ spec.add_development_dependency "rubysl-prettyprint", "~> 2.0"
25
+ end
@@ -0,0 +1,16 @@
1
+ require 'pathname'
2
+
3
+ describe "Kernel.Pathname" do
4
+ it "returns a new Pathname Object with 1 argument" do
5
+ Kernel.Pathname('').should be_kind_of(Pathname)
6
+ end
7
+
8
+ it "raises an ArgumentError when called with \0" do
9
+ lambda { Kernel.Pathname("\0")}.should raise_error(ArgumentError)
10
+ end
11
+
12
+ it "is tainted if path is tainted" do
13
+ path = '/usr/local/bin'.taint
14
+ Kernel.Pathname(path).tainted?.should == true
15
+ end
16
+ end
data/spec/new_spec.rb CHANGED
@@ -14,5 +14,18 @@ describe "Pathname.new" do
14
14
  Pathname.new(path).tainted?.should == true
15
15
  end
16
16
 
17
+ it "calls #to_str to convert the argument to a String" do
18
+ obj = mock("to_str")
19
+ obj.should_receive(:to_str).and_return("/")
20
+
21
+ Pathname.new(obj).should == Pathname.new('/')
22
+ end
23
+
24
+ it "calls #to_path to convert the argument to a String" do
25
+ obj = mock("to_path")
26
+ obj.should_receive(:to_path).and_return("/")
27
+
28
+ Pathname.new(obj).should == Pathname.new('/')
29
+ end
17
30
  end
18
31
 
metadata CHANGED
@@ -1,57 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubysl-pathname
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Shirai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-05 00:00:00.000000000 Z
11
+ date: 2014-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.5'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubysl-prettyprint
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.0'
55
69
  description: Ruby standard library pathname.
56
70
  email:
57
71
  - brixen@gmail.com
@@ -59,8 +73,8 @@ executables: []
59
73
  extensions: []
60
74
  extra_rdoc_files: []
61
75
  files:
62
- - .gitignore
63
- - .travis.yml
76
+ - ".gitignore"
77
+ - ".travis.yml"
64
78
  - Gemfile
65
79
  - LICENSE
66
80
  - README.md
@@ -73,6 +87,7 @@ files:
73
87
  - spec/absolute_spec.rb
74
88
  - spec/equal_value_spec.rb
75
89
  - spec/hash_spec.rb
90
+ - spec/kernel_spec.rb
76
91
  - spec/new_spec.rb
77
92
  - spec/parent_spec.rb
78
93
  - spec/relative_spec.rb
@@ -88,17 +103,17 @@ require_paths:
88
103
  - lib
89
104
  required_ruby_version: !ruby/object:Gem::Requirement
90
105
  requirements:
91
- - - '>='
106
+ - - "~>"
92
107
  - !ruby/object:Gem::Version
93
- version: '0'
108
+ version: '2.0'
94
109
  required_rubygems_version: !ruby/object:Gem::Requirement
95
110
  requirements:
96
- - - '>='
111
+ - - ">="
97
112
  - !ruby/object:Gem::Version
98
113
  version: '0'
99
114
  requirements: []
100
115
  rubyforge_project:
101
- rubygems_version: 2.0.7
116
+ rubygems_version: 2.2.2
102
117
  signing_key:
103
118
  specification_version: 4
104
119
  summary: Ruby standard library pathname.
@@ -106,6 +121,7 @@ test_files:
106
121
  - spec/absolute_spec.rb
107
122
  - spec/equal_value_spec.rb
108
123
  - spec/hash_spec.rb
124
+ - spec/kernel_spec.rb
109
125
  - spec/new_spec.rb
110
126
  - spec/parent_spec.rb
111
127
  - spec/relative_spec.rb