Class: Github::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/github/cli.rb,
lib/github/cli/shell_helpers.rb

Defined Under Namespace

Modules: ShellHelpers

Constant Summary collapse

CONFIG_FILE_PATH =
File.expand_path('~/.github-cli.yml')

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject (readonly)

Returns the value of attribute config.



14
15
16
# File 'lib/github/cli.rb', line 14

def config
  @config
end

.repositoryObject (readonly)

Returns the value of attribute repository.



14
15
16
# File 'lib/github/cli.rb', line 14

def repository
  @repository
end

.repository_dirObject (readonly)

Returns the value of attribute repository_dir.



14
15
16
# File 'lib/github/cli.rb', line 14

def repository_dir
  @repository_dir
end

Class Method Details

.configure_repository(dir) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/github/cli.rb', line 16

def configure_repository(dir)
  return @repository if @repository

  @repository_dir = dir
  begin
    @repository = Github::Repository.new(@repository_dir)
  rescue Github::Repository::InvalidRepositoryDirectory
    parent_dir = File.expand_path('..', @repository_dir)

    if @repository_dir != parent_dir
      @repository_dir = parent_dir
      retry
    end
  end
end

.load_configObject



32
33
34
35
# File 'lib/github/cli.rb', line 32

def load_config
  @config = YAML.load_file(CONFIG_FILE_PATH)
  @config
end