trello-changelog 0.4.0 → 1.0.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: ffc5670d0f7ab8dad0af79aa79acdcfc8621be98
4
- data.tar.gz: 67e01bc0f616bbc0b5fc45065959fa0cd69b8f34
3
+ metadata.gz: e12cbf871ff56176304a80c53fa4f1cc81f0f6be
4
+ data.tar.gz: 75082590618f93d8e871d3dfb5a7d43de4adbf56
5
5
  SHA512:
6
- metadata.gz: 1c95733149f94ba3dded4d3a09a5e7e41f21a44396a3f9fe8fc94b2d016a0720ac1c8f1ffb4e370186e6ec57a90d93eda60a9331fc07b42cdeb5720482bf92c3
7
- data.tar.gz: 969c5004e353acf89f50cd9ab8061b1a641b294aee6718d0760418ebedd27d82d014698b2157cd22a504b4b4897b7e2ee2a35c6cb9f987096634e3c2b33d5cfb
6
+ metadata.gz: 3dc8fd987bc9f549ad757f989a4a50a8e97b1bb164e8f6432a9867967c92d61a61da9eeaf551803bb4fd976c560adce4e25d8457816a0b149fadf6348b664392
7
+ data.tar.gz: f4dd053373ba3ea58737d2f4f9d49ab312ba6ee91bbde414ab0ea90f9cc8b777233a327ea0cf906f5e394f1ca0a76e5a8dbcec12571a5acc579de25c8cb52377
data/bin/trello-changelog CHANGED
@@ -11,9 +11,14 @@ class TrelloChangelogCommand < Thor
11
11
  'this parameter is only needed if you want to run on an other day than friday.'
12
12
  )
13
13
  option :start_date, type: :string, desc: 'Start date'
14
+ option :devkey, type: :string, desc: "Trello key"
15
+ option :mem_token, type: :string, desc: "Trello token"
16
+ option :board, type: :string, desc: "Trello board ID"
17
+ option :done_list_name, type: :string, desc: "Name of the 'Done' list"
18
+ option :labels, type: :array, desc: "Specific labels you want to output"
14
19
 
15
20
  def print
16
- TrelloChangelog.new(options[:start_date])
21
+ TrelloChangelog.new(options)
17
22
  end
18
23
  end
19
24
 
@@ -2,12 +2,15 @@ require 'date'
2
2
  require 'trello'
3
3
  require 'trello-changelog/config'
4
4
  require 'trello-changelog/printers'
5
+ require 'active_support/core_ext/hash/indifferent_access'
5
6
 
6
7
  class TrelloChangelog
7
- def initialize(date)
8
+ def initialize(options)
9
+ @options = options.with_indifferent_access
10
+
8
11
  load_config_file
9
12
  configure_trello
10
- start_date date
13
+ start_date(@options[:start_date])
11
14
 
12
15
  print
13
16
  end
@@ -2,8 +2,19 @@ class TrelloChangelog
2
2
  private
3
3
 
4
4
  def load_config_file
5
+ @config = HashWithIndifferentAccess.new(labels: [])
6
+ if %w(devkey mem_token board done_list_name).all? { |key| @options.has_key?(key) }
7
+ puts "Config set via cli, ~/.trello-changelog.rb not loaded"
8
+ @options.each { |key, value| @config[key] = value }
9
+ return true
10
+ end
5
11
  begin
6
12
  require '~/.trello-changelog.rb'
13
+ @config[:devkey] = Variables::DEVKEY
14
+ @config[:mem_token] = Variables::MEM_TOKEN
15
+ @config[:board] = Variables::BOARD
16
+ @config[:done_list_name] = Variables::DONE_LIST_NAME
17
+ @config[:labels] = Variables::LABELS || []
7
18
  rescue LoadError
8
19
  puts 'File: ".trello-changelog.rb" was not found in your home directory! See README on Github.'
9
20
  exit
@@ -12,8 +23,8 @@ class TrelloChangelog
12
23
 
13
24
  def configure_trello
14
25
  Trello.configure do |trello_config|
15
- trello_config.developer_public_key = Variables::DEVKEY
16
- trello_config.member_token = Variables::MEM_TOKEN
26
+ trello_config.developer_public_key = @config[:devkey]
27
+ trello_config.member_token = @config[:mem_token]
17
28
  end
18
29
  end
19
30
 
@@ -23,7 +34,7 @@ class TrelloChangelog
23
34
  Date.today - 6
24
35
  else
25
36
  begin
26
- Date.parse start_date
37
+ Date.parse(start_date)
27
38
  rescue ArgumentError
28
39
  puts 'The start date syntax is wrong. Possible correct syntax are:'\
29
40
  'YYYY-MM-DD, DD-MM-YYYY, YYYY/MM/DD, DD/MM/YYYY, ... . Please try again.'
@@ -18,7 +18,7 @@ class TrelloChangelog
18
18
  end
19
19
 
20
20
  def print_labels
21
- for label_name in Variables::LABELS do
21
+ for label_name in @config[:labels] do
22
22
  tickets_label_name = done_tickets.select { |ticket| ticket.labels.select { |label| label.name == label_name}.count > 0 }
23
23
  puts "\n## #{label_name}:\n\n"
24
24
  tickets_label_name.each do |ticket|
@@ -31,7 +31,7 @@ class TrelloChangelog
31
31
  def print_unlabeled
32
32
  @unlabeled_done_tickets = done_tickets
33
33
 
34
- Variables::LABELS.each do |label|
34
+ @config[:labels].each do |label|
35
35
  @unlabeled_done_tickets.select! { |ticket| !ticket.card_labels.find{ |card_label| card_label['name'] == label} }
36
36
  end
37
37
 
@@ -2,11 +2,11 @@ require 'trello-changelog/trello/card'
2
2
 
3
3
  class TrelloChangelog
4
4
  def board
5
- @board ||= Trello::Board.find(Variables::BOARD)
5
+ @board ||= Trello::Board.find(@config[:board])
6
6
  end
7
7
 
8
8
  def done_list
9
- @done_list ||= board.lists.select { |list| list.name == Variables::DONE_LIST_NAME }.last
9
+ @done_list ||= board.lists.select { |list| list.name == @config[:done_list_name] }.last
10
10
  end
11
11
 
12
12
  def new_tickets
metadata CHANGED
@@ -1,10 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trello-changelog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giel De Bleser
8
+ - Steven De Coeyer
9
+ - Joren De Groof
8
10
  autorequire:
9
11
  bindir: bin
10
12
  cert_chain: []
@@ -99,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
101
  version: '0'
100
102
  requirements: []
101
103
  rubyforge_project:
102
- rubygems_version: 2.4.6
104
+ rubygems_version: 2.5.1
103
105
  signing_key:
104
106
  specification_version: 4
105
107
  summary: Changelog for Trello