slackcat 0.2.2 → 0.2.3
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 +4 -4
- data/README.md +3 -1
- data/bin/slackcat +7 -1
- data/lib/slackcat/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5520ed2610ebb85feef74432cd4d8446fcd1c297
|
4
|
+
data.tar.gz: 295aad9710b3419cd3f853fe0d42f10193d93d5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21170c59cc56aa2db55dbd3a05d282d7a01a5625043fdf7c696e272be622ad823a16781b3a989fb946370f9eb2adb7299a32a455f08af1540dcaa61e5c5b405e
|
7
|
+
data.tar.gz: 0c1e5bb4cce399f9e77873a7e29e9d81e2b2eab0dd72abfde79aba15e8855ca552c670b26b9eebecf107dc5a2d2db1080a4bee380d4da43e25858409b6373e07
|
data/README.md
CHANGED
@@ -17,6 +17,8 @@ echo 'hello world' | slackcat -c <channel>
|
|
17
17
|
## Environment variables
|
18
18
|
|
19
19
|
* `SLACK_TOKEN`: your token from https://api.slack.com/.
|
20
|
+
* `SLACK_CHANNEL`: default destination channel; will be used if
|
21
|
+
no `-c`, `-g` or `-u` option given
|
20
22
|
|
21
23
|
## Command-line options
|
22
24
|
|
@@ -64,7 +66,7 @@ slackcat -c general -m kitten.jpg cat.gif
|
|
64
66
|
Slack does a good job of setting filetype correctly from mimetype,
|
65
67
|
though you may override this with the `-t` option.
|
66
68
|
|
67
|
-
This mode does not read stdin.
|
69
|
+
This mode does not read stdin.
|
68
70
|
|
69
71
|
## Post messages as chat text
|
70
72
|
|
data/bin/slackcat
CHANGED
@@ -81,6 +81,12 @@ end
|
|
81
81
|
raise 'set slack API token using SLACK_TOKEN or -k option' unless opts[:token]
|
82
82
|
slack = Slackcat.new(opts[:token])
|
83
83
|
|
84
|
+
## use default channel if no destination given
|
85
|
+
if opts.values_at(:channels, :groups, :users).all?(&:empty?)
|
86
|
+
opts[:channels] = ENV.fetch('SLACK_CHANNEL', '')
|
87
|
+
end
|
88
|
+
|
89
|
+
## translate destination names into slack ids
|
84
90
|
channels = opts[:channels].split(/[\s,]+/).map do |name|
|
85
91
|
slack.channels.find { |channel| channel['name'] == name }.fetch('id')
|
86
92
|
end
|
@@ -98,7 +104,7 @@ params = {
|
|
98
104
|
filename: opts[:filename],
|
99
105
|
title: opts[:title],
|
100
106
|
initial_comment: opts[:initial_comment],
|
101
|
-
channels: (channels + groups + ims).join(
|
107
|
+
channels: (channels + groups + ims).join(',')
|
102
108
|
}.select { |_, value| value }
|
103
109
|
|
104
110
|
if opts[:post] #simple text post
|
data/lib/slackcat/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slackcat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Lister
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|