Class: Bookbinder::RemoteYamlCredentialProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/bookbinder/remote_yaml_credential_provider.rb

Instance Method Summary collapse

Constructor Details

#initialize(logger, repository, git_accessor = Git) ⇒ RemoteYamlCredentialProvider

Returns a new instance of RemoteYamlCredentialProvider.



6
7
8
9
10
# File 'lib/bookbinder/remote_yaml_credential_provider.rb', line 6

def initialize(logger, repository, git_accessor = Git)
  @logger = logger
  @repository = repository
  @git_accessor = git_accessor
end

Instance Method Details

#credentialsObject



12
13
14
15
16
17
18
19
# File 'lib/bookbinder/remote_yaml_credential_provider.rb', line 12

def credentials
  @logger.log "Processing #{@repository.full_name.cyan}"
  Dir.mktmpdir do |destination_dir|
    @repository.copy_from_remote(destination_dir, @git_accessor)
    cred_file_yaml = File.join(destination_dir, @repository.short_name, 'credentials.yml')
    YAML.load_file(cred_file_yaml)
  end
end