Class: Pocketbook::CLI::Runner::GitHubThemeSource
- Inherits:
-
Struct
- Object
- Struct
- Pocketbook::CLI::Runner::GitHubThemeSource
- Defined in:
- lib/pocketbook/cli/runner.rb
Instance Attribute Summary collapse
-
#owner ⇒ Object
Returns the value of attribute owner.
-
#ref ⇒ Object
Returns the value of attribute ref.
-
#repo ⇒ Object
Returns the value of attribute repo.
-
#theme_directory ⇒ Object
Returns the value of attribute theme_directory.
Instance Method Summary collapse
- #default_theme_name ⇒ Object
- #raw_base ⇒ Object
- #raw_file_url(relative_path) ⇒ Object
- #raw_manifest_url ⇒ Object
- #with_ref(new_ref) ⇒ Object
Instance Attribute Details
#owner ⇒ Object
Returns the value of attribute owner
16 17 18 |
# File 'lib/pocketbook/cli/runner.rb', line 16 def owner @owner end |
#ref ⇒ Object
Returns the value of attribute ref
16 17 18 |
# File 'lib/pocketbook/cli/runner.rb', line 16 def ref @ref end |
#repo ⇒ Object
Returns the value of attribute repo
16 17 18 |
# File 'lib/pocketbook/cli/runner.rb', line 16 def repo @repo end |
#theme_directory ⇒ Object
Returns the value of attribute theme_directory
16 17 18 |
# File 'lib/pocketbook/cli/runner.rb', line 16 def theme_directory @theme_directory end |
Instance Method Details
#default_theme_name ⇒ Object
34 35 36 |
# File 'lib/pocketbook/cli/runner.rb', line 34 def default_theme_name File.basename(theme_directory) end |
#raw_base ⇒ Object
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_url ⇒ Object
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 |