Skip to content
Browse files

dont hardcode the username dummy

  • Loading branch information...
1 parent b667d94 commit 5707b5bf373c0cd36758c62ea8cc1a6657891095 @ddollar committed
Showing with 10 additions and 6 deletions.
  1. +6 −3 bin/github-backup
  2. +4 −3 lib/github-backup.rb
View
9 bin/github-backup
@@ -5,10 +5,13 @@ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'octopi'
require 'github-backup'
-unless ARGV.length == 1
- puts "usage: github-backup <local backup root>"
+unless ARGV.length == 2
+ puts "usage: github-backup <username> <local backup root>"
exit 1
end
-backup = Github::Backup.new(ARGV.first)
+username = ARGV.shift
+root = ARGV.shift
+
+backup = Github::Backup.new(username, root)
backup.execute
View
7 lib/github-backup.rb
@@ -7,9 +7,10 @@ class Github::Backup
include Octopi
- attr_reader :backup_root, :debug
+ attr_reader :backup_root, :debug, :username
- def initialize(backup_root)
+ def initialize(username, backup_root)
+ @username = username
@backup_root = backup_root
@debug = false
end
@@ -17,7 +18,7 @@ def initialize(backup_root)
def execute
FileUtils::mkdir_p(backup_root)
authenticated do |api|
- repositories = User.find('ddollar').repositories.sort_by { |r| r.name }
+ repositories = User.find(username).repositories.sort_by { |r| r.name }
repositories.each do |repository|
puts "Backing up: #{repository.name}"
backup_repository repository

0 comments on commit 5707b5b

Please sign in to comment.
Something went wrong with that request. Please try again.