slackdo 0.3.2 → 0.3.3

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: 4131a40592d0ffe36d85a9b41961954977549986
4
- data.tar.gz: 2911733a592a995759833263b365b73dcb7db836
3
+ metadata.gz: a663cfae4fc0eb10cf51c1819f9ec7c307eb8872
4
+ data.tar.gz: 2a8f2f93ff16605b54d886f38baf4abbe47947dd
5
5
  SHA512:
6
- metadata.gz: b87cf9b97c3df3cd23723dc398d7622b2de90d1a20b5cef679cec5f5a543480d75857268d78871bc83ea18f5086f2e9df90ef5959697d003a55404f32f4ea0bf
7
- data.tar.gz: f9a5394036103023cf3ecefb31209005977fb6c6d191cbc2012fc824ca455292170b2a868c80d2d2b34c3301281360deb894dff332caa11bfa25b481e6be16d1
6
+ metadata.gz: f0ec0cf47cdb1e40f8b5a3087b69e71d3a58502790db7ccc3701a1477f9123d54d1772c8d2fd19e6d299c888d18dbd22f132423d1698f92acee53a61d9c09500
7
+ data.tar.gz: 1077c3cc7b274eeb060c2a23863514e21c704f8a7fa60d842aca09a27a75fd1e575b773b2c213aef7c0b1dc3c5ad94fa7aaa22762b54bd571d4b08851febb962
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- slackdo (0.3.2)
4
+ slackdo (0.3.3)
5
5
  highline
6
6
  json
7
7
  ruby-trello
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
- # Slackdo
1
+ # Slackdo [![Gem Version](https://badge.fury.io/rb/slackdo.svg)](https://badge.fury.io/rb/slackdo)
2
+
2
3
  ![example](img/task-example.png)
3
4
 
4
5
  SlackDO is a simple CLI tool that allows you to send TODO items and reminders to a channel on Slack or to yourself. It simplifies the process of maintaining your TODO list from the CLI without having to leave it.
@@ -52,15 +53,24 @@ Now that this has been configured SlackDO will send your items to both Slack and
52
53
  slackdo task
53
54
  ```
54
55
 
55
- ![example](img/slack-task.png)
56
56
  ![example](img/trello-card.png)
57
57
 
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:
59
+
60
+ ```
61
+ slackdo label add
62
+ ```
63
+
64
+ Just make sure you name your labels on Trello the same as the categories you use for your SlackDO tasks, otherwise it won't find these labels. So for example if you create a task with category set to `GENERAL` it will search for a label with a name set to `GENERAL` as well.
65
+
58
66
  To disable the Trello integration again use:
59
67
 
60
68
  ```
61
69
  slackdo disable trello
62
70
  ```
63
71
 
72
+
73
+
64
74
  ### Configuration
65
75
  The config file is located at `~/.slackdo/config.json` if you like to change things manually.
66
76
 
data/bin/slackdo CHANGED
@@ -9,6 +9,8 @@ case ARGV[0]
9
9
  when 'configure'
10
10
  config.configure_slack_webhook if ARGV[1] == 'slack'
11
11
  config.configure_trello_api if ARGV[1] == 'trello' && ARGV[2].nil?
12
+ when 'label'
13
+ config.add_label if ARGV[1] == 'add'
12
14
  when 'disable'
13
15
  config.disable_trello if ARGV[1] == 'trello'
14
16
  when 'enable'
@@ -21,8 +23,9 @@ case ARGV[0]
21
23
  if hash['allow_trello_pushing'] == 'true'
22
24
  card_name = slack.get_message
23
25
  card_desc = slack.get_notes
26
+ card_category = slack.get_category
24
27
  trello = Slackdo::Card.new
25
- trello.add_card(card_name, card_desc)
28
+ trello.add_card(card_category, card_name, card_desc)
26
29
  end
27
30
  when 'reminder'
28
31
  slack = Slackdo::Reminder.new
@@ -1,3 +1,3 @@
1
1
  module Slackdo
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
data/lib/slackdo.rb CHANGED
@@ -15,13 +15,25 @@ module Slackdo
15
15
  "allow_trello_pushing" => "false",
16
16
  "trello_public_key" => "",
17
17
  "trello_member_token" => "",
18
- "trello_list_id" => ""
18
+ "trello_list_id" => "",
19
+ "trello_label_list_ids" => []
19
20
  }
20
21
  File.open("#{ENV['HOME']}/.slackdo/config.json",'w') do |f|
21
22
  f.write(hash.to_json)
22
23
  end
23
24
  end
24
25
  end
26
+ def add_label
27
+ cli = HighLine.new
28
+ file = File.read("#{ENV['HOME']}/.slackdo/config.json")
29
+ hash = JSON.parse(file)
30
+ id = cli.ask 'What is the ID of the label you wish to add?'.strip
31
+ hash['trello_label_list_ids'] << id
32
+ File.open("#{ENV['HOME']}/.slackdo/config.json",'w') do |f|
33
+ f.write(hash.to_json)
34
+ end
35
+ puts "Label with ID '#{id}' was added..."
36
+ end
25
37
  def enable_trello
26
38
  file = File.read("#{ENV['HOME']}/.slackdo/config.json")
27
39
  hash = JSON.parse(file)
@@ -78,15 +90,24 @@ module Slackdo
78
90
  config.member_token = hash['trello_member_token']
79
91
  end
80
92
  end
81
- def add_card(card_name, card_desc)
93
+ def add_card(card_category, card_name, card_desc)
82
94
  file = File.read("#{ENV['HOME']}/.slackdo/config.json")
83
95
  hash = JSON.parse(file)
84
96
  configure_trello
97
+ card_name_full = ''
98
+ card_name_full << "[#{card_category}]"
99
+ card_name_full << " #{card_name}"
100
+ label_id = ''
101
+ hash['trello_label_list_ids'].each do |id|
102
+ label = Trello::Label.find(id)
103
+ label_id = id if label.name == card_category
104
+ end
85
105
  card = Trello::Card.create(
86
- name: card_name,
106
+ name: card_name_full,
87
107
  desc: card_desc,
88
- list_id: hash['trello_list_id'],
108
+ list_id: hash['trello_list_id'],
89
109
  pos: 'top',
110
+ card_labels: label_id
90
111
  )
91
112
  card.save
92
113
  puts 'Card was created on Trello...'
@@ -96,14 +117,21 @@ module Slackdo
96
117
  class Task
97
118
  $note_content = ''
98
119
  $message = ''
99
- def set_message(text)
100
- $message = text
120
+ $category = ''
121
+ def set_category(cat)
122
+ $category = cat
101
123
  end
102
- def set_notes(notes)
103
- $note_content = notes
124
+ def get_category
125
+ return $category
126
+ end
127
+ def set_message(text)
128
+ $message = text
104
129
  end
105
130
  def get_message
106
- return $message
131
+ return $message
132
+ end
133
+ def set_notes(notes)
134
+ $note_content = notes
107
135
  end
108
136
  def get_notes
109
137
  return $note_content
@@ -114,7 +142,7 @@ module Slackdo
114
142
  webhook = hash['slack_webhook']
115
143
  notifier = Slack::Notifier.new webhook
116
144
  cli = HighLine.new
117
- category = cli.ask 'What is the category of this new task? eg. DEV or GENERAL'
145
+ cli_category = cli.ask 'What is the category of this new task? eg. DEV or GENERAL'
118
146
  cli_message = cli.ask 'Type your new task:'
119
147
  want_note = cli.ask 'Do you want to add a note to this new task? y/n'
120
148
  cli_note = ''
@@ -129,9 +157,10 @@ module Slackdo
129
157
  color: "gray",
130
158
  mrkdwn_in: ["text"]
131
159
  }
132
- set_message("[#{category}] #{cli_message}")
160
+ set_message(cli_message)
161
+ set_category(cli_category)
133
162
  set_notes(cli_note)
134
- notifier.post text: "• [#{category}] #{cli_message}", attachments: [note]
163
+ notifier.post text: "• [#{cli_category}] #{cli_message}", attachments: [note]
135
164
  puts 'Item was posted to Slack...'
136
165
  end
137
166
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slackdo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - segersniels
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-06 00:00:00.000000000 Z
11
+ date: 2017-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -134,7 +134,6 @@ files:
134
134
  - lib/slackdo.rb
135
135
  - lib/slackdo/version.rb
136
136
  - slackdo.gemspec
137
- - "}"
138
137
  homepage: https://github.com/segersniels/slackdo
139
138
  licenses:
140
139
  - MIT
data/} DELETED
File without changes