Class: Pocketbook::CLI::Runner::GitHubThemeSource

Inherits:
Struct
  • Object
show all
Defined in:
lib/pocketbook/cli/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ownerObject

Returns the value of attribute owner

Returns:

  • (Object)

    the current value of owner



16
17
18
# File 'lib/pocketbook/cli/runner.rb', line 16

def owner
  @owner
end

#refObject

Returns the value of attribute ref

Returns:

  • (Object)

    the current value of ref



16
17
18
# File 'lib/pocketbook/cli/runner.rb', line 16

def ref
  @ref
end

#repoObject

Returns the value of attribute repo

Returns:

  • (Object)

    the current value of repo



16
17
18
# File 'lib/pocketbook/cli/runner.rb', line 16

def repo
  @repo
end

#theme_directoryObject

Returns the value of attribute theme_directory

Returns:

  • (Object)

    the current value of theme_directory



16
17
18
# File 'lib/pocketbook/cli/runner.rb', line 16

def theme_directory
  @theme_directory
end

Instance Method Details

#default_theme_nameObject



34
35
36
# File 'lib/pocketbook/cli/runner.rb', line 34

def default_theme_name
  File.basename(theme_directory)
end

#raw_baseObject



21
22
23
# File 'lib/pocketbook/cli/runner.rb', line 21

def raw_base
  "https://raw.githubusercontent.com/#{owner}/#{repo}/#{ref}"
end

#raw_file_url(relative_path) ⇒ Object



29
30
31
32
# File 'lib/pocketbook/cli/runner.rb', line 29

def raw_file_url(relative_path)
  joined = [theme_directory, relative_path].reject { |part| part.nil? || part.empty? || part == "." }.join("/")
  "#{raw_base}/#{joined}"
end

#raw_manifest_urlObject



25
26
27
# File 'lib/pocketbook/cli/runner.rb', line 25

def raw_manifest_url
  raw_file_url("theme.yml")
end

#with_ref(new_ref) ⇒ Object



17
18
19
# File 'lib/pocketbook/cli/runner.rb', line 17

def with_ref(new_ref)
  self.class.new(owner: owner, repo: repo, ref: new_ref, theme_directory: theme_directory)
end