edi 0.1.2 → 0.2.0
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 +4 -4
- data/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/Guardfile +3 -3
- data/README.md +43 -2
- data/Vagrantfile +8 -0
- data/lib/edi.rb +6 -1
- data/lib/edi/application.rb +1 -1
- data/lib/edi/configuration.rb +3 -1
- data/lib/edi/dsl.rb +57 -0
- data/lib/edi/environment.rb +33 -0
- data/lib/edi/job.rb +10 -0
- data/lib/edi/postable.rb +37 -0
- data/lib/edi/{scheduler.rb → schedule.rb} +5 -5
- data/lib/edi/service.rb +2 -70
- data/lib/edi/version.rb +1 -1
- data/scripts/bootstrap_edi.sh +10 -0
- data/spec/edi/postable_spec.rb +35 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/support/fixtures/vcr_cassettes/i_heart_quotes.yml +0 -1
- data/spec/support/fixtures/vcr_cassettes/postable.yml +44 -0
- data/templates/project/Gemfile +1 -2
- data/templates/project/config/environment.rb +18 -0
- metadata +14 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 678184e62fabd6b36de22fd7373be103a547748f
|
|
4
|
+
data.tar.gz: 22df8582ad826e7d481fe13007db80e68f6fefb9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7fc32a6e729f356e96ed9ee2a9014c194a01422873ef08be1e2cce3ea760ba696511a6f2ffbcc61df298b191f86b2627ddd37cf224986c760cd020febf223512
|
|
7
|
+
data.tar.gz: acc3d7ec301c1aaaa5798fe59cdacbf789de8570f343202466304675fea0f2add6bee6c4834ce3f44ca488d60bafa1d43a9b6af51e7f60baca1a4737bff34adf
|
data/.gitignore
CHANGED
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
2.2.1
|
data/Guardfile
CHANGED
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
|
33
33
|
# * 'just' rspec: 'rspec'
|
|
34
34
|
|
|
35
|
-
guard :rspec, cmd: 'rspec' do
|
|
36
|
-
watch(%r{^spec/.+_spec\.rb$})
|
|
37
|
-
watch(%r{^lib/(.+)\.rb$}) {
|
|
35
|
+
guard :rspec, cmd: 'rspec', all_on_start: true, all_after_pass: true do
|
|
36
|
+
watch(%r{^spec/.+_spec\.rb$}) { "spec" }
|
|
37
|
+
watch(%r{^lib/(.+)\.rb$}) { "spec" }
|
|
38
38
|
watch('spec/spec_helper.rb') { "spec" }
|
|
39
39
|
end
|
|
40
40
|
|
data/README.md
CHANGED
|
@@ -42,7 +42,7 @@ class MyService < EDI::Service
|
|
|
42
42
|
end
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
If a service is Registered in `
|
|
45
|
+
If a service is Registered in `bot/server.rb` but does not have it's expected environment, edi will throw an exception and respond with a polite refusal to execute the service. This message can be set in your EDI configuration. The enviornment method will also create a getter method for each environment variable.
|
|
46
46
|
|
|
47
47
|
### Service Routing
|
|
48
48
|
|
|
@@ -95,11 +95,12 @@ You can do actions before or after the service is run, but before edi responds.
|
|
|
95
95
|
|
|
96
96
|
```ruby
|
|
97
97
|
class Joke < EDI::Service
|
|
98
|
+
include Postable
|
|
98
99
|
before_invoke :setup
|
|
99
100
|
invoke_with :punch
|
|
100
101
|
|
|
101
102
|
def setup
|
|
102
|
-
|
|
103
|
+
post_to_slack(message: "What do you call a fish with no eyes?", channel: "##{channel_name}")
|
|
103
104
|
sleep 1
|
|
104
105
|
end
|
|
105
106
|
|
|
@@ -108,6 +109,46 @@ class Joke < EDI::Service
|
|
|
108
109
|
end
|
|
109
110
|
end
|
|
110
111
|
```
|
|
112
|
+
|
|
113
|
+
## Jobs
|
|
114
|
+
|
|
115
|
+
Jobs are just Services that occur at a regular interval or specific time instead of in response to a message.
|
|
116
|
+
|
|
117
|
+
They can be used to poll your CI status and let the Team know if the build is broken, or tell a joke once in awhile, or inform the team of the weather before everyone drives in.
|
|
118
|
+
|
|
119
|
+
```ruby
|
|
120
|
+
require 'travis'
|
|
121
|
+
class CIStatus < EDI::Job
|
|
122
|
+
every "1m" :check_ci
|
|
123
|
+
channel "#general"
|
|
124
|
+
|
|
125
|
+
def check_ci
|
|
126
|
+
edi = Travis::Repository.find('DVG/EDI')
|
|
127
|
+
if edi.last_build.failed?
|
|
128
|
+
post_to_slack(message: "Oh noes, the build is broken!")
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
In this example EDI is going to check the CI status of the project, and post a message to the general channel if it fails.
|
|
135
|
+
|
|
136
|
+
Unlike Services, Jobs have to opt-in to posting to the chatroom with the `post` method. Jobs that run frequently may not always make a post.
|
|
137
|
+
|
|
138
|
+
EDI Schedule is in-process and in-memory. It will not persist in cron if EDI shuts down. You can use the `enable_keepalive` configuration option to have EDI try and stay awake on Heroku
|
|
139
|
+
|
|
140
|
+
### Configuration
|
|
141
|
+
|
|
142
|
+
The following config values are available for Jobs:
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
EDI.configure do |config|
|
|
146
|
+
config.slack_incoming_webhook_url # Required, the Incoming Webhook for your slack chatroom
|
|
147
|
+
config.job_default_channel # Defaults to #general, but you can specify a different Default Channel. This will be used if you don't specify a channel in the job
|
|
148
|
+
config.enable_keepalive # If you are on heroku, this will attempt to keep your dyno alive.
|
|
149
|
+
end
|
|
150
|
+
```
|
|
151
|
+
|
|
111
152
|
## Ship List
|
|
112
153
|
|
|
113
154
|
When these things are done, we'll be ready for 1.0
|
data/Vagrantfile
ADDED
data/lib/edi.rb
CHANGED
|
@@ -3,6 +3,9 @@ require 'active_support/string_inquirer'
|
|
|
3
3
|
require 'edi/core_ext'
|
|
4
4
|
require "edi/version"
|
|
5
5
|
require 'edi/server'
|
|
6
|
+
require 'edi/dsl'
|
|
7
|
+
require 'edi/postable'
|
|
8
|
+
require 'edi/environment'
|
|
6
9
|
require 'edi/service'
|
|
7
10
|
require 'edi/exceptions'
|
|
8
11
|
require 'edi/interpreter'
|
|
@@ -14,7 +17,8 @@ require 'edi/configuration'
|
|
|
14
17
|
require 'edi/http_utilities'
|
|
15
18
|
require 'edi/application'
|
|
16
19
|
require 'edi/utilities/array_responder'
|
|
17
|
-
require 'edi/
|
|
20
|
+
require 'edi/schedule'
|
|
21
|
+
require 'edi/job'
|
|
18
22
|
module EDI
|
|
19
23
|
class << self
|
|
20
24
|
attr_accessor :services
|
|
@@ -47,6 +51,7 @@ module EDI
|
|
|
47
51
|
def env=(environment)
|
|
48
52
|
self.config.environment = ActiveSupport::StringInquirer.new(environment)
|
|
49
53
|
end
|
|
54
|
+
|
|
50
55
|
end
|
|
51
56
|
include EDI::HTTPUtilities
|
|
52
57
|
include EDI::Configuration
|
data/lib/edi/application.rb
CHANGED
data/lib/edi/configuration.rb
CHANGED
|
@@ -6,7 +6,6 @@ module EDI
|
|
|
6
6
|
def self.included(base)
|
|
7
7
|
base.include ActiveSupport::Configurable
|
|
8
8
|
base.configure do |config|
|
|
9
|
-
|
|
10
9
|
# Bot Name
|
|
11
10
|
config.bot_name = "EDI"
|
|
12
11
|
|
|
@@ -20,6 +19,9 @@ module EDI
|
|
|
20
19
|
|
|
21
20
|
# Autoload Services
|
|
22
21
|
config.autoload_paths = ["bot/services"]
|
|
22
|
+
|
|
23
|
+
# Postable Configuration
|
|
24
|
+
config.default_channel = "#general"
|
|
23
25
|
end
|
|
24
26
|
end
|
|
25
27
|
end
|
data/lib/edi/dsl.rb
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
require 'hooks'
|
|
2
|
+
module EDI
|
|
3
|
+
module DSL
|
|
4
|
+
module ClassMethods
|
|
5
|
+
attr_accessor :required_environment_variables, :pattern, :interpreter_phrases, :invoker
|
|
6
|
+
def phrases(*args)
|
|
7
|
+
@interpreter_phrases = args
|
|
8
|
+
reset_interpreter_pattern
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def interpreter_pattern(pattern)
|
|
12
|
+
@pattern = pattern
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def pattern
|
|
16
|
+
@pattern ||= concatenate_phrases_into_regex
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# class MyService < EDI::Service
|
|
20
|
+
# invoke_with :post_tweet
|
|
21
|
+
#
|
|
22
|
+
# end
|
|
23
|
+
def invoke_with(method_name)
|
|
24
|
+
send :define_method, :invoke do
|
|
25
|
+
run_hook :before_invoke
|
|
26
|
+
@response = send method_name
|
|
27
|
+
run_hook :after_invoke
|
|
28
|
+
@response
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def concatenate_phrases_into_regex
|
|
34
|
+
case interpreter_phrases
|
|
35
|
+
when Array then /#{interpreter_phrases.join("|")}/i
|
|
36
|
+
when String then /#{interpreter_phrases}/i
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def reset_interpreter_pattern
|
|
41
|
+
@pattern = nil
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def run
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def self.included(base)
|
|
50
|
+
base.send(:include, Hooks)
|
|
51
|
+
base.send(:extend, ClassMethods)
|
|
52
|
+
base.send(:invoke_with, :run)
|
|
53
|
+
base.send(:define_hooks, :before_invoke, :after_invoke)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module EDI
|
|
2
|
+
module Environment
|
|
3
|
+
|
|
4
|
+
module ClassMethods
|
|
5
|
+
attr_accessor :required_environment_variables
|
|
6
|
+
|
|
7
|
+
def environment(*args)
|
|
8
|
+
args.each do |sym|
|
|
9
|
+
str = sym.to_s.upcase
|
|
10
|
+
send :define_method, sym do
|
|
11
|
+
ENV[str] || ENV[str.downcase]
|
|
12
|
+
end
|
|
13
|
+
required_environment_variables << str
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def required_environment_variables
|
|
18
|
+
@required_environment_variables ||= []
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def validate_environment
|
|
24
|
+
self.class.required_environment_variables.each do |v|
|
|
25
|
+
raise UnfitEnvironmentException unless (ENV[v] || ENV[v.downcase])
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def self.included(base)
|
|
30
|
+
base.send(:extend, ClassMethods)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
data/lib/edi/job.rb
ADDED
data/lib/edi/postable.rb
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module EDI
|
|
2
|
+
module Postable
|
|
3
|
+
|
|
4
|
+
module ClassMethods
|
|
5
|
+
attr_accessor :_channel
|
|
6
|
+
def channel(channel)
|
|
7
|
+
@_channel = channel
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
private
|
|
12
|
+
def _actually_post(message:, channel: nil)
|
|
13
|
+
body = {
|
|
14
|
+
text: message,
|
|
15
|
+
channel: channel || self.class._channel || EDI.config.default_channel
|
|
16
|
+
}
|
|
17
|
+
EDI.post(slack_webhook_url, body: body.to_json)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
public
|
|
21
|
+
def post_to_slack(message:, channel: nil)
|
|
22
|
+
begin
|
|
23
|
+
validate_environment
|
|
24
|
+
rescue EDI::UnfitEnvironmentException
|
|
25
|
+
return
|
|
26
|
+
end
|
|
27
|
+
_actually_post(message: message, channel: channel)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def self.included(base)
|
|
32
|
+
base.send(:extend, ClassMethods)
|
|
33
|
+
base.send(:environment, :slack_webhook_url)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
require 'rufus-scheduler'
|
|
2
2
|
module EDI
|
|
3
|
-
module
|
|
4
|
-
def
|
|
5
|
-
@
|
|
3
|
+
module Schedule
|
|
4
|
+
def schedule
|
|
5
|
+
@schedule ||= Rufus::Scheduler.new
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
def keepalive
|
|
9
|
-
|
|
9
|
+
schedule.every "30s" do
|
|
10
10
|
host = if EDI.env.development?
|
|
11
11
|
puts "http://127.0.0.1:#{EDI.config.port}"
|
|
12
12
|
"http://127.0.0.1:#{EDI.config.port}"
|
|
@@ -17,5 +17,5 @@ module EDI
|
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
|
-
extend
|
|
20
|
+
extend Schedule
|
|
21
21
|
end
|
data/lib/edi/service.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
require 'hooks'
|
|
2
1
|
module EDI
|
|
3
2
|
class Service
|
|
4
|
-
include
|
|
3
|
+
include ::EDI::DSL
|
|
4
|
+
include ::EDI::Environment
|
|
5
5
|
|
|
6
6
|
attr_accessor :message, :response
|
|
7
7
|
def initialize(message)
|
|
@@ -17,73 +17,5 @@ module EDI
|
|
|
17
17
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
def validate_environment
|
|
21
|
-
self.class.required_environment_variables.each do |v|
|
|
22
|
-
raise UnfitEnvironmentException unless (ENV[v] || ENV[v.downcase])
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
# Class Methods
|
|
27
|
-
class << self
|
|
28
|
-
attr_accessor :required_environment_variables, :pattern, :interpreter_phrases, :invoker
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def self.phrases(*args)
|
|
32
|
-
@interpreter_phrases = args
|
|
33
|
-
reset_interpreter_pattern
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def self.required_environment_variables
|
|
37
|
-
@required_environment_variables ||= []
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def self.environment(*args)
|
|
41
|
-
args.each do |sym|
|
|
42
|
-
str = sym.to_s.upcase
|
|
43
|
-
send :define_method, sym do
|
|
44
|
-
ENV[str] || ENV[str.downcase]
|
|
45
|
-
end
|
|
46
|
-
required_environment_variables << str
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
def self.interpreter_pattern(pattern)
|
|
52
|
-
@pattern = pattern
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def self.pattern
|
|
56
|
-
@pattern ||= concatenate_phrases_into_regex
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
# class MyService < EDI::Service
|
|
60
|
-
# invoke_with :post_tweet
|
|
61
|
-
#
|
|
62
|
-
# end
|
|
63
|
-
def self.invoke_with(method_name)
|
|
64
|
-
send :define_method, :invoke do
|
|
65
|
-
run_hook :before_invoke
|
|
66
|
-
self.response = send method_name
|
|
67
|
-
run_hook :after_invoke
|
|
68
|
-
self.response
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
private
|
|
74
|
-
|
|
75
|
-
def self.concatenate_phrases_into_regex
|
|
76
|
-
case self.interpreter_phrases
|
|
77
|
-
when Array then /#{self.interpreter_phrases.join("|")}/i
|
|
78
|
-
when String then /#{self.interpreter_phrases}/i
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
def self.reset_interpreter_pattern
|
|
83
|
-
@pattern = nil
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
invoke_with :run
|
|
87
|
-
define_hooks :before_invoke, :after_invoke
|
|
88
20
|
end
|
|
89
21
|
end
|
data/lib/edi/version.rb
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
sudo apt-get update
|
|
4
|
+
sudo apt-get install -y build-essential git curl libxslt1-dev libxml2-dev libssl-dev
|
|
5
|
+
|
|
6
|
+
# rvm and ruby
|
|
7
|
+
su - vagrant -c "gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3"
|
|
8
|
+
su - vagrant -c 'curl -sSL https://get.rvm.io | bash -s stable'
|
|
9
|
+
su - vagrant -c 'rvm install 2.1.4'
|
|
10
|
+
su - vagrant -c 'rvm rvmrc warning ignore allGemfiles'
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
RSpec.describe EDI::Postable, vcr: { cassette_name: 'postable', :record => :new_episodes} do
|
|
4
|
+
subject do
|
|
5
|
+
Class.new do
|
|
6
|
+
include EDI::Environment
|
|
7
|
+
include EDI::Postable
|
|
8
|
+
channel "#testing"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
describe "post_to_slack" do
|
|
13
|
+
before { stub_env("SLACK_WEBHOOK_URL" => "http://api.slack.com/my/webhook/url") }
|
|
14
|
+
it "posts to the configured channel" do
|
|
15
|
+
expect(subject.new.post_to_slack(message: "Hello World").status).to eq 200
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
describe "Doesn't try to post if slack webhook isn't set up" do
|
|
20
|
+
before { stub_env("SLACK_WEBHOOK_URL" => nil) }
|
|
21
|
+
it "validates environment" do
|
|
22
|
+
expect(EDI).to_not receive(:post)
|
|
23
|
+
subject.new.post_to_slack message: "Hello World"
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
describe "Can override class-level channel definition by passing channel" do
|
|
28
|
+
before { stub_env("SLACK_WEBHOOK_URL" => "http://api.slack.com/my/webhook/url") }
|
|
29
|
+
let(:expected_body) { {text: "Hello World", channel: "#edi_testing"}.to_json }
|
|
30
|
+
it "posts with the passed in channel" do
|
|
31
|
+
expect(EDI).to receive(:post).with(ENV["SLACK_WEBHOOK_URL"], :body => expected_body)
|
|
32
|
+
subject.new.post_to_slack(message: "Hello World", channel: "#edi_testing")
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -48,4 +48,6 @@ VCR.configure do |config|
|
|
|
48
48
|
config.cassette_library_dir = "spec/support/fixtures/vcr_cassettes"
|
|
49
49
|
config.configure_rspec_metadata!
|
|
50
50
|
config.hook_into :webmock
|
|
51
|
+
config.filter_sensitive_data("<SLACK_WEBHOOK_URL>") { ENV["SLACK_WEBHOOK_URL"] }
|
|
52
|
+
config.allow_http_connections_when_no_cassette = true
|
|
51
53
|
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: post
|
|
5
|
+
uri: "<SLACK_WEBHOOK_URL>"
|
|
6
|
+
body:
|
|
7
|
+
encoding: UTF-8
|
|
8
|
+
string: '{"text":"Hello World","channel":"#testing"}'
|
|
9
|
+
headers:
|
|
10
|
+
Accept-Encoding:
|
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
12
|
+
Accept:
|
|
13
|
+
- "*/*"
|
|
14
|
+
User-Agent:
|
|
15
|
+
- Ruby
|
|
16
|
+
response:
|
|
17
|
+
status:
|
|
18
|
+
code: 200
|
|
19
|
+
message: OK
|
|
20
|
+
headers:
|
|
21
|
+
Access-Control-Allow-Origin:
|
|
22
|
+
- "*"
|
|
23
|
+
Content-Type:
|
|
24
|
+
- text/html
|
|
25
|
+
Date:
|
|
26
|
+
- Fri, 06 Mar 2015 01:00:04 GMT
|
|
27
|
+
Server:
|
|
28
|
+
- Apache
|
|
29
|
+
Strict-Transport-Security:
|
|
30
|
+
- max-age=31536000; includeSubDomains; preload
|
|
31
|
+
Vary:
|
|
32
|
+
- Accept-Encoding
|
|
33
|
+
X-Frame-Options:
|
|
34
|
+
- SAMEORIGIN
|
|
35
|
+
Content-Length:
|
|
36
|
+
- '22'
|
|
37
|
+
Connection:
|
|
38
|
+
- keep-alive
|
|
39
|
+
body:
|
|
40
|
+
encoding: UTF-8
|
|
41
|
+
string: ok
|
|
42
|
+
http_version:
|
|
43
|
+
recorded_at: Fri, 06 Mar 2015 01:00:04 GMT
|
|
44
|
+
recorded_with: VCR 2.9.3
|
data/templates/project/Gemfile
CHANGED
|
@@ -2,11 +2,29 @@ require 'bundler/setup'
|
|
|
2
2
|
Bundler.require(:default, ENV["RACK_ENV"].to_sym)
|
|
3
3
|
EDI.configure do |config|
|
|
4
4
|
config.root = File.expand_path "./"
|
|
5
|
+
# Your bot's name, not required for anything, but you can use it to have your bot speak it's name
|
|
6
|
+
# config.bot_name = "EDI"
|
|
7
|
+
|
|
5
8
|
# Default response is what EDI will say in response to a message that doesn't have a registered service.
|
|
6
9
|
# If you configure this to be an array of strings, a random one will be selected.
|
|
7
10
|
# config.default_response = "What is this, I don't even"
|
|
11
|
+
|
|
12
|
+
# Hello Message, returned when browsing to / on your bot's host
|
|
13
|
+
# config.hello_message = "Hello, I'm #{config.bot_name}"
|
|
14
|
+
|
|
15
|
+
# Message returned to slack if an unconfigured service is invoked
|
|
16
|
+
# config.unfit_environment_response = "I'm really sorrt, but that service needs to be configured"
|
|
17
|
+
|
|
18
|
+
# Message returned to slack if a third party api fails
|
|
19
|
+
# config.third_party_api_failure_response = "Most unfortunately, that service is not working right now."
|
|
20
|
+
|
|
21
|
+
# Standard Error Response sent back to slack if anything else goes wrong
|
|
22
|
+
# config.standard_error_response = "I'm sorry, something went wrong."
|
|
8
23
|
|
|
9
24
|
# Add additional autoload directories to autoload_paths
|
|
10
25
|
# config.autoload_paths += "bot/models"
|
|
26
|
+
|
|
27
|
+
# Default channel to post to using the post_to_slack method
|
|
28
|
+
# config.default_channel = "#general"
|
|
11
29
|
end
|
|
12
30
|
EDI.bootstrap
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: edi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- DVG
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-03-
|
|
11
|
+
date: 2015-03-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -307,6 +307,7 @@ files:
|
|
|
307
307
|
- LICENSE.txt
|
|
308
308
|
- README.md
|
|
309
309
|
- Rakefile
|
|
310
|
+
- Vagrantfile
|
|
310
311
|
- bin/edi
|
|
311
312
|
- edi.gemspec
|
|
312
313
|
- features/fact_service.feature
|
|
@@ -343,12 +344,16 @@ files:
|
|
|
343
344
|
- lib/edi/configuration.rb
|
|
344
345
|
- lib/edi/core_ext.rb
|
|
345
346
|
- lib/edi/core_ext/symbol.rb
|
|
347
|
+
- lib/edi/dsl.rb
|
|
348
|
+
- lib/edi/environment.rb
|
|
346
349
|
- lib/edi/exceptions.rb
|
|
347
350
|
- lib/edi/http_utilities.rb
|
|
348
351
|
- lib/edi/interpreter.rb
|
|
352
|
+
- lib/edi/job.rb
|
|
353
|
+
- lib/edi/postable.rb
|
|
349
354
|
- lib/edi/refinements.rb
|
|
350
355
|
- lib/edi/refinements/zip_refinement.rb
|
|
351
|
-
- lib/edi/
|
|
356
|
+
- lib/edi/schedule.rb
|
|
352
357
|
- lib/edi/server.rb
|
|
353
358
|
- lib/edi/service.rb
|
|
354
359
|
- lib/edi/services.rb
|
|
@@ -382,8 +387,10 @@ files:
|
|
|
382
387
|
- lib/edi/test_support/test_support.rb
|
|
383
388
|
- lib/edi/utilities/array_responder.rb
|
|
384
389
|
- lib/edi/version.rb
|
|
390
|
+
- scripts/bootstrap_edi.sh
|
|
385
391
|
- spec/edi/edi_spec.rb
|
|
386
392
|
- spec/edi/interpreter_spec.rb
|
|
393
|
+
- spec/edi/postable_spec.rb
|
|
387
394
|
- spec/edi/server_spec.rb
|
|
388
395
|
- spec/edi/service_spec.rb
|
|
389
396
|
- spec/services/dice_spec.rb
|
|
@@ -413,6 +420,7 @@ files:
|
|
|
413
420
|
- spec/support/fixtures/vcr_cassettes/img_flip_what_if_I_told_you.yml
|
|
414
421
|
- spec/support/fixtures/vcr_cassettes/img_flip_willy_wonka.yml
|
|
415
422
|
- spec/support/fixtures/vcr_cassettes/img_flip_y_u_no.yml
|
|
423
|
+
- spec/support/fixtures/vcr_cassettes/postable.yml
|
|
416
424
|
- spec/support/fixtures/vcr_cassettes/tweet_that.yml
|
|
417
425
|
- spec/support/fixtures/vcr_cassettes/weather.yml
|
|
418
426
|
- spec/support/shared_contexts/server.rb
|
|
@@ -445,7 +453,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
445
453
|
version: '0'
|
|
446
454
|
requirements: []
|
|
447
455
|
rubyforge_project:
|
|
448
|
-
rubygems_version: 2.4.
|
|
456
|
+
rubygems_version: 2.4.5
|
|
449
457
|
signing_key:
|
|
450
458
|
specification_version: 4
|
|
451
459
|
summary: Chatbot Application Framework for Slack Chat Rooms
|
|
@@ -479,6 +487,7 @@ test_files:
|
|
|
479
487
|
- features/weather_service.feature
|
|
480
488
|
- spec/edi/edi_spec.rb
|
|
481
489
|
- spec/edi/interpreter_spec.rb
|
|
490
|
+
- spec/edi/postable_spec.rb
|
|
482
491
|
- spec/edi/server_spec.rb
|
|
483
492
|
- spec/edi/service_spec.rb
|
|
484
493
|
- spec/services/dice_spec.rb
|
|
@@ -508,6 +517,7 @@ test_files:
|
|
|
508
517
|
- spec/support/fixtures/vcr_cassettes/img_flip_what_if_I_told_you.yml
|
|
509
518
|
- spec/support/fixtures/vcr_cassettes/img_flip_willy_wonka.yml
|
|
510
519
|
- spec/support/fixtures/vcr_cassettes/img_flip_y_u_no.yml
|
|
520
|
+
- spec/support/fixtures/vcr_cassettes/postable.yml
|
|
511
521
|
- spec/support/fixtures/vcr_cassettes/tweet_that.yml
|
|
512
522
|
- spec/support/fixtures/vcr_cassettes/weather.yml
|
|
513
523
|
- spec/support/shared_contexts/server.rb
|