ey_resolver 0.2.1 → 0.2.2
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 +15 -0
- data/ey_resolver.gemspec +1 -1
- data/lib/ey_resolver.rb +6 -6
- data/lib/ey_resolver/account_resolver.rb +1 -1
- data/lib/ey_resolver/app_env_resolver.rb +1 -1
- data/lib/ey_resolver/app_resolver.rb +1 -1
- data/lib/ey_resolver/environment_resolver.rb +1 -1
- data/lib/ey_resolver/query.rb +1 -0
- data/lib/ey_resolver/version.rb +1 -1
- data/spec/app_env_resolver_spec.rb +2 -2
- data/spec/app_resolver_spec.rb +2 -2
- data/spec/environment_resolver_spec.rb +6 -6
- data/spec/spec_helper.rb +2 -5
- metadata +24 -23
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MTg2YThiMjMyZWFkZDAwOGFkM2VmYjI1NjM3ZmU1NDUwZjFjNzMxNA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZDFmMjA1MTQ0YjU4NjAxN2E2Mzk0MjNjNjc3MGRiZDZlOTU4ZmUxMQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MDA5Yzk4Njc0MTllNDE3MjYxZWU4NDhhN2UwYmE0ZmZlNmI5N2MxNGU1ODc1
|
10
|
+
MTExMDMxMTFjOGY5ZWZjYmU0OTViNjE5NmQ1OWVjODgxNzEwOGNkMjYyMmFj
|
11
|
+
ZDEwYzFjY2I5YWYyZTljZGZlMjI2MzRlNzFhYjVjYmJiMWVkYTE=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NWE2ZDAxNjFkOWQ5NDQzNjc0YjU1YzRmOGVlOWYyODQ5YmM3NTVmMDMzNDJl
|
14
|
+
MTE0YmZkNDJlM2YyMDg1MWY2NWEwN2VkYjU3ZDQ0MWZmMjA2Zjg2YWVlYTQx
|
15
|
+
NWQzZTAzZWIxNjVkYmJiYzRkYzQ4NWNhZmYwODZiNDc1YWRkYjg=
|
data/ey_resolver.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
21
|
# specify any dependencies here; for example:
|
22
|
-
s.add_runtime_dependency "gitable", "~>0.2.
|
22
|
+
s.add_runtime_dependency "gitable", "~>0.2.4"
|
23
23
|
s.add_development_dependency "rake"
|
24
24
|
s.add_development_dependency "rspec", "~>2.0"
|
25
25
|
end
|
data/lib/ey_resolver.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
+
module EY
|
2
|
+
class Resolver
|
3
|
+
class UnconstrainedError < ArgumentError; end
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
1
7
|
require 'ey_resolver/query'
|
2
8
|
require 'ey_resolver/examiner'
|
3
9
|
require 'ey_resolver/account_resolver'
|
4
10
|
require 'ey_resolver/app_resolver'
|
5
11
|
require 'ey_resolver/app_env_resolver'
|
6
12
|
require 'ey_resolver/environment_resolver'
|
7
|
-
|
8
|
-
module EY
|
9
|
-
class Resolver
|
10
|
-
class UnconstrainedError < ArgumentError; end
|
11
|
-
end
|
12
|
-
end
|
@@ -32,7 +32,7 @@ class EY::Resolver
|
|
32
32
|
def exact_match?(account, key, val)
|
33
33
|
case key.to_sym
|
34
34
|
when :remotes
|
35
|
-
app_uris = account.apps.map { |app| app.gitable_uri }.flatten
|
35
|
+
app_uris = account.apps.map { |app| app.gitable_uri }.flatten.compact
|
36
36
|
val.any? { |uri| app_uris.any? { |app_uri| app_uri.equivalent?(uri) } }
|
37
37
|
when :app_name
|
38
38
|
account.apps.any? {|app| app.name.downcase.index(val.downcase) } # partial match app if given for account
|
@@ -45,7 +45,7 @@ class EY::Resolver
|
|
45
45
|
# cache app uris since we might use it twice
|
46
46
|
def app_uris(env)
|
47
47
|
@app_uris ||= {}
|
48
|
-
@app_uris[env] ||= env.apps.map { |app| app.gitable_uri }.flatten
|
48
|
+
@app_uris[env] ||= env.apps.map { |app| app.gitable_uri }.flatten.compact
|
49
49
|
end
|
50
50
|
|
51
51
|
def equivalent_remote?(env, uri)
|
data/lib/ey_resolver/query.rb
CHANGED
@@ -63,6 +63,7 @@ class EY::Resolver
|
|
63
63
|
return nil if val.nil? || val.empty?
|
64
64
|
val.reject {|uri| uri.to_s.empty? }.map { |uri| Gitable::URI.parse_when_valid(uri) }.compact
|
65
65
|
else
|
66
|
+
# allowable characters assumption: [a-zA-Z0-9_-]
|
66
67
|
norm = val.to_s.gsub(/[^\w-]+/,'')
|
67
68
|
norm.empty? ? nil : norm
|
68
69
|
end
|
data/lib/ey_resolver/version.rb
CHANGED
@@ -199,10 +199,10 @@ describe EY::Resolver::AppEnvResolver do
|
|
199
199
|
end
|
200
200
|
|
201
201
|
it "app (by repo) does not have an environment" do
|
202
|
-
resolver = app_env_resolver(nil, nil, nil, ["git
|
202
|
+
resolver = app_env_resolver(nil, nil, nil, ["git@github.com:repo/noe.git"])
|
203
203
|
resolver.matches.should == []
|
204
204
|
resolver.errors.should ==
|
205
|
-
[%|No environment found for applications matching remotes:\n\tgit
|
205
|
+
[%|No environment found for applications matching remotes:\n\tgit@github.com:repo/noe.git|]
|
206
206
|
resolver.suggestions.should be_empty
|
207
207
|
end
|
208
208
|
end
|
data/spec/app_resolver_spec.rb
CHANGED
@@ -107,10 +107,10 @@ describe EY::Resolver::AppEnvResolver do
|
|
107
107
|
end
|
108
108
|
|
109
109
|
it "repo not found" do
|
110
|
-
resolver = app_resolver(nil, nil, nil, ["git
|
110
|
+
resolver = app_resolver(nil, nil, nil, ["git@fake.com:fake/fake.git"])
|
111
111
|
resolver.matches.should == []
|
112
112
|
resolver.errors.should ==
|
113
|
-
[%|No application found matching remotes:\n\tgit
|
113
|
+
[%|No application found matching remotes:\n\tgit@fake.com:fake/fake.git|]
|
114
114
|
end
|
115
115
|
|
116
116
|
it "repo not found in account" do
|
@@ -24,7 +24,7 @@ describe EY::Resolver::EnvironmentResolver do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
it "returns empty when there is no remote match and env name is not specified" do
|
27
|
-
env_resolver(nil, nil, nil, ["git
|
27
|
+
env_resolver(nil, nil, nil, ["git@github.com:repo/noe.git"]).matches.should == []
|
28
28
|
end
|
29
29
|
|
30
30
|
it "returns empty when there is no environment match" do
|
@@ -47,7 +47,7 @@ describe EY::Resolver::EnvironmentResolver do
|
|
47
47
|
|
48
48
|
it "finds matches that don't match the remotes" do
|
49
49
|
env_resolver(nil, nil, 'production', ["git://github.com/repo/app.git"]).matches.should == envs(@production, @hugeprod)
|
50
|
-
env_resolver(nil, nil, 'staging', ["git
|
50
|
+
env_resolver(nil, nil, 'staging', ["git@github.com:repo/noe.git"]).matches.should == envs(@staging, @big)
|
51
51
|
end
|
52
52
|
|
53
53
|
it "scopes by app name when specified" do
|
@@ -164,10 +164,10 @@ describe EY::Resolver::EnvironmentResolver do
|
|
164
164
|
end
|
165
165
|
|
166
166
|
it "repo found but env doesn't exist on it" do
|
167
|
-
resolver = env_resolver(nil, nil, nil, ["git
|
167
|
+
resolver = env_resolver(nil, nil, nil, ["git@github.com:repo/noe.git"])
|
168
168
|
resolver.matches.should == []
|
169
169
|
resolver.errors.should ==
|
170
|
-
[%|No environment found for applications matching remotes:\n\tgit
|
170
|
+
[%|No environment found for applications matching remotes:\n\tgit@github.com:repo/noe.git|]
|
171
171
|
resolver.suggestions.should be_empty
|
172
172
|
end
|
173
173
|
|
@@ -192,10 +192,10 @@ describe EY::Resolver::EnvironmentResolver do
|
|
192
192
|
end
|
193
193
|
|
194
194
|
it "app (by repo) does not have an environment" do
|
195
|
-
resolver = env_resolver(nil, nil, nil, ["git
|
195
|
+
resolver = env_resolver(nil, nil, nil, ["git@github.com:repo/noe.git"])
|
196
196
|
resolver.matches.should == []
|
197
197
|
resolver.errors.should ==
|
198
|
-
[%|No environment found for applications matching remotes:\n\tgit
|
198
|
+
[%|No environment found for applications matching remotes:\n\tgit@github.com:repo/noe.git|]
|
199
199
|
resolver.suggestions.should be_empty
|
200
200
|
end
|
201
201
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -27,10 +27,6 @@ module Helpers
|
|
27
27
|
raise "Must have an account"
|
28
28
|
end
|
29
29
|
|
30
|
-
if !!app_name != !!repo # both or neither (XNOR)
|
31
|
-
raise "app_name and repo must be supplied together"
|
32
|
-
end
|
33
|
-
|
34
30
|
account = Account.first(:user => user, :name => acc_name)
|
35
31
|
account ||= Account.create(:user => user, :name => acc_name)
|
36
32
|
|
@@ -110,7 +106,8 @@ RSpec.configure do |config|
|
|
110
106
|
@me_dup = mock_models('me', "app_dup", "app_dup", "git://github.com/repo/dup.git")
|
111
107
|
@me_other = mock_models('me', "other", "app_dup", "git://github.com/repo/oth.git")
|
112
108
|
@noapp = mock_models('ey', nil, "noapp", nil)
|
113
|
-
@
|
109
|
+
@norepo = mock_models('ey', "herring", "herring", nil)
|
110
|
+
@noenv = mock_models('ey', "noenv", nil, "git@github.com:repo/noe.git")
|
114
111
|
@account = mock_models('no', nil, nil, nil)
|
115
112
|
end
|
116
113
|
end
|
metadata
CHANGED
@@ -1,49 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ey_resolver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Martin Emde
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-10-21 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: gitable
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.2.
|
19
|
+
version: 0.2.4
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.2.4
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: rake
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
31
|
- - ! '>='
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: '0'
|
33
34
|
type: :development
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
36
41
|
- !ruby/object:Gem::Dependency
|
37
42
|
name: rspec
|
38
|
-
requirement:
|
39
|
-
none: false
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
40
44
|
requirements:
|
41
45
|
- - ~>
|
42
46
|
- !ruby/object:Gem::Version
|
43
47
|
version: '2.0'
|
44
48
|
type: :development
|
45
49
|
prerelease: false
|
46
|
-
version_requirements:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.0'
|
47
55
|
description: Resolves apps, environments, app_environments and accounts using a set
|
48
56
|
of constraints
|
49
57
|
email:
|
@@ -80,33 +88,26 @@ files:
|
|
80
88
|
- spec/spec_helper.rb
|
81
89
|
homepage: ''
|
82
90
|
licenses: []
|
91
|
+
metadata: {}
|
83
92
|
post_install_message:
|
84
93
|
rdoc_options: []
|
85
94
|
require_paths:
|
86
95
|
- lib
|
87
96
|
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
-
none: false
|
89
97
|
requirements:
|
90
98
|
- - ! '>='
|
91
99
|
- !ruby/object:Gem::Version
|
92
100
|
version: '0'
|
93
|
-
segments:
|
94
|
-
- 0
|
95
|
-
hash: 4321533697507775913
|
96
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
102
|
requirements:
|
99
103
|
- - ! '>='
|
100
104
|
- !ruby/object:Gem::Version
|
101
105
|
version: '0'
|
102
|
-
segments:
|
103
|
-
- 0
|
104
|
-
hash: 4321533697507775913
|
105
106
|
requirements: []
|
106
107
|
rubyforge_project: ey_resolver
|
107
|
-
rubygems_version:
|
108
|
+
rubygems_version: 2.0.6
|
108
109
|
signing_key:
|
109
|
-
specification_version:
|
110
|
+
specification_version: 4
|
110
111
|
summary: Resolves awsm models given constraints
|
111
112
|
test_files:
|
112
113
|
- spec/account_resolver_spec.rb
|