Class: Enola::Channel

Inherits:
Struct
  • Object
show all
Defined in:
lib/enola/channel.rb

Constant Summary collapse

UPSTREAM =
Channel.new(
  name: "upstream",
  release_base: "https://github.com/enola-labs/enola/releases/download",
  version: UPSTREAM_VERSION,
  asset_prefix: "enola"
).freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#asset_prefixObject

Returns the value of attribute asset_prefix

Returns:

  • (Object)

    the current value of asset_prefix



4
5
6
# File 'lib/enola/channel.rb', line 4

def asset_prefix
  @asset_prefix
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



4
5
6
# File 'lib/enola/channel.rb', line 4

def name
  @name
end

#release_baseObject

Returns the value of attribute release_base

Returns:

  • (Object)

    the current value of release_base



4
5
6
# File 'lib/enola/channel.rb', line 4

def release_base
  @release_base
end

#tag_prefixObject

Returns the value of attribute tag_prefix

Returns:

  • (Object)

    the current value of tag_prefix



4
5
6
# File 'lib/enola/channel.rb', line 4

def tag_prefix
  @tag_prefix
end

#versionObject

Returns the value of attribute version

Returns:

  • (Object)

    the current value of version



4
5
6
# File 'lib/enola/channel.rb', line 4

def version
  @version
end

Instance Method Details

#asset(platform) ⇒ Object



5
6
7
# File 'lib/enola/channel.rb', line 5

def asset(platform)
  "#{asset_prefix}-#{version}-#{platform}.tar.gz"
end

#cache_dir(root) ⇒ Object



21
22
23
# File 'lib/enola/channel.rb', line 21

def cache_dir(root)
  File.join(root, name, version)
end

#checksum_asset(platform) ⇒ Object



9
10
11
# File 'lib/enola/channel.rb', line 9

def checksum_asset(platform)
  "#{asset_prefix}-#{version}-#{platform}.sha256"
end

#tagObject



13
14
15
# File 'lib/enola/channel.rb', line 13

def tag
  "#{tag_prefix || 'v'}#{version}"
end

#to_sObject



25
26
27
# File 'lib/enola/channel.rb', line 25

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

#url(file) ⇒ Object



17
18
19
# File 'lib/enola/channel.rb', line 17

def url(file)
  "#{release_base.chomp('/')}/#{tag}/#{file}"
end