trello-weekly-velocity 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/lib/CardContainsComplexityFilter.rb +12 -0
- data/lib/CardsCompletedInLastSevenDaysFilter.rb +31 -0
- data/lib/CompletedCard.rb +11 -0
- data/lib/CompletedCardRepository.rb +12 -0
- data/lib/FilterFactory.rb +17 -0
- data/lib/FilteredCardRepository.rb +15 -0
- data/lib/TrelloBoard.rb +28 -0
- data/lib/TrelloBoards.rb +14 -0
- data/lib/TrelloWeeklyVelocity.rb +39 -0
- data/lib/VelocityCalculator.rb +15 -0
- metadata +81 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
OWQ4ODRjYTRlOWIzNGRhMmJmNTI2Y2MzYmVjNTgyMjVmNmM1ZjhiYg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZGNhMjc0Mjc5MTM2ZmQ4NzIwYThmZTU4ZDBhZjhlZmRkYjZhYjk0YQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
N2JiMjliNjAxYzQ1M2ViYWE5Nzc3YzhjOTQ5ODNiNWMzYWI2MDVmMTU5Njhh
|
10
|
+
Y2NmZjdhNWQxMmUxZWZkYWE1NWQ5OTZkZjEzN2Y0ODJhYjg0MmM0NTQzOTVk
|
11
|
+
MDQ5M2FkZTdmNzkxOTA5MWEwNzM2OTE4MjMzMjczYmRiZDc3ODY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NDQ1MzlmM2E1OTYxZDhjNDZmZjE5NzEyODEyNmQ4OGJkZGM3YWNmZjAzY2Jj
|
14
|
+
NzRlMTkwYmIwMTEyYjc5OTA3ODQ2NDUwMGZkNTgxMjVkNjBkMGFmYjI2M2Yy
|
15
|
+
YmU2N2U4MDcyN2Q5OWJlODQzZTk5OGI2YjhhNWI3M2MzZmNmMjc=
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module AgileTrello
|
2
|
+
ONE_DAY = 86400
|
3
|
+
|
4
|
+
class CardsCompletedInLastSevenDaysFilter
|
5
|
+
SEVEN_DAYS_AGO = Time.now - (ONE_DAY * 7)
|
6
|
+
MOVE_INTO_LIST_ACTION = 'updateCard'
|
7
|
+
|
8
|
+
def initialize(end_list, lists_after_end_list)
|
9
|
+
@end_list = end_list
|
10
|
+
@lists_after_end_list = lists_after_end_list
|
11
|
+
end
|
12
|
+
|
13
|
+
def match(card)
|
14
|
+
moved_into_end_list_action = find_movement_action(@end_list, card)
|
15
|
+
count = 0
|
16
|
+
until (moved_into_end_list_action || count == @lists_after_end_list.length) do
|
17
|
+
list_name = @lists_after_end_list[count]
|
18
|
+
moved_into_end_list_action = find_movement_action(list_name, card)
|
19
|
+
count = count+1
|
20
|
+
end
|
21
|
+
moved_into_end_list_action && moved_into_end_list_action.date > SEVEN_DAYS_AGO
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
def find_movement_action(list_name, card)
|
26
|
+
card.actions.find do | action |
|
27
|
+
action.type == MOVE_INTO_LIST_ACTION && action.data && action.data['listAfter'] && action.data['listAfter']['name'].include?(list_name)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module AgileTrello
|
2
|
+
class CompletedCardRepository
|
3
|
+
def initialize(card_repository)
|
4
|
+
@card_repository = card_repository
|
5
|
+
end
|
6
|
+
|
7
|
+
def find(parameters)
|
8
|
+
cards = @card_repository.find(parameters)
|
9
|
+
return cards.map { | card | CompletedCard.new(card.name) }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative './CardsCompletedInLastSevenDaysFilter'
|
2
|
+
require_relative './CardContainsComplexityFilter'
|
3
|
+
|
4
|
+
module AgileTrello
|
5
|
+
class FilterFactory
|
6
|
+
def initialize(trello_boards)
|
7
|
+
@trello_boards = trello_boards
|
8
|
+
end
|
9
|
+
|
10
|
+
def create(board_id, end_list_name)
|
11
|
+
trello_board = @trello_boards.get(board_id)
|
12
|
+
lists_after = trello_board.get_list_names_after(end_list_name)
|
13
|
+
seven_day_filter = CardsCompletedInLastSevenDaysFilter.new(end_list_name, lists_after)
|
14
|
+
CardContainsComplexityFilter.new(seven_day_filter)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module AgileTrello
|
2
|
+
class FilteredCardRepostitory
|
3
|
+
def initialize(trello_boards)
|
4
|
+
@trello_boards = trello_boards
|
5
|
+
end
|
6
|
+
|
7
|
+
def find(parameters)
|
8
|
+
filter = parameters[:filter]
|
9
|
+
@trello_boards
|
10
|
+
.get(parameters[:board_id])
|
11
|
+
.get_cards_after_list(parameters[:end_list])
|
12
|
+
.find_all {|card| filter.match(card)}
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/TrelloBoard.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
module AgileTrello
|
2
|
+
class TrelloBoard
|
3
|
+
def initialize(board)
|
4
|
+
@board = board
|
5
|
+
end
|
6
|
+
|
7
|
+
def get_cards_after_list(end_list_name)
|
8
|
+
found_end = false
|
9
|
+
cards = []
|
10
|
+
@board.lists.each do | list |
|
11
|
+
found_end = true if !found_end && (list.name.include? end_list_name)
|
12
|
+
if (found_end)
|
13
|
+
list.cards.each do | card |
|
14
|
+
cards.push(card)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
return cards
|
19
|
+
end
|
20
|
+
|
21
|
+
def get_list_names_after(end_list_name)
|
22
|
+
list_names = @board.lists.map { | list | list.name }
|
23
|
+
end_list_position = list_names.index{ |list_name | list_name.include? end_list_name }
|
24
|
+
return [] unless end_list_position
|
25
|
+
return list_names.slice(end_list_position+1, list_names.length)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/TrelloBoards.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'TrelloCredentials'
|
2
|
+
require 'TrelloFactory'
|
3
|
+
require_relative '../lib/CompletedCard'
|
4
|
+
require_relative '../lib/VelocityCalculator'
|
5
|
+
require_relative '../lib/CompletedCardRepository'
|
6
|
+
require_relative '../lib/TrelloBoards'
|
7
|
+
require_relative '../lib/FilteredCardRepository'
|
8
|
+
require_relative '../lib/FilterFactory'
|
9
|
+
|
10
|
+
module AgileTrello
|
11
|
+
class TrelloWeeklyVelocity
|
12
|
+
def initialize(parameters = {})
|
13
|
+
trello_credentials = TrelloCredentials.new(parameters[:public_key], parameters[:access_token])
|
14
|
+
trello_factory = parameters[:trello_factory].nil? ? TrelloFactory.new : parameters[:trello_factory]
|
15
|
+
trello = trello_factory.create(trello_credentials)
|
16
|
+
trello_boards = TrelloBoards.new(trello)
|
17
|
+
last_seven_days_cards = FilteredCardRepostitory.new(trello_boards)
|
18
|
+
@completed_cards = CompletedCardRepository.new(last_seven_days_cards)
|
19
|
+
@filter_factory = FilterFactory.new(trello_boards)
|
20
|
+
end
|
21
|
+
|
22
|
+
def get(parameters = {})
|
23
|
+
filter = @filter_factory.create(parameters[:board_id], parameters[:end_list])
|
24
|
+
velocity_calculator = VelocityCalculator.new
|
25
|
+
@completed_cards
|
26
|
+
.find(board_id: parameters[:board_id], end_list: parameters[:end_list], filter: filter)
|
27
|
+
.each { | card | velocity_calculator.add(card.complexity) }
|
28
|
+
return WeeklyVelocity.new(velocity_calculator.total);
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class WeeklyVelocity
|
33
|
+
attr_reader :amount
|
34
|
+
|
35
|
+
def initialize(amount)
|
36
|
+
@amount = amount
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: trello-weekly-velocity
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- iainjmitchell
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-09-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ruby-trello
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: trello-factory
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description:
|
42
|
+
email: iainjmitchell@gmail.com
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- lib/CardContainsComplexityFilter.rb
|
48
|
+
- lib/CardsCompletedInLastSevenDaysFilter.rb
|
49
|
+
- lib/CompletedCard.rb
|
50
|
+
- lib/CompletedCardRepository.rb
|
51
|
+
- lib/FilterFactory.rb
|
52
|
+
- lib/FilteredCardRepository.rb
|
53
|
+
- lib/TrelloBoard.rb
|
54
|
+
- lib/TrelloBoards.rb
|
55
|
+
- lib/TrelloWeeklyVelocity.rb
|
56
|
+
- lib/VelocityCalculator.rb
|
57
|
+
homepage: https://github.com/code-computerlove/trello-weekly-velocity
|
58
|
+
licenses:
|
59
|
+
- MIT
|
60
|
+
metadata: {}
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ! '>='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
requirements: []
|
76
|
+
rubyforge_project:
|
77
|
+
rubygems_version: 2.2.2
|
78
|
+
signing_key:
|
79
|
+
specification_version: 4
|
80
|
+
summary: Calculates weekly velocity from trello boards
|
81
|
+
test_files: []
|