lita-ext 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rubocop.yml +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +140 -0
- data/Rakefile +8 -0
- data/bin/lita-ext +6 -0
- data/lib/lita/ext.rb +3 -0
- data/lib/lita/ext/cli.rb +32 -0
- data/lib/lita/ext/core.rb +69 -0
- data/lib/lita/ext/handler.rb +62 -0
- data/lib/lita/ext/version.rb +5 -0
- data/lita-ext.gemspec +29 -0
- data/rubocop-todo.yml +40 -0
- data/spec/lita/ext/handler_spec.rb +74 -0
- data/spec/lita/ext_spec.rb +15 -0
- data/spec/spec_helper.rb +2 -0
- data/templates/handler.tt +2 -0
- data/templates/robot/Gemfile +15 -0
- data/templates/robot/app/handlers/.keep +0 -0
- data/templates/robot/config/environments/development.rb +10 -0
- data/templates/robot/config/environments/production.rb +13 -0
- data/templates/robot/config/initializers/.keep +0 -0
- data/templates/robot/lib/.keep +0 -0
- data/templates/robot/lita_config.rb +23 -0
- data/templates/robot/log/.keep +0 -0
- metadata +172 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4297bf51b4083a9decd7c0b28fbfacdefcbf6ab0
|
4
|
+
data.tar.gz: 249a40dc0c293005a58aad62b6f7b815476ee407
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1b19a3fdaab026595a642472b0a6d4fe8ec1bc9ca12fda97f64f85aeb55d9b32c2b816a078e8b642087331ceb8c00af577979776fc5eba2a94604450b2e38528
|
7
|
+
data.tar.gz: c409b29f698f21fa0a8bf01f0c495542bab4f95af8decdf94c811a8801db63d59e58cff5f630ce171bf084220f94e3012074ed3f1bad0b24a563f5331c9393a4
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
inherit_from: rubocop-todo.yml
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Bryan Traywick
|
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,140 @@
|
|
1
|
+
# Lita::Ext
|
2
|
+
|
3
|
+
Lita::Ext adds a number of extensions to [Lita](https://www.lita.io/) to
|
4
|
+
make it more Rails like. It adds the concept of multiple environments,
|
5
|
+
Rails like initializers, and provides structure for your Lita handlers.
|
6
|
+
|
7
|
+
The layout of a Lita::Ext bot:
|
8
|
+
|
9
|
+
.
|
10
|
+
├── Gemfile
|
11
|
+
├── Gemfile.lock
|
12
|
+
├── README.md
|
13
|
+
├── Rakefile
|
14
|
+
├── app
|
15
|
+
│ └── handlers
|
16
|
+
│ └── echo.rb
|
17
|
+
├── config
|
18
|
+
│ ├── environments
|
19
|
+
│ │ ├── development.rb
|
20
|
+
│ │ ├── production.rb
|
21
|
+
│ │ └── testing.rb
|
22
|
+
│ └── initializers
|
23
|
+
│ └── initialize_foo.rb
|
24
|
+
├── lib
|
25
|
+
│ └── custom_lib.rb
|
26
|
+
├── lita_config.rb
|
27
|
+
└── log
|
28
|
+
└── lita.log
|
29
|
+
|
30
|
+
Following the Rails conventions, your bot's handlers go in `app/handlers`
|
31
|
+
and environment specific settings are in `config/environments`. Initializers
|
32
|
+
are placed in `config/initializers` and are used to initialize a library or
|
33
|
+
setup global variables before the bot starts.
|
34
|
+
|
35
|
+
The `lib` folder is used for code that isn't a handler or initializer.
|
36
|
+
For example, a helper script for accessing a web service that is used by
|
37
|
+
a handler. The `lib` folder is added to the `$LOAD_PATH` but you must
|
38
|
+
`require` files that you want to use.
|
39
|
+
|
40
|
+
## Installation
|
41
|
+
|
42
|
+
Add this line to your application's Gemfile:
|
43
|
+
|
44
|
+
gem 'lita-ext'
|
45
|
+
|
46
|
+
And then execute:
|
47
|
+
|
48
|
+
$ bundle
|
49
|
+
|
50
|
+
Or install it yourself as:
|
51
|
+
|
52
|
+
$ gem install lita-ext
|
53
|
+
|
54
|
+
## Usage
|
55
|
+
|
56
|
+
### Startup Process
|
57
|
+
|
58
|
+
Lita::Ext performs serveral actions at startup that makes it easier for you
|
59
|
+
to focus on writing customer handlers for your bot. The `Lita.run` method
|
60
|
+
performs the following additional actions:
|
61
|
+
|
62
|
+
1. Change directory to the `Lita.root` directory.
|
63
|
+
2. Load [Dotenv](https://github.com/bkeepers/dotenv) settings for the bot.
|
64
|
+
Like the dotenv-rails gem, Lita::Ext will load both the standard `.env`
|
65
|
+
file as well as environment specific settings in `.env.#{Lita.env}`.
|
66
|
+
3. Add the `lib` directory to the load path.
|
67
|
+
4. Load initializers in the `config/initializers` directory.
|
68
|
+
5. Load your bot's custom handlers from the `app/handlers` directory.
|
69
|
+
6. Auto-register your bot's handlers so that you don't have to call
|
70
|
+
`Lita.register_handler(MyCustomHandler)` for each handler.
|
71
|
+
7. Load the environment specific settings from
|
72
|
+
`config/environments/#{Lita.env}.rb`.
|
73
|
+
|
74
|
+
### Lita module extensions
|
75
|
+
|
76
|
+
Lita::Ext provides two new methods to the base `Lita` module.
|
77
|
+
|
78
|
+
#### Lita.env
|
79
|
+
|
80
|
+
The `Lita.env` method will return the current Lita environment. The
|
81
|
+
environment is set with the `LITA_ENV` environment variable and defaults
|
82
|
+
to `"development"` when not set. The Lita environment will determine which
|
83
|
+
environment configuration to load form the `config/environments` directory
|
84
|
+
and which Dotenv settings file to load. Environments can be used to run
|
85
|
+
different adapters for development, testing, and production. For example,
|
86
|
+
you can use the shell adapter for the development environment and the
|
87
|
+
[Campfire adapter](https://github.com/josacar/lita-campfire) in production.
|
88
|
+
|
89
|
+
Examples:
|
90
|
+
|
91
|
+
Lita.env => "development"
|
92
|
+
Lita.env.development? => true
|
93
|
+
|
94
|
+
#### Lita.root
|
95
|
+
|
96
|
+
The `Lita.root` method returns the path to the root directory for your
|
97
|
+
Lita bot. It is useful for loading setting files relative to the bot's
|
98
|
+
root directory. By default the root directory is determined by the
|
99
|
+
current working directory, but it can be overridden with the `LITA_ROOT`
|
100
|
+
environment variable.
|
101
|
+
|
102
|
+
Examples:
|
103
|
+
|
104
|
+
Lita.root => "/path/to/lita/bot"
|
105
|
+
|
106
|
+
### Lita::Handler extensions
|
107
|
+
|
108
|
+
Lita::Ext provides several convenience methods to the default
|
109
|
+
`Lita::Handler` class. The `#log` method provides shorter access to Lita
|
110
|
+
logger at `Lita.logger`. The `#config` method provides direct access to
|
111
|
+
the handler's configuration options. The `Lita::Handler.config` class
|
112
|
+
method makes it easy to specify configuration settings for the handler.
|
113
|
+
The `#config_valid?` method returns true if all required configuration
|
114
|
+
options are set and false otherwise.
|
115
|
+
|
116
|
+
Example:
|
117
|
+
|
118
|
+
class MyCustomHandler < Lita::Handler
|
119
|
+
config :api_token
|
120
|
+
config :foo, default: "bar", required: false
|
121
|
+
|
122
|
+
route /^foo/, :foo, command: true
|
123
|
+
|
124
|
+
def foo(response)
|
125
|
+
if config_valid?
|
126
|
+
# Do something with config.api_token
|
127
|
+
...
|
128
|
+
else
|
129
|
+
response.reply "Missing foo API token"
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
## Contributing
|
135
|
+
|
136
|
+
1. Fork it
|
137
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
138
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
139
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
140
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/bin/lita-ext
ADDED
data/lib/lita/ext.rb
ADDED
data/lib/lita/ext/cli.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'lita'
|
3
|
+
require 'lita/cli'
|
4
|
+
require 'lita/ext'
|
5
|
+
|
6
|
+
module Lita
|
7
|
+
module Ext
|
8
|
+
class CLI < Thor
|
9
|
+
include Thor::Actions
|
10
|
+
|
11
|
+
# The root path for the templates directory.
|
12
|
+
# @note This is a magic method required by Thor for file operations.
|
13
|
+
# @return [String] The path.
|
14
|
+
def self.source_root
|
15
|
+
File.expand_path("../../../../templates", __FILE__)
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "new NAME", "Create a new Lita bot named NAME (default name: lita)"
|
19
|
+
def new(name = "lita")
|
20
|
+
directory "robot", name
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "handler NAME", "Create a new app handler named NAME"
|
24
|
+
def handler(name)
|
25
|
+
config = {}
|
26
|
+
config[:handler_name] = name.split(/_/).map { |p| p.capitalize }.join
|
27
|
+
target = File.join(Lita.root, "app/handlers/#{name}.rb")
|
28
|
+
template("handler.tt", target, config)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'lita'
|
2
|
+
require 'dotenv'
|
3
|
+
require 'active_support'
|
4
|
+
require 'active_support/core_ext/module/aliasing'
|
5
|
+
|
6
|
+
module Lita
|
7
|
+
class << self
|
8
|
+
def env
|
9
|
+
@env ||= ActiveSupport::StringInquirer.new(ENV['LITA_ENV'] || 'development')
|
10
|
+
end
|
11
|
+
|
12
|
+
def root
|
13
|
+
@root ||= ENV['LITA_ROOT'] ||= File.expand_path('.')
|
14
|
+
end
|
15
|
+
|
16
|
+
def run_with_ext(config_path = nil)
|
17
|
+
chdir_to_lita_root
|
18
|
+
load_dotenv
|
19
|
+
add_lib_to_load_path
|
20
|
+
load_initializers
|
21
|
+
load_app_handlers
|
22
|
+
register_app_handlers
|
23
|
+
load_environment_config
|
24
|
+
|
25
|
+
run_without_ext(config_path)
|
26
|
+
end
|
27
|
+
alias_method_chain :run, :ext
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def chdir_to_lita_root
|
32
|
+
Dir.chdir(Lita.root)
|
33
|
+
end
|
34
|
+
|
35
|
+
def load_dotenv
|
36
|
+
Dotenv.load ".env.#{Lita.env}", '.env'
|
37
|
+
end
|
38
|
+
|
39
|
+
def add_lib_to_load_path
|
40
|
+
lib = File.expand_path('lib', Lita.root)
|
41
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
42
|
+
end
|
43
|
+
|
44
|
+
def load_initializers
|
45
|
+
initializers = "#{Lita.root}/config/initializers/**/*.rb"
|
46
|
+
Dir.glob(initializers).each { |initializer| require initializer }
|
47
|
+
end
|
48
|
+
|
49
|
+
def load_app_handlers
|
50
|
+
handlers = "#{Lita.root}/app/handlers/**/*.rb"
|
51
|
+
Dir.glob(handlers).each { |handler| require handler }
|
52
|
+
end
|
53
|
+
|
54
|
+
def register_app_handlers
|
55
|
+
Lita::Handler.handlers.each do |handler|
|
56
|
+
unless handler.disabled?
|
57
|
+
Lita.register_handler(handler)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def load_environment_config
|
63
|
+
environment = "#{Lita.root}/config/environments/#{Lita.env}"
|
64
|
+
if File.exists?("#{environment}.rb")
|
65
|
+
require environment
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'lita'
|
2
|
+
require 'lita/handler'
|
3
|
+
|
4
|
+
module Lita
|
5
|
+
class Handler
|
6
|
+
def log
|
7
|
+
Lita.logger
|
8
|
+
end
|
9
|
+
|
10
|
+
def config
|
11
|
+
Lita.config.handlers[self.class.namespace]
|
12
|
+
end
|
13
|
+
|
14
|
+
def config_valid?
|
15
|
+
valid = true
|
16
|
+
self.class.config_options.each do |config_option|
|
17
|
+
if config_option.required? and config[config_option.name].nil?
|
18
|
+
log.error "#{self.class.name.split('::').last}: missing #{config_option.name} setting"
|
19
|
+
valid = false
|
20
|
+
end
|
21
|
+
end
|
22
|
+
valid
|
23
|
+
end
|
24
|
+
|
25
|
+
class ConfigOption < Struct.new(
|
26
|
+
:name,
|
27
|
+
:required,
|
28
|
+
:default
|
29
|
+
)
|
30
|
+
alias_method :required?, :required
|
31
|
+
end
|
32
|
+
|
33
|
+
class << self
|
34
|
+
def inherited(subclass)
|
35
|
+
handlers << subclass
|
36
|
+
super
|
37
|
+
end
|
38
|
+
|
39
|
+
def handlers
|
40
|
+
@handlers ||= []
|
41
|
+
end
|
42
|
+
|
43
|
+
def config(name, required: true, default: nil)
|
44
|
+
config_options << ConfigOption.new(name, required, default)
|
45
|
+
end
|
46
|
+
|
47
|
+
def config_options
|
48
|
+
@config_options ||= []
|
49
|
+
end
|
50
|
+
|
51
|
+
def default_config(default)
|
52
|
+
config_options.each do |config_option|
|
53
|
+
default[config_option.name] = config_option.default
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def disabled?
|
58
|
+
Lita.config.disabled and Lita.config.disabled.include?(namespace.to_sym)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
data/lita-ext.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'lita/ext/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "lita-ext"
|
8
|
+
spec.version = Lita::Ext::VERSION
|
9
|
+
spec.authors = ["Bryan Traywick"]
|
10
|
+
spec.email = ["bryan@railsmachine.com"]
|
11
|
+
spec.description = %q{A collection of extensions to the Lita chat bot.}
|
12
|
+
spec.summary = %q{A collection of extensions to the Lita chat bot.}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency "lita", "~> 3.0"
|
22
|
+
spec.add_runtime_dependency "dotenv"
|
23
|
+
spec.add_runtime_dependency "activesupport"
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
26
|
+
spec.add_development_dependency "rake"
|
27
|
+
spec.add_development_dependency "rspec", ">= 3.0.0.beta1"
|
28
|
+
spec.add_development_dependency "rubocop"
|
29
|
+
end
|
data/rubocop-todo.yml
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
+
# on 2014-03-24 00:32:18 -0400 using RuboCop version 0.19.1.
|
3
|
+
# The point is for the user to remove these configuration records
|
4
|
+
# one by one as the offenses are removed from the code base.
|
5
|
+
# Note that changes in the inspected code, or installation of new
|
6
|
+
# versions of RuboCop, may require this file to be generated again.
|
7
|
+
|
8
|
+
# Offense count: 2
|
9
|
+
# Cop supports --auto-correct.
|
10
|
+
AndOr:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
# Offense count: 1
|
14
|
+
# Cop supports --auto-correct.
|
15
|
+
DeprecatedClassMethods:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
# Offense count: 6
|
19
|
+
Documentation:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
# Offense count: 1
|
23
|
+
# Cop supports --auto-correct.
|
24
|
+
EmptyLinesAroundBody:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
# Offense count: 2
|
28
|
+
# Configuration parameters: MaxLineLength.
|
29
|
+
IfUnlessModifier:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
# Offense count: 4
|
33
|
+
LineLength:
|
34
|
+
Max: 96
|
35
|
+
|
36
|
+
# Offense count: 10
|
37
|
+
# Cop supports --auto-correct.
|
38
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
39
|
+
StringLiterals:
|
40
|
+
Enabled: false
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Lita::Handler, lita: true do
|
4
|
+
let(:robot) { instance_double("Lita::Robot", name: "Lita") }
|
5
|
+
let(:user) { instance_double("Lita::User", name: "Test User") }
|
6
|
+
|
7
|
+
let(:handler_class) do
|
8
|
+
Class.new(described_class) do
|
9
|
+
config :foo
|
10
|
+
config :bar, required: false
|
11
|
+
config :baz, default: "default value"
|
12
|
+
|
13
|
+
def self.name
|
14
|
+
"FooHandler"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
subject { handler_class.new(robot) }
|
20
|
+
|
21
|
+
it "auto-registers Lita::Handler sub-classes" do
|
22
|
+
class TestHandler < Lita::Handler
|
23
|
+
end
|
24
|
+
Lita.send(:register_app_handlers)
|
25
|
+
expect(Lita.handlers).to include(TestHandler)
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '.config_options' do
|
29
|
+
it "contains specified configuration options" do
|
30
|
+
expect(handler_class.config_options.length).to eq(3)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe '.config' do
|
35
|
+
before do
|
36
|
+
allow(Lita).to receive(:handlers).and_return([subject])
|
37
|
+
Lita::Config.load_user_config
|
38
|
+
end
|
39
|
+
|
40
|
+
it "defaults to required" do
|
41
|
+
foo_option = handler_class.config_options.select { |opt| opt.name == :foo }.first
|
42
|
+
expect(foo_option.required?).to eq(true)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "required option can be used to make a config setting optional" do
|
46
|
+
bar_option = handler_class.config_options.select { |opt| opt.name == :bar }.first
|
47
|
+
expect(bar_option.required?).to eq(false)
|
48
|
+
end
|
49
|
+
|
50
|
+
# TODO: figure out how to initialize the handler's config object properly
|
51
|
+
# it "can accept a default value for the config setting" do
|
52
|
+
# baz_option = handler_class.config_options.select { |opt| opt.name == :baz }.first
|
53
|
+
# expect(baz_option.default).to eq("default value")
|
54
|
+
# expect(subject.config[:baz]).to eq("default value")
|
55
|
+
# end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe '#log' do
|
59
|
+
it "returns the Lita logger" do
|
60
|
+
expect(subject.log).to eq(Lita.logger)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe '#config' do
|
65
|
+
it "returns the handler's config object" do
|
66
|
+
expect(subject.config).to eq(Lita.config.handlers.foo_handler)
|
67
|
+
end
|
68
|
+
|
69
|
+
# TODO: figure out how to initialize the handler's config object properly
|
70
|
+
# it "contains options specified with Lita::Handler.config" do
|
71
|
+
# exepect(subject.config.baz).to eq("default value")
|
72
|
+
# end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Lita do
|
4
|
+
describe '.env' do
|
5
|
+
it "defaults to 'development'" do
|
6
|
+
expect(described_class.env).to eq('development')
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '.root' do
|
11
|
+
it "equals cwd" do
|
12
|
+
expect(described_class.root).to eq(File.expand_path('../../../', __FILE__))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gem "lita"
|
4
|
+
gem "lita-ext"
|
5
|
+
|
6
|
+
# Uncomment to use the HipChat adapter
|
7
|
+
# gem "lita-hipchat"
|
8
|
+
|
9
|
+
# Uncomment to use the IRC adapter
|
10
|
+
# gem "lita-irc"
|
11
|
+
|
12
|
+
# Add handlers to give Lita new functionality.
|
13
|
+
# For example:
|
14
|
+
# gem "lita-google-images"
|
15
|
+
# gem "lita-karma"
|
File without changes
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Lita.configure do |config|
|
2
|
+
# The adapter you want to connect with. Make sure you've added the
|
3
|
+
# appropriate gem to the Gemfile.
|
4
|
+
config.robot.adapter = :shell
|
5
|
+
config.robot.log_level = :debug
|
6
|
+
|
7
|
+
## Example: Set options for the Redis connection.
|
8
|
+
# config.redis.host = "127.0.0.1"
|
9
|
+
# config.redis.port = 1234
|
10
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Lita.configure do |config|
|
2
|
+
# The adapter you want to connect with. Make sure you've added the
|
3
|
+
# appropriate gem to the Gemfile.
|
4
|
+
# config.robot.adapter = :hipchat
|
5
|
+
|
6
|
+
## Example: Set options for the chosen adapter.
|
7
|
+
# config.adapter.username = "myname"
|
8
|
+
# config.adapter.password = "secret"
|
9
|
+
|
10
|
+
## Example: Set options for the Redis connection.
|
11
|
+
# config.redis.host = "127.0.0.1"
|
12
|
+
# config.redis.port = 1234
|
13
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Lita.configure do |config|
|
2
|
+
# The name your robot will use.
|
3
|
+
config.robot.name = "Lita"
|
4
|
+
config.robot.mention_name = "lita"
|
5
|
+
|
6
|
+
# The severity of messages to log. Options are:
|
7
|
+
# :debug, :info, :warn, :error, :fatal
|
8
|
+
# Messages at the selected level and above will be logged.
|
9
|
+
# config.robot.log_level = :debug
|
10
|
+
|
11
|
+
# An array of user IDs that are considered administrators. These users
|
12
|
+
# the ability to add and remove other users from authorization groups.
|
13
|
+
# What is considered a user ID will change depending on which adapter you use.
|
14
|
+
# config.robot.admins = ["1", "2"]
|
15
|
+
|
16
|
+
## Example: Set options for the Redis connection.
|
17
|
+
# config.redis.host = "127.0.0.1"
|
18
|
+
# config.redis.port = 1234
|
19
|
+
|
20
|
+
## Example: Set configuration for any loaded handlers. See the handler's
|
21
|
+
## documentation for options.
|
22
|
+
# config.handlers.some_handler.some_config_key = "value"
|
23
|
+
end
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,172 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lita-ext
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bryan Traywick
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-04-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: lita
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: dotenv
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: activesupport
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.3'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 3.0.0.beta1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 3.0.0.beta1
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: A collection of extensions to the Lita chat bot.
|
112
|
+
email:
|
113
|
+
- bryan@railsmachine.com
|
114
|
+
executables:
|
115
|
+
- lita-ext
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- .gitignore
|
120
|
+
- .rubocop.yml
|
121
|
+
- Gemfile
|
122
|
+
- LICENSE.txt
|
123
|
+
- README.md
|
124
|
+
- Rakefile
|
125
|
+
- bin/lita-ext
|
126
|
+
- lib/lita/ext.rb
|
127
|
+
- lib/lita/ext/cli.rb
|
128
|
+
- lib/lita/ext/core.rb
|
129
|
+
- lib/lita/ext/handler.rb
|
130
|
+
- lib/lita/ext/version.rb
|
131
|
+
- lita-ext.gemspec
|
132
|
+
- rubocop-todo.yml
|
133
|
+
- spec/lita/ext/handler_spec.rb
|
134
|
+
- spec/lita/ext_spec.rb
|
135
|
+
- spec/spec_helper.rb
|
136
|
+
- templates/handler.tt
|
137
|
+
- templates/robot/Gemfile
|
138
|
+
- templates/robot/app/handlers/.keep
|
139
|
+
- templates/robot/config/environments/development.rb
|
140
|
+
- templates/robot/config/environments/production.rb
|
141
|
+
- templates/robot/config/initializers/.keep
|
142
|
+
- templates/robot/lib/.keep
|
143
|
+
- templates/robot/lita_config.rb
|
144
|
+
- templates/robot/log/.keep
|
145
|
+
homepage: ''
|
146
|
+
licenses:
|
147
|
+
- MIT
|
148
|
+
metadata: {}
|
149
|
+
post_install_message:
|
150
|
+
rdoc_options: []
|
151
|
+
require_paths:
|
152
|
+
- lib
|
153
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
|
+
requirements:
|
160
|
+
- - '>='
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: '0'
|
163
|
+
requirements: []
|
164
|
+
rubyforge_project:
|
165
|
+
rubygems_version: 2.0.0
|
166
|
+
signing_key:
|
167
|
+
specification_version: 4
|
168
|
+
summary: A collection of extensions to the Lita chat bot.
|
169
|
+
test_files:
|
170
|
+
- spec/lita/ext/handler_spec.rb
|
171
|
+
- spec/lita/ext_spec.rb
|
172
|
+
- spec/spec_helper.rb
|