speedflow-plugin-flowdock 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 +7 -0
- data/LICENSE +21 -0
- data/README.md +69 -0
- data/bin/console +10 -0
- data/bin/setup +8 -0
- data/lib/speedflow-plugin-flowdock.rb +1 -0
- data/lib/speedflow/plugin/flowdock.rb +43 -0
- data/lib/speedflow/plugin/flowdock/client.rb +71 -0
- data/lib/speedflow/plugin/flowdock/configuration.rb +79 -0
- data/lib/speedflow/plugin/flowdock/plugin_core.rb +69 -0
- data/lib/speedflow/plugin/flowdock/prompt.rb +42 -0
- data/lib/speedflow/plugin/flowdock/version.rb +7 -0
- data/spec/spec_helper.rb +13 -0
- data/spec/speedflow/plugin/flowdock/client_spec.rb +29 -0
- data/spec/speedflow/plugin/flowdock/configuration_spec.rb +48 -0
- data/spec/speedflow/plugin/flowdock/plugin_core_spec.rb +40 -0
- data/spec/speedflow/plugin/flowdock/prompt_spec.rb +28 -0
- data/spec/speedflow/plugin/flowdock_spec.rb +20 -0
- metadata +215 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 39bdbe34027ab936045d11ffea07f2b6c5550368
|
4
|
+
data.tar.gz: c697352bd8ba804ded0ad63901a7ab6f98d575f0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c20ac32d8e009eded9655d4e4d60a33c37bf41f289806f431d245a4ad2cfc56e251a5cde7d3f39fa72aeceb6eea45e964b3874c72d836bce6f6a8f9a396076f2
|
7
|
+
data.tar.gz: a387e5014edc3c39c46547362f45fbf6f5e71bdd71aedf1f3889b0b9557bf97d58cbc7f400c1aa74febaf5c419c30e1de0384b0cd3b367376509b92634d553e2
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Julien Breux
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# Speedflow plugin Flowdock
|
2
|
+
|
3
|
+
[](https://travis-ci.org/speedflow/speedflow-plugin-flowdock)
|
4
|
+
[](https://badge.fury.io/rb/speedflow-plugin-flowdock)
|
5
|
+
[](https://codeclimate.com/github/speedflow/speedflow-plugin-flowdock)
|
6
|
+
[](https://codeclimate.com/github/speedflow/speedflow-plugin-flowdock/coverage)
|
7
|
+
[](http://inch-ci.org/github/speedflow/speedflow-plugin-flowdock)
|
8
|
+
|
9
|
+
:package: A Speedflow plugin to work with Flowdock.
|
10
|
+
|
11
|
+
## How to install?
|
12
|
+
|
13
|
+
`gem install speedflow-plugin-flowdock`
|
14
|
+
|
15
|
+
## How to configure?
|
16
|
+
|
17
|
+
`.speedflow.yml` :
|
18
|
+
```yml
|
19
|
+
---
|
20
|
+
plugins:
|
21
|
+
- flowdock
|
22
|
+
|
23
|
+
# ...
|
24
|
+
|
25
|
+
flowdock:
|
26
|
+
token: "{FLOWDOCK_TOKEN}"
|
27
|
+
flow: "{FLOWDOCK_FLOW_ID}"
|
28
|
+
```
|
29
|
+
|
30
|
+
`~/.zshrc` or `~/.bashrc` :
|
31
|
+
```sh
|
32
|
+
# Flowdock
|
33
|
+
export FLOWDOCK_TOKEN="..."
|
34
|
+
export FLOWDOCK_FLOW_ID="..."
|
35
|
+
```
|
36
|
+
|
37
|
+
### How to use in my flow?
|
38
|
+
|
39
|
+
`.speedflow.yml` :
|
40
|
+
```yml
|
41
|
+
#...
|
42
|
+
|
43
|
+
flow:
|
44
|
+
test:
|
45
|
+
- plugin: flowdock
|
46
|
+
action: notify
|
47
|
+
arguments:
|
48
|
+
message:
|
49
|
+
default: "Test"
|
50
|
+
```
|
51
|
+
|
52
|
+
or
|
53
|
+
|
54
|
+
`.speedflow.yml` :
|
55
|
+
```yml
|
56
|
+
#...
|
57
|
+
|
58
|
+
flow:
|
59
|
+
test:
|
60
|
+
- plugin: flowdock
|
61
|
+
action: notify
|
62
|
+
arguments:
|
63
|
+
message:
|
64
|
+
default: "Test"
|
65
|
+
flow:
|
66
|
+
default: "{FLOWDOCK_FLOW_ID}"
|
67
|
+
tags:
|
68
|
+
default: "other,flow"
|
69
|
+
```
|
data/bin/console
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'speedflow/plugin/flowdock'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
require 'pry'
|
10
|
+
Pry.start
|
data/bin/setup
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'speedflow/plugin/flowdock'
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'speedflow/plugin/flowdock/version'
|
2
|
+
require 'speedflow/plugin/flowdock/plugin_core'
|
3
|
+
require 'speedflow/plugin/flowdock/prompt'
|
4
|
+
require 'speedflow/plugin/flowdock/configuration'
|
5
|
+
require 'speedflow/plugin/flowdock/client'
|
6
|
+
|
7
|
+
# Speedflow GEM, help you to boost your flow and keep your time.
|
8
|
+
module Speedflow
|
9
|
+
module Plugin
|
10
|
+
# Flowdock Speedflow plugin.
|
11
|
+
module Flowdock
|
12
|
+
# TODO: Move this system in the core Utils
|
13
|
+
class << self
|
14
|
+
ACTIONS = [
|
15
|
+
:action_notify
|
16
|
+
].freeze
|
17
|
+
|
18
|
+
# @return [Speedflow::Plugin::Flowdock.PluginCore] Plugin.
|
19
|
+
attr_writer :plugin
|
20
|
+
|
21
|
+
# Public: Magic method to route to action
|
22
|
+
#
|
23
|
+
# args - Some arguments :)
|
24
|
+
#
|
25
|
+
# Returns nothing.
|
26
|
+
def method_missing(*args)
|
27
|
+
action = args.first
|
28
|
+
|
29
|
+
raise NoMethodError, action unless ACTIONS.include? action
|
30
|
+
|
31
|
+
plugin.new(args.last).send(action)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Public: Plugin.
|
35
|
+
#
|
36
|
+
# Returns Speedflow::Plugin::Flowdock.PluginCore instance.
|
37
|
+
def plugin
|
38
|
+
@plugin ||= PluginCore
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'flowdock'
|
2
|
+
|
3
|
+
module Speedflow
|
4
|
+
module Plugin
|
5
|
+
module Flowdock
|
6
|
+
# Flowdock client
|
7
|
+
class Client
|
8
|
+
# @return [Prompt] Prompt.
|
9
|
+
attr_writer :prompt
|
10
|
+
|
11
|
+
# @return [Flowdock::Client] Flowdock client.
|
12
|
+
attr_writer :flowdock_client
|
13
|
+
|
14
|
+
# Initialize.
|
15
|
+
#
|
16
|
+
# config - Speedflow::Plugin::Flowdock::Configuration instance.
|
17
|
+
# prompt - Speedflow::Plugin::Flowdock::Prompt instance.
|
18
|
+
#
|
19
|
+
# Examples
|
20
|
+
#
|
21
|
+
# Client.new({}, Speedflow::Plugin::Flowdock::Prompt.new)
|
22
|
+
# # => <Speedflow::Plugin::Flowdock::Client>
|
23
|
+
#
|
24
|
+
# Returns nothing.
|
25
|
+
def initialize(config, prompt)
|
26
|
+
@config = config
|
27
|
+
@prompt = prompt
|
28
|
+
end
|
29
|
+
|
30
|
+
# Public: Notify.
|
31
|
+
#
|
32
|
+
# flow_id - Flow ID.
|
33
|
+
# message - String of message.
|
34
|
+
# tags - Array of tags / Just add "Speedflow" tags 8-).
|
35
|
+
#
|
36
|
+
# Returns nothing.
|
37
|
+
def notify(flow_id, message, tags)
|
38
|
+
safe do
|
39
|
+
tags = ['Speedflow'].concat(tags)
|
40
|
+
flowdock_client.chat_message(
|
41
|
+
flow: flow_id, content: message, tags: tags)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Public: Safe process Flowdock action.
|
46
|
+
#
|
47
|
+
# Returns nothing.
|
48
|
+
def safe
|
49
|
+
yield
|
50
|
+
rescue ::Flowdock::ApiError => exception
|
51
|
+
prompt.errors exception
|
52
|
+
abort
|
53
|
+
end
|
54
|
+
|
55
|
+
# Public: Flowdock client.
|
56
|
+
#
|
57
|
+
# Returns ::Flowdock::Client instance.
|
58
|
+
def flowdock_client
|
59
|
+
@flowdock_client ||= ::Flowdock::Client.new(@config.auth)
|
60
|
+
end
|
61
|
+
|
62
|
+
# Public: Prompt.
|
63
|
+
#
|
64
|
+
# Returns ::Speedflow::Plugin::Flowdock::Prompt instance.
|
65
|
+
def prompt
|
66
|
+
@prompt ||= ::Speedflow::Plugin::Flowdock::Prompt.new
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
module Speedflow
|
2
|
+
module Plugin
|
3
|
+
module Flowdock
|
4
|
+
# Flowdock Configuration
|
5
|
+
class Configuration
|
6
|
+
CONFIG_KEY = '_config'.freeze
|
7
|
+
PLUGIN_KEY = 'flowdock'.freeze
|
8
|
+
|
9
|
+
# Initialize.
|
10
|
+
#
|
11
|
+
# arguments - Hash of arguments.
|
12
|
+
#
|
13
|
+
# Examples
|
14
|
+
#
|
15
|
+
# Configuration.new({})
|
16
|
+
# # => <Speedflow::Plugin::Flowdock::Configuration>
|
17
|
+
#
|
18
|
+
# Returns nothing.
|
19
|
+
def initialize(arguments)
|
20
|
+
@arguments = arguments
|
21
|
+
end
|
22
|
+
|
23
|
+
# Public: Auth configuration.
|
24
|
+
#
|
25
|
+
# Returns Hash of auth configuration.
|
26
|
+
def auth
|
27
|
+
{
|
28
|
+
api_token: by_config('token')
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Public: Get a specific config.
|
33
|
+
#
|
34
|
+
# key - Key of config.
|
35
|
+
# default_value - Default value.
|
36
|
+
#
|
37
|
+
# Returns value of config key.
|
38
|
+
def by_config(key, default_value = '')
|
39
|
+
if @arguments.key?(CONFIG_KEY) &&
|
40
|
+
@arguments[CONFIG_KEY].key?(PLUGIN_KEY)
|
41
|
+
config = @arguments[CONFIG_KEY][PLUGIN_KEY]
|
42
|
+
end
|
43
|
+
config.key?(key) ? config[key] : default_value
|
44
|
+
end
|
45
|
+
|
46
|
+
# Public: Get an input config by key.
|
47
|
+
#
|
48
|
+
# key - Key of config.
|
49
|
+
# default_value - Default value.
|
50
|
+
#
|
51
|
+
# Returns value of input config key.
|
52
|
+
def by_input(key, default_value = '')
|
53
|
+
if @arguments.key?(key)
|
54
|
+
@arguments[key]['value']
|
55
|
+
else
|
56
|
+
default_value
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# Public: Get an input config by key but required.
|
61
|
+
#
|
62
|
+
# key - Key of config.
|
63
|
+
# default_value - Default value.
|
64
|
+
#
|
65
|
+
# Returns value of input config key or Exception.
|
66
|
+
def by_required_input(key, default_value = '')
|
67
|
+
value = by_input(key, default_value)
|
68
|
+
|
69
|
+
# TODO: Improve communication with core for errors
|
70
|
+
if by_input(key).empty?
|
71
|
+
raise Exception, "Required value for '#{key}'."
|
72
|
+
end
|
73
|
+
|
74
|
+
value
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'tty-prompt'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module Speedflow
|
5
|
+
module Plugin
|
6
|
+
module Flowdock
|
7
|
+
# Plugin core
|
8
|
+
class PluginCore
|
9
|
+
# @return [Prompt] Plugin prompt.
|
10
|
+
attr_writer :prompt
|
11
|
+
|
12
|
+
# @return [Client] Plugin client.
|
13
|
+
attr_writer :client
|
14
|
+
|
15
|
+
# @return [Config] Plugin config.
|
16
|
+
attr_writer :config
|
17
|
+
|
18
|
+
# Initialize.
|
19
|
+
#
|
20
|
+
# arguments - Hash of arguments.
|
21
|
+
#
|
22
|
+
# Examples
|
23
|
+
#
|
24
|
+
# Plugin.new({})
|
25
|
+
# # => <Speedflow::Plugin::Flowdock::PluginCore>
|
26
|
+
#
|
27
|
+
# Returns nothing.
|
28
|
+
def initialize(arguments)
|
29
|
+
@arguments = arguments
|
30
|
+
end
|
31
|
+
|
32
|
+
# Public: Notify.
|
33
|
+
#
|
34
|
+
# Returns nothing.
|
35
|
+
def action_notify
|
36
|
+
flow_id_or_token = config.by_input('flow', config.by_config('flow'))
|
37
|
+
|
38
|
+
message = config.by_input('message')
|
39
|
+
tags = config.by_input('tags').split(',')
|
40
|
+
|
41
|
+
client.notify(flow_id_or_token, message, tags)
|
42
|
+
|
43
|
+
prompt.ok '[FLOWDOCK] Flow was notified'
|
44
|
+
end
|
45
|
+
|
46
|
+
# Public: Plugin configuration.
|
47
|
+
#
|
48
|
+
# Returns Configuration instance.
|
49
|
+
def config
|
50
|
+
@config ||= Configuration.new(@arguments)
|
51
|
+
end
|
52
|
+
|
53
|
+
# Public: Plugin client.
|
54
|
+
#
|
55
|
+
# Returns Client instance.
|
56
|
+
def client
|
57
|
+
@client ||= Client.new(@config, @prompt)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Public: Plugin prompt.
|
61
|
+
#
|
62
|
+
# Returns Prompt instance.
|
63
|
+
def prompt
|
64
|
+
@prompt ||= Prompt.new
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'tty-prompt'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module Speedflow
|
5
|
+
module Plugin
|
6
|
+
module Flowdock
|
7
|
+
# Plugin prompt
|
8
|
+
class Prompt # < TTY::Prompt
|
9
|
+
# @return [TTY::Prompt] TTY::Prompt.
|
10
|
+
attr_writer :prompt
|
11
|
+
|
12
|
+
# Public: Errors from Flowdock exception.
|
13
|
+
#
|
14
|
+
# exception - Flowdock::ApiError.
|
15
|
+
#
|
16
|
+
# Returns nothing.
|
17
|
+
def errors(exception)
|
18
|
+
prompt.error 'Flowdock errors'
|
19
|
+
prompt.warn exception.message
|
20
|
+
end
|
21
|
+
|
22
|
+
# Delegate.
|
23
|
+
#
|
24
|
+
# method - Method.
|
25
|
+
# args - Arguments.
|
26
|
+
# block - Block.
|
27
|
+
#
|
28
|
+
# Returns wathever.
|
29
|
+
def method_missing(method, *args, &block)
|
30
|
+
prompt.send(method, *args, &block)
|
31
|
+
end
|
32
|
+
|
33
|
+
# Public: TTY prompt.
|
34
|
+
#
|
35
|
+
# Returns ::TTY::Prompt instance.
|
36
|
+
def prompt
|
37
|
+
@prompt ||= ::TTY::Prompt.new
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
|
+
|
3
|
+
require 'simplecov'
|
4
|
+
require 'codeclimate-test-reporter'
|
5
|
+
|
6
|
+
CodeClimate::TestReporter.start if ENV['CODECLIMATE_REPO_TOKEN']
|
7
|
+
|
8
|
+
SimpleCov.start do
|
9
|
+
formatter SimpleCov::Formatter::MultiFormatter.new(
|
10
|
+
[SimpleCov::Formatter::HTMLFormatter, CodeClimate::TestReporter::Formatter])
|
11
|
+
end
|
12
|
+
|
13
|
+
require 'speedflow/plugin/flowdock'
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Speedflow::Plugin::Flowdock::Client do
|
4
|
+
let(:client) do
|
5
|
+
client = ::Speedflow::Plugin::Flowdock::Client.new(double, double)
|
6
|
+
client.flowdock_client = double
|
7
|
+
client
|
8
|
+
end
|
9
|
+
|
10
|
+
it '.notify' do
|
11
|
+
allow(client.flowdock_client).to receive(:chat_message)
|
12
|
+
|
13
|
+
client.notify('XXX', 'Hello', %w(foo bar baz))
|
14
|
+
end
|
15
|
+
|
16
|
+
it '.safe' do
|
17
|
+
allow(client.prompt)
|
18
|
+
.to receive(:error)
|
19
|
+
.with('Flowdock errors')
|
20
|
+
allow(client.prompt)
|
21
|
+
.to receive(:errors)
|
22
|
+
e = expect do
|
23
|
+
client.safe do
|
24
|
+
raise ::Flowdock::ApiError.new('Error'), '...'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
e.to raise_error(SystemExit)
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Speedflow::Plugin::Flowdock::Configuration do
|
4
|
+
let(:config) do
|
5
|
+
message = { 'value' => 'hello' }
|
6
|
+
tags = { 'value' => 'foo,bar,baz' }
|
7
|
+
jira_config = { 'token' => 'foo', 'flow' => 'bar' }
|
8
|
+
config = { 'flowdock' => jira_config }
|
9
|
+
args = { 'tags' => tags, 'message' => message, '_config' => config }
|
10
|
+
Speedflow::Plugin::Flowdock::Configuration.new(args)
|
11
|
+
end
|
12
|
+
|
13
|
+
it '.by_config' do
|
14
|
+
expect(config.by_config('token', 'default'))
|
15
|
+
.to eq 'foo'
|
16
|
+
end
|
17
|
+
|
18
|
+
it '.by_input' do
|
19
|
+
expect(config.by_input('message', 'default'))
|
20
|
+
.to eq 'hello'
|
21
|
+
|
22
|
+
expect(config.by_input('tags'))
|
23
|
+
.to eq 'foo,bar,baz'
|
24
|
+
|
25
|
+
expect(config.by_input('nomessage', 'default'))
|
26
|
+
.to eq 'default'
|
27
|
+
end
|
28
|
+
|
29
|
+
it '.by_required_input' do
|
30
|
+
expect(config.by_required_input('message', 'default'))
|
31
|
+
.to eq 'hello'
|
32
|
+
|
33
|
+
expect { config.by_required_input('nomessage') }
|
34
|
+
.to raise_error(Exception)
|
35
|
+
|
36
|
+
expect { config.by_required_input('nonomessage', 'default') }
|
37
|
+
.to raise_error(Exception)
|
38
|
+
end
|
39
|
+
|
40
|
+
it '.auth' do
|
41
|
+
returned_hash = {
|
42
|
+
api_token: 'foo'
|
43
|
+
}
|
44
|
+
|
45
|
+
expect(config.auth)
|
46
|
+
.to eq returned_hash
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Speedflow::Plugin::Flowdock::PluginCore do
|
4
|
+
let(:plugin) do
|
5
|
+
plugin = ::Speedflow::Plugin::Flowdock::PluginCore.new({})
|
6
|
+
plugin.config = double
|
7
|
+
plugin.prompt = double
|
8
|
+
plugin.client = double
|
9
|
+
plugin
|
10
|
+
end
|
11
|
+
|
12
|
+
it '.action_create_issue' do
|
13
|
+
allow(plugin.config)
|
14
|
+
.to receive(:by_config)
|
15
|
+
.with('flow')
|
16
|
+
.and_return('XXX')
|
17
|
+
allow(plugin.config)
|
18
|
+
.to receive(:by_input)
|
19
|
+
.with('flow', 'XXX')
|
20
|
+
.and_return('XXX')
|
21
|
+
allow(plugin.config)
|
22
|
+
.to receive(:by_input)
|
23
|
+
.with('message')
|
24
|
+
.and_return('Hello')
|
25
|
+
allow(plugin.config)
|
26
|
+
.to receive(:by_input)
|
27
|
+
.with('tags')
|
28
|
+
.and_return('foo,bar,baz')
|
29
|
+
|
30
|
+
allow(plugin.prompt)
|
31
|
+
.to receive(:ok)
|
32
|
+
.with('[FLOWDOCK] Flow was notified')
|
33
|
+
|
34
|
+
allow(plugin.client)
|
35
|
+
.to receive(:notify)
|
36
|
+
.with('XXX', 'Hello', %w(foo bar baz))
|
37
|
+
|
38
|
+
plugin.action_notify
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Speedflow::Plugin::Flowdock::Prompt do
|
4
|
+
let(:prompt) do
|
5
|
+
prompt = ::Speedflow::Plugin::Flowdock::Prompt.new
|
6
|
+
prompt.prompt = double
|
7
|
+
prompt
|
8
|
+
end
|
9
|
+
let(:exception) do
|
10
|
+
double(message: "Error\n")
|
11
|
+
end
|
12
|
+
|
13
|
+
it '.ok' do
|
14
|
+
allow(prompt.prompt)
|
15
|
+
.to receive(:ok).with('Test')
|
16
|
+
|
17
|
+
expect(prompt.ok('Test'))
|
18
|
+
end
|
19
|
+
|
20
|
+
it '.errors' do
|
21
|
+
allow(prompt.prompt)
|
22
|
+
.to receive(:error).with('Flowdock errors')
|
23
|
+
allow(prompt.prompt)
|
24
|
+
.to receive(:warn).with("Error\n")
|
25
|
+
|
26
|
+
expect(prompt.errors(exception))
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Speedflow::Plugin::Flowdock do
|
4
|
+
let(:plugin) do
|
5
|
+
double(new: double(action_notify: nil))
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'has a version number' do
|
9
|
+
expect(Speedflow::Plugin::Flowdock::VERSION).not_to be nil
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'has an action catcher' do
|
13
|
+
expect { Speedflow::Plugin::Flowdock.action_lol }
|
14
|
+
.to raise_error(NoMethodError)
|
15
|
+
|
16
|
+
Speedflow::Plugin::Flowdock.plugin = plugin
|
17
|
+
|
18
|
+
expect(Speedflow::Plugin::Flowdock.action_notify).to eq nil
|
19
|
+
end
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,215 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: speedflow-plugin-flowdock
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Julien Breux
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-04-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: flowdock
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.7.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.7.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: tty-prompt
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.5.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.5.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.11'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.11'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '11.1'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '11.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.4'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.4'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: fuubar
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: guard-rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '4.6'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '4.6'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: guard-rubocop
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.2'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.2'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: pry
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.10'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0.10'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: codeclimate-test-reporter
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.5'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.5'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: simplecov
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0.11'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0.11'
|
167
|
+
description: A Speedflow plugin to work with Flowdock.
|
168
|
+
email:
|
169
|
+
- julien.breux@gmail.com
|
170
|
+
executables: []
|
171
|
+
extensions: []
|
172
|
+
extra_rdoc_files: []
|
173
|
+
files:
|
174
|
+
- LICENSE
|
175
|
+
- README.md
|
176
|
+
- bin/console
|
177
|
+
- bin/setup
|
178
|
+
- lib/speedflow-plugin-flowdock.rb
|
179
|
+
- lib/speedflow/plugin/flowdock.rb
|
180
|
+
- lib/speedflow/plugin/flowdock/client.rb
|
181
|
+
- lib/speedflow/plugin/flowdock/configuration.rb
|
182
|
+
- lib/speedflow/plugin/flowdock/plugin_core.rb
|
183
|
+
- lib/speedflow/plugin/flowdock/prompt.rb
|
184
|
+
- lib/speedflow/plugin/flowdock/version.rb
|
185
|
+
- spec/spec_helper.rb
|
186
|
+
- spec/speedflow/plugin/flowdock/client_spec.rb
|
187
|
+
- spec/speedflow/plugin/flowdock/configuration_spec.rb
|
188
|
+
- spec/speedflow/plugin/flowdock/plugin_core_spec.rb
|
189
|
+
- spec/speedflow/plugin/flowdock/prompt_spec.rb
|
190
|
+
- spec/speedflow/plugin/flowdock_spec.rb
|
191
|
+
homepage: https://github.com/speedflow/speedflow-plugin-flowdock
|
192
|
+
licenses:
|
193
|
+
- MIT
|
194
|
+
metadata: {}
|
195
|
+
post_install_message:
|
196
|
+
rdoc_options: []
|
197
|
+
require_paths:
|
198
|
+
- lib
|
199
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
200
|
+
requirements:
|
201
|
+
- - ">="
|
202
|
+
- !ruby/object:Gem::Version
|
203
|
+
version: '2.3'
|
204
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
209
|
+
requirements: []
|
210
|
+
rubyforge_project:
|
211
|
+
rubygems_version: 2.5.2
|
212
|
+
signing_key:
|
213
|
+
specification_version: 4
|
214
|
+
summary: A Speedflow plugin to work with Flowdock.
|
215
|
+
test_files: []
|