slackdo 0.2.3 → 0.3.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: 76a0f88e0c4a9e662f5e0b6e6d60fa129d0898fc
4
- data.tar.gz: e45f582661a9f5cc90e892b864a3cf6cb4839fad
3
+ metadata.gz: 5506335231c02001550addecf509393dd3179819
4
+ data.tar.gz: 2a375c347978f10660eed09e8a982b2af16a1125
5
5
  SHA512:
6
- metadata.gz: dab4d921323e0f05c4d3471e33ff44f825a0f8559aadb33e33eadcbcc0b8ca6b29f299abb9994292710ee5e5099d8176e91791a0d0481cf871a58ceaa6c2bc85
7
- data.tar.gz: 6c8c4a1c2aea632f717d5026ff8eead82bfde339a00bd553d2d5f3d48a78ad5fbf2c4eec1addf1009e5e29a03a743a25adf2c0e21a4551ab1593a53b0878b593
6
+ metadata.gz: 7848f72ae63ff078e2669162e7721c1dbc4aa7372812ef3f231598043de12e4441544be2d6607fce0706493f3de104d6a9fb8c8182dafd04ac077face9780671
7
+ data.tar.gz: ff1e8f3fbe807e5dda917ec7b96bf5b876a6875b7a88586d8ecf7fd8ddc9e67b899d0601b11506226f41c5594d51b2706adda51c4c67db2862f25c15b32e7b3c
data/.gitignore CHANGED
@@ -9,3 +9,5 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+
13
+ .DS_Store
data/Gemfile.lock CHANGED
@@ -1,16 +1,46 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- slackdo (0.2.3)
4
+ slackdo (0.3.0)
5
5
  highline
6
+ json
7
+ ruby-trello
6
8
  slack-notifier
7
9
 
8
10
  GEM
9
11
  remote: https://rubygems.org/
10
12
  specs:
13
+ activemodel (5.1.4)
14
+ activesupport (= 5.1.4)
15
+ activesupport (5.1.4)
16
+ concurrent-ruby (~> 1.0, >= 1.0.2)
17
+ i18n (~> 0.7)
18
+ minitest (~> 5.1)
19
+ tzinfo (~> 1.1)
20
+ addressable (2.5.2)
21
+ public_suffix (>= 2.0.2, < 4.0)
22
+ concurrent-ruby (1.0.5)
11
23
  diff-lcs (1.3)
24
+ domain_name (0.5.20170404)
25
+ unf (>= 0.0.5, < 1.0.0)
12
26
  highline (1.7.8)
27
+ http-cookie (1.0.3)
28
+ domain_name (~> 0.5)
29
+ i18n (0.9.1)
30
+ concurrent-ruby (~> 1.0)
31
+ json (2.1.0)
32
+ mime-types (3.1)
33
+ mime-types-data (~> 3.2015)
34
+ mime-types-data (3.2016.0521)
35
+ minitest (5.10.3)
36
+ netrc (0.11.0)
37
+ oauth (0.5.3)
38
+ public_suffix (3.0.0)
13
39
  rake (10.5.0)
40
+ rest-client (2.0.2)
41
+ http-cookie (>= 1.0.2, < 2.0)
42
+ mime-types (>= 1.16, < 4.0)
43
+ netrc (~> 0.8)
14
44
  rspec (3.7.0)
15
45
  rspec-core (~> 3.7.0)
16
46
  rspec-expectations (~> 3.7.0)
@@ -24,7 +54,19 @@ GEM
24
54
  diff-lcs (>= 1.2.0, < 2.0)
25
55
  rspec-support (~> 3.7.0)
26
56
  rspec-support (3.7.0)
57
+ ruby-trello (2.0.0)
58
+ activemodel (>= 3.2.0)
59
+ addressable (~> 2.3)
60
+ json
61
+ oauth (>= 0.4.5)
62
+ rest-client (>= 1.8.0)
27
63
  slack-notifier (2.3.1)
64
+ thread_safe (0.3.6)
65
+ tzinfo (1.2.4)
66
+ thread_safe (~> 0.1)
67
+ unf (0.1.4)
68
+ unf_ext
69
+ unf_ext (0.0.7.4)
28
70
 
29
71
  PLATFORMS
30
72
  ruby
data/README.md CHANGED
@@ -39,11 +39,11 @@ $ gem which slackdo
39
39
  This indicates that your gem binary is located at `/usr/local/lib/ruby/gems/<ruby-version>/gems/slackdo-<gem-version>/bin`.
40
40
 
41
41
  ## Usage
42
-
42
+ ### Slack
43
43
  First thing you should do is configure your incoming webhook by doing the following:
44
44
 
45
45
  ```
46
- slackdo webhook
46
+ slackdo configure slack
47
47
  ```
48
48
 
49
49
  After that you're all set to go.
@@ -58,6 +58,23 @@ or add a reminder with
58
58
  slackdo reminder
59
59
  ```
60
60
 
61
+ ### Trello
62
+ To start using the Trello integration of SlackDO, which enables you to push your TODO items to a list on Trello use:
63
+
64
+ ```
65
+ slackdo configure trello
66
+ ```
67
+
68
+ Now that this has been configured SlackDO will send your items to Trello as well using the same command.
69
+
70
+ ```
71
+ slackdo task
72
+ ```
73
+
74
+ ![example](img/cli-example.png)
75
+ ![example](img/slack-task.png)
76
+ ![example](img/trello-card.png)
77
+
61
78
  ## Development
62
79
 
63
80
  Slackdo is still under development and might still be buggy. Feel free to contribute to the project.
data/bin/slackdo CHANGED
@@ -2,15 +2,24 @@
2
2
 
3
3
  require 'slackdo'
4
4
 
5
- webhook = Slackdo::Webhook.new
6
- webhook.create_directory
5
+ config = Slackdo::Config.new
6
+ config.configure_init
7
7
 
8
8
  case ARGV[0]
9
- when 'webhook'
10
- webhook.configure_webhook
9
+ when 'configure'
10
+ config.configure_slack_webhook if ARGV[1] == 'slack'
11
+ config.configure_trello_api if ARGV[1] == 'trello'
11
12
  when 'task'
12
13
  slack = Slackdo::Task.new
13
14
  slack.add_task
15
+ file = File.read("#{ENV['HOME']}/.slackdo/config.json")
16
+ hash = JSON.parse(file)
17
+ if hash['allow_trello_pushing'] == 'true'
18
+ card_name = slack.get_message
19
+ card_desc = slack.get_notes
20
+ trello = Slackdo::Card.new
21
+ trello.add_card(card_name, card_desc)
22
+ end
14
23
  when 'reminder'
15
24
  slack = Slackdo::Reminder.new
16
25
  slack.add_reminder
Binary file
Binary file
Binary file
@@ -1,3 +1,3 @@
1
1
  module Slackdo
2
- VERSION = "0.2.3"
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/slackdo.rb CHANGED
@@ -1,45 +1,129 @@
1
- require "slackdo/version"
1
+ require 'slackdo/version'
2
2
  require 'highline'
3
3
  require 'slack-notifier'
4
+ require 'trello'
5
+ require 'json'
4
6
 
5
7
  module Slackdo
6
- class Webhook
7
- def create_directory
8
- system 'mkdir ~/.slackdo &> /dev/null'
9
- end
10
- def configure_webhook
8
+ class Config
9
+ def configure_init
10
+ system "mkdir #{ENV['HOME']}/.slackdo &> /dev/null"
11
+ unless File.exist?("#{ENV['HOME']}/.slackdo/config.json")
12
+ system "touch #{ENV['HOME']}/.slackdo/config.json"
13
+ hash = {
14
+ "slack_webhook" => "",
15
+ "allow_trello_pushing" => "false",
16
+ "trello_public_key" => "",
17
+ "trello_member_token" => "",
18
+ "trello_list_id" => ""
19
+ }
20
+ File.open("#{ENV['HOME']}/.slackdo/config.json",'w') do |f|
21
+ f.write(hash.to_json)
22
+ end
23
+ end
24
+ end
25
+ def configure_trello_api
11
26
  cli = HighLine.new
12
- webhook = cli.ask 'Configure your webhook:'
13
- system "echo #{webhook} > ~/.slackdo/webhook"
27
+ file = File.read("#{ENV['HOME']}/.slackdo/config.json")
28
+ hash = JSON.parse(file)
29
+ public_key = cli.ask 'What is your Trello public key?'.strip
30
+ member_token = cli.ask 'What is your Trello member token?'.strip
31
+ list_id = cli.ask 'What is your board list ID where the cards should be created?'.strip
32
+ hash["trello_public_key"] = public_key
33
+ hash["trello_member_token"] = member_token
34
+ hash["allow_trello_pushing"] = "true"
35
+ hash["trello_list_id"] = list_id
36
+ File.open("#{ENV['HOME']}/.slackdo/config.json",'w') do |f|
37
+ f.write(hash.to_json)
38
+ end
39
+ puts 'Trello API was configured...'
40
+ end
41
+ def configure_slack_webhook
42
+ cli = HighLine.new
43
+ file = File.read("#{ENV['HOME']}/.slackdo/config.json")
44
+ hash = JSON.parse(file)
45
+ webhook = cli.ask 'What is your Slack webhook?'.strip
46
+ hash["slack_webhook"] = webhook
47
+ File.open("#{ENV['HOME']}/.slackdo/config.json",'w') do |f|
48
+ f.write(hash.to_json)
49
+ end
50
+ puts 'Slack API was configured...'
14
51
  end
15
52
  end
53
+
54
+ class Card
55
+ def configure_trello
56
+ file = File.read("#{ENV['HOME']}/.slackdo/config.json")
57
+ hash = JSON.parse(file)
58
+ Trello.configure do |config|
59
+ config.developer_public_key = hash['trello_public_key']
60
+ config.member_token = hash['trello_member_token']
61
+ end
62
+ end
63
+ def add_card(card_name, card_desc)
64
+ file = File.read("#{ENV['HOME']}/.slackdo/config.json")
65
+ hash = JSON.parse(file)
66
+ configure_trello
67
+ card = Trello::Card.create(
68
+ name: card_name,
69
+ desc: card_desc,
70
+ list_id: hash['trello_list_id'],
71
+ pos: 'top',
72
+ )
73
+ card.save
74
+ puts 'Card was created on Trello...'
75
+ end
76
+ end
77
+
16
78
  class Task
79
+ $note_content = ''
80
+ $message = ''
81
+ def set_message(text)
82
+ $message = text
83
+ end
84
+ def set_notes(notes)
85
+ $note_content = notes
86
+ end
87
+ def get_message
88
+ return $message
89
+ end
90
+ def get_notes
91
+ return $note_content
92
+ end
17
93
  def add_task
18
- notifier = Slack::Notifier.new `cat ~/.slackdo/webhook`.strip
94
+ file = File.read("#{ENV['HOME']}/.slackdo/config.json")
95
+ hash = JSON.parse(file)
96
+ webhook = hash['slack_webhook']
97
+ notifier = Slack::Notifier.new webhook
19
98
  cli = HighLine.new
20
99
  category = cli.ask 'What is the category of this new task? eg. DEV or GENERAL'
21
- message = cli.ask 'Type your new task:'
100
+ cli_message = cli.ask 'Type your new task:'
22
101
  want_note = cli.ask 'Do you want to add a note to this new task? y/n'
23
- note_content = ''
102
+ cli_note = ''
24
103
  while want_note == 'y'
25
104
  note_text = cli.ask 'Type your note:'
26
- note_content << "\n`- #{note_text}`"
105
+ cli_note << "\n`- #{note_text}`"
27
106
  want_note = cli.ask 'Do you want to add another note to the task? y/n'
28
107
  end
29
108
  note = {
30
109
  fallback: "This should've been a new note but looks like something went wrong...",
31
- text: note_content,
110
+ text: cli_note,
32
111
  color: "gray",
33
112
  mrkdwn_in: ["text"]
34
113
  }
35
- notifier.post text: "[#{category}] #{message}", attachments: [note]
114
+ set_message("[#{category}] #{cli_message}")
115
+ set_notes(cli_note)
116
+ notifier.post text: "• [#{category}] #{cli_message}", attachments: [note]
36
117
  puts 'Item was posted to Slack...'
37
118
  end
38
119
  end
39
120
 
40
121
  class Reminder
41
122
  def add_reminder
42
- notifier = Slack::Notifier.new `cat ~/.slackdo/webhook`.strip
123
+ file = File.read("#{ENV['HOME']}/.slackdo/config.json")
124
+ hash = JSON.parse(file)
125
+ webhook = hash['slack_webhook']
126
+ notifier = Slack::Notifier.new webhook
43
127
  cli = HighLine.new
44
128
  message = cli.ask 'Type your reminder:'
45
129
  notifier.post text: "• _#{message}_"
data/slackdo.gemspec CHANGED
@@ -27,6 +27,8 @@ 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"
31
- spec.add_dependency "slack-notifier"
30
+ spec.add_dependency 'highline'
31
+ spec.add_dependency 'slack-notifier'
32
+ spec.add_dependency 'ruby-trello'
33
+ spec.add_dependency 'json'
32
34
  end
data/} ADDED
File without changes
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.2.3
4
+ version: 0.3.0
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-03 00:00:00.000000000 Z
11
+ date: 2017-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,6 +80,34 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: ruby-trello
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: json
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
83
111
  description: SlackDO provides you with an easy CLI tool which allows you to write
84
112
  todo tasks and reminders to yourself on Slack
85
113
  email:
@@ -88,7 +116,6 @@ executables: []
88
116
  extensions: []
89
117
  extra_rdoc_files: []
90
118
  files:
91
- - ".DS_Store"
92
119
  - ".gitignore"
93
120
  - ".rspec"
94
121
  - ".travis.yml"
@@ -100,10 +127,14 @@ files:
100
127
  - bin/console
101
128
  - bin/setup
102
129
  - bin/slackdo
130
+ - img/cli-example.png
131
+ - img/slack-task.png
103
132
  - img/task-example.png
133
+ - img/trello-card.png
104
134
  - lib/slackdo.rb
105
135
  - lib/slackdo/version.rb
106
136
  - slackdo.gemspec
137
+ - "}"
107
138
  homepage: https://github.com/segersniels/slackdo
108
139
  licenses:
109
140
  - MIT
data/.DS_Store DELETED
Binary file