App-BambooCli

 view release on metacpan or  search on metacpan

lib/App/BambooCli/Config.pm  view on Meta::CPAN

package App::BambooCli::Config;

# Created on: 2019-06-03 12:55:20
# Create by:  Ivan Wills
# $Id$
# $Revision$, $HeadURL$, $Date$
# $Revision$, $Source$, $Date$

use Moo;
use warnings;
use version;
use Carp;
use Scalar::Util;
use List::Util;
#use List::MoreUtils;
use Data::Dumper qw/Dumper/;
use English qw/ -no_match_vars /;
use Net::Bamboo;

our $VERSION = version->new('0.0.1');

has name => (
    is      => 'rw',
    default => sub {
        return -f '.bamboo' ? '.bamboo' : "$ENV{HOME}/.bamboo";
    },
);
has bamboo => (
    is      => 'rw',
    lazy    => 1,
    builder => '_bamboo',
);
has [qw/ hostname username password debug /] => (
    is      => 'rw',
);

sub _bamboo {
    my ($self) = @_;
    my $bamboo = new Net::Bamboo;

    $bamboo->hostname($self->hostname);
    $bamboo->debug($self->debug);

    if ($self->username && $self->password) {
        $bamboo->username($self->username);
        $bamboo->password($self->password);
    }

    return $bamboo;
}

1;

__END__

=head1 NAME

App::BambooCli::Config - Stores the configuration for the bamboo commands

=head1 VERSION

This documentation refers to App::BambooCli::Config version 0.0.1

=head1 SYNOPSIS

   use App::BambooCli::Config;

   # Brief but working code example(s) here showing the most common usage(s)
   # This section will be as far as many users bother reading, so make it as
   # educational and exemplary as possible.


=head1 DESCRIPTION

=head1 SUBROUTINES/METHODS



( run in 0.668 second using v1.01-cache-2.11-cpan-a5162978ef8 )