slackdraft 1.0.2 → 1.0.3

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: 3a3d20d902033420d44050a957cb89bc1c76a038
4
- data.tar.gz: 57f127c0596a44ac40b099bc9f4dc7d9ca51d9f7
3
+ metadata.gz: ded88ef1ca68959bd569da6efb2c506a04252a94
4
+ data.tar.gz: 38454fde45dfb915e59bd6fe1a5ff9b6427b0c89
5
5
  SHA512:
6
- metadata.gz: 0cd799b3cd20ad0aff2596b2c8bdc1db6602adbbf7fd82010c35d7383126fa100a2675d7920065a681d1af0c7ce068549e84eec6a62ece201968f4520db7c26d
7
- data.tar.gz: f4967737ba77b035a8add917c19cd895248d4c26d830344982c3f744ad5d8102e696136703ec0fe73a37aba29c828c8920d55af02b5a50bbbffe072ee94de972
6
+ metadata.gz: 7192e5a0594864e2eba9a25bfa3d3524d50231d2f19c4994474b2bd9aace7000d569f748549cfe4b1dc76750e0d40c6915090605821c1cb46f652fd90680d464
7
+ data.tar.gz: 0df124c468c44f2e1ac8762270750dadb4cb60f44224c6ccca3c7d9846161a3290b19fc959c2daadf468d4aacdcf5254c273c095977a81e15f98ac67b40882c1
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  /.bundle/
2
2
  /vendor/
3
- Gemfile.lock
3
+ Gemfile.lock
4
+ *.gem
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # slackdraft
2
2
  Simplest way to send messages to Slack.
3
3
 
4
- ![TravisCI](https://travis-ci.org/mikemackintosh/slackdraft.svg)
4
+ [![TravisCI](https://travis-ci.org/mikemackintosh/slackdraft.svg)](https://travis-ci.org/mikemackintosh/slackdraft)
5
5
 
6
6
  # Installation
7
7
 
@@ -11,6 +11,17 @@ Like any other gem:
11
11
  gem install slackdraft
12
12
  ```
13
13
 
14
+ # Features
15
+
16
+ I created the gem to allow for really simple integration into Slack. Some of the features include:
17
+
18
+ - Formatting Support
19
+ - User(`@channel` and `@mike`) and Channel (`#channel`) Notification Support
20
+ - Awesome Attachment Support
21
+ - Command Line Utility
22
+
23
+ See examples of pre-formated alerts in the [examples/formatted/](https://github.com/mikemackintosh/slackdraft/tree/master/examples/formatted).
24
+
14
25
  # Ruby Usage
15
26
 
16
27
  Usage is very simple:
data/Rakefile CHANGED
@@ -1 +1,17 @@
1
+ #encoding: utf-8
1
2
  require "bundler/gem_tasks"
3
+ require 'rspec/core/rake_task'
4
+
5
+ task default: :test
6
+
7
+ RSpec::Core::RakeTask.new do |spec|
8
+ spec.verbose = false
9
+ spec.pattern = './spec/{*/**/}*_spec.rb'
10
+ end
11
+
12
+ task :test do
13
+ ENV['RACK_ENV'] = 'test'
14
+
15
+ require './spec/spec_helper'
16
+ Rake::Task['spec'].invoke
17
+ end
@@ -28,7 +28,7 @@ class App
28
28
  if slack.send!
29
29
  Slackdraft::success("Message successful")
30
30
  end
31
-
31
+
32
32
  end
33
33
 
34
34
  # These are the options
@@ -37,7 +37,7 @@ class App
37
37
  on('-m', '--message MESSAGE', "Message to send")
38
38
  on('-e', '--emoji EMOJI', "Emoji to prefix message with")
39
39
  on('-i', '--icon ICON', "Icon to prefix message with")
40
-
40
+
41
41
  # Grab to webhook url
42
42
  arg :url
43
43
 
@@ -57,4 +57,4 @@ class App
57
57
  Slackdraft::fatal("An error occurred: #{e.class.name}: #{e.message}")
58
58
  end
59
59
 
60
- end
60
+ end
@@ -0,0 +1,6 @@
1
+ # Screenshots's Or It Didn't Happen
2
+
3
+ Below find some graphical examples of some of the pre-formatted messages
4
+
5
+ ### `alert.rb`
6
+ ![https://www.dropbox.com/s/b84vjezs7yei7c8/Screenshot%202015-02-16%2017.23.36.png?dl=1](https://www.dropbox.com/s/b84vjezs7yei7c8/Screenshot%202015-02-16%2017.23.36.png?dl=1)
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env ruby
2
+ lib = File.expand_path('../../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ # TODO: Change color based on alert type
6
+
7
+ # Require Slackdraft
8
+ require 'slackdraft'
9
+
10
+ # Set the webhook
11
+ WEBHOOK = ENV['SLACK_EP'] ||= "https://...."
12
+
13
+ # Create instance
14
+ slack = Slackdraft::Message.new WEBHOOK
15
+
16
+ slack.text = "Calling out to @mike. Does it work?"
17
+ slack.username = "johndoe"
18
+ slack.channel = "#slackdraft"
19
+
20
+ # Send it, and check response
21
+ if slack.send!
22
+ Slackdraft::success("Message successful")
23
+ end
@@ -11,12 +11,12 @@ require 'slackdraft/attachment'
11
11
  require 'slackdraft/format/init'
12
12
 
13
13
  module Slackdraft
14
-
14
+
15
15
  def self.success(message)
16
- puts " #{Paint['[]', :bright, :green]} #{Paint[message, :bright, :white]}"
16
+ puts " #{Paint['[ok]', :bright, :green]} #{Paint[message, :bright, :white]}"
17
17
  exit!
18
18
  end
19
-
19
+
20
20
  def self.info(message)
21
21
  puts " #{Paint['[i]', :bright, :blue]} #{Paint[message, :bright, :white]}"
22
22
  exit!
@@ -26,10 +26,10 @@ module Slackdraft
26
26
  puts " #{Paint['[!]', :bright, :orange]} #{Paint[message, :bright, :white]}"
27
27
  exit!
28
28
  end
29
-
29
+
30
30
  def self.fatal(message)
31
31
  puts " #{Paint['[x]', :bright, :red]} #{Paint[message, :bright, :white]}"
32
32
  exit!
33
33
  end
34
34
 
35
- end
35
+ end
@@ -1,3 +1,3 @@
1
1
  module Slackdraft
2
- VERSION = '1.0.2'
3
- end
2
+ VERSION = '1.0.3'
3
+ end
@@ -0,0 +1,25 @@
1
+ require 'rspec/core'
2
+
3
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'slackdraft')
4
+
5
+ # Create the share API context
6
+ # so we can pass stuff between
7
+ # the different tests
8
+ RSpec.shared_context "shared environment", :a => :b do
9
+
10
+ before(:all) do
11
+
12
+ # Set webhook token
13
+ @slackhook = 'blahblahblah'
14
+
15
+ end
16
+
17
+ end
18
+
19
+ # Seems to run tests more than once if we do RSpec.configure more than once
20
+ #unless RSpec.configuration.color_enabled == true
21
+ RSpec.configure do |config|
22
+ config.color = true
23
+ config.formatter = :documentation
24
+ end
25
+ #end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slackdraft
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Mackintosh
@@ -141,7 +141,9 @@ files:
141
141
  - examples/README.md
142
142
  - examples/attachment.rb
143
143
  - examples/attachment_long.rb
144
+ - examples/formatted/README.md
144
145
  - examples/formatted/alert.rb
146
+ - examples/message_user.rb
145
147
  - lib/slackdraft.rb
146
148
  - lib/slackdraft/attachment.rb
147
149
  - lib/slackdraft/base.rb
@@ -150,6 +152,7 @@ files:
150
152
  - lib/slackdraft/message.rb
151
153
  - lib/slackdraft/version.rb
152
154
  - slackdraft.gemspec
155
+ - spec/spec_helper.rb
153
156
  homepage: http://github.com/mikemackintosh/slackdraft
154
157
  licenses:
155
158
  - MIT
@@ -174,4 +177,5 @@ rubygems_version: 2.0.14
174
177
  signing_key:
175
178
  specification_version: 4
176
179
  summary: Slack messaging with half the Kurt Russell
177
- test_files: []
180
+ test_files:
181
+ - spec/spec_helper.rb