App-RewriteVersion
view release on metacpan or search on metacpan
Dist::Zilla::Plugin::BumpVersionAfterRelease for more information.
dry_run
my $bool = $app->dry_run;
$app = $app->dry_run(1);
If true, the module will process files as normal but not actually
modify them. Useful with "verbose" to verify expected functionality.
follow_symlinks
my $bool = $app->follow_symlinks;
$app = $app->follow_symlinks(1);
If true, the application will follow symlinked directories when
traversing the distribution for modules. Defaults to false.
global
my $bool = $app->global;
$app = $app->global(1);
If true, the application will replace all version assignments found
instead of just the first instance in each file. Defaults to false.
verbose
my $bool = $app->verbose;
$app = $app->verbose(1);
Enable progress messages to be printed to STDOUT. Defaults to false.
METHODS
new
my $app = App::RewriteVersion->new;
Construct a new App::RewriteVersion object.
bump_version
my $new_version = $app->bump_version($version);
my $new_version = $app->bump_version($version, sub { $_[0] + 1 });
Increments a version string, returning the new version string. An
optional coderef can be passed for custom version bump logic. The
coderef will receive the current version string as the first argument
and is expected to return a new version string. By default,
Version::Next is used. An exception will be thrown if an invalid
version is passed according to the current settings.
current_version
my $current_version = $app->current_version;
my $current_version = $app->current_version(dist_dir => $dist_dir);
my $current_version = $app->current_version(file => $file);
Returns the current version of the distribution using "version_from".
If no file is passed, the main module filename will be guessed from
dist_dir (defaulting to current working directory), using heuristics
similar to Dist::Zilla::Plugin::NameFromDirectory and "main_module" in
Dist::Zilla. For example, if the directory is named Foo-Bar it will
look for lib/Foo/Bar.pm within the distribution, and if that doesn't
exist, the shortest module path found. If the V environment variable is
set, it will be returned regardless of other options. An exception will
be thrown if no version is found in the specified or guessed file, or
if no perl modules could be found.
rewrite_version
my $bool = $app->rewrite_version($file, $version);
my $bool = $app->rewrite_version($file, $version, is_trial => $is_trial);
Rewrites the version of the file at $file to $version if it has a
version assignment in the form our $VERSION = '...';. Returns true if
the version was rewritten, or false if no version assignment was found.
If is_trial is true, # TRIAL will be appended to the version assignment
line when rewriting. The -TRIAL indication is not part of the version
and should be added to the name of the archive you upload to PAUSE,
which is outside of the scope of this tool. An exception will be thrown
if an invalid version is passed, or an I/O error occurs. A warning will
be printed if $version is lower than the version previously declared in
the file.
rewrite_versions
$app = $app->rewrite_versions($version);
$app = $app->rewrite_versions($version, dist_dir => $dist_dir);
$app = $app->rewrite_versions($version, is_trial => 1);
$app = $app->rewrite_versions($version, subdirs => ['lib']);
Rewrites the versions of all perl files found in dist_dir (defaulting
to current working directory) to $version using "rewrite_version". The
subdirs option can be used to specify an arrayref of subdirectories
relative to dist_dir in which versions will be rewritten, otherwise
defaulting to lib, script, and bin. If passed, the is_trial option is
passed through to "rewrite_version". An exception will be thrown if an
invalid version is passed, or an I/O error occurs.
version_from
my $version = $app->version_from($file);
Attempts to read version from the file at $file. Returns undef if no
version assignment was found.
BUGS
Report any issues on the public bugtracker.
AUTHOR
Dan Book <dbook@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2015 by Dan Book.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
SEE ALSO
Dist::Zilla::Plugin::RewriteVersion, Version::Next
( run in 2.079 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )