lita-ey-info 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4639d6b3167bf30cd457c791627192ca533a749c
4
- data.tar.gz: 246c7d3a24e6c3e3b480f89771661978369d1490
3
+ metadata.gz: dfd31e8529f855dcf86ff1ad0ceb87f4cc32215f
4
+ data.tar.gz: 1bb36bb2d910486f5b9e89d92893a1f3a463905c
5
5
  SHA512:
6
- metadata.gz: a668dcab0220e282515444943d597b0e85eee7bdd38e7ab7f06fd33adbb493d66242c8541db970ff4fc82e4eb1c1cc3462097f684bcc174f3668f6159b6f13d6
7
- data.tar.gz: 4d0fadb379804dd103aaf979afd2cb631baefad254f4a754124e4e773bff3d297bdcd2a5975e500100182b54c17561b7c9acbed02c60f312167cb04eed55d40e
6
+ metadata.gz: 66c6dd9d35a3bd3ea526f61a2a0f46e8a911dbbc681a1ce34c062b15069c6e5f80f8e9d4c498949fbb04dd4691c0b70559e553838834d1ed7d1fbbd0937419f4
7
+ data.tar.gz: 7ece3aa7c005a967695f73fdfbd873d9de81ee13d43dbd39bbbe08ce6fb6e7482d40f79e121a55dbf95b7d5d607daf976e67ebdfe86dab2734c0db1d7e33ffea
data/Gemfile.lock CHANGED
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lita-ey-info (0.0.3)
4
+ lita-ey-info (0.0.4)
5
5
  engineyard
6
6
  lita (>= 3.2.0)
7
+ lita-ey-base
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
@@ -17,16 +18,15 @@ GEM
17
18
  thor
18
19
  diff-lcs (1.2.5)
19
20
  docile (1.1.3)
20
- engineyard (2.3.3)
21
- engineyard-cloud-client (~> 1.0.16)
21
+ engineyard (2.3.1)
22
+ engineyard-cloud-client (~> 1.0.14)
22
23
  engineyard-serverside-adapter (= 2.2.0)
23
24
  escape (~> 0.0.4)
24
25
  highline (~> 1.6.1)
25
26
  launchy (~> 2.1)
26
- net-ssh (~> 2.7)
27
+ net-ssh (~> 2.2)
27
28
  rest-client (~> 1.6.0)
28
- engineyard-cloud-client (1.0.16)
29
- mime-types (~> 1.16)
29
+ engineyard-cloud-client (1.0.15)
30
30
  multi_json (~> 1.6)
31
31
  rest-client (~> 1.6.1)
32
32
  engineyard-serverside-adapter (2.2.0)
@@ -43,7 +43,7 @@ GEM
43
43
  ice_nine (0.11.0)
44
44
  launchy (2.4.2)
45
45
  addressable (~> 2.3)
46
- lita (3.2.0)
46
+ lita (3.3.0)
47
47
  bundler (>= 1.3)
48
48
  faraday (>= 0.8.7)
49
49
  http_router (>= 0.11.1)
@@ -52,33 +52,38 @@ GEM
52
52
  multi_json (>= 1.7.7)
53
53
  puma (>= 2.7.1)
54
54
  rack (>= 1.5.2)
55
+ rb-readline (>= 0.5.1)
55
56
  redis-namespace (>= 1.3.0)
56
57
  thor (>= 0.18.1)
57
- mime-types (1.25.1)
58
- multi_json (1.10.0)
58
+ lita-ey-base (0.0.2)
59
+ engineyard
60
+ lita (>= 3.2.0)
61
+ mime-types (2.3)
62
+ multi_json (1.10.1)
59
63
  multipart-post (2.0.0)
60
64
  net-ssh (2.9.1)
61
65
  puma (2.8.2)
62
66
  rack (>= 1.1, < 2.0)
63
67
  rack (1.5.2)
64
68
  rake (10.3.2)
69
+ rb-readline (0.5.1)
65
70
  redis (3.0.7)
66
71
  redis-namespace (1.4.1)
67
72
  redis (~> 3.0.4)
68
73
  rest-client (1.6.7)
69
74
  mime-types (>= 1.16)
70
- rspec (3.0.0.beta2)
71
- rspec-core (= 3.0.0.beta2)
72
- rspec-expectations (= 3.0.0.beta2)
73
- rspec-mocks (= 3.0.0.beta2)
74
- rspec-core (3.0.0.beta2)
75
- rspec-support (= 3.0.0.beta2)
76
- rspec-expectations (3.0.0.beta2)
75
+ rspec (3.0.0)
76
+ rspec-core (~> 3.0.0)
77
+ rspec-expectations (~> 3.0.0)
78
+ rspec-mocks (~> 3.0.0)
79
+ rspec-core (3.0.2)
80
+ rspec-support (~> 3.0.0)
81
+ rspec-expectations (3.0.2)
77
82
  diff-lcs (>= 1.2.0, < 2.0)
78
- rspec-support (= 3.0.0.beta2)
79
- rspec-mocks (3.0.0.beta2)
80
- rspec-support (= 3.0.0.beta2)
81
- rspec-support (3.0.0.beta2)
83
+ rspec-support (~> 3.0.0)
84
+ rspec-mocks (3.0.2)
85
+ rspec-support (~> 3.0.0)
86
+ rspec-support (3.0.2)
82
87
  simplecov (0.8.2)
83
88
  docile (~> 1.1.0)
84
89
  multi_json
@@ -99,5 +104,5 @@ DEPENDENCIES
99
104
  coveralls
100
105
  lita-ey-info!
101
106
  rake
102
- rspec (>= 3.0.0.beta1)
107
+ rspec (>= 3.0.0)
103
108
  simplecov
data/README.md CHANGED
@@ -18,17 +18,43 @@ Don't forget to include your EngineYard API key on the lita_config.rb file:
18
18
 
19
19
  ``` ruby
20
20
  config.handlers.ey.api_token = "YOUR_EY_API_TOKEN"
21
+ config.handlers.ey.apps = {
22
+ "my_app_name_for_lita" => {
23
+ "ey_name" => "my_app_name_at_ey",
24
+ "envs" => {
25
+ "test" => {
26
+ ey_name: "my_app_testing",
27
+ auth_group: "devs",
28
+ default_branch: "develop"
29
+ },
30
+ "stage" => {
31
+ ey_name: "my_app_staging",
32
+ auth_group: "testers",
33
+ default_branch: "stage"
34
+ },
35
+ "production" => {
36
+ ey_name: "my_app_production",
37
+ auth_group: "devops",
38
+ default_branch: "master"
39
+ }
40
+ }
41
+ }
42
+ }
21
43
  ```
22
44
 
23
45
  ## Usage
24
46
 
25
47
  ```
26
48
  You: @Lita ey envs
27
- You: @Lita ey <app_name> <env_name> servers
28
- You: @Lita ey <app_name> <env_name> logs
29
- You: @Lita ey <app_name> <env_name> status
49
+ You: @Lita ey servers [env_name]
50
+ You: @Lita ey logs [env_name]
51
+ You: @Lita ey status [env_name]
30
52
  ```
31
53
 
54
+ ## See also
55
+
56
+ [lita-ey-deploy](http://github.com/carlosparamio/lita-ey-deploy)
57
+
32
58
  ## License
33
59
 
34
- [MIT](http://opensource.org/licenses/MIT)
60
+ [MIT](http://opensource.org/licenses/MIT)
data/lib/lita-ey-info.rb CHANGED
@@ -1 +1,3 @@
1
+ require "lita"
2
+ require "lita-ey-base"
1
3
  require "lita/handlers/ey_info"
@@ -1,33 +1,23 @@
1
- require "lita"
2
-
3
1
  module Lita
4
2
  module Handlers
5
- class EyInfo < Handler
3
+ class EyInfo < EyBase
6
4
 
7
- route(/ey envs/i, :list_envs, restrict_to: :ey_admins, command: true, help: {
8
- "ey envs" => "Display list of all applications and environments."
5
+ route(/ey (envs|info)/i, :list_envs, restrict_to: :ey_admins, command: true, help: {
6
+ "ey envs / ey info" => "Display list of all applications and environments."
9
7
  })
10
8
 
11
- route(/ey (\w*) servers/i, :list_servers, restrict_to: :ey_admins, command: true, help: {
12
- "ey <env> servers" => "Display list of all servers for an application environment."
9
+ route(/ey servers (\w*) (\w*)/i, :list_servers, command: true, help: {
10
+ "ey servers <app> <env>" => "Display list of all servers for an application environment."
13
11
  })
14
12
 
15
- route(/ey (\w*) logs/i, :show_logs, restrict_to: :ey_admins, command: true, help: {
16
- "ey <env> logs" => "Retrieve the latest logs for an application environment."
13
+ route(/ey logs (\w*) (\w*)/i, :show_logs, command: true, help: {
14
+ "ey logs <app> <env>" => "Retrieve the latest logs for an application environment."
17
15
  })
18
16
 
19
- route(/ey (\w*) (\w*) status/i, :show_status, restrict_to: :ey_admins, command: true, help: {
20
- "ey <app> <env> status" => "Show the deployment status of the application environment."
17
+ route(/ey status (\w*) (\w*)/i, :show_status, command: true, help: {
18
+ "ey status <app> <env>" => "Show the deployment status of the application environment."
21
19
  })
22
20
 
23
- def self.default_config(config)
24
- config.api_token = ""
25
- end
26
-
27
- def self.namespace
28
- "ey"
29
- end
30
-
31
21
  def list_envs(response)
32
22
  response.reply retrieving_msg
33
23
  response.reply_privately `bundle exec ey environments --all --api-token=#{config.api_token}`
@@ -35,37 +25,50 @@ module Lita
35
25
  end
36
26
 
37
27
  def list_servers(response)
38
- env = response.matches[0][0]
39
- response.reply retrieving_msg
40
- response.reply_privately `bundle exec ey servers --environment=#{env} --api-token=#{config.api_token}`
41
- response.reply private_msg unless response.message.source.private_message?
28
+ app = response.matches[0][0]
29
+ env = response.matches[0][1]
30
+
31
+ do_if_can_access(response, app, env) do
32
+ response.reply retrieving_msg
33
+ response.reply_privately `bundle exec ey servers --environment=#{ey_env(app, env)} --api-token=#{config.api_token}`
34
+ response.reply private_msg unless response.message.source.private_message?
35
+ end
42
36
  end
43
37
 
44
38
  def show_logs(response)
45
- env = response.matches[0][0]
46
- response.reply retrieving_msg
47
- response.reply_privately `bundle exec ey logs --environment=#{env} --api-token=#{config.api_token}`
48
- response.reply private_msg unless response.message.source.private_message?
39
+ app = response.matches[0][0]
40
+ env = response.matches[0][1]
41
+
42
+ do_if_can_access(response, app, env) do
43
+ response.reply retrieving_msg
44
+ response.reply_privately `bundle exec ey logs --environment=#{ey_env(app, env)} --api-token=#{config.api_token}`
45
+ response.reply private_msg unless response.message.source.private_message?
46
+ end
49
47
  end
50
48
 
51
49
  def show_status(response)
52
50
  app = response.matches[0][0]
53
51
  env = response.matches[0][1]
54
- response.reply retrieving_msg
55
- response.reply_privately `bundle exec ey status --app=#{app} --environment=#{env} --api-token=#{config.api_token}`
56
- response.reply private_msg unless response.message.source.private_message?
52
+
53
+ do_if_can_access(response, app, env) do
54
+ response.reply retrieving_msg
55
+ response.reply_privately `bundle exec ey status --app=#{ey_app(app)} --environment=#{ey_env(app, env)} --api-token=#{config.api_token}`
56
+ response.reply private_msg unless response.message.source.private_message?
57
+ end
57
58
  end
58
59
 
60
+ private
61
+
59
62
  def retrieving_msg
60
63
  "Retrieving info..."
61
64
  end
62
65
 
63
66
  def private_msg
64
- "I've sent you the servers list privately... shhhh..."
67
+ "I've sent you the info privately... shhhh..."
65
68
  end
66
69
 
67
70
  end
68
71
 
69
72
  Lita.register_handler(EyInfo)
70
73
  end
71
- end
74
+ end
data/lita-ey-info.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-ey-info"
3
- spec.version = "0.0.3"
3
+ spec.version = "0.0.4"
4
4
  spec.authors = ["Carlos Paramio"]
5
5
  spec.email = ["hola@carlosparamio.com"]
6
6
  spec.description = %q{A Lita handler to consult EY info.}
@@ -16,10 +16,11 @@ Gem::Specification.new do |spec|
16
16
  spec.add_runtime_dependency "lita", ">= 3.2.0"
17
17
 
18
18
  spec.add_dependency "engineyard"
19
+ spec.add_dependency "lita-ey-base"
19
20
 
20
21
  spec.add_development_dependency "bundler"
21
22
  spec.add_development_dependency "coveralls"
22
23
  spec.add_development_dependency "rake"
23
- spec.add_development_dependency "rspec", ">= 3.0.0.beta1"
24
+ spec.add_development_dependency "rspec", ">= 3.0.0"
24
25
  spec.add_development_dependency "simplecov"
25
26
  end
@@ -2,7 +2,8 @@ require "spec_helper"
2
2
 
3
3
  describe Lita::Handlers::EyInfo, lita_handler: true do
4
4
  it { routes_command("ey envs").to(:list_envs) }
5
- it { routes_command("ey envname servers").to(:list_servers) }
6
- it { routes_command("ey envname logs").to(:show_logs) }
7
- it { routes_command("ey appname envname status").to(:show_status) }
5
+ it { routes_command("ey info").to(:list_envs) }
6
+ it { routes_command("ey servers appname envname").to(:list_servers) }
7
+ it { routes_command("ey logs appname envname").to(:show_logs) }
8
+ it { routes_command("ey status appname envname").to(:show_status) }
8
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-ey-info
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Paramio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-18 00:00:00.000000000 Z
11
+ date: 2014-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: lita-ey-base
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'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: bundler
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +100,14 @@ dependencies:
86
100
  requirements:
87
101
  - - '>='
88
102
  - !ruby/object:Gem::Version
89
- version: 3.0.0.beta1
103
+ version: 3.0.0
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - '>='
95
109
  - !ruby/object:Gem::Version
96
- version: 3.0.0.beta1
110
+ version: 3.0.0
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: simplecov
99
113
  requirement: !ruby/object:Gem::Requirement