Class: Gitload::Sources::Bitbucket
- Inherits:
-
Object
- Object
- Gitload::Sources::Bitbucket
- Includes:
- Source
- Defined in:
- lib/gitload/sources/bitbucket.rb
Defined Under Namespace
Classes: Repo
Instance Method Summary collapse
-
#initialize(config, options = {}) ⇒ Bitbucket
constructor
A new instance of Bitbucket.
- #repos ⇒ Object
Methods included from Source
Constructor Details
#initialize(config, options = {}) ⇒ Bitbucket
Returns a new instance of Bitbucket.
9 10 11 12 13 14 15 16 |
# File 'lib/gitload/sources/bitbucket.rb', line 9 def initialize config, = {} @config = config @user = .fetch :user, ENV['GITLOAD_BITBUCKET_USER'] password = .fetch :password, ENV['GITLOAD_BITBUCKET_TOKEN'] @bitbucket_api = ::BitBucket.new basic_auth: "#{@user}:#{password}" end |
Instance Method Details
#repos ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# 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 |