class Daun::CLI

All daun cli subcommands are made available by this class.

Public Instance Methods

checkout() click to toggle source
# File lib/daun/cli.rb, line 20
def checkout
  rugged_daun = Daun::RuggedDaun.new(options[:directory])
  credentials = nil
  begin
    origin_uri = GitCloneUrl.parse(rugged_daun.remote_url)
    credentials =
      case origin_uri
        when URI::SshGit::Generic then
          Rugged::Credentials::SshKey.new(
            username: origin_uri.user,
            privatekey: options[:ssh_private_key],
            publickey: options[:ssh_public_key]
          )
        else
          # Unsupported URI type
          credentials = nil
      end
  rescue URI::InvalidComponentError
    # Potentially a git local protocol which is not supported by GitCloneUrl yet
    credentials = nil
  end

  rugged_daun.checkout credentials
end
init(remote_url, destination) click to toggle source
# File lib/daun/cli.rb, line 11
def init(remote_url, destination)
  Daun::RuggedDaun.new(destination).init(remote_url)
end