view release on metacpan or search on metacpan
lib/Anego.pm view on Meta::CPAN
package Anego;
use 5.008001;
use strict;
use warnings;
use utf8;
our $VERSION = "0.02";
1;
__END__
=encoding utf-8
=head1 NAME
lib/Anego/CLI.pm view on Meta::CPAN
package Anego::CLI;
use strict;
use warnings;
use utf8;
use Getopt::Long;
use Module::Load;
use Try::Tiny;
use Anego::Logger;
sub run {
my ($self, @args) = @_;
local @ARGV = @args;
lib/Anego/CLI/Diff.pm view on Meta::CPAN
package Anego::CLI::Diff;
use strict;
use warnings;
use utf8;
use Anego::Config;
use Anego::Logger;
use Anego::Task::Diff;
use Anego::Task::SchemaLoader;
use Anego::Util;
sub run {
my ($class, @args) = @_;
my $config = Anego::Config->load;
lib/Anego/CLI/Help.pm view on Meta::CPAN
package Anego::CLI::Help;
use strict;
use warnings;
use utf8;
sub run {
my ($class, @args) = @_;
my $module = 'Anego';
system 'perldoc', $module;
}
1;
lib/Anego/CLI/Migrate.pm view on Meta::CPAN
package Anego::CLI::Migrate;
use strict;
use warnings;
use utf8;
use Anego::Config;
use Anego::Logger;
use Anego::Task::Diff;
use Anego::Task::SchemaLoader;
use Anego::Util;
sub run {
my ($class, @args) = @_;
my $config = Anego::Config->load;
lib/Anego/CLI/Status.pm view on Meta::CPAN
package Anego::CLI::Status;
use strict;
use warnings;
use utf8;
use Anego::Config;
use Anego::Logger;
use Anego::Task::GitLog;
sub run {
my $config = Anego::Config->load;
my $logs = Anego::Task::GitLog->fetch;
errorf("No change log\n") if @{ $logs } == 0;
lib/Anego/CLI/Version.pm view on Meta::CPAN
package Anego::CLI::Version;
use strict;
use warnings;
use utf8;
use Anego;
sub run {
print "Anego: $Anego::VERSION\n";
}
1;
lib/Anego/Config.pm view on Meta::CPAN
package Anego::Config;
use strict;
use warnings;
use utf8;
use File::Spec;
use DBI;
use Anego::Logger;
our $CONFIG_PATH;
our $CONFIG;
sub config_path { $CONFIG_PATH || './.anego.pl' }
lib/Anego/Git.pm view on Meta::CPAN
package Anego::Git;
use strict;
use warnings;
use utf8;
use parent qw/ Exporter /;
use Git::Repository;
use Anego::Logger;
our @EXPORT = qw/ git_log git_cat_file /;
sub git_log {
Git::Repository->new->run('log', @_);
}
lib/Anego/Logger.pm view on Meta::CPAN
package Anego::Logger;
use strict;
use warnings;
use utf8;
use parent qw/ Exporter /;
use Term::ANSIColor qw/ colored /;
our @EXPORT = qw/ infof warnf errorf /;
use constant {
INFO => 1,
WARN => 2,
ERROR => 3,
lib/Anego/Task/Diff.pm view on Meta::CPAN
package Anego::Task::Diff;
use strict;
use warnings;
use utf8;
use SQL::Translator::Diff;
use Anego::Config;
sub diff {
my ($class, $source, $target) = @_;
my $config = Anego::Config->load;
my $diff = SQL::Translator::Diff->new({
output_db => $config->rdbms,
lib/Anego/Task/GitLog.pm view on Meta::CPAN
package Anego::Task::GitLog;
use strict;
use warnings;
use utf8;
use Anego::Config;
use Anego::Git;
use Anego::Logger;
sub fetch {
my $config = Anego::Config->load;
my @revs = map { +{
hash => $_->[0],
message => $_->[1],
lib/Anego/Task/SchemaLoader.pm view on Meta::CPAN
package Anego::Task::SchemaLoader;
use strict;
use warnings;
use utf8;
use Digest::MD5 qw/ md5_hex /;
use SQL::Translator;
use Anego::Config;
use Anego::Git;
use Anego::Logger;
sub from {
my $class = shift;
my $method = lc(shift || 'latest');
lib/Anego/Util.pm view on Meta::CPAN
package Anego::Util;
use strict;
use warnings;
use utf8;
use parent qw/ Exporter /;
use Anego::Logger;
use Anego::Config;
our @EXPORT = qw/ do_sql /;
sub do_sql {
my ($sql) = @_;
my $config = Anego::Config->load;
script/anego view on Meta::CPAN
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use lib 'lib';
use Anego::CLI;
Anego::CLI->run(@ARGV);
chdir $repo->work_tree;
mkdir File::Spec->catdir(qw/ lib /);
mkdir File::Spec->catdir(qw/ lib MyApp /);
my $schema_file = File::Spec->catfile($repo->work_tree, qw/ lib MyApp Schema.pm /);
my $schema1 = <<__SCHEMA__;
package MyApp::Schema;
use strict;
use warnings;
use utf8;
use DBIx::Schema::DSL;
database 'SQLite';
create_table user => columns {
integer 'id' => not_null, unsigned, primary_key;
varchar 'name' => not_null;
};
__SCHEMA__
spew($schema_file, $schema1);
$repo->run('add', $schema_file);
$repo->run('commit', '-m', 'initial commit');
my $schema2 = <<__SCHEMA__;
package MyApp::Schema;
use strict;
use warnings;
use utf8;
use DBIx::Schema::DSL;
database 'SQLite';
create_table user => columns {
integer 'id' => not_null, unsigned, primary_key;
varchar 'name' => not_null;
datetime 'created_at' => not_null;