pv 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -8,21 +8,24 @@ Install the binary:
8
8
 
9
9
  $ gem install pv
10
10
 
11
- Then create `~/.pivotal.yml` with your deets:
11
+ Then create `~/.pv` with your deets:
12
12
 
13
13
  ```yaml
14
14
  username: user@email.com
15
15
  password: your-super-secret-password
16
- project: your-awesome-project-name
16
+ project_id: 123456
17
+ name: 'Your Name'
17
18
  ```
18
19
 
20
+ Or, run `pv config`.
21
+
19
22
  ## Usage
20
23
 
21
- Here are all of the commands Piv can do:
24
+ Here are all of the commands PV can do:
22
25
 
23
26
  ### pv
24
27
 
25
- Simply running `piv` will open your `$PAGER` with the stories
28
+ Simply running `pv` will open your `$PAGER` with the stories
26
29
  in your "My Work" tab. Each story is one line and includes the
27
30
  title and the ID:
28
31
 
@@ -52,14 +55,6 @@ message is appended to the story in comments.
52
55
 
53
56
  Easier-to-remember aliases for the above command.
54
57
 
55
- ### pv create "Story title" --points=3
56
-
57
- Creates a story on Pivotal Tracker. Opens your `$EDITOR` so you can provide more information
58
- than simply the title, unless you pass --minimal. Stories are created as features by default,
59
- but you can override this by passing `--bug` or `--chore`. Note: `--points` values, while
60
- required if creating a feature, are ignored when creating bugs or chores. They are also not
61
- required on the command.
62
-
63
58
  ### pv help
64
59
 
65
60
  Show a command manual.
data/lib/pv/command.rb CHANGED
@@ -9,30 +9,34 @@ module Pv
9
9
  desc :log, "Show every story assigned to you on this project."
10
10
  def log
11
11
  Pv.tracker.stories.each do |story|
12
- say "[#{story.id}] #{story.name} < #{story.requested_by} >"
12
+ id = set_color "#{story.id}", Thor::Shell::Color::YELLOW
13
+ author = set_color story.requested_by, Thor::Shell::Color::WHITE
14
+
15
+ say "* #{id} #{story.name} #{author}"
13
16
  end
14
17
  end
15
18
 
16
19
  desc "show STORY_ID", "Show the full text and attributes of a story on this project."
17
20
  def show story_id
18
- story = File.write "/tmp/story", Story.find(story_id).render
19
- run "less -R /tmp/story"
21
+ sha = Digest::HMAC.hexdigest story_id.to_s, Time.now.to_s, Digest::SHA1
22
+ File.write "/tmp/story-#{sha}", Story.find(story_id).render
23
+ run "less -R /tmp/story-#{sha}"
24
+ run "rm -rf /tmp/story-#{sha}"
20
25
  end
21
26
 
22
- desc "edit STORY_ID", "Edit a story's status on this project."
23
- method_option :status, default: '', alias: 's'
24
- method_option :message, default: "", alias: 'm'
25
- def edit story_id
27
+ desc "edit STORY_ID STATUS", "Edit a story's status on this project."
28
+ #method_option :message, default: "", alias: 'm'
29
+ def edit story_id, status
26
30
  story = Story.find story_id
27
- story.update(status: options[:status]) unless options[:status].blank?
28
- story.comment! options[:message] unless options[:message].blank?
31
+ unless story.update(status)
32
+ run "Error: Story did not update."
33
+ end
29
34
  end
30
35
 
31
36
  %w(start finish deliver accept reject restart).each do |status|
32
37
  desc "#{status} STORY_ID", "#{status.titleize} a story on this project."
33
38
  define_method(status) do |story_id|
34
- options[:status] = status
35
- edit(story_id)
39
+ edit(story_id, "#{status}ed")
36
40
  end
37
41
  end
38
42
 
data/lib/pv/story.rb CHANGED
@@ -2,8 +2,10 @@ module Pv
2
2
  class Story
3
3
  attr_accessor :story_type, :requested_by, :owned_by, :current_state,
4
4
  :name, :description, :estimate, :id
5
+ attr_reader :pivotal_story
5
6
 
6
7
  def initialize from_pivotal_story
8
+ @pivotal_story = from_pivotal_story
7
9
  %w(id story_type requested_by owned_by current_state name description estimate).each do |attr|
8
10
  self.send "#{attr}=", from_pivotal_story.send(attr)
9
11
  end
@@ -19,5 +21,9 @@ module Pv
19
21
  template = ERB.new(source)
20
22
  template.result(binding)
21
23
  end
24
+
25
+ def update(status)
26
+ @pivotal_story.update(current_state: status)
27
+ end
22
28
  end
23
29
  end
data/lib/pv/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pv
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: