kubes 0.7.2 → 0.7.6
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 +4 -4
- data/CHANGELOG.md +14 -0
- data/README.md +3 -1
- data/docs/_docs/config/reference.md +1 -1
- data/docs/_docs/intro/how-kubes-works.md +2 -0
- data/docs/_docs/vs/helm.md +3 -3
- data/docs/_includes/header.html +7 -0
- data/docs/_includes/reference.md +1 -1
- data/docs/_sass/theme.scss +92 -0
- data/docs/index.html +2 -2
- data/docs/search/data.json +44 -0
- data/docs/search/index.html +30 -0
- data/docs/search/lunr.js +3475 -0
- data/docs/search/search.js +247 -0
- data/docs/search/tips.md +48 -0
- data/lib/kubes/cli/init.rb +2 -1
- data/lib/kubes/compiler/decorator/base.rb +2 -2
- data/lib/kubes/compiler/dsl/core/fields.rb +1 -1
- data/lib/kubes/compiler/dsl/syntax/resource.rb +2 -2
- data/lib/kubes/compiler/strategy/dispatcher.rb +2 -2
- data/lib/kubes/compiler.rb +2 -1
- data/lib/kubes/core.rb +6 -0
- data/lib/kubes/docker/args/default.rb +0 -4
- data/lib/kubes/version.rb +1 -1
- data/lib/kubes.rb +1 -0
- data/lib/templates/yaml/.kubes/resources/base/deployment.yaml.tt +0 -3
- data/lib/templates/yaml/.kubes/resources/shared/namespace.yaml.tt +0 -2
- metadata +8 -3
@@ -0,0 +1,247 @@
|
|
1
|
+
/**
|
2
|
+
* A simple JSON search
|
3
|
+
* Requires jQuery (v 1.7+)
|
4
|
+
*
|
5
|
+
* @author Mat Hayward - Erskine Design
|
6
|
+
* @author Rishikesh Darandale <Rishikesh.Darandale@gmail.com>
|
7
|
+
* @version 1.1
|
8
|
+
*/
|
9
|
+
|
10
|
+
var q, jsonFeedUrl = "/search/data.json",
|
11
|
+
$searchForm = $("[data-search-form]"),
|
12
|
+
$searchInput = $("[data-search-input]"),
|
13
|
+
$resultTemplate = $("#search-result"),
|
14
|
+
$resultsPlaceholder = $("[data-search-results]"),
|
15
|
+
$foundContainer = $("[data-search-found]"),
|
16
|
+
$foundTerm = $("[data-search-found-term]"),
|
17
|
+
$foundCount = $("[data-search-found-count]"),
|
18
|
+
$foundWord = $("[data-search-found-word]"),
|
19
|
+
allowEmpty = true,
|
20
|
+
showLoader = true,
|
21
|
+
loadingClass = "is--loading",
|
22
|
+
indexVar;
|
23
|
+
|
24
|
+
|
25
|
+
$(document).ready( function() {
|
26
|
+
// hide items found string
|
27
|
+
$foundContainer.hide();
|
28
|
+
// initiate search functionality
|
29
|
+
initSearch();
|
30
|
+
});
|
31
|
+
|
32
|
+
function initSearch() {
|
33
|
+
if(!sessionStorage.getItem("lunrIndex")) {
|
34
|
+
// get the data
|
35
|
+
getData();
|
36
|
+
} else {
|
37
|
+
// Get search results if q parameter is set in querystring
|
38
|
+
if (getParameterByName('q')) {
|
39
|
+
q = decodeURIComponent(getParameterByName('q'));
|
40
|
+
$searchInput.val(q);
|
41
|
+
execSearch(q);
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
// Get search results on submission of form
|
46
|
+
$(document).on("submit", $searchForm, function(e) {
|
47
|
+
console.log("form submitted");
|
48
|
+
e.preventDefault();
|
49
|
+
q = $searchInput.val();
|
50
|
+
execSearch(q);
|
51
|
+
});
|
52
|
+
}
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Get the JSON data
|
56
|
+
* Get the generated feeds/feed.json file so lunr.js can search it locally.
|
57
|
+
* Store the index in sessionStorage
|
58
|
+
*/
|
59
|
+
function getData(indexVar) {
|
60
|
+
jqxhr = $.getJSON(jsonFeedUrl)
|
61
|
+
.done(function(loaded_data){
|
62
|
+
// save the actual data as well
|
63
|
+
sessionStorage.setItem("actualData", JSON.stringify(loaded_data));
|
64
|
+
// set the index fields
|
65
|
+
indexVar = lunr(function () {
|
66
|
+
this.field('id');
|
67
|
+
this.field('title', { boost: 10 });
|
68
|
+
this.field('search_title', { boost: 10 });
|
69
|
+
this.field('content', { boost: 10 });
|
70
|
+
this.field('author');
|
71
|
+
loaded_data.forEach(function (doc, index) {
|
72
|
+
if ( doc.search_omit != "true" ) {
|
73
|
+
console.log("adding to index: " + doc.title);
|
74
|
+
this.add($.extend({ "id": index }, doc));
|
75
|
+
}
|
76
|
+
}, this)
|
77
|
+
});
|
78
|
+
// store the index in sessionStorage
|
79
|
+
sessionStorage.setItem("lunrIndex", JSON.stringify(indexVar));
|
80
|
+
// Get search results if q parameter is set in querystring
|
81
|
+
if (getParameterByName('q')) {
|
82
|
+
q = decodeURIComponent(getParameterByName('q'));
|
83
|
+
$searchInput.val(q);
|
84
|
+
execSearch(q);
|
85
|
+
}
|
86
|
+
})
|
87
|
+
.fail( function() {
|
88
|
+
console.log("get json failed...");
|
89
|
+
})
|
90
|
+
.always( function() {
|
91
|
+
console.log("finally...");
|
92
|
+
});
|
93
|
+
}
|
94
|
+
|
95
|
+
/**
|
96
|
+
* Get the search result from lunr
|
97
|
+
* @param {String} q
|
98
|
+
* @returns search results
|
99
|
+
*/
|
100
|
+
function getResults(q) {
|
101
|
+
var savedIndexData = JSON.parse(sessionStorage.getItem("lunrIndex"));
|
102
|
+
console.log("Indexed var from sessionStorage: " + savedIndexData);
|
103
|
+
return lunr.Index.load(savedIndexData).search(q);
|
104
|
+
}
|
105
|
+
|
106
|
+
/**
|
107
|
+
* Executes search
|
108
|
+
* @param {String} q
|
109
|
+
* @return null
|
110
|
+
*/
|
111
|
+
function execSearch(q) {
|
112
|
+
if (q != '' || allowEmpty) {
|
113
|
+
if (showLoader) {
|
114
|
+
toggleLoadingClass();
|
115
|
+
}
|
116
|
+
processResultData(getResults(q));
|
117
|
+
changeUrl("Search", "/search/?q=" + encodeURIComponent(q));
|
118
|
+
}
|
119
|
+
}
|
120
|
+
|
121
|
+
/**
|
122
|
+
* Toggles loading class on results and found string
|
123
|
+
* @return null
|
124
|
+
*/
|
125
|
+
function toggleLoadingClass() {
|
126
|
+
$resultsPlaceholder.toggleClass(loadingClass);
|
127
|
+
$foundContainer.toggleClass(loadingClass);
|
128
|
+
}
|
129
|
+
|
130
|
+
/**
|
131
|
+
* Process search result data
|
132
|
+
* @return null
|
133
|
+
*/
|
134
|
+
function processResultData(searchResults) {
|
135
|
+
$results = [];
|
136
|
+
|
137
|
+
console.log("Search Results: " + searchResults);
|
138
|
+
var resultsCount = 0,
|
139
|
+
results = "";
|
140
|
+
|
141
|
+
// Iterate over the results
|
142
|
+
searchResults.forEach(function(result) {
|
143
|
+
var loaded_data = JSON.parse(sessionStorage.getItem("actualData"));
|
144
|
+
var item = loaded_data[result.ref];
|
145
|
+
var result = populateResultContent($resultTemplate.html(), item);
|
146
|
+
resultsCount++;
|
147
|
+
results += result;
|
148
|
+
});
|
149
|
+
|
150
|
+
|
151
|
+
if (showLoader) {
|
152
|
+
toggleLoadingClass();
|
153
|
+
}
|
154
|
+
|
155
|
+
populateResultsString(resultsCount);
|
156
|
+
showSearchResults(results);
|
157
|
+
}
|
158
|
+
|
159
|
+
/**
|
160
|
+
* Add search results to placeholder
|
161
|
+
* @param {String} results
|
162
|
+
* @return null
|
163
|
+
*/
|
164
|
+
function showSearchResults(results) {
|
165
|
+
// Add results HTML to placeholder
|
166
|
+
$resultsPlaceholder.html(results);
|
167
|
+
}
|
168
|
+
|
169
|
+
/**
|
170
|
+
* Add results content to item template
|
171
|
+
* @param {String} html
|
172
|
+
* @param {object} item
|
173
|
+
* @return {String} Populated HTML
|
174
|
+
*/
|
175
|
+
function populateResultContent(html, item) {
|
176
|
+
var title = item.search_title || item.title
|
177
|
+
html = injectContent(html, title, '##Title##');
|
178
|
+
html = injectContent(html, item.link, '##Url##');
|
179
|
+
var content = text_truncate(item.content);
|
180
|
+
html = injectContent(html, content, '##Content##');
|
181
|
+
return html;
|
182
|
+
}
|
183
|
+
|
184
|
+
function text_truncate(str, length, ending) {
|
185
|
+
if (length == null) {
|
186
|
+
length = 255;
|
187
|
+
}
|
188
|
+
if (ending == null) {
|
189
|
+
ending = '...';
|
190
|
+
}
|
191
|
+
if (str.length > length) {
|
192
|
+
return str.substring(0, length - ending.length) + ending;
|
193
|
+
} else {
|
194
|
+
return str;
|
195
|
+
}
|
196
|
+
};
|
197
|
+
|
198
|
+
/**
|
199
|
+
* Populates results string
|
200
|
+
* @param {String} count
|
201
|
+
* @return null
|
202
|
+
*/
|
203
|
+
function populateResultsString(count) {
|
204
|
+
$foundTerm.text(q);
|
205
|
+
$foundCount.text(count);
|
206
|
+
if (count == 1)
|
207
|
+
$foundWord.text("result")
|
208
|
+
else
|
209
|
+
$foundWord.text("results")
|
210
|
+
$foundContainer.show();
|
211
|
+
}
|
212
|
+
|
213
|
+
/* ==========================================================================
|
214
|
+
Helper functions
|
215
|
+
========================================================================== */
|
216
|
+
|
217
|
+
|
218
|
+
/**
|
219
|
+
* Gets query string parameter - taken from http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript
|
220
|
+
* @param {String} name
|
221
|
+
* @return {String} parameter value
|
222
|
+
*/
|
223
|
+
function getParameterByName(name) {
|
224
|
+
var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
|
225
|
+
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
|
226
|
+
}
|
227
|
+
|
228
|
+
/**
|
229
|
+
* Injects content into template using placeholder
|
230
|
+
* @param {String} originalContent
|
231
|
+
* @param {String} injection
|
232
|
+
* @param {String} placeholder
|
233
|
+
* @return {String} injected content
|
234
|
+
*/
|
235
|
+
function injectContent(originalContent, injection, placeholder) {
|
236
|
+
var regex = new RegExp(placeholder, 'g');
|
237
|
+
return originalContent.replace(regex, injection);
|
238
|
+
}
|
239
|
+
|
240
|
+
function changeUrl(page, url) {
|
241
|
+
if (typeof(window.history.pushState) != "undefined") {
|
242
|
+
var obj = { Page: page, Url: url };
|
243
|
+
window.history.pushState(obj, obj.Page, obj.Url);
|
244
|
+
} else {
|
245
|
+
console.log("Browser does not support HTML5.");
|
246
|
+
}
|
247
|
+
}
|
data/docs/search/tips.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
---
|
2
|
+
title: Search Tips
|
3
|
+
---
|
4
|
+
|
5
|
+
Here are some useful search tips that can help to make searching more effective.
|
6
|
+
|
7
|
+
## OR Searches
|
8
|
+
|
9
|
+
By default, searches for multiple terms are combined with OR. If a document matches at least one of the search terms, it will show in the results. So:
|
10
|
+
|
11
|
+
install aws
|
12
|
+
|
13
|
+
Will always result in more results just `install` by itself.
|
14
|
+
|
15
|
+
|
16
|
+
## AND Searches
|
17
|
+
|
18
|
+
To do an AND search of "install AND aws" mark both terms as required, you use a `+` sign in front of each term. Example:
|
19
|
+
|
20
|
+
+install +aws
|
21
|
+
|
22
|
+
This results in pages only with both exactly install and aws.
|
23
|
+
|
24
|
+
## Filter Terms
|
25
|
+
|
26
|
+
To filter "keywords", you use a `-` sign in front of each term. Example:
|
27
|
+
|
28
|
+
+install -aws
|
29
|
+
|
30
|
+
This results in pages only with install but filter or reject any pages with aws.
|
31
|
+
|
32
|
+
## Wildcard
|
33
|
+
|
34
|
+
You can use wildcards:
|
35
|
+
|
36
|
+
install*
|
37
|
+
|
38
|
+
## Fields
|
39
|
+
|
40
|
+
You can target specific fields:
|
41
|
+
|
42
|
+
title:install
|
43
|
+
|
44
|
+
For fields see: [search data.json]({% link search/data.json %})
|
45
|
+
|
46
|
+
## More Tips
|
47
|
+
|
48
|
+
More search tips can be found at: [lunrjs searching](https://lunrjs.com/guides/searching.html)
|
data/lib/kubes/cli/init.rb
CHANGED
@@ -86,10 +86,11 @@ class Kubes::CLI
|
|
86
86
|
ignores = %w[
|
87
87
|
.kubes/output
|
88
88
|
.kubes/state
|
89
|
+
.kubes/tmp
|
89
90
|
].map {|l| "#{l}\n"} # the readlines will have lines with \n so keep consistent for processing
|
90
91
|
if File.exist?(".gitignore")
|
91
92
|
lines = IO.readlines(".gitignore")
|
92
|
-
if lines.detect { |l| l.include?('.kubes/
|
93
|
+
if lines.detect { |l| l.include?('.kubes/tmp') }
|
93
94
|
return # early
|
94
95
|
else
|
95
96
|
lines += ignores
|
@@ -12,9 +12,9 @@ module Kubes::Compiler::Decorator
|
|
12
12
|
|
13
13
|
def result
|
14
14
|
if @data.key?(Kubes::Compiler::Dsl::Core::Blocks)
|
15
|
-
@data.results.each { |k,v|
|
15
|
+
@data.results.each { |k,v| run(v) } # returns nil
|
16
16
|
else
|
17
|
-
|
17
|
+
run # processes and returns @data
|
18
18
|
end
|
19
19
|
@data # important to return @data so we keep the original @data structure: Blocks or Hash
|
20
20
|
end
|
@@ -64,7 +64,7 @@ module Kubes::Compiler::Dsl::Core
|
|
64
64
|
result = instance_variable_get(ivar)
|
65
65
|
result = {} if mode == "reset" # allow user to override with mode: reset option
|
66
66
|
result ||= {} # maintain value for layering
|
67
|
-
|
67
|
+
Kubes.deep_merge!(result, value)
|
68
68
|
instance_variable_set(ivar, result)
|
69
69
|
end
|
70
70
|
end
|
@@ -18,7 +18,7 @@ module Kubes::Compiler::Dsl::Syntax
|
|
18
18
|
# top-level of resource is quite common
|
19
19
|
def default_result
|
20
20
|
data = top.merge(default_top)
|
21
|
-
|
21
|
+
Kubes.deep_merge!(data, default_result_append)
|
22
22
|
data.deep_stringify_keys!
|
23
23
|
HashSqueezer.squeeze(data)
|
24
24
|
end
|
@@ -63,7 +63,7 @@ module Kubes::Compiler::Dsl::Syntax
|
|
63
63
|
|
64
64
|
# For generic kind
|
65
65
|
def field(name, data)
|
66
|
-
|
66
|
+
Kubes.deep_merge!(top, {name => data})
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
@@ -4,8 +4,8 @@ class Kubes::Compiler::Strategy
|
|
4
4
|
result = render(@path) # main
|
5
5
|
results = [result].flatten # ensure array
|
6
6
|
data = results.map! do |main|
|
7
|
-
hash =
|
8
|
-
|
7
|
+
hash = Kubes.deep_merge!(pre_layer, main)
|
8
|
+
Kubes.deep_merge!(hash, post_layer)
|
9
9
|
end
|
10
10
|
Result.new(@save_file, data)
|
11
11
|
end
|
data/lib/kubes/compiler.rb
CHANGED
@@ -57,7 +57,8 @@ module Kubes
|
|
57
57
|
acc << IO.read(file)
|
58
58
|
end
|
59
59
|
content = full.join("\n")
|
60
|
-
path = "#{Kubes.root}/.kubes/
|
60
|
+
path = "#{Kubes.root}/.kubes/tmp/full.yaml" # write to tmp instead of output so it doesnt interfere with kubes get
|
61
|
+
FileUtils.mkdir_p(File.dirname(path))
|
61
62
|
IO.write(path, content)
|
62
63
|
logger.debug "Compiled #{pretty(path)}"
|
63
64
|
end
|
data/lib/kubes/core.rb
CHANGED
@@ -34,5 +34,11 @@ module Kubes
|
|
34
34
|
logger.error "ERROR: It doesnt look like this is a kubes project. Are you sure you are in a kubes project?".color(:red)
|
35
35
|
ENV['TS_TEST'] ? raise : exit(1)
|
36
36
|
end
|
37
|
+
|
38
|
+
# wrapper to ensure we use the same deeper_merge options everywhere
|
39
|
+
def deep_merge!(a, b)
|
40
|
+
a.deeper_merge!(b, overwrite_arrays: true)
|
41
|
+
a
|
42
|
+
end
|
37
43
|
end
|
38
44
|
end
|
data/lib/kubes/version.rb
CHANGED
data/lib/kubes.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kubes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -472,6 +472,11 @@ files:
|
|
472
472
|
- docs/opal/sidebar.rb
|
473
473
|
- docs/opal/sidebar/expander.rb
|
474
474
|
- docs/reference.md
|
475
|
+
- docs/search/data.json
|
476
|
+
- docs/search/index.html
|
477
|
+
- docs/search/lunr.js
|
478
|
+
- docs/search/search.js
|
479
|
+
- docs/search/tips.md
|
475
480
|
- docs/support.md
|
476
481
|
- docs/vendor/bootstrap/css/bootstrap-grid.css
|
477
482
|
- docs/vendor/bootstrap/css/bootstrap-grid.css.map
|
@@ -786,7 +791,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
786
791
|
- !ruby/object:Gem::Version
|
787
792
|
version: '0'
|
788
793
|
requirements: []
|
789
|
-
rubygems_version: 3.1.
|
794
|
+
rubygems_version: 3.1.6
|
790
795
|
signing_key:
|
791
796
|
specification_version: 4
|
792
797
|
summary: 'Kubernetes Deployment Tool: build docker image, compile Kubernetes YAML
|