lita-heroku 0.1.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: 4218ad5753b957c47652d32c0bc2e2235ff0441e
4
+ data.tar.gz: ccd62ca025294d1d74a2e8f1790d8f00ece39d78
5
+ SHA512:
6
+ metadata.gz: 36994c78fc15b76e93bbfb4d48865c23b1937252e54e7c2a738148fbd0cf8e0944a8a0067b934c0f6f372d50f8200d801dd4243ef31e647dcf4687a7f769f0ad
7
+ data.tar.gz: 395099d08d16cc968e252458977968c681588d797fc19f0e082c9ab7e573523eb868edc5dff53cec1a8deee88a6853b389dc7c7acb2632e245d631a6a878d75f
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
+ vendor/bundle
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # lita-heroku
2
+
3
+ TODO: Add a description of the plugin.
4
+
5
+ ## Installation
6
+
7
+ Add lita-heroku to your Lita instance's Gemfile:
8
+
9
+ ``` ruby
10
+ gem "lita-heroku"
11
+ ```
12
+
13
+ ## Configuration
14
+
15
+ TODO: Describe any configuration attributes the plugin exposes.
16
+
17
+ ## Usage
18
+
19
+ TODO: Describe the plugin's features and how to use them.
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,54 @@
1
+ require "json"
2
+ module Lita
3
+ module Handlers
4
+ class Heroku < Handler
5
+ config :bearer, required: true
6
+ config :application_id, required: true
7
+
8
+ route(/^hk\s+([^ ]+)\s+(.+)/, :heroku_cmd, command: true, help: {
9
+ "heroku deploy [environment]" => "example: 'lita heroku deploy production'"
10
+ })
11
+
12
+ def heroku_cmd(response)
13
+ environment = response.matches[0][0]
14
+ command = response.matches[0][1]
15
+ if command == "deploy"
16
+ heroku_deploy response
17
+ else
18
+ response.reply `#{heroku_bin} #{command} -a hats-#{environment}`
19
+ end
20
+ end
21
+
22
+ def heroku_bin
23
+ @heroku_bin ||= if `type heroku 2>&1 | grep -v "not found"`.empty?
24
+ if `ls /usr/local/heroku/bin/heroku 2> /dev/null`.empty?
25
+ raise "Couldn't find heroku binary; please install the Heroku Toolbelt"
26
+ else
27
+ "/usr/local/heroku/bin/heroku"
28
+ end
29
+ else
30
+ "heroku"
31
+ end
32
+ end
33
+
34
+ route(/^hk deploy\s+(.+)/, :heroku_deploy, command: true, help: {
35
+ "heroku deploy [environment]" => "example: 'lita heroku deploy production'"
36
+ })
37
+
38
+ def heroku_deploy(response)
39
+ app_id = config.application_id
40
+ bearer = config.bearer
41
+ branch = "master"
42
+
43
+ build_response = `curl -s "https://kolkrabbi.herokuapp.com/apps/#{app_id}/github/push" -H "Authorization: Bearer #{bearer}" -d '{"branch":"#{branch}"}'`
44
+ build_response = JSON.parse build_response
45
+
46
+ if build_response.key?("build") && build_response["build"]["status"] == "pending"
47
+ response.reply("Started deploy")
48
+ end
49
+ end
50
+
51
+ Lita.register_handler(self)
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,12 @@
1
+ require "lita"
2
+
3
+ Lita.load_locales Dir[File.expand_path(
4
+ File.join("..", "..", "locales", "*.yml"), __FILE__
5
+ )]
6
+
7
+ require "lita/handlers/heroku"
8
+
9
+ Lita::Handlers::Heroku.template_root File.expand_path(
10
+ File.join("..", "..", "templates"),
11
+ __FILE__
12
+ )
@@ -0,0 +1,24 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = "lita-heroku"
3
+ spec.version = "0.1.1"
4
+ spec.authors = ["Eric Boehs"]
5
+ spec.email = ["ericboehs@gmail.com"]
6
+ spec.description = "Lita handler for interacting with Heroku Apps"
7
+ spec.summary = "Lita handler for interacting with Heroku Apps"
8
+ spec.homepage = "https://github.com/ericboehs/lita-heroku"
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.7"
18
+
19
+ spec.add_development_dependency "bundler", "~> 1.3"
20
+ spec.add_development_dependency "pry-byebug"
21
+ spec.add_development_dependency "rake"
22
+ spec.add_development_dependency "rack-test"
23
+ spec.add_development_dependency "rspec", ">= 3.0.0"
24
+ end
data/locales/en.yml ADDED
@@ -0,0 +1,4 @@
1
+ en:
2
+ lita:
3
+ handlers:
4
+ heroku:
@@ -0,0 +1,4 @@
1
+ require "spec_helper"
2
+
3
+ describe Lita::Handlers::Heroku, lita_handler: true do
4
+ end
@@ -0,0 +1,6 @@
1
+ require "lita-heroku"
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,142 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lita-heroku
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Eric Boehs
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-03-04 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.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '4.7'
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.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry-byebug
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
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rack-test
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
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
97
+ description: Lita handler for interacting with Heroku Apps
98
+ email:
99
+ - ericboehs@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - Gemfile
106
+ - README.md
107
+ - Rakefile
108
+ - lib/lita-heroku.rb
109
+ - lib/lita/handlers/heroku.rb
110
+ - lita-heroku.gemspec
111
+ - locales/en.yml
112
+ - spec/lita/handlers/heroku_spec.rb
113
+ - spec/spec_helper.rb
114
+ - templates/.gitkeep
115
+ homepage: https://github.com/ericboehs/lita-heroku
116
+ licenses:
117
+ - MIT
118
+ metadata:
119
+ lita_plugin_type: handler
120
+ post_install_message:
121
+ rdoc_options: []
122
+ require_paths:
123
+ - lib
124
+ required_ruby_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ requirements: []
135
+ rubyforge_project:
136
+ rubygems_version: 2.5.1
137
+ signing_key:
138
+ specification_version: 4
139
+ summary: Lita handler for interacting with Heroku Apps
140
+ test_files:
141
+ - spec/lita/handlers/heroku_spec.rb
142
+ - spec/spec_helper.rb