slackdo 0.3.3 → 0.3.4

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: a663cfae4fc0eb10cf51c1819f9ec7c307eb8872
4
- data.tar.gz: 2a8f2f93ff16605b54d886f38baf4abbe47947dd
3
+ metadata.gz: a79abb96691b2bbe11d2d15a71609239e2b4e735
4
+ data.tar.gz: a5323448bdd7b2beb39cc77a5d599419e9309918
5
5
  SHA512:
6
- metadata.gz: f0ec0cf47cdb1e40f8b5a3087b69e71d3a58502790db7ccc3701a1477f9123d54d1772c8d2fd19e6d299c888d18dbd22f132423d1698f92acee53a61d9c09500
7
- data.tar.gz: 1077c3cc7b274eeb060c2a23863514e21c704f8a7fa60d842aca09a27a75fd1e575b773b2c213aef7c0b1dc3c5ad94fa7aaa22762b54bd571d4b08851febb962
6
+ metadata.gz: '06088a43df3803a2d10c48c456df62fd6fced80d0925e9c720cef3582209bf66c0d54abbedda2999a31a2579bde3a90b4c2b0e299918169f07ef1eb5b8ea5432'
7
+ data.tar.gz: 3169e030ff9ba945cc3ba9bcc4d106bfb7c3b0464f4b189ac3659a744c234c2ba9cb2786aa0143120dcb690b31c5063cf425296eada7812761b0d2acaba8b90c
data/Gemfile.lock CHANGED
@@ -1,11 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- slackdo (0.3.3)
5
- highline
4
+ slackdo (0.3.4)
6
5
  json
7
6
  ruby-trello
8
7
  slack-notifier
8
+ tty-prompt
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
@@ -23,7 +23,8 @@ GEM
23
23
  diff-lcs (1.3)
24
24
  domain_name (0.5.20170404)
25
25
  unf (>= 0.0.5, < 1.0.0)
26
- highline (1.7.8)
26
+ equatable (0.5.0)
27
+ hitimes (1.2.6)
27
28
  http-cookie (1.0.3)
28
29
  domain_name (~> 0.5)
29
30
  i18n (0.9.1)
@@ -33,8 +34,12 @@ GEM
33
34
  mime-types-data (~> 3.2015)
34
35
  mime-types-data (3.2016.0521)
35
36
  minitest (5.10.3)
37
+ necromancer (0.4.0)
36
38
  netrc (0.11.0)
37
39
  oauth (0.5.3)
40
+ pastel (0.7.2)
41
+ equatable (~> 0.5.0)
42
+ tty-color (~> 0.4.0)
38
43
  public_suffix (3.0.0)
39
44
  rake (10.5.0)
40
45
  rest-client (2.0.2)
@@ -62,11 +67,24 @@ GEM
62
67
  rest-client (>= 1.8.0)
63
68
  slack-notifier (2.3.1)
64
69
  thread_safe (0.3.6)
70
+ timers (4.1.2)
71
+ hitimes
72
+ tty-color (0.4.2)
73
+ tty-cursor (0.5.0)
74
+ tty-prompt (0.13.2)
75
+ necromancer (~> 0.4.0)
76
+ pastel (~> 0.7.0)
77
+ timers (~> 4.1.2)
78
+ tty-cursor (~> 0.5.0)
79
+ tty-reader (~> 0.1.0)
80
+ tty-reader (0.1.0)
81
+ wisper (~> 2.0.0)
65
82
  tzinfo (1.2.4)
66
83
  thread_safe (~> 0.1)
67
84
  unf (0.1.4)
68
85
  unf_ext
69
86
  unf_ext (0.0.7.4)
87
+ wisper (2.0.0)
70
88
 
71
89
  PLATFORMS
72
90
  ruby
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Slackdo [![Gem Version](https://badge.fury.io/rb/slackdo.svg)](https://badge.fury.io/rb/slackdo)
1
+ # SlackDO [![Gem Version](https://badge.fury.io/rb/slackdo.svg)](https://badge.fury.io/rb/slackdo)
2
2
 
3
3
  ![example](img/task-example.png)
4
4
 
@@ -61,7 +61,8 @@ You can add your label ids to the configuration to enable SlackDO to automatical
61
61
  slackdo label add
62
62
  ```
63
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.
64
+ SlackDO will look for labels that have the same name as the category you have selected for your new task.
65
+ So for example if you create a task with the category set to `GENERAL` SlackDO will look for a label with name `GENERAL`.
65
66
 
66
67
  To disable the Trello integration again use:
67
68
 
@@ -69,7 +70,10 @@ To disable the Trello integration again use:
69
70
  slackdo disable trello
70
71
  ```
71
72
 
72
-
73
+ #### Chrome extensions
74
+ When you decide on using labels to add flair to your Trello cards I suggest taking a look at the following Chrome extensions:
75
+ - [Card Color Titles for Trello](https://chrome.google.com/webstore/detail/card-color-titles-for-tre/hpmobkglehhleflhaefmfajhbdnjmgim?hl=en)
76
+ - [Card Colors for Trello](https://chrome.google.com/webstore/detail/card-colors-for-trello/nodlpencjjlohojddhflnahnfpfanbjm?hl=en)
73
77
 
74
78
  ### Configuration
75
79
  The config file is located at `~/.slackdo/config.json` if you like to change things manually.
data/bin/slackdo CHANGED
@@ -9,6 +9,9 @@ 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 'category'
13
+ config.add_category if ARGV[1] == 'add'
14
+ config.remove_category if ARGV[1] == 'remove'
12
15
  when 'label'
13
16
  config.add_label if ARGV[1] == 'add'
14
17
  when 'disable'
@@ -1,3 +1,3 @@
1
1
  module Slackdo
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
data/lib/slackdo.rb CHANGED
@@ -1,8 +1,10 @@
1
1
  require 'slackdo/version'
2
- require 'highline'
3
2
  require 'slack-notifier'
4
3
  require 'trello'
5
4
  require 'json'
5
+ require 'tty-prompt'
6
+
7
+ $prompt = TTY::Prompt.new
6
8
 
7
9
  module Slackdo
8
10
  class Config
@@ -16,18 +18,42 @@ module Slackdo
16
18
  "trello_public_key" => "",
17
19
  "trello_member_token" => "",
18
20
  "trello_list_id" => "",
19
- "trello_label_list_ids" => []
21
+ "trello_label_list_ids" => [],
22
+ "categories" => [GENERAL]
20
23
  }
21
24
  File.open("#{ENV['HOME']}/.slackdo/config.json",'w') do |f|
22
25
  f.write(hash.to_json)
23
26
  end
24
27
  end
25
28
  end
29
+ def add_category
30
+ file = File.read("#{ENV['HOME']}/.slackdo/config.json")
31
+ hash = JSON.parse(file)
32
+ cat = $prompt.ask('What is the category you wish to add?')
33
+ unless hash['categories'].include?(cat.upcase)
34
+ hash['categories'].push(cat.upcase)
35
+ File.open("#{ENV['HOME']}/.slackdo/config.json",'w') do |f|
36
+ f.write(hash.to_json)
37
+ end
38
+ puts "Category '#{cat.upcase}' was added..."
39
+ else
40
+ puts "Category '#{cat.upcase}' already exists..."
41
+ end
42
+ end
43
+ def remove_category
44
+ file = File.read("#{ENV['HOME']}/.slackdo/config.json")
45
+ hash = JSON.parse(file)
46
+ cat = $prompt.select('What is the category you wish to remove?', hash['categories'])
47
+ hash['categories'].delete(cat)
48
+ File.open("#{ENV['HOME']}/.slackdo/config.json",'w') do |f|
49
+ f.write(hash.to_json)
50
+ end
51
+ puts "Category '#{cat}' was removed..."
52
+ end
26
53
  def add_label
27
- cli = HighLine.new
28
54
  file = File.read("#{ENV['HOME']}/.slackdo/config.json")
29
55
  hash = JSON.parse(file)
30
- id = cli.ask 'What is the ID of the label you wish to add?'.strip
56
+ id = $prompt.ask('What is the ID of the label you wish to add?')
31
57
  hash['trello_label_list_ids'] << id
32
58
  File.open("#{ENV['HOME']}/.slackdo/config.json",'w') do |f|
33
59
  f.write(hash.to_json)
@@ -53,12 +79,11 @@ module Slackdo
53
79
  puts 'Trello has been disabled...'
54
80
  end
55
81
  def configure_trello_api
56
- cli = HighLine.new
57
82
  file = File.read("#{ENV['HOME']}/.slackdo/config.json")
58
83
  hash = JSON.parse(file)
59
- public_key = cli.ask 'What is your Trello public key?'.strip
60
- member_token = cli.ask 'What is your Trello member token?'.strip
61
- list_id = cli.ask 'What is your board list ID where the cards should be created?'.strip
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?')
62
87
  hash["trello_public_key"] = public_key
63
88
  hash["trello_member_token"] = member_token
64
89
  hash["allow_trello_pushing"] = "true"
@@ -69,10 +94,9 @@ module Slackdo
69
94
  puts 'Trello API was configured...'
70
95
  end
71
96
  def configure_slack_webhook
72
- cli = HighLine.new
73
97
  file = File.read("#{ENV['HOME']}/.slackdo/config.json")
74
98
  hash = JSON.parse(file)
75
- webhook = cli.ask 'What is your Slack webhook?'.strip
99
+ webhook = $prompt.ask('What is your Slack webhook?')
76
100
  hash["slack_webhook"] = webhook
77
101
  File.open("#{ENV['HOME']}/.slackdo/config.json",'w') do |f|
78
102
  f.write(hash.to_json)
@@ -141,15 +165,14 @@ module Slackdo
141
165
  hash = JSON.parse(file)
142
166
  webhook = hash['slack_webhook']
143
167
  notifier = Slack::Notifier.new webhook
144
- cli = HighLine.new
145
- cli_category = cli.ask 'What is the category of this new task? eg. DEV or GENERAL'
146
- cli_message = cli.ask 'Type your new task:'
147
- want_note = cli.ask 'Do you want to add a note to this new task? y/n'
168
+ cli_category = $prompt.select('What is the category of this new task?', hash['categories'])
169
+ cli_message = $prompt.ask('Type your new task:')
170
+ want_note = $prompt.select('Do you want to add a note to this new task?', %w(Yes No))
148
171
  cli_note = ''
149
- while want_note == 'y'
150
- note_text = cli.ask 'Type your note:'
172
+ while want_note == 'Yes'
173
+ note_text = $prompt.ask('Type your note:')
151
174
  cli_note << "\n`- #{note_text}`"
152
- want_note = cli.ask 'Do you want to add another note to the task? y/n'
175
+ want_note = $prompt.select('Do you want to add another note to the task?', %w(Yes No))
153
176
  end
154
177
  note = {
155
178
  fallback: "This should've been a new note but looks like something went wrong...",
@@ -171,8 +194,7 @@ module Slackdo
171
194
  hash = JSON.parse(file)
172
195
  webhook = hash['slack_webhook']
173
196
  notifier = Slack::Notifier.new webhook
174
- cli = HighLine.new
175
- message = cli.ask 'Type your reminder:'
197
+ message = $prompt.ask('Type your reminder:')
176
198
  notifier.post text: "• _#{message}_"
177
199
  puts 'Reminder was posted to Slack...'
178
200
  end
data/slackdo.gemspec CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency "bundler", "~> 1.16"
28
28
  spec.add_development_dependency "rake", "~> 10.0"
29
29
  spec.add_development_dependency "rspec", "~> 3.0"
30
- spec.add_dependency 'highline'
30
+ spec.add_dependency 'tty-prompt'
31
31
  spec.add_dependency 'slack-notifier'
32
32
  spec.add_dependency 'ruby-trello'
33
33
  spec.add_dependency 'json'
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.3
4
+ version: 0.3.4
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-14 00:00:00.000000000 Z
11
+ date: 2017-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: highline
56
+ name: tty-prompt
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="