pathname 0.2.0 → 0.2.1

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: 222ab05e8698152edf5c4d2db5215d1385281d77e408234a03e9417d8f7e33c6
4
+ data.tar.gz: f267783875853911d60d63e08d7e871ba4562a84a73a335d1b72b453c3665a59
5
5
  SHA512:
6
- metadata.gz: 268cbeca3ea44caea9c811b3e9ae12b63b294993c4af419be43e70f1ba599af7391ffa02fd25377f4cd254e2879075cef96fa4dc6776aab36c37ab1d9defaeed
7
- data.tar.gz: c7ded65024e264c8c2fcad21879a0af24dba969d5d94d91015c8d6922aa303e3727babf6eb1425a50d45f6a363b7784da7162d7454c48a34f5a477fc319041f0
6
+ metadata.gz: 0b2b4a31d31f5e5dc9fe356c6a25a5a8f40b573604c073b9090ec53c09bafac5aafa61339b1396136659ef0ddeb1932955eb4e43f2ab7d83a906509a9412b313
7
+ data.tar.gz: 789a9cd9d5929793cabecde7d8a023ce153d1b5c11ef85da85aa8e0a74a427c85162c7cc0d09e85c3f33e8ee2f2d43bfeabed665fdd5f2742dec3611662204dd
@@ -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'
@@ -7,7 +7,7 @@ jobs:
7
7
  name: build (${{ matrix.ruby }} / ${{ matrix.os }})
8
8
  strategy:
9
9
  matrix:
10
- ruby: [ '3.0', head ]
10
+ ruby: [ 2.7, '3.0', 3.1, head ]
11
11
  os: [ ubuntu-latest, macos-latest, windows-latest ]
12
12
  exclude:
13
13
  - { os: windows-latest , ruby: head }
@@ -16,11 +16,12 @@ jobs:
16
16
  - { os: windows-latest , ruby: mswin }
17
17
  runs-on: ${{ matrix.os }}
18
18
  steps:
19
- - uses: actions/checkout@v2
19
+ - uses: actions/checkout@v3
20
20
  - name: Set up Ruby
21
21
  uses: ruby/setup-ruby@v1
22
22
  with:
23
23
  ruby-version: ${{ matrix.ruby }}
24
- bundler-cache: true # 'bundle install' and cache
24
+ - name: Install dependencies
25
+ run: bundle install
25
26
  - name: Run test
26
- run: bundle exec rake compile test
27
+ run: rake compile test
@@ -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;
@@ -764,6 +765,19 @@ path_utime(VALUE self, VALUE atime, VALUE mtime)
764
765
  return rb_funcall(rb_cFile, id_utime, 3, atime, mtime, get_strpath(self));
765
766
  }
766
767
 
768
+ /*
769
+ * Update the access and modification times of the file.
770
+ *
771
+ * Same as Pathname#utime, but does not follow symbolic links.
772
+ *
773
+ * See File.lutime.
774
+ */
775
+ static VALUE
776
+ path_lutime(VALUE self, VALUE atime, VALUE mtime)
777
+ {
778
+ return rb_funcall(rb_cFile, id_lutime, 3, atime, mtime, get_strpath(self));
779
+ }
780
+
767
781
  /*
768
782
  * Returns the last component of the path.
769
783
  *
@@ -1212,7 +1226,7 @@ path_entries(VALUE self)
1212
1226
  ary = rb_funcall(rb_cDir, id_entries, 1, str);
1213
1227
  ary = rb_convert_type(ary, T_ARRAY, "Array", "to_ary");
1214
1228
  for (i = 0; i < RARRAY_LEN(ary); i++) {
1215
- VALUE elt = RARRAY_AREF(ary, i);
1229
+ VALUE elt = RARRAY_AREF(ary, i);
1216
1230
  elt = rb_class_new_instance(1, &elt, klass);
1217
1231
  rb_ary_store(ary, i, elt);
1218
1232
  }
@@ -1274,6 +1288,7 @@ static VALUE
1274
1288
  path_each_entry(VALUE self)
1275
1289
  {
1276
1290
  VALUE args[1];
1291
+ RETURN_ENUMERATOR(self, 0, 0);
1277
1292
 
1278
1293
  args[0] = get_strpath(self);
1279
1294
  return rb_block_call(rb_cDir, id_foreach, 1, args, each_entry_i, rb_obj_class(self));
@@ -1464,6 +1479,7 @@ path_f_pathname(VALUE self, VALUE str)
1464
1479
  * - #make_symlink(old)
1465
1480
  * - #truncate(length)
1466
1481
  * - #utime(atime, mtime)
1482
+ * - #lutime(atime, mtime)
1467
1483
  * - #basename(*args)
1468
1484
  * - #dirname
1469
1485
  * - #extname
@@ -1562,6 +1578,7 @@ Init_pathname(void)
1562
1578
  rb_define_method(rb_cPathname, "make_symlink", path_make_symlink, 1);
1563
1579
  rb_define_method(rb_cPathname, "truncate", path_truncate, 1);
1564
1580
  rb_define_method(rb_cPathname, "utime", path_utime, 2);
1581
+ rb_define_method(rb_cPathname, "lutime", path_lutime, 2);
1565
1582
  rb_define_method(rb_cPathname, "basename", path_basename, -1);
1566
1583
  rb_define_method(rb_cPathname, "dirname", path_dirname, 0);
1567
1584
  rb_define_method(rb_cPathname, "extname", path_extname, 0);
@@ -1645,6 +1662,7 @@ InitVM_pathname(void)
1645
1662
  id_lchown = rb_intern("lchown");
1646
1663
  id_link = rb_intern("link");
1647
1664
  id_lstat = rb_intern("lstat");
1665
+ id_lutime = rb_intern("lutime");
1648
1666
  id_mkdir = rb_intern("mkdir");
1649
1667
  id_mtime = rb_intern("mtime");
1650
1668
  id_open = rb_intern("open");
data/lib/pathname.rb CHANGED
@@ -338,6 +338,8 @@ class Pathname
338
338
 
339
339
  #
340
340
  # Appends a pathname fragment to +self+ to produce a new Pathname object.
341
+ # Since +other+ is considered as a path relative to +self+, if +other+ is
342
+ # an absolute path, the new Pathname object is created from just +other+.
341
343
  #
342
344
  # p1 = Pathname.new("/usr") # Pathname:/usr
343
345
  # p2 = p1 + "bin/ruby" # Pathname:/usr/bin/ruby
@@ -399,6 +401,8 @@ class Pathname
399
401
 
400
402
  #
401
403
  # Joins the given pathnames onto +self+ to create a new Pathname object.
404
+ # This is effectively the same as using Pathname#+ to append +self+ and
405
+ # all arguments sequentially.
402
406
  #
403
407
  # path0 = Pathname.new("/usr") # Pathname:/usr
404
408
  # path0 = path0.join("bin/ruby") # Pathname:/usr/bin/ruby
@@ -574,9 +578,9 @@ class Pathname # * Find *
574
578
  end
575
579
 
576
580
 
577
- class Pathname # * FileUtils *
578
- autoload(:FileUtils, 'fileutils')
581
+ autoload(:FileUtils, 'fileutils')
579
582
 
583
+ class Pathname # * FileUtils *
580
584
  # Creates a full path, including any intermediate directories that don't yet
581
585
  # exist.
582
586
  #
@@ -588,11 +592,12 @@ class Pathname # * FileUtils *
588
592
 
589
593
  # Recursively deletes a directory, including all directories beneath it.
590
594
  #
591
- # See FileUtils.rm_r
592
- def rmtree
595
+ # See FileUtils.rm_rf
596
+ def rmtree(noop: nil, verbose: nil, secure: nil)
593
597
  # The name "rmtree" is borrowed from File::Path of Perl.
594
598
  # File::Path provides "mkpath" and "rmtree".
595
- FileUtils.rm_r(@path)
599
+ require 'fileutils'
600
+ FileUtils.rm_rf(@path, noop: noop, verbose: verbose, secure: secure)
596
601
  nil
597
602
  end
598
603
  end
data/pathname.gemspec CHANGED
@@ -1,13 +1,13 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "pathname"
3
- spec.version = "0.2.0"
3
+ spec.version = "0.2.1"
4
4
  spec.authors = ["Tanaka Akira"]
5
5
  spec.email = ["akr@fsij.org"]
6
6
 
7
7
  spec.summary = %q{Representation of the name of a file or directory on the filesystem}
8
8
  spec.description = %q{Representation of the name of a file or directory on the filesystem}
9
9
  spec.homepage = "https://github.com/ruby/pathname"
10
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
10
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
11
11
  spec.licenses = ["Ruby", "BSD-2-Clause"]
12
12
 
13
13
  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.2.1
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: 2022-12-05 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.4.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