Class: SimpleSlack::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/simple_slack/cli.rb

Instance Method Summary collapse

Instance Method Details

#post(channel, text) ⇒ Object



7
8
9
10
# File 'lib/simple_slack/cli.rb', line 7

def post(channel, text)
  client = SimpleSlack::Client.new
  client.post.channel(to: channel, text: text)
end

#rspec(file_name = 'spec/', channel = nil, bundle = true) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/simple_slack/cli.rb', line 13

def rspec(file_name = 'spec/', channel = nil, bundle = true)
  return 'channel name blank' if channel.nil?
  client = SimpleSlack::Client.new
  if bundle
    text = `bundle exec rspec #{file_name}`
  else
    text = `rspec #{file_name}`
  end
  puts text
  client.post.channel(to: channel, text: text)
end