Граф коммитов

192 Коммитов

Автор SHA1 Сообщение Дата
Hiroshi SHIBATA 0949c586c0 [ruby/pathname] Bump up v0.4.0
https://github.com/ruby/pathname/commit/b020cbde46
2024-11-06 07:09:08 +00:00
schneems 3c54b8e920 Allow method chaining with Pathname#mkpath
Currently in my code when I want to create a pathname object and create a path at the same time I must use tap

```
path = Pathname.new("/tmp/new").tap(&:mkpath)
```

I think it would be cleaner to be able to chain on the results of these methods instead:

```
path = Pathname.new("/tmp/new").mkpath
```
2024-10-04 12:21:27 +09:00
schneems 08346e7267 Introduce Pathname.mktmpdir
When I want to create a tmpdir I often want to manipulate it as a pathname. By introducing Pathname.mktmpdir I can get this behavior. 

Currently I must:

```ruby
Dir.mktmpdir do |dir|
  dir = Pathname(dir)
  # ... code
end
```

I would like to be able to instead:

```ruby
Pathname.mktmpdir do |dir|
  # ... code
end
```
2024-10-04 11:15:33 +09:00
Ivan Kuchin 6c16598a72 [ruby/pathname] use delete_prefix instead of sub in find method
delete_prefix with a string is easier to read than a regular expression
also it should be faster. It is available since ruby 2.5 and the gem requires
ruby 2.7.

https://github.com/ruby/pathname/commit/0070f43f19
2024-09-11 04:49:08 +00:00
卜部昌平 c844968b72 ruby tool/update-deps --fix 2024-04-27 21:55:28 +09:00
Peter Zhu f8f542bd9b [ruby/pathname] Remove check for File.birthtime
File.birthtime has existed since Ruby 2.2, and pathname requires Ruby
>= 2.7.0, so the method will always be there.

https://github.com/ruby/pathname/commit/aca9613bbf
2024-04-16 05:48:57 +00:00
Ivan Kuchin 1f1edeef3f [ruby/pathname] require fileutils in both methods using it
rmtree is already requiring fileutils, but mkpath apparently relies on
autoload of FileUtils. Switch to require for both methods

https://github.com/ruby/pathname/commit/07ad1fb41a
2023-12-28 00:07:56 +00:00
Hiroshi SHIBATA fbb63605c4 [ruby/pathname] Bump up 0.3.0
https://github.com/ruby/pathname/commit/f3d23679b0
2023-11-07 07:55:13 +00:00
Hiroshi SHIBATA 8a06f1a69f [ruby/pathname] Expose Pathname::VERSION
https://github.com/ruby/pathname/commit/2b0b1a82ee
2023-04-14 12:42:36 +09:00
Hiroshi SHIBATA 9b7a7e9cef [ruby/pathname] Remove taint/untaint methods because they should be removed since Ruby 3.2 released.
Fixes https://github.com/ruby/pathname/pull/28

https://github.com/ruby/pathname/commit/c52fd3a835
2023-03-27 07:21:52 +00:00
Matt Valentine-House 5e4b80177e Update the depend files 2023-02-28 09:09:00 -08:00
Matt Valentine-House f38c6552f9 Remove intern/gc.h from Make deps 2023-02-27 10:11:56 -08:00
Nobuyoshi Nakada 899ea35035
Extract include/ruby/internal/attr/packed_struct.h
Split `PACKED_STRUCT` and `PACKED_STRUCT_UNALIGNED` macros into the
macros bellow:
* `RBIMPL_ATTR_PACKED_STRUCT_BEGIN`
* `RBIMPL_ATTR_PACKED_STRUCT_END`
* `RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_BEGIN`
* `RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_END`
2023-02-08 12:34:13 +09:00
Hiroshi SHIBATA 0d5ad44ac3 [ruby/pathname] Bump version to 0.2.1
https://github.com/ruby/pathname/commit/7e796cc78e
2022-12-05 16:33:43 +09:00
Nobuyoshi Nakada b8a73e704d [ruby/pathname] [Misc #19155] [DOC] Addion of absolute paths
https://github.com/ruby/pathname/commit/3cb5ed2576
2022-12-03 15:53:20 +00:00
Nobuyoshi Nakada 64c8291c7e [ruby/pathname] Fix `autoload` of `FileUtils`
Should not be `Pathname::FileUtils`.

https://github.com/ruby/pathname/commit/d1eb366e73
2022-07-27 21:05:10 +09:00
Takashi Kokubun 5b21e94beb Expand tabs [ci skip]
[Misc #18891]
2022-07-21 09:42:04 -07:00
Hiroshi SHIBATA c83ec3aba7
Merge https://github.com/ruby/pathname/pull/8 for pathname 2022-05-20 18:36:01 +09:00
Akinori MUSHA cb02324c4e [ruby/pathname] Implement Pathname#lutime
https://github.com/ruby/pathname/commit/268cb5acff
2022-04-21 17:10:19 +09:00
Peter Zhu 2d5ecd60a5 [Feature #18249] Update dependencies 2022-02-22 09:55:21 -05:00
David Rodríguez de678cd51e
[ruby/pathname] Officially drop support for ruby 2.6 or older
The gem doesn't even install on old rubies, but since the gemspec claims
it's supported, `gem install pathname` will try to install it and print
an error.

This commit doesn't fix the above issue. The only way to fix it would be
to restore support and release a new version that actually supports old
rubies. However, such a change has been proposed and ignored for a long
time.

So this issue proposes to leave that broken but at least bring the
gemspec manifest and the CI matrix in sync to hopefully avoid this issue
from happening again in the future.

https://github.com/ruby/pathname/commit/3ee010b538
2022-01-25 08:50:31 +09:00
Jeremy Evans dd6a75195a [ruby/pathname] Make Pathname#each_entry return enumerator if called without block
Fixes [Bug #18158]

https://github.com/ruby/pathname/commit/914c726aa2
2022-01-07 09:42:09 +09:00
Nobuyoshi Nakada ac152b3cac
Update dependencies 2021-11-21 16:21:18 +09:00
Hiroshi SHIBATA b7f557178d [ruby/pathname] Bump up pathname version to 0.2.0
https://github.com/ruby/pathname/commit/e6b3b3ed25
2021-10-14 21:08:03 +09:00
卜部昌平 5c167a9778 ruby tool/update-deps --fix 2021-10-05 14:18:23 +09:00
Nobuyoshi Nakada 2dd26bed86
[Feature #16972] Add mode: option to Pathname#mkpath 2021-08-31 11:53:41 +09:00
schneems 51070ee5c4 Faster Pathname FileUtils methods
Currently when calling any of the "FileUtils" methods on pathname `require` is called every time even though that library might already be loaded. This is slow:

We can speed it up by either checking first if the constant is already defined, or by using autoload.

Using defined speeds up the action by about 300x and using autoload is about twice as fast as that (600x faster than current require method).

I'm proposing we use autoload:

```ruby
require 'benchmark/ips'

Benchmark.ips do |x|
  autoload(:FileUtils, "fileutils")
  x.report("require") { require 'fileutils' }
  x.report("defined") { require 'fileutils' unless defined?(FileUtils) }
  x.report("autoload") { FileUtils }

  x.compare!
end

# Warming up --------------------------------------
#              require     3.624k i/100ms
#              defined     1.465M i/100ms
#             autoload     2.320M i/100ms
# Calculating -------------------------------------
#              require     36.282k (± 2.4%) i/s -    184.824k in   5.097153s
#              defined     14.539M (± 2.0%) i/s -     73.260M in   5.041161s
#             autoload     23.100M (± 1.9%) i/s -    115.993M in   5.023271s

# Comparison:
#             autoload: 23099779.2 i/s
#              defined: 14538544.9 i/s - 1.59x  (± 0.00) slower
#              require:    36282.3 i/s - 636.67x  (± 0.00) slower
```

Because this autoload is scoped to Pathname it will not change the behavior of existing programs that are not expecting FileUtils to be loaded yet:

```
ruby -rpathname -e "class Pathname; autoload(:FileUtils, 'fileutils'); end; puts FileUtils.exist?"
Traceback (most recent call last):
-e:1:in `<main>': uninitialized constant FileUtils (NameError)
```
2021-08-30 15:18:11 +09:00
Olle Jonsson ad3f4c07d9 [ruby/pathname] gemspec: Explicitly list 0 executables
This gem exposes no executables.

https://github.com/ruby/pathname/commit/c401d97d58
2021-04-27 20:52:48 +09:00
卜部昌平 6413dc27dc dependency updates 2021-04-13 14:30:21 +09:00
Kenichi Kamiya 9af57eeed6
[ruby/pathname] Fix segfault of Pathname#split
Fix segmentation fault of Pathname#split when File.split returns
non array value [Bug #17755]

https://github.com/ruby/pathname/commit/e29b49e3b1
https://github.com/ruby/pathname/commit/1db7479a74
2021-03-28 14:04:10 +09:00
Nobuyoshi Nakada 9241211538 Forward keyword arguments for Pathname#each_line [Bug #17589] 2021-01-29 14:27:53 +09:00
Kenta Murata de80b92891
[pathname] Make Pathname Ractor safe (#3940) 2020-12-20 00:40:47 +09:00
Hiroshi SHIBATA 9aab916990
Promote pathname to default gems 2020-10-14 14:42:53 +09:00
Marc-Andre Lafortune 39312cf4d6 Optimize Pathname#relative? / absolute? 2020-09-14 14:18:23 -04:00
Jeremy Evans cc5b7ed1dc Document limitation of Pathname#relative_path_from [ci skip]
This method is explicitly documented to not access the filesystem,
and the only way to get the correct behavior for a case where the
filesystem's case sensitivity differs from the operating system
default would be to access the filesystem.

Fixes [Bug #15417]
2020-09-02 10:34:33 -07:00
卜部昌平 490010084e sed -i '/rmodule.h/d' 2020-08-27 16:42:06 +09:00
卜部昌平 756403d775 sed -i '/r_cast.h/d' 2020-08-27 15:03:36 +09:00
卜部昌平 0da2a3f1fc sed -i '\,2/extern.h,d' 2020-08-27 14:07:49 +09:00
卜部昌平 9e41a75255 sed -i 's|ruby/impl|ruby/internal|'
To fix build failures.
2020-05-11 09:24:08 +09:00
卜部昌平 d7f4d732c1 sed -i s|ruby/3|ruby/impl|g
This shall fix compile errors.
2020-05-11 09:24:08 +09:00
卜部昌平 9e6e39c351
Merge pull request #2991 from shyouhei/ruby.h
Split ruby.h
2020-04-08 13:28:13 +09:00
Kazuhiro NISHIYAMA 761528e8aa
Add `#write` and `#binwrite` to IO section [ci skip] 2020-03-02 16:05:44 +09:00
Masataka Pocke Kuwabara fa1ec60424 Fix wrong documentation for return value of Pathname#fnmatch 2020-02-25 16:53:35 +13:00
Kazuhiro NISHIYAMA 79ad50d219
Fix call-seq of Pathname#{,l}ch{mod,own} [ci skip] 2020-02-15 12:14:12 +09:00
Kazuhiro NISHIYAMA 3c7a09ece8
Add call-seq to Pathname#open from File.open
before:
```
  open(p1 = v1, p2 = v2, p3 = v3)
```
2020-02-04 20:56:13 +09:00
Nobuyoshi Nakada 27ac1c615d
Revert pathname, rb_warn_deprecated* are not public API 2020-01-23 21:49:58 +09:00
Nobuyoshi Nakada aefb13eb63
Added rb_warn_deprecated_to_remove
Warn the deprecation and future removal, with obeying the warning
flag.
2020-01-23 21:42:15 +09:00
Jeremy Evans e18b817b1f Make taint warnings non-verbose instead of verbose 2020-01-22 11:19:13 -08:00
Masataka Pocke Kuwabara 8f52604b47 Remove unnecessary double bangs from Pathname#root? 2019-12-17 14:14:54 +09:00
Jeremy Evans ffd0820ab3 Deprecate taint/trust and related methods, and make the methods no-ops
This removes the related tests, and puts the related specs behind
version guards.  This affects all code in lib, including some
libraries that may want to support older versions of Ruby.
2019-11-18 01:00:25 +02:00