tmpdir 0.1.0 → 0.1.1
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.
Potentially problematic release.
This version of tmpdir might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Rakefile +7 -0
- data/lib/tmpdir.rb +12 -5
- data/tmpdir.gemspec +7 -4
- metadata +24 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0d9634c0737b99ed1386a7d3be6361e752c25f17b5a480bddde860963aa102f
|
4
|
+
data.tar.gz: ef93a41c46bca182f2e9e4dc0d9a7cc9d705a151e6278afd24bfcb2aba03a4bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39d20bfd3d0546c67b931ae7e039cbb6b2b0e89e87a70e33153562fbbebbad1d8cdb9dba8bcdeda7246e8560ec9d7d988de9233c37522c5faa9cc5c4d44af806
|
7
|
+
data.tar.gz: 49d849bbfa103d62bfd075825bb43965c18f6e261f047c164c63f91fa9e0c31de032b051983d84bfa8b8dcc60d39c93eb8b7d49daa8a4c78f1768721fd6096f3
|
data/Rakefile
CHANGED
@@ -7,4 +7,11 @@ Rake::TestTask.new(:test) do |t|
|
|
7
7
|
t.test_files = FileList["test/**/test_*.rb"]
|
8
8
|
end
|
9
9
|
|
10
|
+
task :sync_tool do
|
11
|
+
require 'fileutils'
|
12
|
+
FileUtils.cp "../ruby/tool/lib/test/unit/core_assertions.rb", "./test/lib"
|
13
|
+
FileUtils.cp "../ruby/tool/lib/envutil.rb", "./test/lib"
|
14
|
+
FileUtils.cp "../ruby/tool/lib/find_executable.rb", "./test/lib"
|
15
|
+
end
|
16
|
+
|
10
17
|
task :default => :test
|
data/lib/tmpdir.rb
CHANGED
@@ -20,14 +20,21 @@ class Dir
|
|
20
20
|
|
21
21
|
def self.tmpdir
|
22
22
|
tmp = nil
|
23
|
-
[
|
23
|
+
['TMPDIR', 'TMP', 'TEMP', ['system temporary path', @@systmpdir], ['/tmp']*2, ['.']*2].each do |name, dir = ENV[name]|
|
24
24
|
next if !dir
|
25
25
|
dir = File.expand_path(dir)
|
26
|
-
|
27
|
-
|
26
|
+
stat = File.stat(dir) rescue next
|
27
|
+
case
|
28
|
+
when !stat.directory?
|
29
|
+
warn "#{name} is not a directory: #{dir}"
|
30
|
+
when !stat.writable?
|
31
|
+
warn "#{name} is not writable: #{dir}"
|
32
|
+
when stat.world_writable? && !stat.sticky?
|
33
|
+
warn "#{name} is world-writable: #{dir}"
|
34
|
+
else
|
28
35
|
tmp = dir
|
29
36
|
break
|
30
|
-
end
|
37
|
+
end
|
31
38
|
end
|
32
39
|
raise ArgumentError, "could not find a temporary directory" unless tmp
|
33
40
|
tmp
|
@@ -86,7 +93,7 @@ class Dir
|
|
86
93
|
}
|
87
94
|
if block_given?
|
88
95
|
begin
|
89
|
-
yield path
|
96
|
+
yield path.dup
|
90
97
|
ensure
|
91
98
|
unless base
|
92
99
|
stat = File.stat(File.dirname(path))
|
data/tmpdir.gemspec
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "tmpdir"
|
3
|
-
spec.version = "0.1.
|
4
|
-
spec.authors
|
5
|
-
spec.email
|
3
|
+
spec.version = "0.1.1"
|
4
|
+
spec.authors = ["Yukihiro Matsumoto"]
|
5
|
+
spec.email = ["matz@ruby-lang.org"]
|
6
6
|
|
7
7
|
spec.summary = %q{Extends the Dir class to manage the OS temporary file path.}
|
8
8
|
spec.description = %q{Extends the Dir class to manage the OS temporary file path.}
|
9
9
|
spec.homepage = "https://github.com/ruby/tmpdir"
|
10
|
+
spec.licenses = ["Ruby", "BSD-2-Clause"]
|
10
11
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
11
12
|
|
12
13
|
spec.metadata["homepage_uri"] = spec.homepage
|
@@ -15,9 +16,11 @@ Gem::Specification.new do |spec|
|
|
15
16
|
# Specify which files should be added to the gem when it is released.
|
16
17
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
17
18
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
18
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
`git ls-files -z 2>/dev/null`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
20
|
end
|
20
21
|
spec.bindir = "exe"
|
21
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
23
|
spec.require_paths = ["lib"]
|
24
|
+
|
25
|
+
spec.add_dependency "fileutils"
|
23
26
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tmpdir
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yukihiro Matsumoto
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
12
|
-
dependencies:
|
11
|
+
date: 2020-12-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: fileutils
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
description: Extends the Dir class to manage the OS temporary file path.
|
14
28
|
email:
|
15
29
|
- matz@ruby-lang.org
|
@@ -28,11 +42,13 @@ files:
|
|
28
42
|
- lib/tmpdir.rb
|
29
43
|
- tmpdir.gemspec
|
30
44
|
homepage: https://github.com/ruby/tmpdir
|
31
|
-
licenses:
|
45
|
+
licenses:
|
46
|
+
- Ruby
|
47
|
+
- BSD-2-Clause
|
32
48
|
metadata:
|
33
49
|
homepage_uri: https://github.com/ruby/tmpdir
|
34
50
|
source_code_uri: https://github.com/ruby/tmpdir
|
35
|
-
post_install_message:
|
51
|
+
post_install_message:
|
36
52
|
rdoc_options: []
|
37
53
|
require_paths:
|
38
54
|
- lib
|
@@ -47,8 +63,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
47
63
|
- !ruby/object:Gem::Version
|
48
64
|
version: '0'
|
49
65
|
requirements: []
|
50
|
-
rubygems_version: 3.2.
|
51
|
-
signing_key:
|
66
|
+
rubygems_version: 3.2.2
|
67
|
+
signing_key:
|
52
68
|
specification_version: 4
|
53
69
|
summary: Extends the Dir class to manage the OS temporary file path.
|
54
70
|
test_files: []
|