lita-ironio 0.1.0.pre.beta

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0107d4e0fa64c640393ce387e9150b683ef752e6
4
+ data.tar.gz: 361e85496cad2bb88572732e8e4134316e2f9859
5
+ SHA512:
6
+ metadata.gz: cd972cc5af6de3ec5971e0ef458a5ca64f82e54d65efc938b0045bcef53d38c9f58fc80c0254d4eaab786995e7a681802eef963a9fa058836a78a1972e2ce0de
7
+ data.tar.gz: e8092773d36b99961367e2838bc37360d4453d06675e4fefffd7172a89e31c5fee3e95d50fd9ce6fe704411d32d4bacc0d719ed7bec1d266fe552939c10b5254
data/.gitignore ADDED
@@ -0,0 +1,18 @@
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
+ *.swp
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # lita-ironio [![Gem Version](https://badge.fury.io/rb/lita-ironio.svg)](http://badge.fury.io/rb/lita-ironio)
2
+
3
+ **lita-ironio** is an handler for [Lita](https://www.lita.io) that gives your bot the power to interact with [Iron.io](https://iron.io)'s [IronWorker](http://www.iron.io/worker), [IronMQ](http://www.iron.io/mq), and [IronCache](http://www.iron.io/cache) solutions.
4
+
5
+ TODO: Add a description of the plugin.
6
+
7
+ ## Installation
8
+
9
+ Add lita-ironio to your Lita instance's Gemfile:
10
+
11
+ ``` ruby
12
+ gem "lita-ironio"
13
+ ```
14
+
15
+ ## Configuration
16
+ ### Required attributes
17
+
18
+
19
+ * `token` (String) – Project specific tokenfrom the hud
20
+ * `project_id` (String) – Identifier of the project
21
+
22
+ ### Example
23
+
24
+ ``` ruby
25
+ Lita.configure do |config|
26
+ config.handlers.ironio.token = ENV["IRONIO_TOKEN"]
27
+ config.handlers.ironio.project_id = ENV["IRONIO_PROJECT_ID"]
28
+ end
29
+ ```
30
+
31
+ ## Usage
32
+
33
+ Commands are called in the with the `iron` prefix what can be optionally with the `ir` abbreviation.
34
+
35
+ ```shell
36
+ iron tasks
37
+ ir schedules
38
+ iron tasks <TASKID>
39
+ ```
40
+
41
+ ### Example
42
+
43
+ `iron schedules` lists all the configured schdules for the project.
44
+
45
+ ## License
46
+
47
+ [MIT](http://opensource.org/licenses/MIT)
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -0,0 +1,85 @@
1
+ require 'iron_worker_ng'
2
+ require 'iron_cache'
3
+ require 'iron_mq'
4
+ require 'lita/utils/factory'
5
+
6
+ module Lita
7
+ module Handlers
8
+ class Ironio < Handler
9
+ config :project_id, required: true
10
+ config :token, required: true
11
+
12
+
13
+ class << self
14
+ attr_accessor :iron
15
+ end
16
+
17
+ def self.config(config)
18
+ self.iron = nil
19
+ end
20
+
21
+ route /^ir(?:on)?\s(tasks|stacks|codes|schedules|queues|caches)$/i, :list, help: {
22
+ "iron tasks" => "list project tasks",
23
+ "iron stacks" => "list available stacks",
24
+ "iron codes" => "list project code packages",
25
+ "iron queues" => "list project queues",
26
+ "iron caches" => "list project caches"
27
+ }
28
+
29
+ route /^ir(?:on)?\s(tasks|stacks|codes|schedules|queues)?\s(.+)$/i, :get, help: {
30
+ "iron tasks [id]" => "list project tasks",
31
+ "iron stacks [id]" => "list available stacks",
32
+ "iron codes [id]" => "list project code packages",
33
+ "iron queues [id]" => "list project queues",
34
+ }
35
+
36
+ def list(msg)
37
+ reply = nil
38
+ response = self.client("#{msg.matches.flatten.first}".to_sym).send("#{msg.matches.flatten.first}_list")
39
+ case response
40
+ when 0, nil, []
41
+ reply = "No #{msg.matches.flatten.first}"
42
+ else
43
+ reply = response
44
+ end
45
+ msg.reply reply
46
+ end
47
+
48
+ def get(msg)
49
+ reply = nil
50
+ begin
51
+ response = self.client("#{msg.matches.flatten.first}".to_sym).send("#{msg.matches.flatten.first}_get", msg.matches.flatten[1])
52
+ rescue
53
+ response = "Welps!"
54
+ end
55
+ case response
56
+ when 0, nil, []
57
+ reply = "No #{msg.matches.flatten.first}"
58
+ else
59
+ reply = response
60
+ end
61
+ msg.reply reply
62
+ end
63
+
64
+ def client(lib)
65
+ plugin = {
66
+ [:stacks, :tasks, :codes] => :worker,
67
+ [:queues] => :mq,
68
+ [:caches] => :cache
69
+ }.select {|k,v| k.include?(lib) }.values
70
+ case plugin.first
71
+ when :worker
72
+ self.class.iron ||= IronWorkerNG::Client.new({token: config.token, project_id: config.project_id})
73
+ when :mq
74
+ self.class.iron ||= IronMQ::Client.new({token: config.token, project_id: config.project_id})
75
+ when :cache
76
+ self.class.iron ||= IronCache::Client.new({token: config.token, project_id: config.project_id})
77
+ else
78
+ self.class.iron ||= IronWorkerNG::Client.new({token: config.token, project_id: config.project_id})
79
+ end
80
+ end
81
+ end
82
+
83
+ Lita.register_handler(Ironio)
84
+ end
85
+ end
@@ -0,0 +1,13 @@
1
+ require "lita"
2
+
3
+ Lita.load_locales Dir[File.expand_path(
4
+ File.join("..", "..", "locales", "*.yml"), __FILE__
5
+ )]
6
+
7
+ require "lita/handlers/ironio"
8
+ require "lita/utils/factory"
9
+
10
+ Lita::Handlers::Ironio.template_root File.expand_path(
11
+ File.join("..", "..", "templates"),
12
+ __FILE__
13
+ )
@@ -0,0 +1,27 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = "lita-ironio"
3
+ spec.version = "0.1.0-beta"
4
+ spec.authors = ["Jurnell Cockhren"]
5
+ spec.email = ["jurnell.cockhren@sophicware.com"]
6
+ spec.description = "IronIO handler for Lita Bot"
7
+ spec.summary = spec.description
8
+ spec.homepage = "https://github.com/sophicware/lita-ironio"
9
+ spec.license = "MIT"
10
+ spec.metadata = { "lita_plugin_type" => "handler" }
11
+
12
+ spec.files = `git ls-files`.split($/)
13
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
14
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
15
+ spec.require_paths = ["lib"]
16
+
17
+ spec.add_runtime_dependency "lita", "~> 4.3"
18
+ spec.add_runtime_dependency "iron_worker_ng", "~> 1.6"
19
+ spec.add_runtime_dependency "iron_cache", "~> 0"
20
+ spec.add_runtime_dependency "iron_mq", "~> 5.0"
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.3"
23
+ spec.add_development_dependency "pry-byebug"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "rack-test"
26
+ spec.add_development_dependency "rspec", ">= 3.0.0"
27
+ end
data/locales/en.yml ADDED
@@ -0,0 +1,4 @@
1
+ en:
2
+ lita:
3
+ handlers:
4
+ ironio:
@@ -0,0 +1,4 @@
1
+ require "spec_helper"
2
+
3
+ describe Lita::Handlers::Ironio, lita_handler: true do
4
+ end
@@ -0,0 +1,6 @@
1
+ require "lita-ironio"
2
+ require "lita/rspec"
3
+
4
+ # A compatibility mode is provided for older plugins upgrading from Lita 3. Since this plugin
5
+ # was generated with Lita 4, the compatibility mode should be left disabled.
6
+ Lita.version_3_compatibility_mode = false
File without changes
metadata ADDED
@@ -0,0 +1,184 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lita-ironio
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0.pre.beta
5
+ platform: ruby
6
+ authors:
7
+ - Jurnell Cockhren
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-06-07 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: '4.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: iron_worker_ng
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.6'
34
+ type: :runtime
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: iron_cache
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: iron_mq
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.3'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.3'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry-byebug
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
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
+ - !ruby/object:Gem::Dependency
112
+ name: rack-test
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: 3.0.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: 3.0.0
139
+ description: IronIO handler for Lita Bot
140
+ email:
141
+ - jurnell.cockhren@sophicware.com
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - ".gitignore"
147
+ - Gemfile
148
+ - README.md
149
+ - Rakefile
150
+ - lib/lita-ironio.rb
151
+ - lib/lita/handlers/ironio.rb
152
+ - lita-ironio.gemspec
153
+ - locales/en.yml
154
+ - spec/lita/handlers/ironio_spec.rb
155
+ - spec/spec_helper.rb
156
+ - templates/.gitkeep
157
+ homepage: https://github.com/sophicware/lita-ironio
158
+ licenses:
159
+ - MIT
160
+ metadata:
161
+ lita_plugin_type: handler
162
+ post_install_message:
163
+ rdoc_options: []
164
+ require_paths:
165
+ - lib
166
+ required_ruby_version: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - ">="
169
+ - !ruby/object:Gem::Version
170
+ version: '0'
171
+ required_rubygems_version: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - ">"
174
+ - !ruby/object:Gem::Version
175
+ version: 1.3.1
176
+ requirements: []
177
+ rubyforge_project:
178
+ rubygems_version: 2.4.5
179
+ signing_key:
180
+ specification_version: 4
181
+ summary: IronIO handler for Lita Bot
182
+ test_files:
183
+ - spec/lita/handlers/ironio_spec.rb
184
+ - spec/spec_helper.rb