pathname 0.2.1 → 0.4.0

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
2
  SHA256:
3
- metadata.gz: 222ab05e8698152edf5c4d2db5215d1385281d77e408234a03e9417d8f7e33c6
4
- data.tar.gz: f267783875853911d60d63e08d7e871ba4562a84a73a335d1b72b453c3665a59
3
+ metadata.gz: b7667d4cec31df28ffcfe85b035246a5efc867339ff3cc3c53712b3c61529534
4
+ data.tar.gz: 12cfe37fad1b656250d6b777ceedd9f5ef7f7ff96a1a1bf70db29a3fdd458eda
5
5
  SHA512:
6
- metadata.gz: 0b2b4a31d31f5e5dc9fe356c6a25a5a8f40b573604c073b9090ec53c09bafac5aafa61339b1396136659ef0ddeb1932955eb4e43f2ab7d83a906509a9412b313
7
- data.tar.gz: 789a9cd9d5929793cabecde7d8a023ce153d1b5c11ef85da85aa8e0a74a427c85162c7cc0d09e85c3f33e8ee2f2d43bfeabed665fdd5f2742dec3611662204dd
6
+ metadata.gz: a7cdeaf870f2eef4c8cb394fbe16d2c9aa36f950787da7f2bde6e65b4294b16a01ed28341df955f8fb1f0caa0ede2fdc585242470611ee164a4caca6312701dc
7
+ data.tar.gz: 3ca9f67a7d1cc76df2b89e578b297ae860dd388293f400534b2ea45bbedb06e48ba49995ece6d99384f93d2f86389b125073363a76f48ddf32b63c7d789b04b2
@@ -0,0 +1,66 @@
1
+ name: Publish gem to rubygems.org
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ push:
13
+ if: github.repository == 'ruby/pathname'
14
+ runs-on: ubuntu-latest
15
+
16
+ environment:
17
+ name: rubygems.org
18
+ url: https://rubygems.org/gems/pathname
19
+
20
+ permissions:
21
+ contents: write
22
+ id-token: write
23
+
24
+ steps:
25
+ - name: Harden Runner
26
+ uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
27
+ with:
28
+ egress-policy: audit
29
+
30
+ - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
31
+
32
+ - name: Set up Ruby
33
+ uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1.190.0
34
+ with:
35
+ bundler-cache: true
36
+ ruby-version: ruby
37
+
38
+ - name: Set remote URL
39
+ run: |
40
+ # Attribute commits to the last committer on HEAD
41
+ git config --global user.email "$(git log -1 --pretty=format:'%ae')"
42
+ git config --global user.name "$(git log -1 --pretty=format:'%an')"
43
+ git remote set-url origin "https://x-access-token:${{ github.token }}@github.com/$GITHUB_REPOSITORY"
44
+ shell: bash
45
+
46
+ - name: Configure trusted publishing credentials
47
+ uses: rubygems/configure-rubygems-credentials@v1.0.0
48
+
49
+ - name: Install dependencies
50
+ run: gem install rake-compiler
51
+ shell: bash
52
+
53
+ - name: Run release rake task
54
+ run: rake release
55
+ shell: bash
56
+
57
+ - name: Wait for release to propagate
58
+ run: gem exec rubygems-await pkg/*.gem
59
+ shell: bash
60
+
61
+ - name: Create GitHub release
62
+ run: |
63
+ tag_name="$(git describe --tags --abbrev=0)"
64
+ gh release create "${tag_name}" --verify-tag --generate-notes
65
+ env:
66
+ GITHUB_TOKEN: ${{ secrets.MATZBOT_GITHUB_WORKFLOW_TOKEN }}
@@ -3,11 +3,17 @@ name: build
3
3
  on: [push, pull_request]
4
4
 
5
5
  jobs:
6
- build:
6
+ ruby-versions:
7
+ uses: ruby/actions/.github/workflows/ruby_versions.yml@master
8
+ with:
9
+ engine: cruby
10
+
11
+ test:
12
+ needs: ruby-versions
7
13
  name: build (${{ matrix.ruby }} / ${{ matrix.os }})
8
14
  strategy:
9
15
  matrix:
10
- ruby: [ 2.7, '3.0', 3.1, head ]
16
+ ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
11
17
  os: [ ubuntu-latest, macos-latest, windows-latest ]
12
18
  exclude:
13
19
  - { os: windows-latest , ruby: head }
@@ -16,7 +22,7 @@ jobs:
16
22
  - { os: windows-latest , ruby: mswin }
17
23
  runs-on: ${{ matrix.os }}
18
24
  steps:
19
- - uses: actions/checkout@v3
25
+ - uses: actions/checkout@v4
20
26
  - name: Set up Ruby
21
27
  uses: ruby/setup-ruby@v1
22
28
  with:
@@ -4,10 +4,10 @@ Redistribution and use in source and binary forms, with or without
4
4
  modification, are permitted provided that the following conditions
5
5
  are met:
6
6
  1. Redistributions of source code must retain the above copyright
7
- notice, this list of conditions and the following disclaimer.
7
+ notice, this list of conditions and the following disclaimer.
8
8
  2. Redistributions in binary form must reproduce the above copyright
9
- notice, this list of conditions and the following disclaimer in the
10
- documentation and/or other materials provided with the distribution.
9
+ notice, this list of conditions and the following disclaimer in the
10
+ documentation and/or other materials provided with the distribution.
11
11
 
12
12
  THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
13
13
  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
data/COPYING ADDED
@@ -0,0 +1,56 @@
1
+ Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
2
+ You can redistribute it and/or modify it under either the terms of the
3
+ 2-clause BSDL (see the file BSDL), or the conditions below:
4
+
5
+ 1. You may make and give away verbatim copies of the source form of the
6
+ software without restriction, provided that you duplicate all of the
7
+ original copyright notices and associated disclaimers.
8
+
9
+ 2. You may modify your copy of the software in any way, provided that
10
+ you do at least ONE of the following:
11
+
12
+ a. place your modifications in the Public Domain or otherwise
13
+ make them Freely Available, such as by posting said
14
+ modifications to Usenet or an equivalent medium, or by allowing
15
+ the author to include your modifications in the software.
16
+
17
+ b. use the modified software only within your corporation or
18
+ organization.
19
+
20
+ c. give non-standard binaries non-standard names, with
21
+ instructions on where to get the original software distribution.
22
+
23
+ d. make other distribution arrangements with the author.
24
+
25
+ 3. You may distribute the software in object code or binary form,
26
+ provided that you do at least ONE of the following:
27
+
28
+ a. distribute the binaries and library files of the software,
29
+ together with instructions (in the manual page or equivalent)
30
+ on where to get the original distribution.
31
+
32
+ b. accompany the distribution with the machine-readable source of
33
+ the software.
34
+
35
+ c. give non-standard binaries non-standard names, with
36
+ instructions on where to get the original software distribution.
37
+
38
+ d. make other distribution arrangements with the author.
39
+
40
+ 4. You may modify and include the part of the software into any other
41
+ software (possibly commercial). But some files in the distribution
42
+ are not written by the author, so that they are not under these terms.
43
+
44
+ For the list of those files and their copying conditions, see the
45
+ file LEGAL.
46
+
47
+ 5. The scripts and library files supplied as input to or produced as
48
+ output from the software do not automatically fall under the
49
+ copyright of the software, but belong to whomever generated them,
50
+ and may be sold commercially, and may be aggregated with this
51
+ software.
52
+
53
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
54
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
55
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56
+ PURPOSE.
data/Gemfile CHANGED
@@ -5,3 +5,4 @@ gemspec
5
5
  gem "rake"
6
6
  gem "rake-compiler"
7
7
  gem "test-unit"
8
+ gem "test-unit-ruby-core"
data/Rakefile CHANGED
@@ -7,13 +7,6 @@ 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/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
-
17
10
  require 'rake/extensiontask'
18
11
  Rake::ExtensionTask.new("pathname")
19
12
 
@@ -1,4 +1,3 @@
1
1
  # frozen_string_literal: false
2
2
  require 'mkmf'
3
- have_func("rb_file_s_birthtime")
4
3
  create_makefile('pathname')
@@ -130,32 +130,6 @@ path_freeze(VALUE self)
130
130
  return self;
131
131
  }
132
132
 
133
- /*
134
- * call-seq:
135
- * pathname.taint -> obj
136
- *
137
- * Returns pathname. This method is deprecated and will be removed in Ruby 3.2.
138
- */
139
- static VALUE
140
- path_taint(VALUE self)
141
- {
142
- rb_warn("Pathname#taint is deprecated and will be removed in Ruby 3.2.");
143
- return self;
144
- }
145
-
146
- /*
147
- * call-seq:
148
- * pathname.untaint -> obj
149
- *
150
- * Returns pathname. This method is deprecated and will be removed in Ruby 3.2.
151
- */
152
- static VALUE
153
- path_untaint(VALUE self)
154
- {
155
- rb_warn("Pathname#untaint is deprecated and will be removed in Ruby 3.2.");
156
- return self;
157
- }
158
-
159
133
  /*
160
134
  * Compare this pathname with +other+. The comparison is string-based.
161
135
  * Be aware that two different paths (<tt>foo.txt</tt> and <tt>./foo.txt</tt>)
@@ -505,7 +479,6 @@ path_atime(VALUE self)
505
479
  return rb_funcall(rb_cFile, id_atime, 1, get_strpath(self));
506
480
  }
507
481
 
508
- #if defined(HAVE_RB_FILE_S_BIRTHTIME)
509
482
  /*
510
483
  * call-seq:
511
484
  * pathname.birthtime -> time
@@ -520,10 +493,6 @@ path_birthtime(VALUE self)
520
493
  {
521
494
  return rb_funcall(rb_cFile, id_birthtime, 1, get_strpath(self));
522
495
  }
523
- #else
524
- /* check at compilation time for `respond_to?` */
525
- # define path_birthtime rb_f_notimplement
526
- #endif
527
496
 
528
497
  /*
529
498
  * call-seq:
@@ -1537,8 +1506,6 @@ Init_pathname(void)
1537
1506
  rb_cPathname = rb_define_class("Pathname", rb_cObject);
1538
1507
  rb_define_method(rb_cPathname, "initialize", path_initialize, 1);
1539
1508
  rb_define_method(rb_cPathname, "freeze", path_freeze, 0);
1540
- rb_define_method(rb_cPathname, "taint", path_taint, 0);
1541
- rb_define_method(rb_cPathname, "untaint", path_untaint, 0);
1542
1509
  rb_define_method(rb_cPathname, "==", path_eq, 1);
1543
1510
  rb_define_method(rb_cPathname, "===", path_eq, 1);
1544
1511
  rb_define_method(rb_cPathname, "eql?", path_eq, 1);
data/lib/pathname.rb CHANGED
@@ -14,6 +14,8 @@ require 'pathname.so'
14
14
 
15
15
  class Pathname
16
16
 
17
+ VERSION = "0.4.0"
18
+
17
19
  # :stopdoc:
18
20
 
19
21
  # to_path is implemented so Pathname objects are usable with File.open, etc.
@@ -570,7 +572,7 @@ class Pathname # * Find *
570
572
  return to_enum(__method__, ignore_error: ignore_error) unless block_given?
571
573
  require 'find'
572
574
  if @path == '.'
573
- Find.find(@path, ignore_error: ignore_error) {|f| yield self.class.new(f.sub(%r{\A\./}, '')) }
575
+ Find.find(@path, ignore_error: ignore_error) {|f| yield self.class.new(f.delete_prefix('./')) }
574
576
  else
575
577
  Find.find(@path, ignore_error: ignore_error) {|f| yield self.class.new(f) }
576
578
  end
@@ -578,16 +580,15 @@ class Pathname # * Find *
578
580
  end
579
581
 
580
582
 
581
- autoload(:FileUtils, 'fileutils')
582
-
583
583
  class Pathname # * FileUtils *
584
584
  # Creates a full path, including any intermediate directories that don't yet
585
585
  # exist.
586
586
  #
587
587
  # See FileUtils.mkpath and FileUtils.mkdir_p
588
588
  def mkpath(mode: nil)
589
+ require 'fileutils'
589
590
  FileUtils.mkpath(@path, mode: mode)
590
- nil
591
+ self
591
592
  end
592
593
 
593
594
  # Recursively deletes a directory, including all directories beneath it.
@@ -598,7 +599,23 @@ class Pathname # * FileUtils *
598
599
  # File::Path provides "mkpath" and "rmtree".
599
600
  require 'fileutils'
600
601
  FileUtils.rm_rf(@path, noop: noop, verbose: verbose, secure: secure)
601
- nil
602
+ self
602
603
  end
603
604
  end
604
605
 
606
+ class Pathname # * tmpdir *
607
+ # Creates a tmp directory and wraps the returned path in a Pathname object.
608
+ #
609
+ # See Dir.mktmpdir
610
+ def self.mktmpdir
611
+ require 'tmpdir' unless defined?(Dir.mktmpdir)
612
+ if block_given?
613
+ Dir.mktmpdir do |dir|
614
+ dir = self.new(dir)
615
+ yield dir
616
+ end
617
+ else
618
+ self.new(Dir.mktmpdir)
619
+ end
620
+ end
621
+ end
data/pathname.gemspec CHANGED
@@ -1,6 +1,13 @@
1
+ name = File.basename(__FILE__, ".gemspec")
2
+ version = ["lib", "ext/lib"].find do |dir|
3
+ break File.foreach(File.join(__dir__, dir, "#{name}.rb")) do |line|
4
+ /^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1
5
+ end rescue nil
6
+ end
7
+
1
8
  Gem::Specification.new do |spec|
2
- spec.name = "pathname"
3
- spec.version = "0.2.1"
9
+ spec.name = name
10
+ spec.version = version
4
11
  spec.authors = ["Tanaka Akira"]
5
12
  spec.email = ["akr@fsij.org"]
6
13
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pathname
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tanaka Akira
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-05 00:00:00.000000000 Z
11
+ date: 2024-11-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Representation of the name of a file or directory on the filesystem
14
14
  email:
@@ -20,10 +20,12 @@ extra_rdoc_files: []
20
20
  files:
21
21
  - ".git-blame-ignore-revs"
22
22
  - ".github/dependabot.yml"
23
+ - ".github/workflows/push_gem.yml"
23
24
  - ".github/workflows/test.yml"
24
25
  - ".gitignore"
26
+ - BSDL
27
+ - COPYING
25
28
  - Gemfile
26
- - LICENSE.txt
27
29
  - README.md
28
30
  - Rakefile
29
31
  - bin/console
@@ -39,7 +41,7 @@ licenses:
39
41
  metadata:
40
42
  homepage_uri: https://github.com/ruby/pathname
41
43
  source_code_uri: https://github.com/ruby/pathname
42
- post_install_message:
44
+ post_install_message:
43
45
  rdoc_options: []
44
46
  require_paths:
45
47
  - lib
@@ -54,8 +56,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
56
  - !ruby/object:Gem::Version
55
57
  version: '0'
56
58
  requirements: []
57
- rubygems_version: 3.4.0.dev
58
- signing_key:
59
+ rubygems_version: 3.5.11
60
+ signing_key:
59
61
  specification_version: 4
60
62
  summary: Representation of the name of a file or directory on the filesystem
61
63
  test_files: []