class Cp8Cli::Commands::Start

Attributes

name[R]

Public Class Methods

new(name) click to toggle source
# File lib/cp8_cli/commands/start.rb, line 7
def initialize(name)
  @name = name
end

Public Instance Methods

run() click to toggle source
# File lib/cp8_cli/commands/start.rb, line 11
def run
  check_version
  if story
    story.start
  else
    Command.error "No name/url provided"
  end
end

Private Instance Methods

check_version() click to toggle source
# File lib/cp8_cli/commands/start.rb, line 24
def check_version
  unless Version.latest?
    Command.error "Your `cp8_cli` version is out of date. Please run `gem update cp8_cli`."
  end
end
find_or_create_story() click to toggle source
# File lib/cp8_cli/commands/start.rb, line 34
def find_or_create_story
  if name.to_s.start_with?("https://github.com")
    Github::Issue.find_by_url(name)
  elsif name.present?
    AdhocStory.new(name)
  end
end
story() click to toggle source
# File lib/cp8_cli/commands/start.rb, line 30
def story
  @_story ||= find_or_create_story
end