class Bitbucket::Cli::Commands::Repository

Public Instance Methods

account(name) click to toggle source
# File lib/bitbucket/cli/commands/repository.rb, line 32
def account name
  Bitbucket::Cli::Config.new.get_account name
end
create(name='') click to toggle source
# File lib/bitbucket/cli/commands/repository.rb, line 17
def create(name='')
  a = account(options[:account])
  if a.nil?
    puts 'No account, you need to select an account, or perhaps, create a new one?'
    return
  end
  name = File.basename(Dir.getwd) if name == ''
  bitbucket = BitBucket.new({:login=>a[:name], :password=>a[:password]})
  repo = bitbucket.repos.create(repo_options(name, options))
  if options[:skip_remote].nil?
    `git remote add origin git@bitbucket.org:#{repo['owner']}/#{repo['name']}.git`
  end
end
repo_options(name, options) click to toggle source
# File lib/bitbucket/cli/commands/repository.rb, line 36
def repo_options name, options
  opts = {
    "name" => name,
    "description" => options[:description],
    "website" => options[:website],
    "is_private" => options[:p],
    "has_issues" => options[:issues],
    "has_wiki" => options[:wiki]
  }
  opts['owner'] = options[:owner] unless @options[:owner] == ''
  return opts
end