Class: Bitbucket::Cli::Commands::Repository

Inherits:
Thor
  • Object
show all
Defined in:
lib/bitbucket/cli/commands/repository.rb

Instance Method Summary collapse

Instance Method Details

#create(name = '') ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/bitbucket/cli/commands/repository.rb', line 17

def create(name='')
  a = (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 [email protected]:#{repo['owner']}/#{repo['name']}.git`
  end
end