summaryrefslogtreecommitdiff
path: root/ext/pathname
Commit message (Collapse)AuthorAgeFilesLines
* [ruby/pathname] Expose Pathname::VERSIONHiroshi SHIBATA2023-04-142-2/+11
| | | | https://github.com/ruby/pathname/commit/2b0b1a82ee
* [ruby/pathname] Remove taint/untaint methods because they should be removed ↵Hiroshi SHIBATA2023-03-271-28/+0
| | | | | | | | since Ruby 3.2 released. Fixes https://github.com/ruby/pathname/pull/28 https://github.com/ruby/pathname/commit/c52fd3a835
* Update the depend filesMatt Valentine-House2023-02-281-1/+0
|
* Remove intern/gc.h from Make depsMatt Valentine-House2023-02-271-1/+0
|
* Extract include/ruby/internal/attr/packed_struct.hNobuyoshi Nakada2023-02-081-0/+1
| | | | | | | | | 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`
* [ruby/pathname] Bump version to 0.2.1Hiroshi SHIBATA2022-12-051-1/+1
| | | | https://github.com/ruby/pathname/commit/7e796cc78e
* [ruby/pathname] [Misc #19155] [DOC] Addion of absolute pathsNobuyoshi Nakada2022-12-031-0/+4
| | | | https://github.com/ruby/pathname/commit/3cb5ed2576
* [ruby/pathname] Fix `autoload` of `FileUtils`Nobuyoshi Nakada2022-07-271-2/+2
| | | | | | Should not be `Pathname::FileUtils`. https://github.com/ruby/pathname/commit/d1eb366e73
* Expand tabs [ci skip]Takashi Kokubun2022-07-211-1/+1
| | | | [Misc #18891]
* Merge https://github.com/ruby/pathname/pull/8 for pathnameHiroshi SHIBATA2022-05-201-3/+4
|
* [ruby/pathname] Implement Pathname#lutimeAkinori MUSHA2022-04-211-0/+17
| | | | https://github.com/ruby/pathname/commit/268cb5acff
* [Feature #18249] Update dependenciesPeter Zhu2022-02-221-0/+1
|
* [ruby/pathname] Officially drop support for ruby 2.6 or olderDavid Rodríguez2022-01-251-1/+1
| | | | | | | | | | | | | | | | | 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
* [ruby/pathname] Make Pathname#each_entry return enumerator if called without ↵Jeremy Evans2022-01-071-0/+1
| | | | | | | | block Fixes [Bug #18158] https://github.com/ruby/pathname/commit/914c726aa2
* Update dependenciesNobuyoshi Nakada2021-11-211-1/+0
|
* [ruby/pathname] Bump up pathname version to 0.2.0Hiroshi SHIBATA2021-10-141-1/+1
| | | | https://github.com/ruby/pathname/commit/e6b3b3ed25
* ruby tool/update-deps --fix卜部昌平2021-10-051-14/+23
|
* [Feature #16972] Add mode: option to Pathname#mkpathNobuyoshi Nakada2021-08-311-2/+2
|
* Faster Pathname FileUtils methodsschneems2021-08-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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) ```
* [ruby/pathname] gemspec: Explicitly list 0 executablesOlle Jonsson2021-04-271-1/+1
| | | | | | This gem exposes no executables. https://github.com/ruby/pathname/commit/c401d97d58
* dependency updates卜部昌平2021-04-131-1/+0
|
* [ruby/pathname] Fix segfault of Pathname#splitKenichi Kamiya2021-03-281-1/+1
| | | | | | | | 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
* Forward keyword arguments for Pathname#each_line [Bug #17589]Nobuyoshi Nakada2021-01-291-2/+2
|
* [pathname] Make Pathname Ractor safe (#3940)Kenta Murata2020-12-201-0/+4
|
* Promote pathname to default gemsHiroshi SHIBATA2020-10-141-0/+25
|
* Optimize Pathname#relative? / absolute?Marc-Andre Lafortune2020-09-141-6/+9
|
* Document limitation of Pathname#relative_path_from [ci skip]Jeremy Evans2020-09-021-0/+3
| | | | | | | | | 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]
* sed -i '/rmodule.h/d'卜部昌平2020-08-271-1/+0
|
* sed -i '/r_cast.h/d'卜部昌平2020-08-271-1/+0
|
* sed -i '\,2/extern.h,d'卜部昌平2020-08-271-1/+0
|
* sed -i 's|ruby/impl|ruby/internal|'卜部昌平2020-05-111-140/+140
| | | | To fix build failures.
* sed -i s|ruby/3|ruby/impl|g卜部昌平2020-05-111-140/+140
| | | | This shall fix compile errors.
* Merge pull request #2991 from shyouhei/ruby.h卜部昌平2020-04-081-0/+152
| | | Split ruby.h
* Add `#write` and `#binwrite` to IO section [ci skip]Kazuhiro NISHIYAMA2020-03-021-0/+2
|
* Fix wrong documentation for return value of Pathname#fnmatchMasataka Pocke Kuwabara2020-02-251-2/+2
|
* Fix call-seq of Pathname#{,l}ch{mod,own} [ci skip]Kazuhiro NISHIYAMA2020-02-151-4/+4
|
* Add call-seq to Pathname#open from File.openKazuhiro NISHIYAMA2020-02-041-0/+7
| | | | | | | before: ``` open(p1 = v1, p2 = v2, p3 = v3) ```
* Revert pathname, rb_warn_deprecated* are not public APINobuyoshi Nakada2020-01-231-2/+2
|
* Added rb_warn_deprecated_to_removeNobuyoshi Nakada2020-01-231-2/+2
| | | | | Warn the deprecation and future removal, with obeying the warning flag.
* Make taint warnings non-verbose instead of verboseJeremy Evans2020-01-221-2/+2
|
* Remove unnecessary double bangs from Pathname#root?Masataka Pocke Kuwabara2019-12-171-1/+1
|
* Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans2019-11-181-12/+4
| | | | | | 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.
* Fix more keyword argument separation issues in PathnameJeremy Evans2019-09-261-5/+5
|
* Make rb_scan_args handle keywords more similar to Ruby methods (#2460)Jeremy Evans2019-09-251-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cfuncs that use rb_scan_args with the : entry suffer similar keyword argument separation issues that Ruby methods suffer if the cfuncs accept optional or variable arguments. This makes the following changes to : handling. * Treats as **kw, prompting keyword argument separation warnings if called with a positional hash. * Do not look for an option hash if empty keywords are provided. For backwards compatibility, treat an empty keyword splat as a empty mandatory positional hash argument, but emit a a warning, as this behavior will be removed in Ruby 3. The argument number check needs to be moved lower so it can correctly handle an empty positional argument being added. * If the last argument is nil and it is necessary to treat it as an option hash in order to make sure all arguments are processed, continue to treat the last argument as the option hash. Emit a warning in this case, as this behavior will be removed in Ruby 3. * If splitting the keyword hash into two hashes, issue a warning, as we will not be splitting hashes in Ruby 3. * If the keyword argument is required to fill a mandatory positional argument, continue to do so, but emit a warning as this behavior will be going away in Ruby 3. * If keyword arguments are provided and the last argument is not a hash, that indicates something wrong. This can happen if a cfunc is calling rb_scan_args multiple times, and providing arguments that were not passed to it from Ruby. Callers need to switch to the new rb_scan_args_kw function, which allows passing of whether keywords were provided. This commit fixes all warnings caused by the changes above. It switches some function calls to *_kw versions with appropriate kw_splat flags. If delegating arguments, RB_PASS_CALLED_KEYWORDS is used. If creating new arguments, RB_PASS_KEYWORDS is used if the last argument is a hash to be treated as keywords. In open_key_args in io.c, use rb_scan_args_kw. In this case, the arguments provided come from another C function, not Ruby. The last argument may or may not be a hash, so we can't set keyword argument mode. However, if it is a hash, we don't want to warn when treating it as keywords. In Ruby files, make sure to appropriately use keyword splats or literal keywords when calling Cfuncs that now issue keyword argument separation warnings through rb_scan_args. Also, make sure not to pass nil in place of an option hash. Work around Kernel#warn warnings due to problems in the Rubygems override of the method. There is an open pull request to fix these issues in Rubygems, but part of the Rubygems tests for their override fail on ruby-head due to rb_scan_args not recognizing empty keyword splats, which this commit fixes. Implementation wise, adding rb_scan_args_kw is kind of a pain, because rb_scan_args takes a variable number of arguments. In order to not duplicate all the code, the function internals need to be split into two functions taking a va_list, and to avoid passing in a ton of arguments, a single struct argument is used to handle the variables previously local to the function.
* Make Kernel#{Pathname,BigDecimal,Complex} return argument if given correct typeJeremy Evans2019-09-211-0/+2
| | | | | | | | | | | | This is how Kernel#{Array,String,Float,Integer,Hash,Rational} work. BigDecimal and Complex instances are always frozen, so this should not cause backwards compatibility issues for those. Pathname instances are not frozen, so potentially this could cause backwards compatibility issues by not returning a new object. Based on a patch from Joshua Ballanco, some minor changes by me. Fixes [Bug #7522]
* Include ruby/assert.h in ruby/ruby.h so that assertions can be thereNobuyoshi Nakada2019-07-141-0/+1
|
* Delegates 3 arguments for Pathname.glob.Tanaka Akira2019-07-141-2/+2
| | | | Thanks for the patch by pocke (Masataka Kuwabara) [Feature #14405].
* Try statx syscallnobu2019-02-202-2/+3
| | | | | | | * file.c (rb_file_s_birthtime): export for pathname to check if birthtime is supported. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Removed moving toplevel header since r12501nobu2019-02-081-1/+1
| | | | | | | Moving public headers was 12-years ago, no depend files would expect ruby.h in the top source directory now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Pathname#relative_path_from uses is_a?akr2018-12-181-6/+2
| | | | | | | I reconsidered because simpler code would have better maintainablity. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e