fspath 2.0.4 → 2.0.5
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 +15 -0
- data/.gitignore +1 -0
- data/.travis.yml +12 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +1 -1
- data/README.markdown +1 -1
- data/fspath.gemspec +1 -1
- data/lib/fspath.rb +16 -0
- data/spec/fspath_spec.rb +13 -7
- metadata +37 -55
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MTdjMWEyZjJlYjEzYTk5YTgzOTk5YzQ5NzQ3ZDRjMjg1ZjFlMTY5NA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZTAyNDA1ZWUwYWQ4ZGQ2MmFmMmRhMWNjZmJiOGM1N2RmNDc0NWIyMg==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NmNiNTFlZGI1NDA2OWU4NTM1YzUwODc1YTk4NTA5OWRjMWUzOWM5ODcyYWUy
|
10
|
+
ODA0MDE0Y2I4M2NkZWUyZWQwOWE0NTdlM2NiN2Y1MDZhNWI3ZWRmMjA5OThi
|
11
|
+
OGIwNDQxYmU3ZmE1OWJmMTRmMDFiZGJjZGZiOWE4NWJiNmUzNzM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NTM1NTEyYmRkOTg0MjM4MDg3NTM0ZDlkNmI2NjNjMzJjNDg5MDk1YmI3OGUx
|
14
|
+
NjA2ZmU0M2E1NDM1MmIwNjMxNDgwMGMyNDk4NGJkOTQ3OGEzYzI5ZjYxYWRl
|
15
|
+
MmZhODgxNzU2ZDU4YTlkMjAyMTBmNmIxZmQ3ZTg2OGU5YjM2NmU=
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
CHANGED
data/README.markdown
CHANGED
data/fspath.gemspec
CHANGED
data/lib/fspath.rb
CHANGED
@@ -13,6 +13,22 @@ class FSPath < Pathname
|
|
13
13
|
def path
|
14
14
|
@path_klass.new(super)
|
15
15
|
end
|
16
|
+
|
17
|
+
def self.open(*args)
|
18
|
+
tempfile = new(*args)
|
19
|
+
|
20
|
+
if block_given?
|
21
|
+
begin
|
22
|
+
yield(tempfile)
|
23
|
+
ensure
|
24
|
+
tempfile.close
|
25
|
+
end
|
26
|
+
|
27
|
+
nil
|
28
|
+
else
|
29
|
+
tempfile
|
30
|
+
end
|
31
|
+
end
|
16
32
|
end
|
17
33
|
|
18
34
|
class << self
|
data/spec/fspath_spec.rb
CHANGED
@@ -51,6 +51,12 @@ describe FSPath do
|
|
51
51
|
yielded.should be_kind_of(Tempfile)
|
52
52
|
yielded.path.should be_kind_of(klass)
|
53
53
|
end
|
54
|
+
|
55
|
+
it "should call appropriate initializer (jruby 1.8 mode bug)" do
|
56
|
+
lambda {
|
57
|
+
klass.temp_file('abc', '.'){}
|
58
|
+
}.should_not raise_error
|
59
|
+
end
|
54
60
|
end
|
55
61
|
|
56
62
|
describe "#{klass}.temp_file_path" do
|
@@ -76,14 +82,14 @@ describe FSPath do
|
|
76
82
|
describe "temp_dir" do
|
77
83
|
it "should return result of running Dir.mktmpdir as FSPath instance" do
|
78
84
|
@path = '/tmp/a/b/1'
|
79
|
-
Dir.stub
|
85
|
+
Dir.stub(:mktmpdir).and_return(@path)
|
80
86
|
|
81
87
|
FSPath.temp_dir.should == FSPath('/tmp/a/b/1')
|
82
88
|
end
|
83
89
|
|
84
90
|
it "should yield path yielded by Dir.mktmpdir as FSPath instance" do
|
85
91
|
@path = '/tmp/a/b/2'
|
86
|
-
Dir.stub
|
92
|
+
Dir.stub(:mktmpdir).and_yield(@path)
|
87
93
|
|
88
94
|
yielded = nil
|
89
95
|
FSPath.temp_dir{ |y| yielded = y }
|
@@ -132,12 +138,12 @@ describe FSPath do
|
|
132
138
|
describe "writing" do
|
133
139
|
before do
|
134
140
|
@path = FSPath.new('test')
|
135
|
-
@file =
|
136
|
-
@data =
|
137
|
-
@size =
|
141
|
+
@file = double(:file)
|
142
|
+
@data = double(:data)
|
143
|
+
@size = double(:size)
|
138
144
|
|
139
|
-
@path.stub
|
140
|
-
@file.stub
|
145
|
+
@path.stub(:open).and_yield(@file)
|
146
|
+
@file.stub(:write).and_return(@size)
|
141
147
|
end
|
142
148
|
|
143
149
|
describe "write" do
|
metadata
CHANGED
@@ -1,84 +1,66 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: fspath
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 2
|
8
|
-
- 0
|
9
|
-
- 4
|
10
|
-
version: 2.0.4
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.5
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Ivan Kuchin
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2013-07-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
21
14
|
name: rspec
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 3
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
version: "0"
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
32
20
|
type: :development
|
33
|
-
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
34
27
|
description:
|
35
28
|
email:
|
36
29
|
executables: []
|
37
|
-
|
38
30
|
extensions: []
|
39
|
-
|
40
31
|
extra_rdoc_files: []
|
41
|
-
|
42
|
-
files:
|
32
|
+
files:
|
43
33
|
- .gitignore
|
34
|
+
- .travis.yml
|
35
|
+
- Gemfile
|
44
36
|
- LICENSE.txt
|
45
37
|
- README.markdown
|
46
38
|
- fspath.gemspec
|
47
39
|
- lib/fspath.rb
|
48
40
|
- spec/fspath_spec.rb
|
49
41
|
homepage: http://github.com/toy/fspath
|
50
|
-
licenses:
|
42
|
+
licenses:
|
51
43
|
- MIT
|
44
|
+
metadata: {}
|
52
45
|
post_install_message:
|
53
46
|
rdoc_options: []
|
54
|
-
|
55
|
-
require_paths:
|
47
|
+
require_paths:
|
56
48
|
- lib
|
57
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
none: false
|
68
|
-
requirements:
|
69
|
-
- - ">="
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
hash: 3
|
72
|
-
segments:
|
73
|
-
- 0
|
74
|
-
version: "0"
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ! '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
75
59
|
requirements: []
|
76
|
-
|
77
60
|
rubyforge_project: fspath
|
78
|
-
rubygems_version:
|
61
|
+
rubygems_version: 2.0.3
|
79
62
|
signing_key:
|
80
|
-
specification_version:
|
63
|
+
specification_version: 4
|
81
64
|
summary: Better than Pathname
|
82
|
-
test_files:
|
65
|
+
test_files:
|
83
66
|
- spec/fspath_spec.rb
|
84
|
-
has_rdoc:
|