class Rbk::Cli
Attributes
archiver[R]
git[R]
shell[R]
uploader[R]
Public Class Methods
new(argv, options={})
click to toggle source
# File lib/rbk/cli.rb, line 9 def initialize(argv, options={}) @argv = argv @options = options @git = @options[:git] || Git @github_repos = @options[:github_repos] || Github::Repos @stderr = @options[:stderr] || $stderr end
run(argv=ARGV, options={})
click to toggle source
# File lib/rbk/cli.rb, line 5 def self.run(argv=ARGV, options={}) new(argv, options).run end
Public Instance Methods
run()
click to toggle source
# File lib/rbk/cli.rb, line 17 def run @config = Configuration.create(@argv) @config.validate @shell = @options[:shell] || Shell.new(@config.quiet?) @archiver = Archiver.new(@shell) @s3 = @options[:s3] || AWS::S3.new(@config.aws_credentials) @uploader = Uploader.new(@s3.buckets[@config.bucket], @shell) if @config.help? @shell.puts(@config.usage) else Backup.new(repos, git, archiver, uploader, shell).run end 0 rescue => e @stderr.puts(%(#{e.message} (#{e.class}))) if e.is_a?(InsufficientOptionsError) @stderr.puts(@config.usage) end 1 end
Private Instance Methods
repos()
click to toggle source
# File lib/rbk/cli.rb, line 42 def repos @repos ||= begin r = @github_repos.new(oauth_token: @config.github_access_token) r.list(org: @config.organization, auto_pagination: true) end end