class Jigit::IssueRunner

Public Class Methods

new(argv) click to toggle source
Calls superclass method
# File lib/jigit/commands/issue.rb, line 14
def initialize(argv)
  super
  jigitfile = argv.option("jigitfile")
  unless jigitfile
    jigitfile = try_to_find_jigitfile_path
    raise "--jigitfile is a required parameter and could not be nil" if jigitfile.nil?
  end
  @jigitfile = Jigit::Jigitfile.new(jigitfile)
  @issue_name = argv.option("name")
  keychain_item = Jigit::KeychainStorage.new.load_item(@jigitfile.host)
  @jira_config = Jigit::JiraConfig.new(keychain_item.account, keychain_item.password, keychain_item.service)
  @jira_api_client = Jigit::JiraAPIClient.new(@jira_config, nil) if @jira_config
end
options() click to toggle source
Calls superclass method
# File lib/jigit/commands/issue.rb, line 34
def self.options
  [
    ["--name=issue_name_on_jira", "Use this argument to provide a JIRA issue name. For example if the project short name is CNI, the issue name could be CNI-101"],
    ["--jigitfile=path_to_jigit_file", "Use this argument to provide a path to Jigitfile, if nil will be used a default path under the './jigit/' folder"]
  ].concat(super)
end

Public Instance Methods

run() click to toggle source
# File lib/jigit/commands/issue.rb, line 41
def run
  self
end
validate!() click to toggle source
Calls superclass method
# File lib/jigit/commands/issue.rb, line 28
def validate!
  super
  help!("Please setup jira config using `jigit init` before using issue command.") unless @jira_config
  help!("Please setup jigitfile using `jigit init` before using issue command.") unless @jigitfile
end

Private Instance Methods

try_to_find_jigitfile_path() click to toggle source
# File lib/jigit/commands/issue.rb, line 47
def try_to_find_jigitfile_path
  pwd_jigitfile_yaml = Pathname.pwd + ".jigit/Jigitfile.yaml"
  jigitfile = pwd_jigitfile_yaml if File.exist?(pwd_jigitfile_yaml)
  return jigitfile unless jigitfile.nil?
  pwd_jigitfile_yml = Pathname.pwd + ".jigit/Jigitfile.yml"
  jigitfile = pwd_jigitfile_yml if File.exist?(pwd_jigitfile_yml)
  return jigitfile unless jigitfile.nil?
  return nil
end