App-DocKnot
view release on metacpan or search on metacpan
lib/App/DocKnot/Spin/Versions.pm view on Meta::CPAN
}
# Update the version and release date for a package. Add the change to Git if
# the .versions file is at the top of a Git repository.
#
# $package - Name of the package
# $version - New version
# $timestamp - New release date as seconds since epoch
#
# Throws: Text exception on failure
sub update_version {
my ($self, $package, $version, $timestamp) = @_;
my $date = strftime('%Y-%m-%d', localtime($timestamp));
my $time = strftime('%H:%M:%S', localtime($timestamp));
# Edits the line for the package to replace the version and release date.
my $edit = sub {
my ($product, $old_version, $old_date, $old_time) = split(q{ });
return if $product ne $package;
# We're going to replace the old version with the new one, but we need
lib/App/DocKnot/Update.pm view on Meta::CPAN
bless($self, $class);
return $self;
}
# Update an older version of DocKnot configuration. Currently, this only
# handles the old JSON format.
#
# Raises: autodie exception on failure to read metadata
# Text exception on inconsistencies in the package data
# Text exception if schema checking failed on the converted config
sub update {
my ($self) = @_;
# Ensure we were given a valid metadata argument.
if (!$self->{metadata}->is_dir()) {
my $metadata = $self->{metadata};
croak("metadata path $metadata does not exist or is not a directory");
}
# Tell YAML::XS that we'll be feeding it JSON::PP booleans.
local $YAML::XS::Boolean = 'JSON::PP';
lib/App/DocKnot/Update.pm view on Meta::CPAN
# Write the new YAML package configuration.
YAML::XS::DumpFile($self->{output}->stringify(), $data_ref);
return;
}
# Update an input tree for spin to the current format.
#
# $path - Optional path to the spin input tree, defaults to current directory
#
# Raises: Text exception on failure
sub update_spin {
my ($self, $path) = @_;
$path = defined($path) ? path($path) : path(q{.});
my $repo;
if ($path->child('.git')->is_dir()) {
$repo = Git::Repository->new(work_tree => "$path");
}
# Convert all *.faq files to *.spin files.
my $rule = Path::Iterator::Rule->new()->name(qr{ [.] faq \z }xms);
my $iter = $rule->iter($path, { follow_symlinks => 0 });
t/lib/Test/RRA/ModuleVersion.pm view on Meta::CPAN
return;
}
# Update the versions of all modules to the current distribution version.
#
# $root - Directory under which to look for Perl modules
# $version - The version all those modules should have
#
# Returns: undef
# Throws: Text exception on fatal errors
sub update_module_versions {
my ($root, $version) = @_;
my @modules = _module_files($root);
for my $module (@modules) {
_update_module_version($module, $version);
}
return;
}
1;
__END__
( run in 0.355 second using v1.01-cache-2.11-cpan-95122f20152 )