pathutil 0.16.1 → 0.16.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 9b9b739e52c6c725a234d7d00731f2b3868792f3
4
- data.tar.gz: 7bb440ee4a97eacb552e60968457df38a963e4ac
2
+ SHA256:
3
+ metadata.gz: b4feb1b5fd7d2f59c6725a0f65b52670ec95af7da70cd65ba740a14f3c96888b
4
+ data.tar.gz: 7bd341ae59ab1d0e04653d49c996c7d0b2ed03f2165ecfa839e84c58cfb3f09e
5
5
  SHA512:
6
- metadata.gz: bd24504ea9f9534f6cd96a767752eb4d59c8c08fb71b65565037916220c35994538555decd586556804d5b1229e7473468007942fd1622c5f775d6d2936a4614
7
- data.tar.gz: 990355eceee1d4a621f379bceb3f9b0618e8cd1f5d39822e65a14e3162f92e911943d1313f21e666536eefa2e69b51da98cf19fa519e8a72705da6ef5046d6fa
6
+ metadata.gz: 611aa097d828f971d2b130238f4c32eea108665e405fe60e9b7e708d9235b105522243e9bc9f96d806d1bfacfc6915d4265739191e5adbc482764569b69c1ea8
7
+ data.tar.gz: 98aa9acd0c520bd7aa96228bc136747271ceb0203090d0d50598f80cfa20c77767518d75632a99e2c85c71be9800106fca527574818140a540cd54ac5580111f
data/Rakefile CHANGED
@@ -1,81 +1,12 @@
1
1
  # Frozen-string-literal: true
2
- # Copyright: 2015 - 2017 Jordon Bedwell - MIT License
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
- require "open3"
6
- require "rspec/core/rake_task"
7
- require_relative "benchmark/support/task"
8
- require "rubocop/rake_task"
9
- require "simple/ansi"
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
@@ -59,11 +59,29 @@ class Pathutil
59
59
  suffix = tmpname_suffix(suffix)
60
60
 
61
61
  root ||= Dir::Tmpname.tmpdir
62
- File.join(root, Dir::Tmpname.make_tmpname(
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)
@@ -3,5 +3,5 @@
3
3
  # Encoding: utf-8
4
4
 
5
5
  class Pathutil
6
- VERSION = "0.16.1"
6
+ VERSION = "0.16.2"
7
7
  end
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.1
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: 2017-12-11 00:00:00.000000000 Z
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.6.13
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.