pivo 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 44fb7ac68e6bc35bc686fe86c1909850ea5fde25
4
- data.tar.gz: d96642c284b8811b1fe6fd0a44dcdbe72f3c3dce
3
+ metadata.gz: bb63a9caa8cf69d9d118f3033d5fa99d2c173756
4
+ data.tar.gz: 915ffb5580f9657cf9be8cf9bb42f7e3d86da1cd
5
5
  SHA512:
6
- metadata.gz: f386361f2800516bb5e6589c28af0649bfbc81d0c3d0e4674025128ff8349a8b5aabfb8a258bfcde13abfcbba2e68692e664b416fe3379296852e8c7ba7d1a80
7
- data.tar.gz: b63903555b34d046c7bd547607fabe6e333ee603d4c3284e8b9c668922641b05bac75a41a398f5bc1f3424cc7567ac30b3b004e4c5474848a712ab912be5f0e3
6
+ metadata.gz: 2e5f23c78aa1af7857979800e5d01339356cec2a24e40f4661db97890d86ea27faee1efaf0740231906b16edce2f9348cde33797406096d01086d2002ee741ee
7
+ data.tar.gz: 06faee69ec73b8ee2b42f4bfc7ab99643224f01155d304cc352a4f84db89df59e8cc8ea281a1b49f04c2d3a597c87932b8f5fa9673815107ad75a8970f522c4c
data/lib/pivo/commands.rb CHANGED
@@ -4,43 +4,10 @@ require 'thor'
4
4
  require 'date'
5
5
 
6
6
  require 'pivo/resource'
7
+ require 'pivo/formatters'
7
8
 
8
9
  module Pivo
9
- class Velocity < Thor
10
- desc "velocity me PROJECT_NAME VELOCITY", "listing my stories each velocity"
11
- def me(project_name, velocity)
12
- me = Resource::Me.new
13
- project = Resource::Project.find_by_name(project_name)
14
- stories = project.stories(filter: "owner:\"#{me.name}\"")
15
-
16
- days = %w(Sunday Monday Tuesday Wednesday Thursday Friday Saturday)
17
- week_start_day = project.week_start_day
18
- index_of_start_day = days.index(week_start_day)
19
- current_day = DateTime.now.wday
20
- diff = current_day-index_of_start_day
21
- diff = 7 - diff if diff < 0
22
-
23
- current_iteration_start_date = DateTime.now - diff
24
-
25
- point = 0
26
- iteration_index = 1
27
- say "\n===#{current_iteration_start_date.strftime('%Y-%m-%d %a')}=========================================================================\n\n"
28
- stories.each do |story |
29
- if point + story.estimate > velocity.to_i
30
- say "total point: #{point}"
31
- say "\n===#{(current_iteration_start_date + iteration_index*7).strftime('%Y-%m-%d %a')}=========================================================================\n\n"
32
- iteration_index += 1
33
- point = story.estimate
34
- else
35
- point += story.estimate
36
- end
37
- say Resource::Story.new(story).to_s
38
- end
39
- end
40
- end
41
-
42
10
  class Stories < Thor
43
-
44
11
  desc "all PROJECT_NAME", "listing all stories"
45
12
  option :status, type: 'string', desc: "unscheduled, unstarted, planned, rejected, started, finished, delivered, accepted"
46
13
  option :format, type: 'string', desc: "default, md"
@@ -48,8 +15,27 @@ module Pivo
48
15
  project = Resource::Project.find_by_name(project_name)
49
16
  filtering_options = {}
50
17
  filtering_options.merge!(with_state: options[:status]) if options[:status]
51
- project.stories(filtering_options).each do |story|
52
- say Resource::Story.new(story, (options[:format] || 'default')).to_s
18
+ case options[:format]
19
+ when 'md'
20
+ say Formatters::Stories::Markdown.new(project.stories(filtering_options)).to_s
21
+ else
22
+ say Formatters::Stories::Default.new(project.stories(filtering_options)).to_s
23
+ end
24
+ end
25
+
26
+ desc "iteration PROJECT_NAME", "listing stories of iteration"
27
+ option :iterationnumber, type: 'numeric', default: 0, desc: "current iteration number = 0, prev iterationn number = 1, prev prev = 2..."
28
+ option :format, type: 'string', desc: "default, md"
29
+ def iteration(project_name)
30
+ project = Resource::Project.find_by_name(project_name)
31
+ iteration_number = project.current_iteration_number
32
+ iteration_number -= options[:iterationnumber] if options[:iterationnumber]
33
+ iteration = project.iterations(number: iteration_number).first
34
+ case options[:format]
35
+ when 'md'
36
+ say Formatters::Stories::Markdown.new(iteration.stories).to_s
37
+ else
38
+ say Formatters::Stories::Default.new(iteration.stories).to_s
53
39
  end
54
40
  end
55
41
 
@@ -61,8 +47,11 @@ module Pivo
61
47
  project = Resource::Project.find_by_name(project_name)
62
48
  filtering_options = {}
63
49
  filtering_options.merge!(filter: "state:#{options[:status]} owner:\"#{me.name}\"")
64
- project.stories(filtering_options).each do |story|
65
- say Resource::Story.new(story, (options[:format] || 'default')).to_s
50
+ case options[:format]
51
+ when 'md'
52
+ say Formatters::Stories::Markdown.new(project.stories(filtering_options)).to_s
53
+ else
54
+ say Formatters::Stories::Default.new(project.stories(filtering_options)).to_s
66
55
  end
67
56
  end
68
57
  end
@@ -76,15 +65,10 @@ module Pivo
76
65
  desc "stories PROJECT_NAME", "listing project stories"
77
66
  def stories(project_name)
78
67
  project = Resource::Project.find_by_name(project_name)
79
- project.stories.each do |story|
80
- say Resource::Story.new(story).to_s
81
- end
68
+ say Formatters::Stories::Default.new(project.stories(filtering_options)).to_s
82
69
  end
83
70
 
84
71
  desc "stories SUBCOMMAND ARGS", "listing stories"
85
72
  subcommand "stories", Stories
86
-
87
- desc "velocity SUBCOMMAND ARGS", "listing stories each velocity"
88
- subcommand "velocity", Velocity
89
73
  end
90
74
  end
@@ -0,0 +1,6 @@
1
+ module Pivo
2
+ module Formatters
3
+ require_relative 'formatters/stories/default'
4
+ require_relative 'formatters/stories/markdown'
5
+ end
6
+ end
@@ -0,0 +1,17 @@
1
+ module Pivo
2
+ module Formatters
3
+ module Stories
4
+ class Default
5
+ def initialize(stories)
6
+ @stories = stories
7
+ end
8
+
9
+ def to_s
10
+ @stories.map {|story|
11
+ "[#{story.estimate}][#{story.current_state}]\t#{story.name}\t#{story.url}"
12
+ }.join("\n")
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module Pivo
2
+ module Formatters
3
+ module Stories
4
+ class Markdown
5
+ def initialize(stories)
6
+ @stories = stories
7
+ end
8
+
9
+ def to_s
10
+ @stories.map {|story|
11
+ "[#{story.name}](#{story.url})"
12
+ }.join("\n")
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
data/lib/pivo/resource.rb CHANGED
@@ -36,19 +36,4 @@ module Resource
36
36
  end
37
37
  end
38
38
  end
39
-
40
- class Story
41
- def initialize(story, format_option)
42
- @story = story
43
- @format_option = format_option
44
- end
45
-
46
- def to_s
47
- if @format_option == 'md'
48
- "[#{@story.name}](#{@story.url})"
49
- else
50
- "[#{@story.estimate}][#{@story.current_state}]\t#{@story.name}\t#{@story.url}"
51
- end
52
- end
53
- end
54
39
  end
data/lib/pivo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pivo
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pivo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - AKAMATSU Yuki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-13 00:00:00.000000000 Z
11
+ date: 2015-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -82,6 +82,9 @@ files:
82
82
  - bin/pivo
83
83
  - lib/pivo.rb
84
84
  - lib/pivo/commands.rb
85
+ - lib/pivo/formatters.rb
86
+ - lib/pivo/formatters/stories/default.rb
87
+ - lib/pivo/formatters/stories/markdown.rb
85
88
  - lib/pivo/resource.rb
86
89
  - lib/pivo/version.rb
87
90
  - pivo.gemspec
@@ -105,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
108
  version: '0'
106
109
  requirements: []
107
110
  rubyforge_project:
108
- rubygems_version: 2.4.5
111
+ rubygems_version: 2.2.2
109
112
  signing_key:
110
113
  specification_version: 4
111
114
  summary: for pivotal tracker