pathutil 0.16.1 → 0.16.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Rakefile +8 -77
- data/lib/pathutil/helpers.rb +19 -1
- data/lib/pathutil/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b4feb1b5fd7d2f59c6725a0f65b52670ec95af7da70cd65ba740a14f3c96888b
|
4
|
+
data.tar.gz: 7bd341ae59ab1d0e04653d49c996c7d0b2ed03f2165ecfa839e84c58cfb3f09e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 611aa097d828f971d2b130238f4c32eea108665e405fe60e9b7e708d9235b105522243e9bc9f96d806d1bfacfc6915d4265739191e5adbc482764569b69c1ea8
|
7
|
+
data.tar.gz: 98aa9acd0c520bd7aa96228bc136747271ceb0203090d0d50598f80cfa20c77767518d75632a99e2c85c71be9800106fca527574818140a540cd54ac5580111f
|
data/Rakefile
CHANGED
@@ -1,81 +1,12 @@
|
|
1
1
|
# Frozen-string-literal: true
|
2
|
-
# Copyright:
|
2
|
+
# Copyright: 2017 - 2018 - MIT License
|
3
|
+
# Source: https://github.com/envygeeks/devfiles
|
4
|
+
# Author: Jordon Bedwell
|
3
5
|
# Encoding: utf-8
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
require "pathutil"
|
11
|
-
require "json"
|
12
|
-
|
13
|
-
# --
|
14
|
-
|
15
|
-
task :default => [
|
16
|
-
ENV["BENCHMARK"] ? :benchmark : :spec
|
17
|
-
]
|
18
|
-
|
19
|
-
# --
|
20
|
-
|
21
|
-
BenchmarkTask.new :benchmark
|
22
|
-
RSpec::Core::RakeTask.new :spec
|
23
|
-
task :test => :spec
|
24
|
-
|
25
|
-
# --
|
26
|
-
|
27
|
-
namespace :diff do
|
28
|
-
desc "List methods we have that Pathname doesn't."
|
29
|
-
task :methods do
|
30
|
-
methods = Pathutil.instance_methods - Pathname.instance_methods - Object.instance_methods
|
31
|
-
methods.each do |method|
|
32
|
-
$stdout.print "- ", "`", method, "`", "\n"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
# --
|
38
|
-
|
39
|
-
namespace :missing do
|
40
|
-
desc "List methods we are missing."
|
41
|
-
task :methods do
|
42
|
-
methods = Pathname.instance_methods - Pathutil.instance_methods - Object.instance_methods
|
43
|
-
methods-= [
|
44
|
-
:cleanpath
|
45
|
-
]
|
46
|
-
|
47
|
-
methods.each do |method|
|
48
|
-
$stdout.puts method
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
# --
|
54
|
-
|
55
|
-
namespace :pathname do
|
56
|
-
desc "List all of Pathnames methods."
|
57
|
-
task :methods do
|
58
|
-
methods = Pathname.instance_methods - Object.instance_methods
|
59
|
-
methods.each_with_index do |method, index|
|
60
|
-
$stdout.print method
|
61
|
-
unless index == methods.size - 1
|
62
|
-
$stdout.print ", "
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
$stdout.puts
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
# --
|
71
|
-
|
72
|
-
desc "List all of Pathutils methods."
|
73
|
-
task :methods do
|
74
|
-
methods = Pathutil.instance_methods - Object.instance_methods
|
75
|
-
methods.each_with_index do |method, index|
|
76
|
-
$stdout.print "`", method, "`"
|
77
|
-
$stdout.print ", " unless index == methods.size - 1
|
78
|
-
end
|
79
|
-
|
80
|
-
$stdout.puts
|
7
|
+
task default: [:spec]
|
8
|
+
task(:spec) { exec "script/test" }
|
9
|
+
task(:test) { exec "script/test" }
|
10
|
+
Dir.glob("script/rake.d/*.rake").each do |v|
|
11
|
+
load v
|
81
12
|
end
|
data/lib/pathutil/helpers.rb
CHANGED
@@ -59,11 +59,29 @@ class Pathutil
|
|
59
59
|
suffix = tmpname_suffix(suffix)
|
60
60
|
|
61
61
|
root ||= Dir::Tmpname.tmpdir
|
62
|
-
File.join(root,
|
62
|
+
File.join(root, __make_tmpname(
|
63
63
|
prefix, suffix
|
64
64
|
))
|
65
65
|
end
|
66
66
|
|
67
|
+
# --
|
68
|
+
private
|
69
|
+
def __make_tmpname((prefix, suffix), number)
|
70
|
+
prefix &&= String.try_convert(prefix) || tmpname_agerr(:prefix, prefix)
|
71
|
+
suffix &&= String.try_convert(suffix) || tmpname_agerr(:suffix, suffix)
|
72
|
+
|
73
|
+
time = Time.now.strftime("%Y%m%d")
|
74
|
+
path = "#{prefix}#{time}-#{$$}-#{rand(0x100000000).to_s(36)}".dup
|
75
|
+
path << "-#{number}" if number
|
76
|
+
path << suffix if suffix
|
77
|
+
path
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
def tmpname_agerr(type, val)
|
82
|
+
raise ArgumentError, "unexpected #{type}: #{val.inspect}"
|
83
|
+
end
|
84
|
+
|
67
85
|
# --
|
68
86
|
private
|
69
87
|
def tmpname_suffix(suffix)
|
data/lib/pathutil/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pathutil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.16.
|
4
|
+
version: 0.16.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordon Bedwell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: forwardable-extended
|
@@ -57,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
57
|
version: '0'
|
58
58
|
requirements: []
|
59
59
|
rubyforge_project:
|
60
|
-
rubygems_version: 2.
|
60
|
+
rubygems_version: 2.7.7
|
61
61
|
signing_key:
|
62
62
|
specification_version: 4
|
63
63
|
summary: Almost like Pathname but just a little less insane.
|