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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7de9a8aab911b39858e30051b0df560a66a2729b
4
- data.tar.gz: c7a3865e615c0acec76c6ab8dda3cde5060dcb0b
3
+ metadata.gz: 5520ed2610ebb85feef74432cd4d8446fcd1c297
4
+ data.tar.gz: 295aad9710b3419cd3f853fe0d42f10193d93d5c
5
5
  SHA512:
6
- metadata.gz: bd34212773780f8e2f16d8b551d78306d65ac4be038252e556d142a9e99da3d44e4281dc2dbe87cb24f70a351c45d927e97d0c1207e061a3df4efb0a8d15d520
7
- data.tar.gz: 5f041285e516808dd62828b4a66ecbe283db084a672b4ab44e0d19f03622ecfcca34bdf041f75b6b61617a783a7fb903b286ad2f2874be9b43bc996c2b1289b6
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
@@ -1,3 +1,3 @@
1
1
  module Slackcat
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
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.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-12 00:00:00.000000000 Z
11
+ date: 2014-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler