trello-changelog 0.1.1 → 0.4.0

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: c0f6442c72c64bb7733510ccb2706a89542138e5
4
- data.tar.gz: 8f86fc45a735da6c52314f4c18136107f29f5e28
3
+ metadata.gz: ffc5670d0f7ab8dad0af79aa79acdcfc8621be98
4
+ data.tar.gz: 67e01bc0f616bbc0b5fc45065959fa0cd69b8f34
5
5
  SHA512:
6
- metadata.gz: 7ee179e2044adcee700efe64e7f8e12328890a80e857085d7274919c591b4dc98d24b9f120670726598a67d34c0c13e41832a188e1c9f772be8d8036ef06d988
7
- data.tar.gz: 77c64526d2fb8c812a04ba3e3176247b5335f48f200bc381151042c18fc384a8830954d229216b926260d60f17e3121e1f88eb160ba3978652506c5ef033585a
6
+ metadata.gz: 1c95733149f94ba3dded4d3a09a5e7e41f21a44396a3f9fe8fc94b2d016a0720ac1c8f1ffb4e370186e6ec57a90d93eda60a9331fc07b42cdeb5720482bf92c3
7
+ data.tar.gz: 969c5004e353acf89f50cd9ab8061b1a641b294aee6718d0760418ebedd27d82d014698b2157cd22a504b4b4897b7e2ee2a35c6cb9f987096634e3c2b33d5cfb
data/bin/trello-changelog CHANGED
@@ -5,7 +5,11 @@ require 'thor'
5
5
  require 'trello-changelog'
6
6
 
7
7
  class TrelloChangelogCommand < Thor
8
- desc 'print', 'print trelloboard from a startdate (example: trello-changelog --start_date=2015-02-01) this parameter is only needed if you want to run on an other day than friday.'
8
+ desc(
9
+ 'print',
10
+ 'print trelloboard from a startdate (example: trello-changelog --start_date=2015-02-01)'\
11
+ 'this parameter is only needed if you want to run on an other day than friday.'
12
+ )
9
13
  option :start_date, type: :string, desc: 'Start date'
10
14
 
11
15
  def print
@@ -1,94 +1,14 @@
1
1
  require 'date'
2
2
  require 'trello'
3
-
4
- begin
5
- require '~/.trello-changelog.rb'
6
- rescue LoadError
7
- puts 'File: ".trello-changelog.rb" was not found in your home directory!'
8
- exit
9
- end
10
-
11
-
12
- module Trello
13
- class Card < BasicData
14
- def creation_date
15
- epoch_from_id = self.id[0..7].hex
16
- DateTime.strptime(epoch_from_id.to_s,'%s')
17
- end
18
- end
19
- end
3
+ require 'trello-changelog/config'
4
+ require 'trello-changelog/printers'
20
5
 
21
6
  class TrelloChangelog
22
- def initialize(start_date)
23
-
24
- Trello.configure do |trello_config|
25
- trello_config.developer_public_key = Variables::DEVKEY
26
- trello_config.member_token = Variables::MEM_TOKEN
27
- end
28
-
29
- @board = Trello::Board.find(Variables::BOARD)
30
- if(start_date == nil)
31
- @start_date = Date.today - 6
32
- else
33
- begin
34
- @start_date = Date.parse start_date
35
- rescue ArgumentError
36
- puts 'The start date syntax is wrong. Possible correct syntax are: YYYY-MM-DD, DD-MM-YYYY, YYYY/MM/DD, DD/MM/YYYY, ... . Please try again.'
37
- exit
38
- end
39
- end
40
- @year = Date.today.year
41
- @done_list = @board.lists.select { |list| list.name == Variables::DONE_LIST_NAME }.last
7
+ def initialize(date)
8
+ load_config_file
9
+ configure_trello
10
+ start_date date
42
11
 
43
12
  print
44
13
  end
45
-
46
- private
47
-
48
- def new_tickets
49
- @new_tickets ||= @board.cards.select { |card| card.creation_date >= @start_date}
50
- end
51
-
52
- def done_tickets
53
- @done_tickets ||= @board.cards.select { |card| card.list_id == @done_list.id }
54
- end
55
-
56
- def archived_tickets
57
- @archived_tickets ||= @board.cards( { filter: :all } ).select { |card| card.creation_date >= @start_date }.select { |card| card.closed == true } - archived_done_tickets
58
- end
59
-
60
- def archived_done_tickets
61
- @archived_done_tickets ||= @board.cards( { filter: :all } ).select { |card| card.creation_date >= @start_date }.select { |card| card.list_id == @done_list.id }.select { |card| card.closed == true }
62
- end
63
-
64
- def new_tickets_count
65
- new_tickets.count
66
- end
67
-
68
- def done_tickets_count
69
- done_tickets.count
70
- end
71
-
72
- def archived_tickets_count
73
- archived_tickets.count
74
- end
75
-
76
- def print
77
- puts "# Start date: #{@start_date}\n\n"
78
-
79
- puts "Created Trello items since #{@start_date}: #{new_tickets_count}\n\n"
80
- puts "Finished Trello items since #{@start_date}: #{done_tickets_count}\n\n"
81
- puts "Archived Trello items since #{@start_date}: #{archived_tickets_count}\n\n"
82
-
83
- puts "Summary: #{new_tickets_count} tickets in, #{done_tickets_count + archived_tickets_count} tickets out\n\n"
84
-
85
- for label_name in Variables::LABELS do
86
- tickets_label_name = done_tickets.select { |ticket| ticket.labels.select { |label| label.name == label_name}.count > 0 }
87
- puts "\n## #{label_name}:\n\n"
88
- tickets_label_name.each do |ticket|
89
- puts " * [#{ticket.name}](#{ticket.url})"
90
- end
91
- puts 'n.a.' if tickets_label_name.count == 0
92
- end
93
- end
94
14
  end
@@ -0,0 +1,34 @@
1
+ class TrelloChangelog
2
+ private
3
+
4
+ def load_config_file
5
+ begin
6
+ require '~/.trello-changelog.rb'
7
+ rescue LoadError
8
+ puts 'File: ".trello-changelog.rb" was not found in your home directory! See README on Github.'
9
+ exit
10
+ end
11
+ end
12
+
13
+ def configure_trello
14
+ Trello.configure do |trello_config|
15
+ trello_config.developer_public_key = Variables::DEVKEY
16
+ trello_config.member_token = Variables::MEM_TOKEN
17
+ end
18
+ end
19
+
20
+ def start_date(start_date=@start_date)
21
+ @start_date ||= \
22
+ if(start_date == nil)
23
+ Date.today - 6
24
+ else
25
+ begin
26
+ Date.parse start_date
27
+ rescue ArgumentError
28
+ puts 'The start date syntax is wrong. Possible correct syntax are:'\
29
+ 'YYYY-MM-DD, DD-MM-YYYY, YYYY/MM/DD, DD/MM/YYYY, ... . Please try again.'
30
+ exit
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,43 @@
1
+ require 'trello-changelog/tickets'
2
+
3
+ class TrelloChangelog
4
+ def print
5
+ print_summary
6
+ print_labels
7
+ print_unlabeled
8
+ end
9
+
10
+ def print_summary
11
+ puts "# Start date: #{start_date}\n\n"
12
+
13
+ puts "Created Trello items since #{start_date}: #{new_tickets_count}\n\n"
14
+ puts "Finished Trello items since #{start_date}: #{done_tickets_count}\n\n"
15
+ puts "Archived Trello items since #{start_date}: #{archived_tickets_count}\n\n"
16
+
17
+ puts "Summary: #{new_tickets_count} tickets in, #{done_tickets_count + archived_tickets_count} tickets out\n\n"
18
+ end
19
+
20
+ def print_labels
21
+ for label_name in Variables::LABELS do
22
+ tickets_label_name = done_tickets.select { |ticket| ticket.labels.select { |label| label.name == label_name}.count > 0 }
23
+ puts "\n## #{label_name}:\n\n"
24
+ tickets_label_name.each do |ticket|
25
+ puts " * [#{ticket.name}](#{ticket.url})"
26
+ end
27
+ puts 'n.a.' if tickets_label_name.count == 0
28
+ end
29
+ end
30
+
31
+ def print_unlabeled
32
+ @unlabeled_done_tickets = done_tickets
33
+
34
+ Variables::LABELS.each do |label|
35
+ @unlabeled_done_tickets.select! { |ticket| !ticket.card_labels.find{ |card_label| card_label['name'] == label} }
36
+ end
37
+
38
+ puts "\n## Other"
39
+ @unlabeled_done_tickets.each do |ticket|
40
+ puts " * [#{ticket.name}](#{ticket.url})"
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,39 @@
1
+ require 'trello-changelog/trello/card'
2
+
3
+ class TrelloChangelog
4
+ def board
5
+ @board ||= Trello::Board.find(Variables::BOARD)
6
+ end
7
+
8
+ def done_list
9
+ @done_list ||= board.lists.select { |list| list.name == Variables::DONE_LIST_NAME }.last
10
+ end
11
+
12
+ def new_tickets
13
+ @new_tickets ||= board.cards.select { |card| card.creation_date >= start_date}
14
+ end
15
+
16
+ def done_tickets
17
+ @done_tickets ||= board.cards.select { |card| card.list_id == done_list.id }
18
+ end
19
+
20
+ def archived_tickets
21
+ @archived_tickets ||= board.cards( { filter: :all } ).select { |card| card.creation_date >= start_date }.select { |card| card.closed == true } - archived_done_tickets
22
+ end
23
+
24
+ def archived_done_tickets
25
+ @archived_done_tickets ||= board.cards( { filter: :all } ).select { |card| card.creation_date >= start_date }.select { |card| card.list_id == done_list.id }.select { |card| card.closed == true }
26
+ end
27
+
28
+ def new_tickets_count
29
+ new_tickets.count
30
+ end
31
+
32
+ def done_tickets_count
33
+ done_tickets.count
34
+ end
35
+
36
+ def archived_tickets_count
37
+ archived_tickets.count
38
+ end
39
+ end
@@ -0,0 +1,8 @@
1
+ module Trello
2
+ class Card < BasicData
3
+ def creation_date
4
+ epoch_from_id = self.id[0..7].hex
5
+ DateTime.strptime(epoch_from_id.to_s,'%s')
6
+ end
7
+ end
8
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trello-changelog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giel De Bleser
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: thor
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  description: Changelog for Trello
56
70
  email: giel@openminds.be
57
71
  executables:
@@ -59,8 +73,12 @@ executables:
59
73
  extensions: []
60
74
  extra_rdoc_files: []
61
75
  files:
62
- - lib/trello-changelog.rb
63
76
  - bin/trello-changelog
77
+ - lib/trello-changelog.rb
78
+ - lib/trello-changelog/config.rb
79
+ - lib/trello-changelog/printers.rb
80
+ - lib/trello-changelog/tickets.rb
81
+ - lib/trello-changelog/trello/card.rb
64
82
  homepage: https://github.com/openminds/trello-changelog
65
83
  licenses:
66
84
  - MIT
@@ -81,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
99
  version: '0'
82
100
  requirements: []
83
101
  rubyforge_project:
84
- rubygems_version: 2.0.14
102
+ rubygems_version: 2.4.6
85
103
  signing_key:
86
104
  specification_version: 4
87
105
  summary: Changelog for Trello