Skip to content

Commit

Permalink
we now use the GITHUB_TOKEN env var properly
Browse files Browse the repository at this point in the history
  • Loading branch information
stevieb9 committed Feb 12, 2018
1 parent 11e8513 commit 5102d48
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Revision history for Github-Backup
- added new "FUTURE DIRECTION" POD heading
- -h flag is taken as priority in github_backup, and no longer prints
erroneous warnings for missing args
- we now properly respect GITHUB_TOKEN env var

1.01 2018-02-11
- added repos() and issues()
Expand Down
8 changes: 6 additions & 2 deletions lib/Github/Backup.pm
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ has stg => (
sub BUILD {
my ($self) = @_;

if (! $self->token){
$self->token($ENV{GITHUB_TOKEN}) if $ENV{GITHUB_TOKEN};
}

for ($self->api_user, $self->token, $self->dir){
if (! $_){
croak "When instantiating an object, the 'api_user', 'token' and " .
Expand Down Expand Up @@ -156,12 +160,12 @@ sub DESTROY {

if ($self->dir) {
if (-d $self->dir) {
rmtree $self->dir or die "can't remove the old backup directory...";
rmtree $self->dir or die "can't remove the old backup directory: $!";
}

if ($self->stg) {
move $self->stg,
$self->dir or die "can't rename the staging directory...";
$self->dir or die "can't rename the staging directory: $!";
}

if (-d $self->dir && $self->_clean) {
Expand Down

0 comments on commit 5102d48

Please sign in to comment.