hitode909 / app-prt Goto Github PK
View Code? Open in Web Editor NEWCommand line tool for Perl code refactoring
Home Page: https://metacpan.org/release/App-PRT
License: Other
Command line tool for Perl code refactoring
Home Page: https://metacpan.org/release/App-PRT
License: Other
Currently, App::PRT::Collector::AllFiles::find_project_root_directory()
only looks for cpanfile
to determine the project root. However, this means that it cannot find non-cpanfile
, non-git clone
project roots. Example repro:
Term::Choose
from https://cpan.metacpan.org/authors/id/K/KU/KUERBIS/Term-Choose-1.653.tar.gz . (I picked this one at random as an example.)tar xvzf Term-Choose-1.653.tar.gz
cd Term-Choose-1.653
prt list_files
Expected output: names of files in .
, lib
, t
, xt
Observed output: Cannot decide target files at <...>/site_perl/5.26.2/App/PRT/CLI.pm line 57.
I think the fix may be as simple as changing this to:
if (-e $current->file('cpanfile') || -e $current->file('Makefile.PL') || -e $current->file('Build.PL')) {
What do you think? Thanks!
I just wanted to say, prt
is wonderful. I can't wait to see how this project evolves.
I see that prt help
was removed in #31. However, would it be possible to special-case -h
/--help
to invoke pod2usage? I just tripped over that. I am willing to send a PR if you are open to this idea. Please let me know either way. Thanks!
It seems like the prt
command has a little unusual CLI interface where it takes the command name, then arbitrary length of arguments to the command, and finally filenames.
I wonder if this could be made simpler if prt
command works against a work directory, much like git, so when you run prt rename_class Foo Bar
it renames the package Foo to Bar in all perl files (by default *.pm
and *.t
) under the current directory.
To get this one step further, prt
could actually be more "git-aware" in a way that:
.git/
directory (could be also useful to avoid accidental file overwrites against wrong files)git mv
when renaming filesgit ls-files
)This is just a thought.
Maybe the default prt
command shouldn't limit the scope of commands in a way git
is a requirement, but majority of use case will benefit from git being more tightly integrated. (There could probably git-prt
shell wrapper, so that you can do git prt rename_class ...
)
Test module t::test
calls use lib
to add lib/
to @INC
regardless of run configuration. From here:
use lib file(__FILE__)->dir->parent->subdir('lib')->stringify;
Why is that? I commented it out and can still run ./Build test
, PERL_USE_UNSAFE_INC=1 prove -l
, and PERL_USE_UNSAFE_INC=1 minil test
successfully on Perl 5.26.2.
The reason I ask is that I am working on the tests for #40, and I want to detect whether we are running from lib/
or blib/
. With the above line in t::test
, lib
is included ahead of blib
.
Would you please let me know why that line was added, if you happen to remember? If you are not sure, may I suggest removing it? Thanks!
This relates to https://github.com/hitode909/App-PRT/blob/master/lib/App/PRT/CLI.pm#L72-L75 . In my testing,
$ prt list_files 'lib/**/*.pm'
lib/**/*.pm does not exist at lib/App/PRT/Collector/Files.pm line 17.
However,
shopt -s globstar; prt list_files lib/**/*.pm
works fine, because the shell expands the wildcards.
Should prt itself be able to expand wildcards? In #36 (comment) , @hitode909 mentioned
File::Zglob
may resolve the glob issue. I'll try this module later.
I know there is also https://metacpan.org/pod/File::Globstar .
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.