Class: Hackmac::OC

Inherits:
Object
  • Object
show all
Defined in:
lib/hackmac/oc.rb

Instance Method Summary collapse

Constructor Details

#initialize(config:) ⇒ OC

Returns a new instance of OC.



3
4
5
# File 'lib/hackmac/oc.rb', line 3

def initialize(config:)
  @config = config
end

Instance Method Details

#inspectObject



30
31
32
# File 'lib/hackmac/oc.rb', line 30

def inspect
  "#<#{self.class}: #{to_s}>"
end

#nameObject



22
23
24
# File 'lib/hackmac/oc.rb', line 22

def name
  remote.name
end

#remoteObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/hackmac/oc.rb', line 7

def remote
  @remote and return @remote
  source = @config.oc.source
  github = source.github
  auth = [ @config.github.user, @config.github.access_token ].compact
  auth.empty? and auth = nil
  suffix =
    case debug = source.debug?
    when true       then 'DEBUG'
    when false      then 'RELEASE'
    when nil        then nil
    end
  @remote = Hackmac::GithubSource.new(github, auth: auth, suffix: suffix)
end

#to_sObject



34
35
36
# File 'lib/hackmac/oc.rb', line 34

def to_s
  "#{name} #{version}"
end

#versionObject



26
27
28
# File 'lib/hackmac/oc.rb', line 26

def version
  remote.version
end