[libdancer-plugin-dbic-perl] 01/01: this plugin is now a thin wrapper around DBICx::Sugar

Jonas Smedegaard dr at jones.dk
Fri Aug 7 12:23:20 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag v0.2102
in repository libdancer-plugin-dbic-perl.

commit 96eacfc5c44a2ac4c5f6ae5c4e8202c1e9f7c059
Author: Naveed Massjouni <naveed at vt.edu>
Date:   Sun Mar 29 05:30:12 2015 -0400

    this plugin is now a thin wrapper around DBICx::Sugar
    
    I created DBICx::Sugar to factor out the code duplication between
    Dancer::Plugin::DBIC and Dancer2::Plugin::DBIC. Now this plugin is just
    a thin wrapper around DBICx::Sugar.
---
 CHANGES                   | 25 +++++++++++--
 Makefile.PL               |  8 ++---
 README.md                 |  8 ++++-
 dist.ini                  |  5 ++-
 lib/Dancer/Plugin/DBIC.pm | 90 ++++++++++++-----------------------------------
 5 files changed, 57 insertions(+), 79 deletions(-)

diff --git a/CHANGES b/CHANGES
index fe31d4a..a75f07a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,11 +1,32 @@
 ==================================================
-Changes from 2005-02-16 00:00:00 +0000 to present.
+Changes from 2005-03-31 00:00:00 +0000 to present.
 ==================================================
 
 -------------------------------------------
-version 0.2101 at 2015-02-14 02:51:01 +0000
+version 0.2102 at 2015-03-29 09:43:56 +0000
 -------------------------------------------
 
+  Change: f50805e2862779940f42a8b80a2d2f8a9bfd6101
+  Author: Naveed Massjouni <naveed at vt.edu>
+  Date : 2015-03-29 05:41:43 +0000
+
+    this plugin is now a thin wrapper around DBICx::Sugar
+
+    I created DBICx::Sugar to factor out the code duplication between
+    Dancer::Plugin::DBIC and Dancer2::Plugin::DBIC. Now this plugin is
+    just a thin wrapper around DBICx::Sugar. 
+
+-------------------------------------------
+version 0.2101 at 2015-02-14 02:52:24 +0000
+-------------------------------------------
+
+  Change: b4b29aa82925bc53370ae15aa66e897085c31db5
+  Author: Naveed Massjouni <naveed at vt.edu>
+  Date : 2015-02-13 21:52:24 +0000
+
+    updated SQL::Translator version requirement to fix cpantesters
+    failures 
+
   Change: 2ee1a4bfad6362fad5907dfe85fb8d866835cef6
   Author: Naveed Massjouni <naveedm9 at gmail.com>
   Date : 2015-01-12 01:16:15 +0000
diff --git a/Makefile.PL b/Makefile.PL
index e907cf1..96267fc 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -21,11 +21,10 @@ my %WriteMakefileArgs = (
   "MIN_PERL_VERSION" => "5.006",
   "NAME" => "Dancer::Plugin::DBIC",
   "PREREQ_PM" => {
-    "DBIx::Class" => 0,
+    "DBICx::Sugar" => 0,
     "Dancer" => "1.3098",
     "Dancer::Plugin" => 0,
     "Module::Load" => 0,
-    "SQL::Translator" => "0.11018",
     "strict" => 0,
     "utf8" => 0,
     "warnings" => 0
@@ -48,7 +47,7 @@ my %WriteMakefileArgs = (
     "base" => 0,
     "lib" => 0
   },
-  "VERSION" => "0.2101",
+  "VERSION" => "0.2102",
   "test" => {
     "TESTS" => "t/*.t"
   }
@@ -58,7 +57,7 @@ my %WriteMakefileArgs = (
 my %FallbackPrereqs = (
   "DBD::SQLite" => 0,
   "DBI" => 0,
-  "DBIx::Class" => 0,
+  "DBICx::Sugar" => 0,
   "DBIx::Class::Core" => 0,
   "DBIx::Class::Schema" => 0,
   "Dancer" => "1.3098",
@@ -71,7 +70,6 @@ my %FallbackPrereqs = (
   "IPC::Open3" => 0,
   "Module::Load" => 0,
   "Module::Load::Conditional" => 0,
-  "SQL::Translator" => "0.11018",
   "Test::Exception" => 0,
   "Test::More" => 0,
   "Test::Requires" => 0,
diff --git a/README.md b/README.md
index 4d81972..b4e7e8e 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ Dancer::Plugin::DBIC - DBIx::Class interface for Dancer applications
 
 # VERSION
 
-version 0.2101
+version 0.2102
 
 # SYNOPSIS
 
@@ -37,6 +37,8 @@ You just need to configure your database connection information.
 For performance, schema objects are cached in memory
 and are lazy loaded the first time they are accessed.
 
+This plugin is now just a thin wrapper around [DBICx::Sugar](https://metacpan.org/pod/DBICx::Sugar).
+
 # CONFIGURATION
 
 Configuration can be done in your [Dancer](https://metacpan.org/pod/Dancer) config file.
@@ -216,6 +218,10 @@ from the root of your project directory:
 
 For this example, your `schema_class` setting would be `'Foo::Schema'`.
 
+# SEE ALSO
+
+- [DBICx::Sugar](https://metacpan.org/pod/DBICx::Sugar)
+
 # CONTRIBUTORS
 
 - Alexis Sukrieh <sukria at sukria.net>
diff --git a/dist.ini b/dist.ini
index 594e0bf..abbd391 100644
--- a/dist.ini
+++ b/dist.ini
@@ -4,7 +4,7 @@ author           = Naveed Massjouni <naveed at vt.edu>
 license          = Perl_5
 copyright_holder = awncorp
 copyright_year   = 2010
-version          = 0.2101
+version          = 0.2102
 
 [@Filter]
 -bundle = @Basic
@@ -34,8 +34,7 @@ repository.web = https://github.com/ironcamel/Dancer-Plugin-DBIC
 
 [Prereqs]
 Dancer          = 1.3098
-DBIx::Class     = 0
-SQL::Translator = 0.11018
+DBICx::Sugar    = 0
 
 [Prereqs / RuntimeRecommends]
 DBIx::Class::Schema::Loader = 0.07002
diff --git a/lib/Dancer/Plugin/DBIC.pm b/lib/Dancer/Plugin/DBIC.pm
index c86aa8b..25d53f6 100644
--- a/lib/Dancer/Plugin/DBIC.pm
+++ b/lib/Dancer/Plugin/DBIC.pm
@@ -7,81 +7,23 @@ use warnings;
 use utf8;
 use Dancer::Plugin;
 use Module::Load;
+use DBICx::Sugar;
 
-my $schemas = {};
-
-sub schema {
+sub _schema {
     my ($self, $name) = plugin_args(@_);
-    my $cfg = plugin_setting;
-
-    if (not defined $name) {
-        if (keys %$cfg == 1) {
-            ($name) = keys %$cfg;
-        } elsif (keys %$cfg) {
-            $name = "default";
-        } else {
-            die "No schemas are configured";
-        }
-    }
-
-    return $schemas->{$name} if $schemas->{$name};
-
-    my $options = $cfg->{$name} or die "The schema $name is not configured";
-    if ( my $alias = $options->{alias} ) {
-        $options = $cfg->{$alias}
-            or die "The schema alias $alias does not exist in the config";
-        return $schemas->{$alias} if $schemas->{$alias};
-    }
-
-    my @conn_info = $options->{connect_info}
-        ? @{$options->{connect_info}}
-        : @$options{qw(dsn user password options)};
-    if ( exists $options->{pass} ) {
-        warn "The pass option is deprecated. Use password instead.";
-        $conn_info[2] = $options->{pass};
-    }
-
-    my $schema;
-
-    if ( my $schema_class = $options->{schema_class} ) {
-        $schema_class =~ s/-/::/g;
-        eval { load $schema_class };
-        die "Could not load schema_class $schema_class: $@" if $@;
-        if ( my $replicated = $options->{replicated} ) {
-            $schema = $schema_class->clone;
-            my %storage_options;
-            my @params = qw( balancer_type balancer_args pool_type pool_args );
-            for my $p ( @params ) {
-                my $value = $replicated->{$p};
-                $storage_options{$p} = $value if defined $value;
-            }
-            $schema->storage_type([ '::DBI::Replicated', \%storage_options ]);
-            $schema->connection( @conn_info );
-            $schema->storage->connect_replicants( @{$replicated->{replicants}});
-        } else {
-            $schema = $schema_class->connect( @conn_info );
-        }
-    } else {
-        my $dbic_loader = 'DBIx::Class::Schema::Loader';
-        eval { load $dbic_loader };
-        die "You must provide a schema_class option or install $dbic_loader."
-            if $@;
-        $dbic_loader->naming( $options->{schema_loader_naming} || 'v7' );
-        $schema = DBIx::Class::Schema::Loader->connect(@conn_info);
-    }
-
-    return $schemas->{$name} = $schema;
+    DBICx::Sugar::config( plugin_setting );
+    return DBICx::Sugar::schema($name);
 };
 
-sub resultset {
+sub _rset {
     my ($self, $rset_name) = plugin_args(@_);
-    return schema->resultset($rset_name);
+    return DBICx::Sugar::schema->resultset($rset_name);
 }
 
-register schema    => \&schema;
-register resultset => \&resultset;
-register rset      => \&resultset;
-register_plugin for_versions => [ 1, 2 ];
+register schema    => \&_schema;
+register resultset => \&_rset;
+register rset      => \&_rset;
+register_plugin;
 
 # ABSTRACT: DBIx::Class interface for Dancer applications
 
@@ -118,6 +60,8 @@ You just need to configure your database connection information.
 For performance, schema objects are cached in memory
 and are lazy loaded the first time they are accessed.
 
+This plugin is now just a thin wrapper around L<DBICx::Sugar>.
+
 =head1 CONFIGURATION
 
 Configuration can be done in your L<Dancer> config file.
@@ -297,6 +241,16 @@ from the root of your project directory:
 
 For this example, your C<schema_class> setting would be C<'Foo::Schema'>.
 
+=head1 SEE ALSO
+
+=over 4
+
+=item *
+
+L<DBICx::Sugar>
+
+=back
+
 =head1 CONTRIBUTORS
 
 =over 4

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libdancer-plugin-dbic-perl.git



More information about the Pkg-perl-cvs-commits mailing list