Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision fd6e2de4

Von Sven Schöling vor mehr als 13 Jahren hinzugefügt

  • ID fd6e2de4d2753ee73574abfaff1d37c0916fea3a
  • Vorgänger f5976361
  • Nachfolger 3d145cb7

rose_auto_create_model: --diff, --dry-run alias für -n

Unterschiede anzeigen:

scripts/rose_auto_create_model.pl
my $file_exists = -f $meta_file;
if ($file_exists) {
my $old_size = -s $meta_file;
my $old_md5 = md5_hex(do { local(@ARGV, $/) = ($meta_file); <> });
my $orig_file = do { local(@ARGV, $/) = ($meta_file); <> };
my $old_md5 = md5_hex($orig_file);
my $new_size = length $full_definition;
my $new_md5 = md5_hex($full_definition);
if ($old_size == $new_size && $old_md5 == $new_md5) {
notice("No changes in $meta_file, skipping.") if $config{verbose};
return;
}
show_diff(\$orig_file, \$full_definition) if $config{show_diff};
}
if (!$config{nocommit}) {
......
all => \ my $all,
sugar => \ my $sugar,
'no-commit' => \ my $nocommit,
'dry-run' => \ my $nocommit,
help => sub { pod2usage(verbose => 99, sections => 'NAME|SYNOPSIS|OPTIONS') },
verbose => \ my $verbose,
diff => \ my $diff,
);
$options->{login} = $login if $login;
......
$options->{all} = $all;
$options->{nocommit} = $nocommit;
$options->{verbose} = $verbose;
if ($diff) {
if (eval { require Text::Diff; 1 }) {
$options->{show_diff} = 1;
} else {
error('Could not load Text::Diff. Sorry, no diffs for you.');
}
}
}
sub show_diff {
my ($text_a, $text_b) = @_;
my %colors = (
'+' => 'green',
'-' => 'red',
);
Text::Diff::diff($text_a, $text_b, { OUTPUT => sub {
for (split /\n/, $_[0]) {
print colored($_, $colors{substr($_, 0, 1)}), $/;
}
}});
}
sub usage {
......
you debug schema awareness of the RDBO layer.
=item C<--no-commit, -n>
=item C<--dry-run>
Do not write back generated files. This will do everything as usual but not
actually modify any files.
=item C<--diff>
Displays diff for selected file, if file is present and never file is
different. bware, does not imply C<no-commit>.
=item C<--help, -h>
Print this help.

Auch abrufbar als: Unified diff