pathname 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f86bba6b469155aa1c26eb4e655f532d4a550429e36fab4b82eb4f3cb8f98b2
4
- data.tar.gz: 475bb6d8318541b384a1496b9c4aa3b640bd974145fff206b5cfb5b2bee5f1f5
3
+ metadata.gz: 9a656bfd312a6e64a60dbe0587adb442864e7e243112dfd2de00818faa81ddd8
4
+ data.tar.gz: 4bb517d92a8f16923bb2c2e0b3e6cd6336f7b384e69d6a8f93f5fb9c9db4be6e
5
5
  SHA512:
6
- metadata.gz: 268cbeca3ea44caea9c811b3e9ae12b63b294993c4af419be43e70f1ba599af7391ffa02fd25377f4cd254e2879075cef96fa4dc6776aab36c37ab1d9defaeed
7
- data.tar.gz: c7ded65024e264c8c2fcad21879a0af24dba969d5d94d91015c8d6922aa303e3727babf6eb1425a50d45f6a363b7784da7162d7454c48a34f5a477fc319041f0
6
+ metadata.gz: 257242ff8d0cad1b3510f8baa055b53c613d62b8be2975e559824f202cf2500ef700ca714223c0978b03befac7c5daae9eaa3847c6c8b12e50952504ca966f90
7
+ data.tar.gz: 13061a06efa6cbfd3b08799e0974691f1e3d52df1210031d080d2bdb2bfd24081b9c241a21f7115ee859d78d1da8a57cfbf4cd26d68b4eb1446a3886019f3017
@@ -0,0 +1,7 @@
1
+ # This is a file used by GitHub to ignore the following commits on `git blame`.
2
+ #
3
+ # You can also do the same thing in your local repository with:
4
+ # $ git config --local blame.ignoreRevsFile .git-blame-ignore-revs
5
+
6
+ # Expand tabs
7
+ 93e8aaadc7c7945895b1b0b6d9909134409517ff
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: 'github-actions'
4
+ directory: '/'
5
+ schedule:
6
+ interval: 'weekly'
@@ -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: [ '3.0', 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,11 +22,12 @@ jobs:
16
22
  - { os: windows-latest , ruby: mswin }
17
23
  runs-on: ${{ matrix.os }}
18
24
  steps:
19
- - uses: actions/checkout@v2
25
+ - uses: actions/checkout@v4
20
26
  - name: Set up Ruby
21
27
  uses: ruby/setup-ruby@v1
22
28
  with:
23
29
  ruby-version: ${{ matrix.ruby }}
24
- bundler-cache: true # 'bundle install' and cache
30
+ - name: Install dependencies
31
+ run: bundle install
25
32
  - name: Run test
26
- run: bundle exec rake compile test
33
+ run: rake compile test
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
 
@@ -35,6 +35,7 @@ static ID id_lchmod;
35
35
  static ID id_lchown;
36
36
  static ID id_link;
37
37
  static ID id_lstat;
38
+ static ID id_lutime;
38
39
  static ID id_mkdir;
39
40
  static ID id_mtime;
40
41
  static ID id_open;
@@ -129,32 +130,6 @@ path_freeze(VALUE self)
129
130
  return self;
130
131
  }
131
132
 
132
- /*
133
- * call-seq:
134
- * pathname.taint -> obj
135
- *
136
- * Returns pathname. This method is deprecated and will be removed in Ruby 3.2.
137
- */
138
- static VALUE
139
- path_taint(VALUE self)
140
- {
141
- rb_warn("Pathname#taint is deprecated and will be removed in Ruby 3.2.");
142
- return self;
143
- }
144
-
145
- /*
146
- * call-seq:
147
- * pathname.untaint -> obj
148
- *
149
- * Returns pathname. This method is deprecated and will be removed in Ruby 3.2.
150
- */
151
- static VALUE
152
- path_untaint(VALUE self)
153
- {
154
- rb_warn("Pathname#untaint is deprecated and will be removed in Ruby 3.2.");
155
- return self;
156
- }
157
-
158
133
  /*
159
134
  * Compare this pathname with +other+. The comparison is string-based.
160
135
  * Be aware that two different paths (<tt>foo.txt</tt> and <tt>./foo.txt</tt>)
@@ -764,6 +739,19 @@ path_utime(VALUE self, VALUE atime, VALUE mtime)
764
739
  return rb_funcall(rb_cFile, id_utime, 3, atime, mtime, get_strpath(self));
765
740
  }
766
741
 
742
+ /*
743
+ * Update the access and modification times of the file.
744
+ *
745
+ * Same as Pathname#utime, but does not follow symbolic links.
746
+ *
747
+ * See File.lutime.
748
+ */
749
+ static VALUE
750
+ path_lutime(VALUE self, VALUE atime, VALUE mtime)
751
+ {
752
+ return rb_funcall(rb_cFile, id_lutime, 3, atime, mtime, get_strpath(self));
753
+ }
754
+
767
755
  /*
768
756
  * Returns the last component of the path.
769
757
  *
@@ -1212,7 +1200,7 @@ path_entries(VALUE self)
1212
1200
  ary = rb_funcall(rb_cDir, id_entries, 1, str);
1213
1201
  ary = rb_convert_type(ary, T_ARRAY, "Array", "to_ary");
1214
1202
  for (i = 0; i < RARRAY_LEN(ary); i++) {
1215
- VALUE elt = RARRAY_AREF(ary, i);
1203
+ VALUE elt = RARRAY_AREF(ary, i);
1216
1204
  elt = rb_class_new_instance(1, &elt, klass);
1217
1205
  rb_ary_store(ary, i, elt);
1218
1206
  }
@@ -1274,6 +1262,7 @@ static VALUE
1274
1262
  path_each_entry(VALUE self)
1275
1263
  {
1276
1264
  VALUE args[1];
1265
+ RETURN_ENUMERATOR(self, 0, 0);
1277
1266
 
1278
1267
  args[0] = get_strpath(self);
1279
1268
  return rb_block_call(rb_cDir, id_foreach, 1, args, each_entry_i, rb_obj_class(self));
@@ -1464,6 +1453,7 @@ path_f_pathname(VALUE self, VALUE str)
1464
1453
  * - #make_symlink(old)
1465
1454
  * - #truncate(length)
1466
1455
  * - #utime(atime, mtime)
1456
+ * - #lutime(atime, mtime)
1467
1457
  * - #basename(*args)
1468
1458
  * - #dirname
1469
1459
  * - #extname
@@ -1521,8 +1511,6 @@ Init_pathname(void)
1521
1511
  rb_cPathname = rb_define_class("Pathname", rb_cObject);
1522
1512
  rb_define_method(rb_cPathname, "initialize", path_initialize, 1);
1523
1513
  rb_define_method(rb_cPathname, "freeze", path_freeze, 0);
1524
- rb_define_method(rb_cPathname, "taint", path_taint, 0);
1525
- rb_define_method(rb_cPathname, "untaint", path_untaint, 0);
1526
1514
  rb_define_method(rb_cPathname, "==", path_eq, 1);
1527
1515
  rb_define_method(rb_cPathname, "===", path_eq, 1);
1528
1516
  rb_define_method(rb_cPathname, "eql?", path_eq, 1);
@@ -1562,6 +1550,7 @@ Init_pathname(void)
1562
1550
  rb_define_method(rb_cPathname, "make_symlink", path_make_symlink, 1);
1563
1551
  rb_define_method(rb_cPathname, "truncate", path_truncate, 1);
1564
1552
  rb_define_method(rb_cPathname, "utime", path_utime, 2);
1553
+ rb_define_method(rb_cPathname, "lutime", path_lutime, 2);
1565
1554
  rb_define_method(rb_cPathname, "basename", path_basename, -1);
1566
1555
  rb_define_method(rb_cPathname, "dirname", path_dirname, 0);
1567
1556
  rb_define_method(rb_cPathname, "extname", path_extname, 0);
@@ -1645,6 +1634,7 @@ InitVM_pathname(void)
1645
1634
  id_lchown = rb_intern("lchown");
1646
1635
  id_link = rb_intern("link");
1647
1636
  id_lstat = rb_intern("lstat");
1637
+ id_lutime = rb_intern("lutime");
1648
1638
  id_mkdir = rb_intern("mkdir");
1649
1639
  id_mtime = rb_intern("mtime");
1650
1640
  id_open = rb_intern("open");
data/lib/pathname.rb CHANGED
@@ -14,6 +14,8 @@ require 'pathname.so'
14
14
 
15
15
  class Pathname
16
16
 
17
+ VERSION = "0.3.0"
18
+
17
19
  # :stopdoc:
18
20
 
19
21
  # to_path is implemented so Pathname objects are usable with File.open, etc.
@@ -338,6 +340,8 @@ class Pathname
338
340
 
339
341
  #
340
342
  # Appends a pathname fragment to +self+ to produce a new Pathname object.
343
+ # Since +other+ is considered as a path relative to +self+, if +other+ is
344
+ # an absolute path, the new Pathname object is created from just +other+.
341
345
  #
342
346
  # p1 = Pathname.new("/usr") # Pathname:/usr
343
347
  # p2 = p1 + "bin/ruby" # Pathname:/usr/bin/ruby
@@ -399,6 +403,8 @@ class Pathname
399
403
 
400
404
  #
401
405
  # Joins the given pathnames onto +self+ to create a new Pathname object.
406
+ # This is effectively the same as using Pathname#+ to append +self+ and
407
+ # all arguments sequentially.
402
408
  #
403
409
  # path0 = Pathname.new("/usr") # Pathname:/usr
404
410
  # path0 = path0.join("bin/ruby") # Pathname:/usr/bin/ruby
@@ -574,9 +580,9 @@ class Pathname # * Find *
574
580
  end
575
581
 
576
582
 
577
- class Pathname # * FileUtils *
578
- autoload(:FileUtils, 'fileutils')
583
+ autoload(:FileUtils, 'fileutils')
579
584
 
585
+ class Pathname # * FileUtils *
580
586
  # Creates a full path, including any intermediate directories that don't yet
581
587
  # exist.
582
588
  #
@@ -588,11 +594,12 @@ class Pathname # * FileUtils *
588
594
 
589
595
  # Recursively deletes a directory, including all directories beneath it.
590
596
  #
591
- # See FileUtils.rm_r
592
- def rmtree
597
+ # See FileUtils.rm_rf
598
+ def rmtree(noop: nil, verbose: nil, secure: nil)
593
599
  # The name "rmtree" is borrowed from File::Path of Perl.
594
600
  # File::Path provides "mkpath" and "rmtree".
595
- FileUtils.rm_r(@path)
601
+ require 'fileutils'
602
+ FileUtils.rm_rf(@path, noop: noop, verbose: verbose, secure: secure)
596
603
  nil
597
604
  end
598
605
  end
data/pathname.gemspec CHANGED
@@ -1,13 +1,20 @@
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.0"
9
+ spec.name = name
10
+ spec.version = version
4
11
  spec.authors = ["Tanaka Akira"]
5
12
  spec.email = ["akr@fsij.org"]
6
13
 
7
14
  spec.summary = %q{Representation of the name of a file or directory on the filesystem}
8
15
  spec.description = %q{Representation of the name of a file or directory on the filesystem}
9
16
  spec.homepage = "https://github.com/ruby/pathname"
10
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
17
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
11
18
  spec.licenses = ["Ruby", "BSD-2-Clause"]
12
19
 
13
20
  spec.metadata["homepage_uri"] = spec.homepage
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.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tanaka Akira
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-14 00:00:00.000000000 Z
11
+ date: 2023-11-07 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:
@@ -18,6 +18,8 @@ extensions:
18
18
  - ext/pathname/extconf.rb
19
19
  extra_rdoc_files: []
20
20
  files:
21
+ - ".git-blame-ignore-revs"
22
+ - ".github/dependabot.yml"
21
23
  - ".github/workflows/test.yml"
22
24
  - ".gitignore"
23
25
  - Gemfile
@@ -45,14 +47,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
45
47
  requirements:
46
48
  - - ">="
47
49
  - !ruby/object:Gem::Version
48
- version: 2.3.0
50
+ version: 2.7.0
49
51
  required_rubygems_version: !ruby/object:Gem::Requirement
50
52
  requirements:
51
53
  - - ">="
52
54
  - !ruby/object:Gem::Version
53
55
  version: '0'
54
56
  requirements: []
55
- rubygems_version: 3.2.22
57
+ rubygems_version: 3.5.0.dev
56
58
  signing_key:
57
59
  specification_version: 4
58
60
  summary: Representation of the name of a file or directory on the filesystem