TrelloCycleTime 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Y2RhOTdkNGY4M2E0YTQ0MTAyMWZiZDMzZjRlNTFiZTQxN2Y1ZmI5Mw==
4
+ MzUzNmViNzIxOGM1MTI5NTFiYTY0M2I2ZTkyNDE3ODViZTI1MWRjNA==
5
5
  data.tar.gz: !binary |-
6
- NGMwMzFiZGViYjViYzRmMzY3OWU4MzMxNTM4YTMxYmY3OTFhNmZhMw==
6
+ ZjIwMzlmNWVkYmNmMjQ4OGI5ZjhmMDYzZGU3MDRkYjJiN2YzMmQ1Mw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NzA3ODVlYzFjYTM4NzljZjVlMmI5NjIxYjkyY2FmYjVmOTQ3MTI1M2MwYmZm
10
- YWE1NTczODRjZTQyN2FkZGQwMmVkOGI0YWE1MTBkMDY5OWQzNmNlMDY3ZmEy
11
- ZTFlNmM4OWMxNmUwYTE3MDkzZjg1ZTRjZDUwY2RhYjQwZTM4MTI=
9
+ ZTgxZWEwZDA1YTQ2M2Y1ZGY0YjJhYjQ5NWJlOTZkOTY4MGYzMDUxYTQ3NTg4
10
+ YzAxZmM3MWJiYmZkMzMzY2QzY2UwZGM5OWU1NWNmNmQyMzdjNTQyY2ViMDQ2
11
+ ZDVmNDllODhkNmYzMGZiZDBjNWQwYTFlODNjZDcyZTE1YTY5OGY=
12
12
  data.tar.gz: !binary |-
13
- MTdiZGFiYWQ3NzZiNjk5YmFlY2QyZWE2NWMyMDMzM2JjZTRmN2NkMTFhMDky
14
- ZDFjYTU3YzE3ODY0OWM3OGI2OGJhNzRlNjUyOWJhYjkwNDFjOTMzMjg5NDQy
15
- ZjhmMjFlNjk0MWRlMDliNzMwYjAzOGI1YWVmYTk5MDQ2ZTVhZTc=
13
+ YjVjYmU1ZGM5OTViOTZlMWU5ZjE1ZTkyZTU0YTBjYzJhYzM5OTg1YzZkNTNm
14
+ MTg2NDA3Zjk1N2M2NzI2ZTUwMzE2NzFiNzM5NGM5OGJjOGJkMTFmNDZjYTkx
15
+ ZjQyZDk5MTc3ZmQzYTNiMWIwYjJjMTlhYzIwY2QwNGIwMmI3ZTE=
@@ -1,15 +1,14 @@
1
1
  module AgileTrello
2
- class CardRepository
3
- def initialize(trello, parameters)
4
- @trello_board = trello.get_board(parameters[:board_id])
5
- @end_list = parameters[:end_list]
2
+ class BoardCardRepository
3
+ def initialize(trello_board)
4
+ @trello_board = trello_board
6
5
  end
7
6
 
8
- def get_cards_after
7
+ def get_cards_after(end_list)
9
8
  cards_after = []
10
9
  ignore = true
11
10
  @trello_board.lists.each do | list |
12
- ignore = !list.name.include?(@end_list) if ignore
11
+ ignore = !list.name.include?(end_list) if ignore
13
12
  if !ignore
14
13
  list.cards.each do | card |
15
14
  cards_after.push(card)
@@ -0,0 +1,14 @@
1
+ require_relative './BoardCardRepository'
2
+
3
+ module AgileTrello
4
+ class BoardCardRepositoryFactory
5
+ def initialize(trello)
6
+ @trello = trello
7
+ end
8
+
9
+ def create(board_id)
10
+ trello_board = @trello.get_board(board_id)
11
+ BoardCardRepository.new(trello_board)
12
+ end
13
+ end
14
+ end
data/lib/CompletedCard.rb CHANGED
@@ -7,5 +7,9 @@ module AgileTrello
7
7
  def initialize(start_date, end_date)
8
8
  @cycle_time = ((end_date - start_date) / SECONDS_IN_24HRS).round(2)
9
9
  end
10
+
11
+ def shareCycleTimeWith(calculator)
12
+ calculator.add(@cycle_time)
13
+ end
10
14
  end
11
15
  end
@@ -11,13 +11,26 @@ module AgileTrello
11
11
  @start_list = parameters[:start_list]
12
12
  @end_list = parameters[:end_list]
13
13
  @all_lists = parameters[:all_lists]
14
+ @measurement_start_date =
15
+ parameters[:measurement_start_date].nil? ? Time.new(1066) : parameters[:measurement_start_date]
14
16
  end
15
17
 
16
18
  def create(trello_card)
17
19
  card_history = CardHistory.new(trello_card, @all_lists)
18
- start_date = card_history.find_date_entered_list(@start_list)
19
20
  end_date = card_history.find_date_entered_list(@end_list)
20
- CompletedCard.new(start_date, end_date)
21
+ is_in_measured_period = end_date > @measurement_start_date
22
+
23
+ if (is_in_measured_period)
24
+ start_date = card_history.find_date_entered_list(@start_list)
25
+ CompletedCard.new(start_date, end_date)
26
+ else
27
+ CardBeforeMeasurementPeriod.new
28
+ end
29
+ end
30
+ end
31
+
32
+ class CardBeforeMeasurementPeriod
33
+ def shareCycleTimeWith(calculator)
21
34
  end
22
35
  end
23
36
  end
@@ -0,0 +1,34 @@
1
+ require 'peach'
2
+ require_relative './CompletedCardFactory'
3
+ require_relative './BoardCardRepositoryFactory'
4
+
5
+ module AgileTrello
6
+ class CompletedCards
7
+ def initialize(trello, average_cycle_time_calculator, trello_list_repository)
8
+ @board_card_repository_factory = BoardCardRepositoryFactory.new(trello)
9
+ @trello_list_repository = trello_list_repository
10
+ @average_cycle_time_calculator = average_cycle_time_calculator
11
+ end
12
+
13
+ def retrieve(parameters)
14
+ board_id = parameters[:board_id]
15
+ end_list = parameters[:end_list]
16
+
17
+ completed_card_for_board_factory = CompletedCardFactory.new(
18
+ start_list: parameters[:start_list],
19
+ end_list: end_list,
20
+ all_lists: @trello_list_repository.get(board_id),
21
+ average_cycle_time_calculator: parameters[:average_cycle_time_calculator],
22
+ measurement_start_date: parameters[:measurement_start_date]
23
+ )
24
+ @board_card_repository_factory
25
+ .create(board_id)
26
+ .get_cards_after(end_list)
27
+ .peach do |card|
28
+ completed_card_for_board_factory
29
+ .create(card)
30
+ .shareCycleTimeWith(@average_cycle_time_calculator)
31
+ end
32
+ end
33
+ end
34
+ end
@@ -1,24 +1,21 @@
1
- require 'peach'
2
1
  require_relative './TrelloFactory'
3
2
  require_relative './TrelloCredentials'
4
3
  require_relative './AverageCycleTimeCalculator'
5
- require_relative './CompletedCardRepository'
4
+ require_relative './CompletedCards'
5
+ require_relative './TrelloListRepository'
6
6
 
7
7
  module AgileTrello
8
8
  class TrelloCycleTime
9
9
  def initialize(parameters = {})
10
10
  trello_credentials = TrelloCredentials.new(parameters[:public_key], parameters[:access_token])
11
11
  trello_factory = parameters[:trello_factory].nil? ? TrelloFactory.new : parameters[:trello_factory]
12
- @trello = trello_factory.create(trello_credentials)
12
+ trello = trello_factory.create(trello_credentials)
13
13
  @average_cycle_time_calculator = AverageCycleTimeCalculator.new
14
+ @completed_cards = CompletedCards.new(trello, @average_cycle_time_calculator, TrelloListRepository.new(trello))
14
15
  end
15
16
 
16
17
  def get(parameters)
17
- completed_card_repository = CompletedCardRepository.new(@trello, parameters)
18
- finished_cards = completed_card_repository.get
19
- finished_cards.peach do | card |
20
- @average_cycle_time_calculator.add(card.cycle_time)
21
- end
18
+ @completed_cards.retrieve(parameters)
22
19
  return @average_cycle_time_calculator.average
23
20
  end
24
21
  end
@@ -0,0 +1,14 @@
1
+ module AgileTrello
2
+ class TrelloListRepository
3
+ def initialize(trello)
4
+ @trello = trello
5
+ end
6
+
7
+ def get(board_id)
8
+ trello_board = @trello.get_board(board_id)
9
+ trello_board.lists.map do |list|
10
+ list.name
11
+ end
12
+ end
13
+ end
14
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: TrelloCycleTime
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - iainjmitchell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-30 00:00:00.000000000 Z
11
+ date: 2014-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-trello
@@ -45,14 +45,16 @@ extensions: []
45
45
  extra_rdoc_files: []
46
46
  files:
47
47
  - lib/AverageCycleTimeCalculator.rb
48
+ - lib/BoardCardRepository.rb
49
+ - lib/BoardCardRepositoryFactory.rb
48
50
  - lib/CardHistory.rb
49
- - lib/CardRepository.rb
50
51
  - lib/CompletedCard.rb
51
52
  - lib/CompletedCardFactory.rb
52
- - lib/CompletedCardRepository.rb
53
+ - lib/CompletedCards.rb
53
54
  - lib/TrelloCredentials.rb
54
55
  - lib/TrelloCycleTime.rb
55
56
  - lib/TrelloFactory.rb
57
+ - lib/TrelloListRepository.rb
56
58
  homepage: https://github.com/code-computerlove/trello-cycletime
57
59
  licenses:
58
60
  - MIT
@@ -1,26 +0,0 @@
1
- require_relative './CompletedCardFactory'
2
- require_relative './CardRepository'
3
-
4
- module AgileTrello
5
- class CompletedCardRepository
6
- def initialize(trello, parameters)
7
- trello_board = trello.get_board(parameters[:board_id])
8
- all_lists_on_board = trello_board.lists.map do |list|
9
- list.name
10
- end
11
- @card_repository = CardRepository.new(trello, parameters)
12
- @completed_card_factory = CompletedCardFactory.new(
13
- start_list: parameters[:start_list],
14
- end_list: parameters[:end_list],
15
- all_lists: all_lists_on_board
16
- )
17
- end
18
-
19
- def get
20
- completed_cards = @card_repository.get_cards_after
21
- completed_cards.map do |card|
22
- @completed_card_factory.create(card)
23
- end
24
- end
25
- end
26
- end