simple_slack 0.3.3 → 0.4.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: 13c1e00e28260f8fabe4e1db17ac6ce5d505523d
4
- data.tar.gz: b5d947a9841349abd4f5f1342636154681888213
3
+ metadata.gz: 2f13cf5c1437e754b15b9c4803c669b6cb02837b
4
+ data.tar.gz: 77aaa998197015278427092b33180f05e753ff5c
5
5
  SHA512:
6
- metadata.gz: 2b3e8944f7e9eb5bae6ba9a57530b6dc6f9282fd6d52278da3261fcf726b1a541329e5bcce7f04aac86609b1095a9801473539be8c952fb4acd09842d6d7acf6
7
- data.tar.gz: 85c609466c100be57afdacbba018c28150dd032b0eb610385a06bcdb3a8364bde5d274a0f113d22f51147285f6e86406ee685803206c97d463aca180cd4b2aa9
6
+ metadata.gz: 6516cab3b0c5736acc4f4539c8d9ad258dc4eb95e4d40ce8f89a904754f86d33a852c4ee5393bd846823d117cfea3de579c1c71d562f412c6fe7e0eceff094a7
7
+ data.tar.gz: da0108825d5aed1a6dc39204a2e6bddf984c80f933efc874a0fa234a6357ca8162cb9fa2f42e66cab411110e5895abf9ed9a345db68af96f22e769c69215b091
data/bin/sslack ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'simple_slack/cli'
4
+ SimpleSlack::CLI.start
@@ -0,0 +1,25 @@
1
+ require 'thor'
2
+ require "simple_slack/client"
3
+
4
+ module SimpleSlack
5
+ class CLI < Thor
6
+ desc 'post channel', 'post channel to channel_name'
7
+ def post(channel, text)
8
+ client = SimpleSlack::Client.new
9
+ client.post.channel(to: channel, text: text)
10
+ end
11
+
12
+ desc 'post channel rspec', 'post channel to rspec results'
13
+ def rspec(file_name = 'spec/', channel = nil, bundle = true)
14
+ return 'channel name blank' if channel.nil?
15
+ client = SimpleSlack::Client.new
16
+ if bundle
17
+ text = `bundle exec rspec #{file_name}`
18
+ else
19
+ text = `rspec #{file_name}`
20
+ end
21
+ puts text
22
+ client.post.channel(to: channel, text: text)
23
+ end
24
+ end
25
+ end
@@ -5,7 +5,7 @@ require 'simple_slack/botter'
5
5
  require 'simple_slack/toggl'
6
6
 
7
7
  class SimpleSlack::Client
8
- def initialize(token)
8
+ def initialize(token = ENV['SLACK_API_TOKEN'])
9
9
  @token = token
10
10
  Slack.configure { |config| config.token = @token }
11
11
  @slack = Slack.client
@@ -14,7 +14,7 @@ module TogglEntriesParameter
14
14
  def entries_by_tags(*tags)
15
15
  entries.select do |entry|
16
16
  tags.map(&:to_s).all? do |tag|
17
- entry["tags"].include?(tag)
17
+ entry["tags"] && entry["tags"].include?(tag)
18
18
  end
19
19
  end
20
20
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleSlack
2
- VERSION = "0.3.3"
2
+ VERSION = "0.4.0"
3
3
  end
data/lib/simple_slack.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "simple_slack/version"
2
2
  require "simple_slack/client"
3
+ require "simple_slack/cli"
3
4
 
4
5
  module SimpleSlack
5
6
  end
data/simple_slack.gemspec CHANGED
@@ -34,4 +34,5 @@ Gem::Specification.new do |spec|
34
34
  spec.add_dependency "slack-api", '~>1.2.1'
35
35
  spec.add_dependency "togglv8"
36
36
  spec.add_dependency "awesome_print"
37
+ spec.add_dependency "thor"
37
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_slack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - toririn
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-25 00:00:00.000000000 Z
11
+ date: 2016-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: thor
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'
97
111
  description: simple use slack
98
112
  email:
99
113
  - toririn.paftako@gmail.com
@@ -111,8 +125,10 @@ files:
111
125
  - Rakefile
112
126
  - bin/console
113
127
  - bin/setup
128
+ - bin/sslack
114
129
  - lib/simple_slack.rb
115
130
  - lib/simple_slack/botter.rb
131
+ - lib/simple_slack/cli.rb
116
132
  - lib/simple_slack/client.rb
117
133
  - lib/simple_slack/getter.rb
118
134
  - lib/simple_slack/poster.rb
@@ -144,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
160
  version: '0'
145
161
  requirements: []
146
162
  rubyforge_project:
147
- rubygems_version: 2.4.5
163
+ rubygems_version: 2.5.1
148
164
  signing_key:
149
165
  specification_version: 4
150
166
  summary: simple use slack