class Yapt::Runner

Attributes

start_time[R]

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/yapt.rb, line 79
def initialize
  @start_time = Time.now
  super
end

Public Instance Methods

git(since_until) click to toggle source
# File lib/yapt.rb, line 84
def git(since_until)
  commits = GitLogShiv.find(since_until)
  output GitView.new(commits).display("git")
end
images(id) click to toggle source
# File lib/yapt.rb, line 105
def images(id)
  system_open Story.images_url(id)
end
list(*args) click to toggle source
# File lib/yapt.rb, line 89
def list(*args)
  display_config = View.extract_display_config(args)
  @stories = Story.find(args)
  display_config ||= (@stories.length > 1) ? "simple" : "detail"
  output View.new(@stories).display(display_config)
end
move(id, destination) click to toggle source
# File lib/yapt.rb, line 109
def move(id, destination)
  mover = Move.setup(id, destination)
  puts
  puts mover.description
  puts View.new([mover.to_move, mover.target]).display("simple")

  permission = ask("Make this move?  ").downcase
  if %w(y yes).include?(permission)
    mover.execute!
    puts "Moved!"
  else
    puts "Aborted. Oh well."
  end
end
open(id = nil) click to toggle source
# File lib/yapt.rb, line 101
def open(id = nil)
 system_open Story.just_url(id)
end
show(id) click to toggle source
# File lib/yapt.rb, line 96
def show(id)
  @story = Story.find(id)
  output View.new([@story]).display("detail")
end

Private Instance Methods

output(str) click to toggle source
# File lib/yapt.rb, line 131
def output(str)
  puts
  puts str
  puts
  puts "Took #{Time.now - start_time} seconds."
  puts
end
system_open(whatever) click to toggle source
# File lib/yapt.rb, line 126
def system_open(whatever)
  puts "Opening: #{whatever}"
  system "open #{whatever}"
end