Class: Pv::Command

Inherits:
Thor show all
Includes:
Thor::Actions
Defined in:
lib/pv/command.rb

Instance Method Summary collapse

Instance Method Details

#edit(story_id, status) ⇒ Object

method_option :message, default: “”, alias: ‘m’



28
29
30
31
32
33
# File 'lib/pv/command.rb', line 28

def edit story_id, status
  story = Story.find story_id
  unless story.update(status)
    run "Error: Story did not update."
  end
end

#helpObject



43
44
45
46
# File 'lib/pv/command.rb', line 43

def help
  say IO.read("#{Pv.root}/lib/templates/help.txt")
  super
end

#logObject



9
10
11
12
13
14
15
16
# File 'lib/pv/command.rb', line 9

def log
  Pv.tracker.stories.each do |story|
    id = set_color "#{story.id}", Thor::Shell::Color::YELLOW
    author = set_color story.requested_by, Thor::Shell::Color::WHITE

    say "* #{id} #{story.name} #{author}"
  end
end

#show(story_id) ⇒ Object



19
20
21
22
23
24
# File 'lib/pv/command.rb', line 19

def show story_id
  sha = Digest::HMAC.hexdigest story_id.to_s, Time.now.to_s, Digest::SHA1
  File.write "/tmp/story-#{sha}", Story.find(story_id).render
  run "less -R /tmp/story-#{sha}"
  run "rm -rf /tmp/story-#{sha}"
end