ellen-slack 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1baf039084f75306aa8cf6472c4d4d39efd8f9cc
4
+ data.tar.gz: 989f58841a67f17110c493e518461dfce52d8f56
5
+ SHA512:
6
+ metadata.gz: 3f4a21fdf178b4045fd3fedfb2880ff157ac16a54c9b9c193473c85504d71cb0513de5bdb41f274b876d25d3e305af4b7ccb6f15353dc9a587d336e1de63f99e
7
+ data.tar.gz: 774765b68bfe62bb25f1930b37d1b38a5f32207d371e3ac34f1cfa7114b11f772533c876f7f0fafda7f1439004388c733984037bbaaa35b86c771a68cd8e47a4
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ellen-slack.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Ryo Nakamura
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # Ellen::Slack
2
+ Slack adapter for [Ellen](https://github.com/r7kamura/ellen).
3
+
4
+ ## Usage
5
+ Note that you must enable the IRC gateway at https://my.slack.com/admin/settings.
6
+
7
+ ```ruby
8
+ # Gemfile
9
+ gem "ellen-slack"
10
+ ```
11
+
12
+ ## ENV
13
+ ```
14
+ SLACK_CHANNEL - Channel name the bot logs in at first
15
+ SLACK_PASSWORD - Account's IRC password (See https://my.slack.com/account/gateways)
16
+ SLACK_TEAM - Account's team name
17
+ SLACK_USERNAME - Account's username, which must match the name on Slack account
18
+ SLACK_NO_SSL - Pass 1 if you don't want to use SSL connection
19
+ ```
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,22 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "ellen/slack/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "ellen-slack"
7
+ spec.version = Ellen::Slack::VERSION
8
+ spec.authors = ["Ryo Nakamura"]
9
+ spec.email = ["r7kamura@gmail.com"]
10
+ spec.summary = "Slack adapter for Ellen."
11
+ spec.homepage = "https://github.com/r7kamura/ellen-slack"
12
+ spec.license = "MIT"
13
+
14
+ spec.files = `git ls-files -z`.split("\x0")
15
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
16
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
+ spec.require_paths = ["lib"]
18
+
19
+ spec.add_dependency "zircon", ">= 0.0.8"
20
+ spec.add_development_dependency "bundler", "~> 1.6"
21
+ spec.add_development_dependency "rake"
22
+ end
@@ -0,0 +1,74 @@
1
+ require "zircon"
2
+ require "yaml"
3
+
4
+ module Ellen
5
+ module Adapters
6
+ class Slack < Base
7
+ env :SLACK_CHANNEL, "Channel name the bot logs in at first"
8
+ env :SLACK_PASSWORD, "Account's IRC password (See https://my.slack.com/account/gateways)"
9
+ env :SLACK_TEAM, "Account's team name"
10
+ env :SLACK_USERNAME, "Account's username, which must match the name on Slack account"
11
+ env :SLACK_NO_SSL, "Pass 1 if you don't want to use SSL connection", optional: true
12
+
13
+ def run
14
+ bind
15
+ connect
16
+ end
17
+
18
+ def say(body, options = {})
19
+ client.privmsg(channel, ":#{body}")
20
+ end
21
+
22
+ private
23
+
24
+ def client
25
+ @client ||= Zircon.new(
26
+ channel: channel,
27
+ password: password,
28
+ port: port,
29
+ server: server,
30
+ username: username,
31
+ use_ssl: ssl,
32
+ )
33
+ end
34
+
35
+ def channel
36
+ ENV["SLACK_CHANNEL"]
37
+ end
38
+
39
+ def port
40
+ "6667"
41
+ end
42
+
43
+ def server
44
+ "#{team}.irc.slack.com"
45
+ end
46
+
47
+ def username
48
+ ENV["SLACK_USERNAME"]
49
+ end
50
+
51
+ def password
52
+ ENV["SLACK_PASSWORD"]
53
+ end
54
+
55
+ def team
56
+ ENV["SLACK_TEAM"]
57
+ end
58
+
59
+ def ssl
60
+ !ENV["SLACK_NO_SSL"]
61
+ end
62
+
63
+ def bind
64
+ client.on_privmsg do |message|
65
+ robot.receive(body: message.body)
66
+ end
67
+ end
68
+
69
+ def connect
70
+ client.run!
71
+ end
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,5 @@
1
+ module Ellen
2
+ module Slack
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ require "ellen/adapters/slack"
2
+ require "ellen/slack/version"
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ellen-slack
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ryo Nakamura
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: zircon
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.0.8
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.0.8
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.6'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description:
56
+ email:
57
+ - r7kamura@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - ellen-slack.gemspec
68
+ - lib/ellen/adapters/slack.rb
69
+ - lib/ellen/slack.rb
70
+ - lib/ellen/slack/version.rb
71
+ homepage: https://github.com/r7kamura/ellen-slack
72
+ licenses:
73
+ - MIT
74
+ metadata: {}
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 2.2.2
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: Slack adapter for Ellen.
95
+ test_files: []