pivo 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -2
  3. data/lib/pivo/version.rb +1 -1
  4. data/lib/pivo.rb +31 -0
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8466a1623762db6bc766cf3c4824d32ddd0bff91
4
- data.tar.gz: 7df5ca0aabb3bcee5af34e09fb67861ca1becdce
3
+ metadata.gz: 9aed17f0b7509e7ac12e65e0504c06cec3c3c635
4
+ data.tar.gz: 0fec22c3a496d57a473ebf155abeb482355eed0a
5
5
  SHA512:
6
- metadata.gz: 8a7adea6ed10262c854742ac192133a42d7a1ee0e0119ff0a30ff8525bd07660db24fc774845080ac906922eb2e10d3e48602edba235f9d4a50fadba95122aa4
7
- data.tar.gz: c69684097ff952faf27ef5e22ecd6ae84af4ddc4cb580951f30a6ed50f2a07ce1482f8e62a121cf2c3a85b63b0a222751cfe6ce701f5117c68e58d2d11665bf8
6
+ metadata.gz: d9bcbae984a83ab8243c65b74fa5b8ed6edf7c8b67731ee6db9ef19a413ae7fa72e2e0aac09f435fa455d88bb0780f32db2a119c1c2b994b0efdba0335a98f20
7
+ data.tar.gz: 33261af7d5f7b1a9260994dfe69eacfd126b802d1b99cccd87aada3a77bb2699f576433cec1a1c26096f3cde34418a2dc621c54be59589a24db7722668b13c25
data/README.md CHANGED
@@ -17,14 +17,21 @@ $ pivo projects
17
17
  ### Listing stories
18
18
 
19
19
  ```shell
20
- $ pivo stories PROJECT_NAME
20
+ $ pivo stories all PROJECT_NAME
21
+ ```
22
+
23
+ ### Listing mywork
24
+
25
+
26
+ ```shell
27
+ $ pivo stories me PROJECT_NAME
21
28
  ```
22
29
 
23
30
  #### with peco
24
31
 
25
32
  ```zsh
26
33
  function pivo-open() {
27
- local url="$(pivo stories $1 | peco --query "$LBUFFER" | awk '{print $NF}')"
34
+ local url="$(pivo stories me $1 | peco --query "$LBUFFER" | awk '{print $NF}')"
28
35
  open ${url}
29
36
  }
30
37
  ```
data/lib/pivo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pivo
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/pivo.rb CHANGED
@@ -5,6 +5,34 @@ require 'tracker_api'
5
5
  require 'thor'
6
6
 
7
7
  module Pivo
8
+ class Stories < Thor
9
+ desc "stories all PROJECT_NAME", "listing all stories"
10
+ def all(project_name)
11
+ project = client.projects.select {|project| project.name == project_name}[0]
12
+ project.stories.each do |story|
13
+ say "[#{story.current_state}]\t#{story.name}\t#{story.url}"
14
+ end
15
+ end
16
+
17
+ desc "stories me PROJECT_NAME", "listing my stories"
18
+ def me(project_name)
19
+ me = client.me
20
+ project = client.projects.select {|project| project.name == project_name}[0]
21
+ project.stories(filter: "mywork:\"#{me.name}\"").each do |story|
22
+ say "[#{story.current_state}]\t#{story.name}\t#{story.url}"
23
+ end
24
+ end
25
+
26
+ private
27
+
28
+ def client
29
+ TrackerApi::Client.new(token: token)
30
+ end
31
+
32
+ def token
33
+ YAML.load(File.read("#{ENV['HOME']}/.pivo.yml"))['token']
34
+ end
35
+ end
8
36
  class CLI < Thor
9
37
  desc "projects", "listing project names"
10
38
  def projects
@@ -19,6 +47,9 @@ module Pivo
19
47
  end
20
48
  end
21
49
 
50
+ desc "stories SUBCOMMAND ARGS", "listing stories"
51
+ subcommand "stories", Stories
52
+
22
53
  private
23
54
 
24
55
  def client
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pivo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - AKAMATSU Yuki