class Gitload::Sources::Bitbucket

Public Class Methods

new(config, options = {}) click to toggle source
# File lib/gitload/sources/bitbucket.rb, line 9
def initialize config, options = {}

  @config = config

  @user = options.fetch :user, ENV['GITLOAD_BITBUCKET_USER']
  password = options.fetch :password, ENV['GITLOAD_BITBUCKET_TOKEN']
  @bitbucket_api = ::BitBucket.new basic_auth: "#{@user}:#{password}"
end

Public Instance Methods

repos() click to toggle source
# File lib/gitload/sources/bitbucket.rb, line 18
def repos

  puts 'Loading BitBucket projects...'
  data = @config.load_or_cache_data 'bitbucket' do
    Utils.stringify_keys(@bitbucket_api.repos.list)
  end

  data = data.select{ |repo| repo['scm'] == 'git' }

  data.collect{ |d| Repo.new d }
end