machinery-tool 1.9.1 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/NEWS +7 -0
  3. data/html/assets/compare/machinery-compare.js +43 -0
  4. data/html/assets/compare/machinery.js +17 -0
  5. data/html/assets/machinery.css +13 -0
  6. data/html/assets/modal.js +280 -0
  7. data/html/assets/show/machinery-show.js +16 -9
  8. data/html/assets/show/machinery.js +61 -25
  9. data/html/comparison.html.haml +194 -116
  10. data/html/index.html.haml +46 -12
  11. data/lib/array.rb +2 -1
  12. data/lib/cli.rb +44 -23
  13. data/lib/compare_task.rb +5 -29
  14. data/lib/comparison.rb +69 -0
  15. data/lib/config.rb +4 -0
  16. data/lib/export_task.rb +7 -0
  17. data/lib/file_scope.rb +2 -2
  18. data/lib/html.rb +165 -88
  19. data/lib/machinery.rb +6 -2
  20. data/lib/{generate_html_task.rb → man_task.rb} +8 -6
  21. data/lib/object.rb +1 -1
  22. data/lib/renderer.rb +70 -41
  23. data/lib/{scope_file_access.rb → scope_file_access_archive.rb} +23 -20
  24. data/lib/scope_file_access_flat.rb +36 -0
  25. data/lib/serve_html_task.rb +33 -0
  26. data/lib/show_task.rb +19 -5
  27. data/lib/system_file.rb +25 -0
  28. data/lib/version.rb +1 -1
  29. data/man/generated/machinery.1.gz +0 -0
  30. data/man/generated/machinery.1.html +60 -34
  31. data/plugins/changed_managed_files/changed_managed_files_renderer.rb +5 -5
  32. data/plugins/config_files/config_files_renderer.rb +7 -6
  33. data/plugins/groups/groups_renderer.rb +3 -3
  34. data/plugins/os/os_renderer.rb +5 -5
  35. data/plugins/packages/packages_model.rb +25 -0
  36. data/plugins/packages/packages_renderer.rb +36 -5
  37. data/plugins/patterns/patterns_renderer.rb +3 -3
  38. data/plugins/repositories/repositories_model.rb +1 -1
  39. data/plugins/repositories/repositories_renderer.rb +4 -4
  40. data/plugins/services/services_model.rb +2 -2
  41. data/plugins/services/services_renderer.rb +3 -3
  42. data/plugins/unmanaged_files/unmanaged_files_model.rb +2 -1
  43. data/plugins/unmanaged_files/unmanaged_files_renderer.rb +5 -5
  44. data/plugins/users/users_renderer.rb +3 -3
  45. metadata +36 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8755dd722d4450f406fe08db1700528783ff297
4
- data.tar.gz: 3709616bfe0e90ac03543cda9ad942cc60ee8800
3
+ metadata.gz: 0248c07e10c874fd1b90d77d42b98e27ce2f5aa2
4
+ data.tar.gz: cf74177f9c3e73febd1137c9e9c4a028a1dc6676
5
5
  SHA512:
6
- metadata.gz: e8f9fd19e24aeced39f9c6218461aa35145484b53e99de5961d90a9e8933928538aceb53da569714210a2d5fb1d32b6859a73fb383b6b7db2942c601e468c0a7
7
- data.tar.gz: a634e571b90b353f7c3f878ccb9dec19ced958df03d0401d7851226847cf4bbc7ce643b8acd7aebc5bc5c69a7cda5db0f445d1a2e19b5886b5e560db74a6dc60
6
+ metadata.gz: bd8586da9a47fbff50c9b9c4e59ed2fbd6b31e4cd8cdf17c3abc56d2b10a91c0ffa205cae7619255620a27cd852a400e197482707b5189cf1da7e8668f28be3c
7
+ data.tar.gz: 94af88fa5b75517220f9a5383d8306da20a729ccc0c93c09b64e28042577806e98b7d839aedc26e261fdb0da10ee085641fef636980f6d8a2f346419d67c317b
data/NEWS CHANGED
@@ -1,6 +1,13 @@
1
1
  # Machinery Release Notes
2
2
 
3
3
 
4
+ ## Version 1.10.0 - Thu Jul 09 16:26:35 CEST 2015 - thardeck@suse.de
5
+
6
+ * Data which hasn't changed is not shown in the comparison HTML view by default
7
+ * Improve display of package differences in compare command
8
+ * Add `man` command to show the Machinery man page
9
+ * Content of extracted files can be displayed in HTML view
10
+
4
11
  ## Version 1.9.1 - Tue Jun 23 16:57:35 CEST 2015 - thardeck@suse.de
5
12
 
6
13
  * `machinery config` takes arguments of the form 'key=value' as well
@@ -22,6 +22,11 @@ angular.module("machinery-compare")
22
22
  template: "<h3>In both descriptions:</h3>"
23
23
  };
24
24
  })
25
+ .directive("changed", function() {
26
+ return {
27
+ template: "<h3>In both with different attributes:</h3>"
28
+ };
29
+ })
25
30
  .directive("renderTemplate", function() {
26
31
  return {
27
32
  restrict: "E",
@@ -34,3 +39,41 @@ angular.module("machinery-compare")
34
39
  template: '<div ng-include="templateUrl"></div>'
35
40
  };
36
41
  });
42
+
43
+
44
+ // Scope specific directives
45
+ angular.module("machinery-compare")
46
+ .directive("changedPackages", function() {
47
+ return {
48
+ restrict: "E",
49
+ scope: {
50
+ object: "=object"
51
+ },
52
+ link: function(scope, element, attrs) {
53
+ var elements = [];
54
+
55
+ angular.forEach(scope.object, function(value) {
56
+ var changes = [];
57
+ var relevant_attributes = ["version", "vendor", "arch"];
58
+
59
+ if(value[0].version == value[1].version) {
60
+ relevant_attributes.push("release");
61
+ if(value[0].version == value[1].version) {
62
+ relevant_attributes.push("checksum");
63
+ }
64
+ }
65
+
66
+ angular.forEach(relevant_attributes, function(attribute) {
67
+ if(value[0][attribute] != value[1][attribute]) {
68
+ changes.push(attribute + ": " + value[0][attribute] + " ↔ " + value[1][attribute]);
69
+ }
70
+ });
71
+
72
+ elements.push(value[0].name + " (" + changes.join(", ") + ")");
73
+ });
74
+
75
+ scope.changed_elements = elements;
76
+ },
77
+ templateUrl: "scope_packages_changed_partial"
78
+ };
79
+ });
@@ -50,4 +50,21 @@ $(document).ready(function () {
50
50
  $(this).hide();
51
51
  $("#collapse-all").show();
52
52
  });
53
+
54
+ // Show or hide elements which are common in scope
55
+ $(".show-common-elements").click(function(){
56
+ $scope = $(this).closest(".scope");
57
+ $scope.find(".scope_common_content").collapse("show");
58
+ $(this).hide();
59
+ $scope.find(".hide-common-elements").show();
60
+ return false;
61
+ });
62
+
63
+ $(".hide-common-elements").click(function(){
64
+ $scope = $(this).closest(".scope");
65
+ $scope.find(".scope_common_content").collapse("hide");
66
+ $(this).hide();
67
+ $scope.find(".show-common-elements").show();
68
+ return false;
69
+ });
53
70
  });
@@ -24,6 +24,8 @@ a.both_anchor {
24
24
  visibility: hidden;
25
25
  }
26
26
 
27
+ .scope_content{border-bottom: 1px dotted #d58512}
28
+
27
29
  .scope-summary {
28
30
  display: inline;
29
31
  font-weight: normal;
@@ -84,10 +86,15 @@ span.toggle {
84
86
  height: 24px;
85
87
  background: url("arrow_up.png");
86
88
  cursor: pointer;
89
+ background-color: white;
90
+ border-radius: 50%;
91
+
87
92
  }
88
93
 
89
94
  span.toggle.collapsed {
90
95
  background :url("arrow_down.png");
96
+ background-color: white;
97
+ border-radius: 50%;
91
98
  }
92
99
 
93
100
  .popover{
@@ -177,3 +184,9 @@ li.filter {
177
184
  h1 {
178
185
  display: inline-block;
179
186
  }
187
+
188
+ #file-modal-file-content {
189
+ width: 100%;
190
+ min-height: 450px;
191
+ font-family: monospace;
192
+ }
@@ -0,0 +1,280 @@
1
+ /* ========================================================================
2
+ * Bootstrap: modal.js v3.2.0
3
+ * http://getbootstrap.com/javascript/#modals
4
+ * ========================================================================
5
+ * Copyright 2011-2014 Twitter, Inc.
6
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7
+ * ======================================================================== */
8
+
9
+
10
+ +function ($) {
11
+ 'use strict';
12
+
13
+ // MODAL CLASS DEFINITION
14
+ // ======================
15
+
16
+ var Modal = function (element, options) {
17
+ this.options = options
18
+ this.$body = $(document.body)
19
+ this.$element = $(element)
20
+ this.$backdrop =
21
+ this.isShown = null
22
+ this.scrollbarWidth = 0
23
+
24
+ if (this.options.remote) {
25
+ this.$element
26
+ .find('.modal-content')
27
+ .load(this.options.remote, $.proxy(function () {
28
+ this.$element.trigger('loaded.bs.modal')
29
+ }, this))
30
+ }
31
+ }
32
+
33
+ Modal.VERSION = '3.2.0'
34
+
35
+ Modal.DEFAULTS = {
36
+ backdrop: true,
37
+ keyboard: true,
38
+ show: true
39
+ }
40
+
41
+ Modal.prototype.toggle = function (_relatedTarget) {
42
+ return this.isShown ? this.hide() : this.show(_relatedTarget)
43
+ }
44
+
45
+ Modal.prototype.show = function (_relatedTarget) {
46
+ var that = this
47
+ var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
48
+
49
+ this.$element.trigger(e)
50
+
51
+ if (this.isShown || e.isDefaultPrevented()) return
52
+
53
+ this.isShown = true
54
+
55
+ this.checkScrollbar()
56
+ this.$body.addClass('modal-open')
57
+
58
+ this.setScrollbar()
59
+ this.escape()
60
+
61
+ this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
62
+
63
+ this.backdrop(function () {
64
+ var transition = $.support.transition && that.$element.hasClass('fade')
65
+
66
+ if (!that.$element.parent().length) {
67
+ that.$element.appendTo(that.$body) // don't move modals dom position
68
+ }
69
+
70
+ that.$element
71
+ .show()
72
+ .scrollTop(0)
73
+
74
+ if (transition) {
75
+ that.$element[0].offsetWidth // force reflow
76
+ }
77
+
78
+ that.$element
79
+ .addClass('in')
80
+ .attr('aria-hidden', false)
81
+
82
+ that.enforceFocus()
83
+
84
+ var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
85
+
86
+ transition ?
87
+ that.$element.find('.modal-dialog') // wait for modal to slide in
88
+ .one('bsTransitionEnd', function () {
89
+ that.$element.trigger('focus').trigger(e)
90
+ })
91
+ .emulateTransitionEnd(300) :
92
+ that.$element.trigger('focus').trigger(e)
93
+ })
94
+ }
95
+
96
+ Modal.prototype.hide = function (e) {
97
+ if (e) e.preventDefault()
98
+
99
+ e = $.Event('hide.bs.modal')
100
+
101
+ this.$element.trigger(e)
102
+
103
+ if (!this.isShown || e.isDefaultPrevented()) return
104
+
105
+ this.isShown = false
106
+
107
+ this.$body.removeClass('modal-open')
108
+
109
+ this.resetScrollbar()
110
+ this.escape()
111
+
112
+ $(document).off('focusin.bs.modal')
113
+
114
+ this.$element
115
+ .removeClass('in')
116
+ .attr('aria-hidden', true)
117
+ .off('click.dismiss.bs.modal')
118
+
119
+ $.support.transition && this.$element.hasClass('fade') ?
120
+ this.$element
121
+ .one('bsTransitionEnd', $.proxy(this.hideModal, this))
122
+ .emulateTransitionEnd(300) :
123
+ this.hideModal()
124
+ }
125
+
126
+ Modal.prototype.enforceFocus = function () {
127
+ $(document)
128
+ .off('focusin.bs.modal') // guard against infinite focus loop
129
+ .on('focusin.bs.modal', $.proxy(function (e) {
130
+ if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
131
+ this.$element.trigger('focus')
132
+ }
133
+ }, this))
134
+ }
135
+
136
+ Modal.prototype.escape = function () {
137
+ if (this.isShown && this.options.keyboard) {
138
+ this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
139
+ e.which == 27 && this.hide()
140
+ }, this))
141
+ } else if (!this.isShown) {
142
+ this.$element.off('keyup.dismiss.bs.modal')
143
+ }
144
+ }
145
+
146
+ Modal.prototype.hideModal = function () {
147
+ var that = this
148
+ this.$element.hide()
149
+ this.backdrop(function () {
150
+ that.$element.trigger('hidden.bs.modal')
151
+ })
152
+ }
153
+
154
+ Modal.prototype.removeBackdrop = function () {
155
+ this.$backdrop && this.$backdrop.remove()
156
+ this.$backdrop = null
157
+ }
158
+
159
+ Modal.prototype.backdrop = function (callback) {
160
+ var that = this
161
+ var animate = this.$element.hasClass('fade') ? 'fade' : ''
162
+
163
+ if (this.isShown && this.options.backdrop) {
164
+ var doAnimate = $.support.transition && animate
165
+
166
+ this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
167
+ .appendTo(this.$body)
168
+
169
+ this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
170
+ if (e.target !== e.currentTarget) return
171
+ this.options.backdrop == 'static'
172
+ ? this.$element[0].focus.call(this.$element[0])
173
+ : this.hide.call(this)
174
+ }, this))
175
+
176
+ if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
177
+
178
+ this.$backdrop.addClass('in')
179
+
180
+ if (!callback) return
181
+
182
+ doAnimate ?
183
+ this.$backdrop
184
+ .one('bsTransitionEnd', callback)
185
+ .emulateTransitionEnd(150) :
186
+ callback()
187
+
188
+ } else if (!this.isShown && this.$backdrop) {
189
+ this.$backdrop.removeClass('in')
190
+
191
+ var callbackRemove = function () {
192
+ that.removeBackdrop()
193
+ callback && callback()
194
+ }
195
+ $.support.transition && this.$element.hasClass('fade') ?
196
+ this.$backdrop
197
+ .one('bsTransitionEnd', callbackRemove)
198
+ .emulateTransitionEnd(150) :
199
+ callbackRemove()
200
+
201
+ } else if (callback) {
202
+ callback()
203
+ }
204
+ }
205
+
206
+ Modal.prototype.checkScrollbar = function () {
207
+ if (document.body.clientWidth >= window.innerWidth) return
208
+ this.scrollbarWidth = this.scrollbarWidth || this.measureScrollbar()
209
+ }
210
+
211
+ Modal.prototype.setScrollbar = function () {
212
+ var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
213
+ if (this.scrollbarWidth) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
214
+ }
215
+
216
+ Modal.prototype.resetScrollbar = function () {
217
+ this.$body.css('padding-right', '')
218
+ }
219
+
220
+ Modal.prototype.measureScrollbar = function () { // thx walsh
221
+ var scrollDiv = document.createElement('div')
222
+ scrollDiv.className = 'modal-scrollbar-measure'
223
+ this.$body.append(scrollDiv)
224
+ var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
225
+ this.$body[0].removeChild(scrollDiv)
226
+ return scrollbarWidth
227
+ }
228
+
229
+
230
+ // MODAL PLUGIN DEFINITION
231
+ // =======================
232
+
233
+ function Plugin(option, _relatedTarget) {
234
+ return this.each(function () {
235
+ var $this = $(this)
236
+ var data = $this.data('bs.modal')
237
+ var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
238
+
239
+ if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
240
+ if (typeof option == 'string') data[option](_relatedTarget)
241
+ else if (options.show) data.show(_relatedTarget)
242
+ })
243
+ }
244
+
245
+ var old = $.fn.modal
246
+
247
+ $.fn.modal = Plugin
248
+ $.fn.modal.Constructor = Modal
249
+
250
+
251
+ // MODAL NO CONFLICT
252
+ // =================
253
+
254
+ $.fn.modal.noConflict = function () {
255
+ $.fn.modal = old
256
+ return this
257
+ }
258
+
259
+
260
+ // MODAL DATA-API
261
+ // ==============
262
+
263
+ $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
264
+ var $this = $(this)
265
+ var href = $this.attr('href')
266
+ var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
267
+ var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
268
+
269
+ if ($this.is('a')) e.preventDefault()
270
+
271
+ $target.one('show.bs.modal', function (showEvent) {
272
+ if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
273
+ $target.one('hidden.bs.modal', function () {
274
+ $this.is(':visible') && $this.trigger('focus')
275
+ })
276
+ })
277
+ Plugin.call($target, option, this)
278
+ })
279
+
280
+ }(jQuery);
@@ -4,17 +4,24 @@ angular.module("machinery-show")
4
4
  .config(function($locationProvider) {
5
5
  $locationProvider.html5Mode({enabled: true, requireBase: false});
6
6
  })
7
- .controller("showController", function($scope) {
8
- $scope.description = getDescription();
7
+ .controller("showController", function($scope, $http, $timeout, $anchorScroll) {
8
+ $http.get("/descriptions/" + $("body").data("description") + ".js").then(function(result) {
9
+ // Setup links and scroll to desired scope when rendering is done
10
+ $timeout(function() {
11
+ setupDynamicContent();
12
+ $anchorScroll();
13
+ }, 0);
14
+ $scope.description = result.data;
9
15
 
10
16
 
11
- $scope.description.meta_info = {};
12
- angular.forEach($scope.description, function(index, scope) {
13
- if($scope.description.meta[scope]) {
14
- $scope.description.meta_info[scope] = " (" +
15
- "inspected host: '" + $scope.description.meta[scope].hostname + "', " +
16
- "at: " + new Date($scope.description.meta[scope].modified).toLocaleString() + ")";
17
- }
17
+ $scope.description.meta_info = {};
18
+ angular.forEach($scope.description, function(index, scope) {
19
+ if($scope.description.meta[scope]) {
20
+ $scope.description.meta_info[scope] = " (" +
21
+ "inspected host: '" + $scope.description.meta[scope].hostname + "', " +
22
+ "at: " + new Date($scope.description.meta[scope].modified).toLocaleString() + ")";
23
+ }
24
+ });
18
25
  });
19
26
  })
20
27
  .directive("scopeHeader", function(){