lita-ey-base 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.rspec +1 -0
- data/.travis.yml +13 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +105 -0
- data/LICENSE +19 -0
- data/README.md +12 -0
- data/Rakefile +6 -0
- data/lib/lita/handlers/ey_base.rb +84 -0
- data/lib/lita-ey-base.rb +1 -0
- data/lita-ey-base.gemspec +25 -0
- data/spec/lita/handlers/ey_base_spec.rb +4 -0
- data/spec/spec_helper.rb +11 -0
- metadata +157 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5b3614eb0d0ce0548b1b6db261af778449902de9
|
4
|
+
data.tar.gz: 0962357844244a7f159812c49e1183879c6392e9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ec5727996288e4a77792425970aa9ba20395c98a2bc90aede889a40b33f91fd8bd13edd6a76ab80c229f02d589ac3fccfa032f2dfa5b9a9472da21e7f948df8a
|
7
|
+
data.tar.gz: 2e61796d9a1f61ba66bc1f3951027b8fce12f2bb5dc26d84135c326fe98f7dedcbabafb3a6b0c56aaea28ae35aa74176505c21bb1c94f1d778b85af50e847352
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
-f documentation --color
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
lita-ey-base (0.0.1)
|
5
|
+
engineyard
|
6
|
+
lita (>= 3.2.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
addressable (2.3.6)
|
12
|
+
coveralls (0.7.0)
|
13
|
+
multi_json (~> 1.3)
|
14
|
+
rest-client
|
15
|
+
simplecov (>= 0.7)
|
16
|
+
term-ansicolor
|
17
|
+
thor
|
18
|
+
diff-lcs (1.2.5)
|
19
|
+
docile (1.1.3)
|
20
|
+
engineyard (2.3.3)
|
21
|
+
engineyard-cloud-client (~> 1.0.16)
|
22
|
+
engineyard-serverside-adapter (= 2.2.0)
|
23
|
+
escape (~> 0.0.4)
|
24
|
+
highline (~> 1.6.1)
|
25
|
+
launchy (~> 2.1)
|
26
|
+
net-ssh (~> 2.7)
|
27
|
+
rest-client (~> 1.6.0)
|
28
|
+
engineyard-cloud-client (1.0.16)
|
29
|
+
mime-types (~> 1.16)
|
30
|
+
multi_json (~> 1.6)
|
31
|
+
rest-client (~> 1.6.1)
|
32
|
+
engineyard-serverside-adapter (2.2.0)
|
33
|
+
escape (~> 0.0.4)
|
34
|
+
multi_json (~> 1.6)
|
35
|
+
escape (0.0.4)
|
36
|
+
faraday (0.9.0)
|
37
|
+
multipart-post (>= 1.2, < 3)
|
38
|
+
highline (1.6.21)
|
39
|
+
http_router (0.11.1)
|
40
|
+
rack (>= 1.0.0)
|
41
|
+
url_mount (~> 0.2.1)
|
42
|
+
i18n (0.6.9)
|
43
|
+
ice_nine (0.11.0)
|
44
|
+
launchy (2.4.2)
|
45
|
+
addressable (~> 2.3)
|
46
|
+
lita (3.3.0)
|
47
|
+
bundler (>= 1.3)
|
48
|
+
faraday (>= 0.8.7)
|
49
|
+
http_router (>= 0.11.1)
|
50
|
+
i18n (>= 0.6.9)
|
51
|
+
ice_nine (>= 0.11.0)
|
52
|
+
multi_json (>= 1.7.7)
|
53
|
+
puma (>= 2.7.1)
|
54
|
+
rack (>= 1.5.2)
|
55
|
+
rb-readline (>= 0.5.1)
|
56
|
+
redis-namespace (>= 1.3.0)
|
57
|
+
thor (>= 0.18.1)
|
58
|
+
mime-types (1.25.1)
|
59
|
+
multi_json (1.10.0)
|
60
|
+
multipart-post (2.0.0)
|
61
|
+
net-ssh (2.9.1)
|
62
|
+
puma (2.8.2)
|
63
|
+
rack (>= 1.1, < 2.0)
|
64
|
+
rack (1.5.2)
|
65
|
+
rake (10.3.2)
|
66
|
+
rb-readline (0.5.1)
|
67
|
+
redis (3.0.7)
|
68
|
+
redis-namespace (1.4.1)
|
69
|
+
redis (~> 3.0.4)
|
70
|
+
rest-client (1.6.7)
|
71
|
+
mime-types (>= 1.16)
|
72
|
+
rspec (3.0.0)
|
73
|
+
rspec-core (~> 3.0.0)
|
74
|
+
rspec-expectations (~> 3.0.0)
|
75
|
+
rspec-mocks (~> 3.0.0)
|
76
|
+
rspec-core (3.0.2)
|
77
|
+
rspec-support (~> 3.0.0)
|
78
|
+
rspec-expectations (3.0.2)
|
79
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
80
|
+
rspec-support (~> 3.0.0)
|
81
|
+
rspec-mocks (3.0.2)
|
82
|
+
rspec-support (~> 3.0.0)
|
83
|
+
rspec-support (3.0.2)
|
84
|
+
simplecov (0.8.2)
|
85
|
+
docile (~> 1.1.0)
|
86
|
+
multi_json
|
87
|
+
simplecov-html (~> 0.8.0)
|
88
|
+
simplecov-html (0.8.0)
|
89
|
+
term-ansicolor (1.3.0)
|
90
|
+
tins (~> 1.0)
|
91
|
+
thor (0.19.1)
|
92
|
+
tins (1.3.0)
|
93
|
+
url_mount (0.2.1)
|
94
|
+
rack
|
95
|
+
|
96
|
+
PLATFORMS
|
97
|
+
ruby
|
98
|
+
|
99
|
+
DEPENDENCIES
|
100
|
+
bundler
|
101
|
+
coveralls
|
102
|
+
lita-ey-base!
|
103
|
+
rake
|
104
|
+
rspec (>= 3.0.0)
|
105
|
+
simplecov
|
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2014 Carlos Paramio
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# lita-ey-base
|
2
|
+
|
3
|
+
**lita-ey-base** is a base handler for [Lita](http://lita.io/) that provides shared code for all lita-ey-* gems.
|
4
|
+
|
5
|
+
## See also
|
6
|
+
|
7
|
+
[lita-ey-deploy](http://github.com/carlosparamio/lita-ey-deploy)
|
8
|
+
[lita-ey-info](http://github.com/carlosparamio/lita-ey-info)
|
9
|
+
|
10
|
+
## License
|
11
|
+
|
12
|
+
[MIT](http://opensource.org/licenses/MIT)
|
data/Rakefile
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
require "lita"
|
2
|
+
|
3
|
+
module Lita
|
4
|
+
module Handlers
|
5
|
+
class EyBase < Handler
|
6
|
+
|
7
|
+
route(/ey config/i, :show_config, command: true, help: {
|
8
|
+
"ey config" => "Displays EY configuration (apps, envs, default deploy branch, authorized users group...)"
|
9
|
+
})
|
10
|
+
|
11
|
+
def self.default_config(config)
|
12
|
+
config.api_token = ""
|
13
|
+
config.apps = {}
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.namespace
|
17
|
+
"ey"
|
18
|
+
end
|
19
|
+
|
20
|
+
def show_config(response)
|
21
|
+
result = ""
|
22
|
+
config.apps.each do |app_name, app_data|
|
23
|
+
result += "App Name: #{app_name}\n"
|
24
|
+
result += " Environments:\n"
|
25
|
+
app_data["envs"].each do |env_name, env_data|
|
26
|
+
result += " * #{env_name}\n"
|
27
|
+
result += " Default branch: #{env_data["default_branch"]}\n"
|
28
|
+
result += " Authorized users group: #{env_data["auth_group"]}\n"
|
29
|
+
end
|
30
|
+
result += "\n"
|
31
|
+
end
|
32
|
+
response.reply result
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def valid_app?(app)
|
38
|
+
config.apps.keys.include?(app)
|
39
|
+
end
|
40
|
+
|
41
|
+
def valid_env?(app, env)
|
42
|
+
config.apps[app]["envs"].keys.include?(env)
|
43
|
+
end
|
44
|
+
|
45
|
+
def required_group_to_access(app, env)
|
46
|
+
config.apps[app]["envs"][env]["auth_group"]
|
47
|
+
end
|
48
|
+
|
49
|
+
def can_access?(user, app, env)
|
50
|
+
group = required_group_to_access(app, env)
|
51
|
+
return true unless group
|
52
|
+
Lita::Authorization.user_in_group? user, required_group_to_access(app, env)
|
53
|
+
end
|
54
|
+
|
55
|
+
def access_denied_msg
|
56
|
+
"Sorry, you don't have access; you must be at %{group_name} group."
|
57
|
+
end
|
58
|
+
|
59
|
+
def do_if_can_access(response, app, env, &block)
|
60
|
+
if can_access?(response.user, app, env)
|
61
|
+
yield
|
62
|
+
else
|
63
|
+
response.reply access_denied_msg % { group_name: required_group_to_access(app, env) }
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def default_branch_for(app, env)
|
68
|
+
config.apps[app]["envs"][env]["default_branch"] || "master"
|
69
|
+
end
|
70
|
+
|
71
|
+
def ey_app(app)
|
72
|
+
config.apps[app]["ey_name"]
|
73
|
+
end
|
74
|
+
|
75
|
+
def ey_env(app, env)
|
76
|
+
config.apps[app]["envs"][env]["ey_name"]
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
Lita.register_handler(EyBase)
|
82
|
+
|
83
|
+
end
|
84
|
+
end
|
data/lib/lita-ey-base.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "lita/handlers/ey_base"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = "lita-ey-base"
|
3
|
+
spec.version = "0.0.1"
|
4
|
+
spec.authors = ["Carlos Paramio"]
|
5
|
+
spec.email = ["cparamio@avallain.com"]
|
6
|
+
spec.description = %q{A Lita base handler with shared code for all ey-lita-* gems.}
|
7
|
+
spec.summary = %q{A Lita base handler with shared code for all ey-lita-* gems.}
|
8
|
+
spec.homepage = "https://github.com/carlosparamio/lita-ey-base"
|
9
|
+
spec.metadata = { "lita_plugin_type" => "handler" }
|
10
|
+
|
11
|
+
spec.files = `git ls-files`.split($/)
|
12
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
13
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
14
|
+
spec.require_paths = ["lib"]
|
15
|
+
|
16
|
+
spec.add_runtime_dependency "lita", ">= 3.2.0"
|
17
|
+
|
18
|
+
spec.add_dependency "engineyard"
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler"
|
21
|
+
spec.add_development_dependency "coveralls"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec", ">= 3.0.0"
|
24
|
+
spec.add_development_dependency "simplecov"
|
25
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,157 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lita-ey-base
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Carlos Paramio
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-23 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: 3.2.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.2.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: engineyard
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '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'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
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: coveralls
|
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: rake
|
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
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
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
|
+
description: A Lita base handler with shared code for all ey-lita-* gems.
|
112
|
+
email:
|
113
|
+
- cparamio@avallain.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- .gitignore
|
119
|
+
- .rspec
|
120
|
+
- .travis.yml
|
121
|
+
- Gemfile
|
122
|
+
- Gemfile.lock
|
123
|
+
- LICENSE
|
124
|
+
- README.md
|
125
|
+
- Rakefile
|
126
|
+
- lib/lita-ey-base.rb
|
127
|
+
- lib/lita/handlers/ey_base.rb
|
128
|
+
- lita-ey-base.gemspec
|
129
|
+
- spec/lita/handlers/ey_base_spec.rb
|
130
|
+
- spec/spec_helper.rb
|
131
|
+
homepage: https://github.com/carlosparamio/lita-ey-base
|
132
|
+
licenses: []
|
133
|
+
metadata:
|
134
|
+
lita_plugin_type: handler
|
135
|
+
post_install_message:
|
136
|
+
rdoc_options: []
|
137
|
+
require_paths:
|
138
|
+
- lib
|
139
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - '>='
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - '>='
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
requirements: []
|
150
|
+
rubyforge_project:
|
151
|
+
rubygems_version: 2.1.11
|
152
|
+
signing_key:
|
153
|
+
specification_version: 4
|
154
|
+
summary: A Lita base handler with shared code for all ey-lita-* gems.
|
155
|
+
test_files:
|
156
|
+
- spec/lita/handlers/ey_base_spec.rb
|
157
|
+
- spec/spec_helper.rb
|