Class: Geet::Helpers::ConfigurationHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/geet/helpers/configuration_helper.rb

Constant Summary collapse

GIST_CREATE_COMMAND =

Commands

'gist.create'
ISSUE_CREATE_COMMAND =
'issue.create'
ISSUE_LIST_COMMAND =
'issue.list'
PR_CREATE_COMMAND =
'pr.create'
GIST_CREATE_OPTIONS =

Command options

[
  ['-p', '--public'],
  ['-B', '--no-browse', "Don't open the gist link in the browser after creation"],
  'filename',
  '[description]'
]
ISSUE_CREATE_OPTIONS =
[
  ['-n', '--no-open-issue',                           "Don't open the issue link in the browser after creation"],
  ['-l', '--label-patterns "bug,help wanted"',        'Label patterns'],
  ['-a', '--assignee-patterns john,tom,adrian,kevin', 'Assignee login patterns. Defaults to authenticated user'],
  'title',
  'description'
].freeze
ISSUE_LIST_OPTIONS =
[
].freeze
PR_CREATE_OPTIONS =
[
  ['-n', '--no-open-pr',                              "Don't open the PR link in the browser after creation"],
  ['-l', '--label-patterns "legacy,code review"',     'Label patterns'],
  ['-r', '--reviewer-patterns john,tom,adrian,kevin', 'Reviewer login patterns'],
  'title',
  'description'
].freeze

Instance Method Summary collapse

Instance Method Details

#api_tokenObject



60
61
62
# File 'lib/geet/helpers/configuration_helper.rb', line 60

def api_token
  ENV['GITHUB_API_TOKEN'] || raise('Missing $GITHUB_API_TOKEN')
end

#decode_argvObject

Public interface



45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/geet/helpers/configuration_helper.rb', line 45

def decode_argv
  SimpleScripting::Argv.decode(
    'gist' => {
      'create' => GIST_CREATE_OPTIONS,
    },
    'issue' => {
      'create' => ISSUE_CREATE_OPTIONS,
      'list' => ISSUE_LIST_OPTIONS,
    },
    'pr' => {
      'create' => PR_CREATE_OPTIONS,
    },
  )
end