lita-heroku 0.1.3 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7ea1479c89addbafb3f848555eecd0ccae6f164d
4
- data.tar.gz: b5211f61d5bbae6b64a9b3a38560726b6f9154ca
3
+ metadata.gz: 20b7b82c2a0f0f61ff20c86159ddd6d9d5aa757c
4
+ data.tar.gz: dd987cf29419a539fb30c6a79f5ed627bbf94632
5
5
  SHA512:
6
- metadata.gz: 3a145aac191080e00fc5fbd605c8999fd70143564140bb45305971fde186b2c71625a79153189eb187847d0fcf5c1cdab34686996d168a4809381ea477778914
7
- data.tar.gz: 73a357c27064d3cf5e72fc9fc1e18f3a5639858ef0e592af4f907552418d8e8d6a733d7ac182497dd98ca8283f2474417391ac936e3d40e8cb341bee8ff39cce
6
+ metadata.gz: 3d58fe9d81163e010cacdee0baacdd589b04151f9c7add78f4939ab6d492c983b9c8172c6bb4867d2a7830de6548885eff8748c2defa552bfa067b30eff6cf1f
7
+ data.tar.gz: e8dfc016f34e3b1ac49bf2270acf998a740f100af899b520d97b87fbe844946945c133ff4ff568f469d53c2bb4033fb9672248ce1dc491d4303fb6ee1f53ce2d
@@ -1,4 +1,5 @@
1
1
  require "json"
2
+ require "open3"
2
3
  module Lita
3
4
  module Handlers
4
5
  class Heroku < Handler
@@ -15,7 +16,13 @@ module Lita
15
16
  if command == "deploy"
16
17
  heroku_deploy response
17
18
  else
18
- response.reply `#{heroku_bin} #{command} -a #{config.app_prefix}#{environment}`
19
+ stdout, stderr, status = Open3.capture3 "#{heroku_bin} #{command} -a #{config.app_prefix}#{environment}"
20
+ response_text = "```\n"
21
+ response_text += stdout
22
+ response_text += stderr
23
+ response_text += "Exited with status #{status.exitstatus}" unless status.exitstatus.zero?
24
+ response_text += "```"
25
+ response.reply response_text
19
26
  end
20
27
  end
21
28
 
@@ -37,8 +44,9 @@ module Lita
37
44
 
38
45
  def heroku_deploy(response)
39
46
  bearer = config.oauth_token
40
- app_name = "#{config.app_prefix}#{response.matches[0][0]}"
41
- branch = response.matches[0][1] || "master"
47
+ app_name, branch = response.matches[0][0].split
48
+ app_name = "#{config.app_prefix}#{app_name}" unless app_name.start_with? config.app_prefix
49
+ branch ||= "master"
42
50
 
43
51
  apps = JSON.parse `curl -s "https://api.heroku.com/apps" -H "Authorization: Bearer #{bearer}" -H 'Accept: application/vnd.heroku+json; version=3'`
44
52
  app = apps.select{|app| app["name"] == app_name }.first
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-heroku"
3
- spec.version = "0.1.3"
3
+ spec.version = "0.1.4"
4
4
  spec.authors = ["Eric Boehs"]
5
5
  spec.email = ["ericboehs@gmail.com"]
6
6
  spec.description = "Lita handler for interacting with Heroku Apps"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-heroku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Boehs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-10 00:00:00.000000000 Z
11
+ date: 2016-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita