slackdo 0.3.4 → 0.3.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a79abb96691b2bbe11d2d15a71609239e2b4e735
4
- data.tar.gz: a5323448bdd7b2beb39cc77a5d599419e9309918
3
+ metadata.gz: 3b39828c03be73fb6c86aaa55c6c635f1dfff83b
4
+ data.tar.gz: c8f0c26aa86b691b342978a11d8f2e69b7f25d24
5
5
  SHA512:
6
- metadata.gz: '06088a43df3803a2d10c48c456df62fd6fced80d0925e9c720cef3582209bf66c0d54abbedda2999a31a2579bde3a90b4c2b0e299918169f07ef1eb5b8ea5432'
7
- data.tar.gz: 3169e030ff9ba945cc3ba9bcc4d106bfb7c3b0464f4b189ac3659a744c234c2ba9cb2786aa0143120dcb690b31c5063cf425296eada7812761b0d2acaba8b90c
6
+ metadata.gz: efd658ea8ad184d4067d25f3730947b462dd7a0aacb47627f93284dd82eb5417385387c0523338958875cc81103af482418389553cd0805f1e4f34cf83862807
7
+ data.tar.gz: 776cffa4e495eaf4de10ee359b8156ff04652d2e4d17b8adf4485b6aecd0a4d85c067857b35837294afc05dcc58e04b24561df96f6bd1877350e0af85a7e7e76
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- slackdo (0.3.4)
4
+ slackdo (0.3.5)
5
5
  json
6
6
  ruby-trello
7
7
  slack-notifier
data/README.md CHANGED
@@ -28,6 +28,13 @@ First thing you should do is configure your incoming webhook by doing the follow
28
28
  slackdo configure slack
29
29
  ```
30
30
 
31
+ Next up is configuring your categories. To add or remove a category use:
32
+
33
+ ```
34
+ slackdo category add
35
+ slackdo category remove
36
+ ```
37
+
31
38
  After that you're all set to go.
32
39
  Add a new TODO item by using
33
40
 
@@ -55,10 +62,11 @@ slackdo task
55
62
 
56
63
  ![example](img/trello-card.png)
57
64
 
58
- You can add your label ids to the configuration to enable SlackDO to automatically assign labels to your cards. You can do this by doing the following:
65
+ You can add your label ids to the configuration to enable SlackDO to automatically assign labels to your cards. You can add or remove a label by doing the following:
59
66
 
60
67
  ```
61
68
  slackdo label add
69
+ slackdo label remove
62
70
  ```
63
71
 
64
72
  SlackDO will look for labels that have the same name as the category you have selected for your new task.
data/bin/slackdo CHANGED
@@ -14,6 +14,7 @@ case ARGV[0]
14
14
  config.remove_category if ARGV[1] == 'remove'
15
15
  when 'label'
16
16
  config.add_label if ARGV[1] == 'add'
17
+ config.remove_label if ARGV[1] == 'remove'
17
18
  when 'disable'
18
19
  config.disable_trello if ARGV[1] == 'trello'
19
20
  when 'enable'
data/lib/slackdo.rb CHANGED
@@ -18,7 +18,7 @@ module Slackdo
18
18
  "trello_public_key" => "",
19
19
  "trello_member_token" => "",
20
20
  "trello_list_id" => "",
21
- "trello_label_list_ids" => [],
21
+ "trello_label_ids" => [],
22
22
  "categories" => [GENERAL]
23
23
  }
24
24
  File.open("#{ENV['HOME']}/.slackdo/config.json",'w') do |f|
@@ -54,12 +54,33 @@ module Slackdo
54
54
  file = File.read("#{ENV['HOME']}/.slackdo/config.json")
55
55
  hash = JSON.parse(file)
56
56
  id = $prompt.ask('What is the ID of the label you wish to add?')
57
- hash['trello_label_list_ids'] << id
57
+ hash['trello_label_ids'].push(id)
58
58
  File.open("#{ENV['HOME']}/.slackdo/config.json",'w') do |f|
59
59
  f.write(hash.to_json)
60
60
  end
61
61
  puts "Label with ID '#{id}' was added..."
62
62
  end
63
+ def remove_label
64
+ Card.configure_trello
65
+ file = File.read("#{ENV['HOME']}/.slackdo/config.json")
66
+ hash = JSON.parse(file)
67
+ label_names = []
68
+ hash['trello_label_ids'].each do |i|
69
+ label_name = Trello::Label.find(i).name
70
+ label_names.push(label_name)
71
+ end
72
+ label = $prompt.select('What is the label you wish to remove?', label_names)
73
+ id = ""
74
+ hash['trello_label_ids'].each do |i|
75
+ label_name = Trello::Label.find(i).name
76
+ id = i if label_name == label
77
+ end
78
+ hash['trello_label_ids'].delete(id)
79
+ File.open("#{ENV['HOME']}/.slackdo/config.json",'w') do |f|
80
+ f.write(hash.to_json)
81
+ end
82
+ puts "Label '#{label}' was removed..."
83
+ end
63
84
  def enable_trello
64
85
  file = File.read("#{ENV['HOME']}/.slackdo/config.json")
65
86
  hash = JSON.parse(file)
@@ -81,9 +102,9 @@ module Slackdo
81
102
  def configure_trello_api
82
103
  file = File.read("#{ENV['HOME']}/.slackdo/config.json")
83
104
  hash = JSON.parse(file)
84
- public_key = $prompt.ask('What is your Trello public key?')
85
- member_token = $prompt.ask('What is your Trello member token?')
86
- list_id = $prompt.ask('What is your board list ID where the cards should be created?')
105
+ public_key = $prompt.ask('What is your Trello public key?', default: hash['trello_public_key'])
106
+ member_token = $prompt.ask('What is your Trello member token?', default: hash['trello_member_token'])
107
+ list_id = $prompt.ask('What is your Trello list ID where the cards should be created?', default: hash['trello_list_id'])
87
108
  hash["trello_public_key"] = public_key
88
109
  hash["trello_member_token"] = member_token
89
110
  hash["allow_trello_pushing"] = "true"
@@ -96,7 +117,7 @@ module Slackdo
96
117
  def configure_slack_webhook
97
118
  file = File.read("#{ENV['HOME']}/.slackdo/config.json")
98
119
  hash = JSON.parse(file)
99
- webhook = $prompt.ask('What is your Slack webhook?')
120
+ webhook = $prompt.ask('What is your Slack webhook?', default: hash['slack_webhook'])
100
121
  hash["slack_webhook"] = webhook
101
122
  File.open("#{ENV['HOME']}/.slackdo/config.json",'w') do |f|
102
123
  f.write(hash.to_json)
@@ -106,7 +127,7 @@ module Slackdo
106
127
  end
107
128
 
108
129
  class Card
109
- def configure_trello
130
+ def self.configure_trello
110
131
  file = File.read("#{ENV['HOME']}/.slackdo/config.json")
111
132
  hash = JSON.parse(file)
112
133
  Trello.configure do |config|
@@ -122,7 +143,7 @@ module Slackdo
122
143
  card_name_full << "[#{card_category}]"
123
144
  card_name_full << " #{card_name}"
124
145
  label_id = ''
125
- hash['trello_label_list_ids'].each do |id|
146
+ hash['trello_label_ids'].each do |id|
126
147
  label = Trello::Label.find(id)
127
148
  label_id = id if label.name == card_category
128
149
  end
@@ -1,3 +1,3 @@
1
1
  module Slackdo
2
- VERSION = "0.3.4"
2
+ VERSION = "0.3.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slackdo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - segersniels