slacktail 0.0.4 → 0.0.5

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
  SHA256:
3
- metadata.gz: b7a44b7e0a651bdfc640ac7c559179f1a6cdf8cfbc3963c56fef9d7e0e1f0000
4
- data.tar.gz: e42a72fdf74fa6ee7ebfacdb3890890ee756f7fad3191b9cf6c023ea49ee51e9
3
+ metadata.gz: 651b9cb49960450af501860b6454477b892474b8111ef4c533a33f42f070ea0e
4
+ data.tar.gz: dc8fc9f18a02672fb1c6d55d8d292bf8543b289d8a50c929abb2bcada8a9edb5
5
5
  SHA512:
6
- metadata.gz: 6ab2956be75541d8090c2b0ca65b2e656dfa6af4ee18d8f77cca0f59499d532992bd85b3abbc81aa61b7586c49811939990c74958f332fe6456638a362ec16a6
7
- data.tar.gz: e6deec960f359b6d830e5d68666e03e698979df1ed5e6730abdfa93f2790cd1f51d5bf3e01bd27753d4d77a0aa6408cd22e9f0278a7295ce395507deb62cf6dd
6
+ metadata.gz: c8d8ad5c25ccbcf16884e03e6245ea8d54a20a378039c743bfdcc0b214a531b1c9b0581774420cb5855be4a07c898c59722cfbbacccb88aeac4d62a2a2349cfe
7
+ data.tar.gz: 44cd77c91254fd8d5b70b3ae0d35a7b327eb67d549660532aef9bf394751211bee33ea41777c9e4d1bec17b0a56918bc89f1040ec2787d88ac9e9fa7c0131d8e
data/lib/slacktail.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require 'requires'
2
2
  require 'mister_bin'
3
3
  require 'slack-ruby-client'
4
- require 'tty-markdown'
5
4
  require 'byebug' if ENV['BYEBUG']
6
5
 
7
6
  requires \
@@ -8,14 +8,19 @@ module Slacktail
8
8
  end
9
9
 
10
10
  def can_connect?
11
- !!ENV['SLACK_API_TOKEN']
11
+ !!token
12
12
  end
13
13
 
14
14
  def default!
15
15
  raise ArgumentError, 'Please set SLACK_API_TOKEN' unless can_connect?
16
- Slack.configure { |c| c.token = ENV['SLACK_API_TOKEN'] }
16
+ Slack.configure { |c| c.token = token }
17
17
  Slack::RealTime::Client.new
18
18
  end
19
+
20
+ def token
21
+ ENV['SLACK_API_TOKEN']
22
+ end
23
+
19
24
  end
20
25
  end
21
26
  end
@@ -16,11 +16,15 @@ module Slacktail
16
16
  def run(args = nil)
17
17
  args ||= {}
18
18
  @channels = args['CHANNELS'] || []
19
-
20
19
  say "Connecting... " if Client.can_connect?
20
+ start_client
21
+ end
22
+
23
+ private
21
24
 
25
+ def start_client
22
26
  client.on :message do |data|
23
- # File.write 'debug.yml', data.to_yaml
27
+ File.write('slacktail_debug.yml', data.to_yaml) if ENV['SLACKTAIL_DEBUG']
24
28
  @message = Message.new data
25
29
  @message.render unless skip?
26
30
  end
@@ -30,8 +34,6 @@ module Slacktail
30
34
  client.start!
31
35
  end
32
36
 
33
- private
34
-
35
37
  def skip?
36
38
  return true if @message.empty?
37
39
  return false if @channels.empty?
@@ -1,18 +1,14 @@
1
1
  class String
2
- def to_markdown
3
- TTY::Markdown.parse self
4
- end
5
-
6
2
  def to_colsole_color
7
3
  color = {
8
- '000000' => :wht,
4
+ '000000' => :blk,
9
5
  'ff0000' => :red,
10
6
  '00ff00' => :grn,
11
7
  '0000ff' => :blu,
12
8
  'ffff00' => :ylw,
13
9
  'ff00ff' => :pur,
14
10
  '00ffff' => :cyn,
15
- 'ffffff' => :blk,
11
+ 'ffffff' => :wht,
16
12
  }
17
13
 
18
14
  key = self.downcase
@@ -62,6 +62,6 @@ module Slacktail
62
62
  Attachment.new attachment
63
63
  end
64
64
  end
65
+
65
66
  end
66
-
67
- end
67
+ end
@@ -9,7 +9,7 @@ module Slacktail
9
9
 
10
10
  items.each do |line|
11
11
  if line.is_a? String
12
- say "#{prefix}#{line.to_markdown}".strip
12
+ say "#{prefix}#{line}".strip
13
13
  elsif line.is_a? Field
14
14
  say "#{prefix}!txtblu!#{line.key}!txtrst! : !txtgrn!#{line.value}".strip
15
15
  end
@@ -1,3 +1,3 @@
1
1
  module Slacktail
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slacktail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-06 00:00:00.000000000 Z
11
+ date: 2018-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-websocket
@@ -39,47 +39,53 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.5'
41
41
  - !ruby/object:Gem::Dependency
42
- name: requires
42
+ name: colsole
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.1'
47
+ version: '0.5'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 0.5.3
48
51
  type: :runtime
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
51
54
  requirements:
52
55
  - - "~>"
53
56
  - !ruby/object:Gem::Version
54
- version: '0.1'
57
+ version: '0.5'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 0.5.3
55
61
  - !ruby/object:Gem::Dependency
56
- name: slack-ruby-client
62
+ name: requires
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
65
  - - "~>"
60
66
  - !ruby/object:Gem::Version
61
- version: '0.13'
67
+ version: '0.1'
62
68
  type: :runtime
63
69
  prerelease: false
64
70
  version_requirements: !ruby/object:Gem::Requirement
65
71
  requirements:
66
72
  - - "~>"
67
73
  - !ruby/object:Gem::Version
68
- version: '0.13'
74
+ version: '0.1'
69
75
  - !ruby/object:Gem::Dependency
70
- name: tty-markdown
76
+ name: slack-ruby-client
71
77
  requirement: !ruby/object:Gem::Requirement
72
78
  requirements:
73
79
  - - "~>"
74
80
  - !ruby/object:Gem::Version
75
- version: '0.4'
81
+ version: '0.13'
76
82
  type: :runtime
77
83
  prerelease: false
78
84
  version_requirements: !ruby/object:Gem::Requirement
79
85
  requirements:
80
86
  - - "~>"
81
87
  - !ruby/object:Gem::Version
82
- version: '0.4'
88
+ version: '0.13'
83
89
  description: Slacktail is a single-purpose command line utility for following messages
84
90
  sent to your Slack organization chat.
85
91
  email: db@dannyben.com