ey_resolver 0.2.0 → 0.2.1
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.
- data/lib/ey_resolver/abstract_resolver.rb +22 -4
- data/lib/ey_resolver/account_resolver.rb +5 -6
- data/lib/ey_resolver/app_env_resolver.rb +13 -14
- data/lib/ey_resolver/app_resolver.rb +5 -6
- data/lib/ey_resolver/environment_resolver.rb +5 -6
- data/lib/ey_resolver/version.rb +1 -1
- data/spec/account_resolver_spec.rb +3 -21
- data/spec/app_env_resolver_spec.rb +17 -3
- data/spec/app_resolver_spec.rb +21 -17
- data/spec/environment_resolver_spec.rb +12 -10
- metadata +9 -9
@@ -16,22 +16,40 @@ class EY::Resolver
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def matches
|
19
|
+
@matches ||= load_matches
|
20
|
+
end
|
21
|
+
|
22
|
+
def errors
|
23
|
+
@errors ||= load_errors
|
24
|
+
end
|
25
|
+
|
26
|
+
def suggestions
|
27
|
+
@suggestions ||= load_suggestions
|
28
|
+
end
|
29
|
+
|
30
|
+
protected
|
31
|
+
|
32
|
+
def load_matches
|
19
33
|
if query.unconstrained?
|
20
34
|
return []
|
21
35
|
end
|
22
36
|
end
|
23
37
|
|
24
|
-
def
|
38
|
+
def load_errors
|
39
|
+
if matches.any?
|
40
|
+
return []
|
41
|
+
end
|
25
42
|
examiner.unconstrained_errors
|
26
43
|
end
|
27
44
|
|
28
|
-
def
|
45
|
+
def load_suggestions
|
46
|
+
if matches.any?
|
47
|
+
return []
|
48
|
+
end
|
29
49
|
errors
|
30
50
|
examiner.suggestions
|
31
51
|
end
|
32
52
|
|
33
|
-
protected
|
34
|
-
|
35
53
|
def examiner
|
36
54
|
@examiner ||= Examiner.new(query, user)
|
37
55
|
end
|
@@ -10,7 +10,9 @@ class EY::Resolver
|
|
10
10
|
::Account
|
11
11
|
end
|
12
12
|
|
13
|
-
|
13
|
+
protected
|
14
|
+
|
15
|
+
def load_matches
|
14
16
|
if query.unconstrained?
|
15
17
|
return []
|
16
18
|
end
|
@@ -21,15 +23,12 @@ class EY::Resolver
|
|
21
23
|
best_matches user.accounts.all(dm_query)
|
22
24
|
end
|
23
25
|
|
24
|
-
def
|
25
|
-
|
26
|
-
super ||
|
26
|
+
def load_errors
|
27
|
+
super ||
|
27
28
|
examiner.not_found_errors ||
|
28
29
|
[]
|
29
30
|
end
|
30
31
|
|
31
|
-
private
|
32
|
-
|
33
32
|
def exact_match?(account, key, val)
|
34
33
|
case key.to_sym
|
35
34
|
when :remotes
|
@@ -7,23 +7,25 @@ class EY::Resolver
|
|
7
7
|
|
8
8
|
class AppEnvResolver < AbstractResolver
|
9
9
|
|
10
|
-
def self.
|
10
|
+
def self.model
|
11
11
|
if Object.const_defined?(:AppDeployment)
|
12
|
-
|
12
|
+
::AppDeployment
|
13
13
|
else
|
14
|
-
|
14
|
+
::AppEnvironment
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
protected
|
19
|
+
|
20
|
+
def association
|
21
|
+
if model.name =~ /AppDeployment/
|
22
|
+
:app_deployments
|
21
23
|
else
|
22
|
-
|
24
|
+
:app_environments
|
23
25
|
end
|
24
26
|
end
|
25
27
|
|
26
|
-
def
|
28
|
+
def load_matches
|
27
29
|
if query.unconstrained? || query.app_unconstrained?
|
28
30
|
return []
|
29
31
|
end
|
@@ -33,13 +35,12 @@ class EY::Resolver
|
|
33
35
|
dm_query[model.environment.name.like] = "%#{query.environment_name}%" if query.environment_name
|
34
36
|
dm_query[model.app.account.name.like] = "%#{query.account_name}%" if query.account_name
|
35
37
|
|
36
|
-
candidates = user.accounts.apps.send(
|
38
|
+
candidates = user.accounts.apps.send(association).all(dm_query)
|
37
39
|
best_matches filter_by_remotes(candidates)
|
38
40
|
end
|
39
41
|
|
40
|
-
def
|
41
|
-
|
42
|
-
super ||
|
42
|
+
def load_errors
|
43
|
+
super ||
|
43
44
|
examiner.app_unconstrained_errors ||
|
44
45
|
examiner.not_found_errors ||
|
45
46
|
examiner.account_scoping_errors ||
|
@@ -48,8 +49,6 @@ class EY::Resolver
|
|
48
49
|
[]
|
49
50
|
end
|
50
51
|
|
51
|
-
private
|
52
|
-
|
53
52
|
def equivalent_remote?(app_env, uri)
|
54
53
|
app_env.app.gitable_uri.equivalent?(uri)
|
55
54
|
end
|
@@ -10,7 +10,9 @@ class EY::Resolver
|
|
10
10
|
::App
|
11
11
|
end
|
12
12
|
|
13
|
-
|
13
|
+
protected
|
14
|
+
|
15
|
+
def load_matches
|
14
16
|
if query.unconstrained? || query.app_unconstrained?
|
15
17
|
return []
|
16
18
|
end
|
@@ -23,17 +25,14 @@ class EY::Resolver
|
|
23
25
|
best_matches filter_by_remotes(candidates)
|
24
26
|
end
|
25
27
|
|
26
|
-
def
|
27
|
-
|
28
|
-
super ||
|
28
|
+
def load_errors
|
29
|
+
super ||
|
29
30
|
examiner.app_unconstrained_errors ||
|
30
31
|
examiner.not_found_errors ||
|
31
32
|
examiner.account_scoping_errors ||
|
32
33
|
[]
|
33
34
|
end
|
34
35
|
|
35
|
-
protected
|
36
|
-
|
37
36
|
def equivalent_remote?(app, uri)
|
38
37
|
app.gitable_uri.equivalent?(uri)
|
39
38
|
end
|
@@ -10,7 +10,9 @@ class EY::Resolver
|
|
10
10
|
::Environment
|
11
11
|
end
|
12
12
|
|
13
|
-
|
13
|
+
protected
|
14
|
+
|
15
|
+
def load_matches
|
14
16
|
if query.unconstrained? || query.env_unconstrained?
|
15
17
|
return []
|
16
18
|
end
|
@@ -30,9 +32,8 @@ class EY::Resolver
|
|
30
32
|
best_matches candidates
|
31
33
|
end
|
32
34
|
|
33
|
-
def
|
34
|
-
|
35
|
-
super ||
|
35
|
+
def load_errors
|
36
|
+
super ||
|
36
37
|
examiner.env_unconstrained_errors ||
|
37
38
|
examiner.not_found_errors ||
|
38
39
|
examiner.account_scoping_errors ||
|
@@ -41,8 +42,6 @@ class EY::Resolver
|
|
41
42
|
[]
|
42
43
|
end
|
43
44
|
|
44
|
-
private
|
45
|
-
|
46
45
|
# cache app uris since we might use it twice
|
47
46
|
def app_uris(env)
|
48
47
|
@app_uris ||= {}
|
data/lib/ey_resolver/version.rb
CHANGED
@@ -76,27 +76,15 @@ describe EY::Resolver::AppEnvResolver do
|
|
76
76
|
describe "#errors" do
|
77
77
|
it "no account" do
|
78
78
|
resolver = account_resolver('gibberish', 'app', 'production')
|
79
|
+
resolver.matches.should == []
|
79
80
|
resolver.errors.should ==
|
80
81
|
[%|No account found matching "gibberish".|]
|
81
82
|
resolver.suggestions.should == []
|
82
83
|
end
|
83
84
|
|
84
|
-
it "no app" do
|
85
|
-
resolver = account_resolver(nil, 'gibberish', 'app_dup')
|
86
|
-
resolver.errors.should ==
|
87
|
-
[%|No application found matching "gibberish".|]
|
88
|
-
resolver.suggestions.should == []
|
89
|
-
end
|
90
|
-
|
91
|
-
it "no env" do
|
92
|
-
resolver = account_resolver('ey', 'app', 'gibberish')
|
93
|
-
resolver.errors.should ==
|
94
|
-
[%|No environment found matching "gibberish".|]
|
95
|
-
resolver.suggestions.should == []
|
96
|
-
end
|
97
|
-
|
98
85
|
it "no account or app" do
|
99
86
|
resolver = account_resolver('gibberish', 'gibberish', nil)
|
87
|
+
resolver.matches.should == []
|
100
88
|
resolver.errors.should == [
|
101
89
|
%|No account found matching "gibberish".|,
|
102
90
|
%|No application found matching "gibberish".|,
|
@@ -106,6 +94,7 @@ describe EY::Resolver::AppEnvResolver do
|
|
106
94
|
|
107
95
|
it "no account or app or env" do
|
108
96
|
resolver = account_resolver('gibberish', 'gibberish', 'gibberish')
|
97
|
+
resolver.matches.should == []
|
109
98
|
resolver.errors.should == [
|
110
99
|
%|No account found matching "gibberish".|,
|
111
100
|
%|No application found matching "gibberish".|,
|
@@ -113,12 +102,5 @@ describe EY::Resolver::AppEnvResolver do
|
|
113
102
|
]
|
114
103
|
resolver.suggestions.should == []
|
115
104
|
end
|
116
|
-
|
117
|
-
it "repo not found" do
|
118
|
-
resolver = account_resolver(nil, nil, nil, ["git://fake.com/fake/fake.git"])
|
119
|
-
resolver.errors.should ==
|
120
|
-
[%|No application found matching remotes:\n\tgit://fake.com/fake/fake.git|]
|
121
|
-
resolver.suggestions.should == []
|
122
|
-
end
|
123
105
|
end
|
124
106
|
end
|
@@ -75,6 +75,7 @@ describe EY::Resolver::AppEnvResolver do
|
|
75
75
|
describe "errors and suggestions" do
|
76
76
|
it "no constraints" do
|
77
77
|
resolver = app_env_resolver()
|
78
|
+
resolver.matches.should == []
|
78
79
|
resolver.errors.should ==
|
79
80
|
[%|Must search by account name, app name, remotes, or environment name.|]
|
80
81
|
resolver.suggestions.should be_empty
|
@@ -82,6 +83,7 @@ describe EY::Resolver::AppEnvResolver do
|
|
82
83
|
|
83
84
|
it "no app constraints" do
|
84
85
|
resolver = app_env_resolver('ey')
|
86
|
+
resolver.matches.should == []
|
85
87
|
resolver.errors.should ==
|
86
88
|
[%|App name or repository remotes required.|]
|
87
89
|
resolver.suggestions.should be_empty
|
@@ -89,6 +91,7 @@ describe EY::Resolver::AppEnvResolver do
|
|
89
91
|
|
90
92
|
it "no account" do
|
91
93
|
resolver = app_env_resolver('gibberish', 'app', 'production')
|
94
|
+
resolver.matches.should == []
|
92
95
|
resolver.errors.should ==
|
93
96
|
[%|No account found matching "gibberish".|]
|
94
97
|
resolver.suggestions.should be_empty
|
@@ -96,6 +99,7 @@ describe EY::Resolver::AppEnvResolver do
|
|
96
99
|
|
97
100
|
it "no app" do
|
98
101
|
resolver = app_env_resolver(nil, 'gibberish', 'app_dup')
|
102
|
+
resolver.matches.should == []
|
99
103
|
resolver.errors.should ==
|
100
104
|
[%|No application found matching "gibberish".|]
|
101
105
|
resolver.suggestions.should be_empty
|
@@ -103,6 +107,7 @@ describe EY::Resolver::AppEnvResolver do
|
|
103
107
|
|
104
108
|
it "app found, but not on account" do
|
105
109
|
resolver = app_env_resolver('no', 'bigapp', 'app_dup')
|
110
|
+
resolver.matches.should == []
|
106
111
|
resolver.errors.should == [
|
107
112
|
%|Application "bigapp" found, but does not exist in account "no".|,
|
108
113
|
%|Environment "app_dup" found, but does not exist in account "no".|,
|
@@ -117,6 +122,7 @@ describe EY::Resolver::AppEnvResolver do
|
|
117
122
|
|
118
123
|
it "no env" do
|
119
124
|
resolver = app_env_resolver('ey', 'app', 'gibberish')
|
125
|
+
resolver.matches.should == []
|
120
126
|
resolver.errors.should ==
|
121
127
|
[%|No environment found matching "gibberish".|]
|
122
128
|
resolver.suggestions.should be_empty
|
@@ -124,6 +130,7 @@ describe EY::Resolver::AppEnvResolver do
|
|
124
130
|
|
125
131
|
it "no env on account" do
|
126
132
|
resolver = app_env_resolver('me', 'other', 'production')
|
133
|
+
resolver.matches.should == []
|
127
134
|
resolver.errors.should ==
|
128
135
|
[%|Environment "production" found, but does not exist in account "me".|]
|
129
136
|
resolver.suggestions.should =~ [
|
@@ -133,6 +140,7 @@ describe EY::Resolver::AppEnvResolver do
|
|
133
140
|
|
134
141
|
it "no account or app" do
|
135
142
|
resolver = app_env_resolver('gibberish', 'gibberish', nil)
|
143
|
+
resolver.matches.should == []
|
136
144
|
resolver.errors.should == [
|
137
145
|
%|No account found matching "gibberish".|,
|
138
146
|
%|No application found matching "gibberish".|,
|
@@ -142,6 +150,7 @@ describe EY::Resolver::AppEnvResolver do
|
|
142
150
|
|
143
151
|
it "no account or app or env" do
|
144
152
|
resolver = app_env_resolver('gibberish', 'gibberish', 'gibberish')
|
153
|
+
resolver.matches.should == []
|
145
154
|
resolver.errors.should == [
|
146
155
|
%|No account found matching "gibberish".|,
|
147
156
|
%|No application found matching "gibberish".|,
|
@@ -152,6 +161,7 @@ describe EY::Resolver::AppEnvResolver do
|
|
152
161
|
|
153
162
|
it "repo not found" do
|
154
163
|
resolver = app_env_resolver(nil, nil, nil, ["git://fake.com/fake/fake.git"])
|
164
|
+
resolver.matches.should == []
|
155
165
|
resolver.errors.should ==
|
156
166
|
[%|No application found matching remotes:\n\tgit://fake.com/fake/fake.git|]
|
157
167
|
resolver.suggestions.should be_empty
|
@@ -159,6 +169,7 @@ describe EY::Resolver::AppEnvResolver do
|
|
159
169
|
|
160
170
|
it "repo not found in account" do
|
161
171
|
resolver = app_env_resolver('ey', nil, nil, ["git://github.com/repo/oth.git"])
|
172
|
+
resolver.matches.should == []
|
162
173
|
resolver.errors.should ==
|
163
174
|
[%|Application "other" found, but does not exist in account "ey".|]
|
164
175
|
resolver.suggestions.should =~
|
@@ -166,17 +177,19 @@ describe EY::Resolver::AppEnvResolver do
|
|
166
177
|
end
|
167
178
|
|
168
179
|
it "app and environment not associated" do
|
169
|
-
resolver = app_env_resolver('ey', 'bigapp', '
|
180
|
+
resolver = app_env_resolver('ey', 'bigapp', 'app_production')
|
181
|
+
resolver.matches.should == []
|
170
182
|
resolver.errors.should ==
|
171
|
-
[%|Application "bigapp" and environment "
|
183
|
+
[%|Application "bigapp" and environment "app_production" are not associated.|]
|
172
184
|
resolver.suggestions.should =~ [
|
173
185
|
{'account_name' => 'ey', 'app_name' => 'bigapp', 'environment_name' => 'bigapp_staging'},
|
174
|
-
{'account_name' => 'ey', 'app_name' => 'app', 'environment_name' => '
|
186
|
+
{'account_name' => 'ey', 'app_name' => 'app', 'environment_name' => 'app_production'}
|
175
187
|
]
|
176
188
|
end
|
177
189
|
|
178
190
|
it "another app and environment not associated" do
|
179
191
|
resolver = app_env_resolver(nil, nil, 'app_dup', ["git://github.com/repo/app.git"])
|
192
|
+
resolver.matches.should == []
|
180
193
|
resolver.errors.should ==
|
181
194
|
[%|Application "app" and environment "app_dup" are not associated.|]
|
182
195
|
resolver.suggestions.should =~ [
|
@@ -187,6 +200,7 @@ describe EY::Resolver::AppEnvResolver do
|
|
187
200
|
|
188
201
|
it "app (by repo) does not have an environment" do
|
189
202
|
resolver = app_env_resolver(nil, nil, nil, ["git://github.com/repo/noe.git"])
|
203
|
+
resolver.matches.should == []
|
190
204
|
resolver.errors.should ==
|
191
205
|
[%|No environment found for applications matching remotes:\n\tgit://github.com/repo/noe.git|]
|
192
206
|
resolver.suggestions.should be_empty
|
data/spec/app_resolver_spec.rb
CHANGED
@@ -65,41 +65,41 @@ describe EY::Resolver::AppEnvResolver do
|
|
65
65
|
|
66
66
|
describe "#errors" do
|
67
67
|
it "no account" do
|
68
|
-
app_resolver('gibberish', 'app', 'production')
|
68
|
+
resolver = app_resolver('gibberish', 'app', 'production')
|
69
|
+
resolver.matches.should == []
|
70
|
+
resolver.errors.should ==
|
69
71
|
[%|No account found matching "gibberish".|]
|
70
72
|
end
|
71
73
|
|
72
74
|
it "no app" do
|
73
|
-
app_resolver(nil, 'gibberish', 'app_dup')
|
75
|
+
resolver = app_resolver(nil, 'gibberish', 'app_dup')
|
76
|
+
resolver.matches.should == []
|
77
|
+
resolver.errors.should ==
|
74
78
|
[%|No application found matching "gibberish".|]
|
75
79
|
end
|
76
80
|
|
77
81
|
it "app found, but not on account" do
|
78
|
-
app_resolver('no', 'bigapp', 'app_dup')
|
82
|
+
resolver = app_resolver('no', 'bigapp', 'app_dup')
|
83
|
+
resolver.matches.should == []
|
84
|
+
resolver.errors.should == [
|
79
85
|
%|Application "bigapp" found, but does not exist in account "no".|,
|
80
86
|
%|Environment "app_dup" found, but does not exist in account "no".|,
|
81
87
|
]
|
82
88
|
end
|
83
89
|
|
84
|
-
it "no env" do
|
85
|
-
app_resolver('ey', 'app', 'gibberish').errors.should ==
|
86
|
-
[%|No environment found matching "gibberish".|]
|
87
|
-
end
|
88
|
-
|
89
|
-
it "no env on account" do
|
90
|
-
app_resolver('me', 'other', 'production').errors.should ==
|
91
|
-
[%|Environment "production" found, but does not exist in account "me".|]
|
92
|
-
end
|
93
|
-
|
94
90
|
it "no account or app" do
|
95
|
-
app_resolver('gibberish', 'gibberish', nil)
|
91
|
+
resolver = app_resolver('gibberish', 'gibberish', nil)
|
92
|
+
resolver.matches.should == []
|
93
|
+
resolver.errors.should == [
|
96
94
|
%|No account found matching "gibberish".|,
|
97
95
|
%|No application found matching "gibberish".|,
|
98
96
|
]
|
99
97
|
end
|
100
98
|
|
101
99
|
it "no account or app or env" do
|
102
|
-
app_resolver('gibberish', 'gibberish', 'gibberish')
|
100
|
+
resolver = app_resolver('gibberish', 'gibberish', 'gibberish')
|
101
|
+
resolver.matches.should == []
|
102
|
+
resolver.errors.should == [
|
103
103
|
%|No account found matching "gibberish".|,
|
104
104
|
%|No application found matching "gibberish".|,
|
105
105
|
%|No environment found matching "gibberish".|,
|
@@ -107,12 +107,16 @@ describe EY::Resolver::AppEnvResolver do
|
|
107
107
|
end
|
108
108
|
|
109
109
|
it "repo not found" do
|
110
|
-
app_resolver(nil, nil, nil, ["git://fake.com/fake/fake.git"])
|
110
|
+
resolver = app_resolver(nil, nil, nil, ["git://fake.com/fake/fake.git"])
|
111
|
+
resolver.matches.should == []
|
112
|
+
resolver.errors.should ==
|
111
113
|
[%|No application found matching remotes:\n\tgit://fake.com/fake/fake.git|]
|
112
114
|
end
|
113
115
|
|
114
116
|
it "repo not found in account" do
|
115
|
-
app_resolver('ey', nil, nil, ["git://github.com/repo/oth.git"])
|
117
|
+
resolver = app_resolver('ey', nil, nil, ["git://github.com/repo/oth.git"])
|
118
|
+
resolver.matches.should == []
|
119
|
+
resolver.errors.should ==
|
116
120
|
[%|Application "other" found, but does not exist in account "ey".|]
|
117
121
|
end
|
118
122
|
|
@@ -85,6 +85,7 @@ describe EY::Resolver::EnvironmentResolver do
|
|
85
85
|
describe "errors and suggestions" do
|
86
86
|
it "no account" do
|
87
87
|
resolver = env_resolver('gibberish', 'app', 'production')
|
88
|
+
resolver.matches.should == []
|
88
89
|
resolver.errors.should ==
|
89
90
|
[%|No account found matching "gibberish".|]
|
90
91
|
resolver.suggestions.should be_empty
|
@@ -92,6 +93,7 @@ describe EY::Resolver::EnvironmentResolver do
|
|
92
93
|
|
93
94
|
it "no app" do
|
94
95
|
resolver = env_resolver(nil, 'gibberish', 'app_dup')
|
96
|
+
resolver.matches.should == []
|
95
97
|
resolver.errors.should ==
|
96
98
|
[%|No application found matching "gibberish".|]
|
97
99
|
resolver.suggestions.should be_empty
|
@@ -99,6 +101,7 @@ describe EY::Resolver::EnvironmentResolver do
|
|
99
101
|
|
100
102
|
it "app found, but not on account" do
|
101
103
|
resolver = env_resolver('no', 'bigapp', 'app_dup')
|
104
|
+
resolver.matches.should == []
|
102
105
|
resolver.errors.should == [
|
103
106
|
%|Application "bigapp" found, but does not exist in account "no".|,
|
104
107
|
%|Environment "app_dup" found, but does not exist in account "no".|,
|
@@ -113,6 +116,7 @@ describe EY::Resolver::EnvironmentResolver do
|
|
113
116
|
|
114
117
|
it "no env" do
|
115
118
|
resolver = env_resolver('ey', nil, 'gibberish')
|
119
|
+
resolver.matches.should == []
|
116
120
|
resolver.errors.should ==
|
117
121
|
[%|No environment found matching "gibberish".|]
|
118
122
|
resolver.suggestions.should be_empty
|
@@ -120,6 +124,7 @@ describe EY::Resolver::EnvironmentResolver do
|
|
120
124
|
|
121
125
|
it "no env on account" do
|
122
126
|
resolver = env_resolver('no', nil, 'app_dup')
|
127
|
+
resolver.matches.should == []
|
123
128
|
resolver.errors.should ==
|
124
129
|
[%|Environment "app_dup" found, but does not exist in account "no".|]
|
125
130
|
resolver.suggestions.should =~ [
|
@@ -131,6 +136,7 @@ describe EY::Resolver::EnvironmentResolver do
|
|
131
136
|
|
132
137
|
it "no account or app" do
|
133
138
|
resolver = env_resolver('gibberish', 'gibberish', nil)
|
139
|
+
resolver.matches.should == []
|
134
140
|
resolver.errors.should == [
|
135
141
|
%|No account found matching "gibberish".|,
|
136
142
|
%|No application found matching "gibberish".|,
|
@@ -140,6 +146,7 @@ describe EY::Resolver::EnvironmentResolver do
|
|
140
146
|
|
141
147
|
it "no account or app or env" do
|
142
148
|
resolver = env_resolver('gibberish', 'gibberish', 'gibberish')
|
149
|
+
resolver.matches.should == []
|
143
150
|
resolver.errors.should == [
|
144
151
|
%|No account found matching "gibberish".|,
|
145
152
|
%|No application found matching "gibberish".|,
|
@@ -150,6 +157,7 @@ describe EY::Resolver::EnvironmentResolver do
|
|
150
157
|
|
151
158
|
it "repo not found" do
|
152
159
|
resolver = env_resolver(nil, nil, nil, ["git://fake.com/fake/fake.git"])
|
160
|
+
resolver.matches.should == []
|
153
161
|
resolver.errors.should ==
|
154
162
|
[%|No application found matching remotes:\n\tgit://fake.com/fake/fake.git|]
|
155
163
|
resolver.suggestions.should be_empty
|
@@ -157,6 +165,7 @@ describe EY::Resolver::EnvironmentResolver do
|
|
157
165
|
|
158
166
|
it "repo found but env doesn't exist on it" do
|
159
167
|
resolver = env_resolver(nil, nil, nil, ["git://github.com/repo/noe.git"])
|
168
|
+
resolver.matches.should == []
|
160
169
|
resolver.errors.should ==
|
161
170
|
[%|No environment found for applications matching remotes:\n\tgit://github.com/repo/noe.git|]
|
162
171
|
resolver.suggestions.should be_empty
|
@@ -164,6 +173,7 @@ describe EY::Resolver::EnvironmentResolver do
|
|
164
173
|
|
165
174
|
it "repo not found in account" do
|
166
175
|
resolver = env_resolver('ey', nil, nil, ["git://github.com/repo/oth.git"])
|
176
|
+
resolver.matches.should == []
|
167
177
|
resolver.errors.should ==
|
168
178
|
[%|Application "other" found, but does not exist in account "ey".|]
|
169
179
|
resolver.suggestions.should =~
|
@@ -172,6 +182,7 @@ describe EY::Resolver::EnvironmentResolver do
|
|
172
182
|
|
173
183
|
it "app and environment not associated" do
|
174
184
|
resolver = env_resolver('ey', 'bigapp', 'app_dup')
|
185
|
+
resolver.matches.should == []
|
175
186
|
resolver.errors.should ==
|
176
187
|
[%|Application "bigapp" and environment "app_dup" are not associated.|]
|
177
188
|
resolver.suggestions.should =~ [
|
@@ -180,18 +191,9 @@ describe EY::Resolver::EnvironmentResolver do
|
|
180
191
|
]
|
181
192
|
end
|
182
193
|
|
183
|
-
it "app (by repo) and environment not associated" do
|
184
|
-
resolver = env_resolver(nil, nil, 'app_dup', ["git://github.com/repo/app.git"])
|
185
|
-
resolver.errors.should ==
|
186
|
-
[%|Application "app" and environment "app_dup" are not associated.|]
|
187
|
-
resolver.suggestions.should =~ [
|
188
|
-
{"account_name"=>"ey", 'app_name' => 'app', "environment_name"=>"app_production"},
|
189
|
-
{"account_name"=>"ey", 'app_name' => 'app', "environment_name"=>"app_staging"}
|
190
|
-
]
|
191
|
-
end
|
192
|
-
|
193
194
|
it "app (by repo) does not have an environment" do
|
194
195
|
resolver = env_resolver(nil, nil, nil, ["git://github.com/repo/noe.git"])
|
196
|
+
resolver.matches.should == []
|
195
197
|
resolver.errors.should ==
|
196
198
|
[%|No environment found for applications matching remotes:\n\tgit://github.com/repo/noe.git|]
|
197
199
|
resolver.suggestions.should be_empty
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ey_resolver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-05-16 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gitable
|
16
|
-
requirement: &
|
16
|
+
requirement: &70189243891520 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.2.3
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70189243891520
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70189243891100 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70189243891100
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70189243890560 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '2.0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70189243890560
|
47
47
|
description: Resolves apps, environments, app_environments and accounts using a set
|
48
48
|
of constraints
|
49
49
|
email:
|
@@ -92,7 +92,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
92
92
|
version: '0'
|
93
93
|
segments:
|
94
94
|
- 0
|
95
|
-
hash:
|
95
|
+
hash: 4321533697507775913
|
96
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
97
|
none: false
|
98
98
|
requirements:
|
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
101
|
version: '0'
|
102
102
|
segments:
|
103
103
|
- 0
|
104
|
-
hash:
|
104
|
+
hash: 4321533697507775913
|
105
105
|
requirements: []
|
106
106
|
rubyforge_project: ey_resolver
|
107
107
|
rubygems_version: 1.8.15
|