App-RewriteVersion

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    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.

lib/App/RewriteVersion.pm  view on Meta::CPAN

	print qq{Guessing distribution name is $name\n} if $self->verbose;
	
	return $name;
}

sub _main_module {
	my ($self, $dist_dir) = @_;
	
	# Adapted from Dist::Zilla
	my $main;
	(my $guess = $self->_dist_name($dist_dir)) =~ s{-}{/}g;
	$main = $dist_dir->child("lib/$guess.pm");
	unless ($main->exists) {
		$main = path($self->_shortest_module($dist_dir));
	}
	croak qq{Could not find any modules to retrieve version from}
		unless defined $main and $main->exists;
	
	print qq{Using "$main" as dist's main module\n} if $self->verbose;
	return $main;
}

lib/App/RewriteVersion.pm  view on Meta::CPAN

new version string. By default, L<Version::Next> is used. An exception will be
thrown if an invalid version is passed according to the current settings.

=head2 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 L</"version_from">. If no
C<file> is passed, the main module filename will be guessed from C<dist_dir>
(defaulting to current working directory), using heuristics similar to
L<Dist::Zilla::Plugin::NameFromDirectory> and L<Dist::Zilla/"main_module">. For
example, if the directory is named C<Foo-Bar> it will look for
C<lib/Foo/Bar.pm> within the distribution, and if that doesn't exist, the
shortest module path found. If the C<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.

=head2 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 C<$file> to C<$version> if it has a version
assignment in the form C<our $VERSION = '...';>. Returns true if the version
was rewritten, or false if no version assignment was found. If C<is_trial> is

script/perl-bump-version  view on Meta::CPAN

Distribution directory to operate on, defaults to current working directory.

=head2 -d, --dry-run

Run as normal but don't actually update any files. Useful with C<--verbose> to
verify expected functionality.

=head2 -f, --from <file>

File to read main version from. If unspecified, the main module of the
distribution will be guessed in order to determine its version, see
L<App::RewriteVersion/"current_version">. Ignored if the C<V> environment
variable is set.

=head2 -g, --global

Update all instances of version assignment, instead of just the first
occurrence in each file.

=head2 -L, --follow-symlinks

script/perl-rewrite-version  view on Meta::CPAN

Distribution directory to operate on, defaults to current working directory.

=head2 -d, --dry-run

Run as normal but don't actually update any files. Useful with C<--verbose> to
verify expected functionality.

=head2 -f, --from <file>

File to read main version from. If unspecified, the main module of the
distribution will be guessed in order to determine its version, see
L<App::RewriteVersion/"current_version">. Ignored if the C<V> environment
variable or the C<-V> option is set.

=head2 -g, --global

Update all instances of version assignment, instead of just the first
occurrence in each file.

=head2 -L, --follow-symlinks



( run in 0.826 second using v1.01-cache-2.11-cpan-748bfb374f4 )