Class: Sleet::Repo

Inherits:
Object
  • Object
show all
Defined in:
lib/sleet/repo.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(circle_ci_token:, username:, project:, branch_name:) ⇒ Repo

Returns a new instance of Repo.



16
17
18
19
20
21
# File 'lib/sleet/repo.rb', line 16

def initialize(circle_ci_token:, username:, project:, branch_name:)
  @circle_ci_token = circle_ci_token
  @github_user = username
  @github_repo = project
  @branch_name = branch_name
end

Class Method Details

.from_config(config) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/sleet/repo.rb', line 5

def self.from_config(config)
  local_repo = Sleet::LocalRepo.new(source_dir: config.source_dir)

  new(
    circle_ci_token: config.circle_ci_token,
    username: config.username || local_repo.username,
    project: config.project || local_repo.project,
    branch_name: config.branch || local_repo.branch_name
  )
end

Instance Method Details

#branchObject



32
33
34
35
36
37
38
39
# File 'lib/sleet/repo.rb', line 32

def branch
  @branch ||= Sleet::Branch.new(
    circle_ci_token: circle_ci_token,
    github_user: github_user,
    github_repo: github_repo,
    branch: branch_name
  )
end

#build_for(build_num) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/sleet/repo.rb', line 23

def build_for(build_num)
  Sleet::Build.new(
    circle_ci_token: circle_ci_token,
    github_user: github_user,
    github_repo: github_repo,
    build_num: build_num
  )
end