update_repo 0.9.7 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -6
- data/WEBSITE.md +6 -6
- data/docs/css/site.css +14 -1
- data/docs/index.html +33 -7
- data/docs/js/main.js +13 -4
- data/lib/update_repo.rb +1 -1
- data/lib/update_repo/cmd_config.rb +7 -6
- data/lib/update_repo/console_output.rb +21 -17
- data/lib/update_repo/git_control.rb +21 -11
- data/lib/update_repo/helpers.rb +13 -0
- data/lib/update_repo/logger.rb +1 -1
- data/lib/update_repo/metrics.rb +2 -1
- data/lib/update_repo/version.rb +1 -1
- data/web/gulpfile.js +52 -62
- data/web/index.html +17 -7
- data/web/js/scripts.js +3 -2
- data/web/js/site.js +10 -2
- data/web/sass/site.scss +9 -1
- data/web/webdata.json +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea51a325f2034931394847abe9affebe15c9f749
|
4
|
+
data.tar.gz: 423151a48e8c9181257407aa22d875cab4793177
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b42b27c64c860d0981951fe331d8acebd943917da21cf781f08c2d336b7826d276086ecb87ad1cbdcdd3f4af91a6be04c638372326de0df60c239a0ddc671d75
|
7
|
+
data.tar.gz: 5a66f4057f27b77e49c25a8720944a64f801e2d7ff1fe219afe2d2b4bba6b267931cbae5ba88682a2afc203cc3223fcd74e9e8eedee79b0868c33a35c390ec38
|
data/README.md
CHANGED
@@ -84,6 +84,11 @@ verbose: true
|
|
84
84
|
verbose_errors: true
|
85
85
|
```
|
86
86
|
|
87
|
+
`brief:` - Do not print the header, footer or summary, defaults to FALSE (optional)
|
88
|
+
```yaml
|
89
|
+
brief: true
|
90
|
+
```
|
91
|
+
|
87
92
|
`quiet:` - no output at all, not even the header and footer, defaults to FALSE (optional)
|
88
93
|
```yaml
|
89
94
|
quiet: true
|
@@ -97,19 +102,20 @@ Enter `update_repo --help` at the command prompt to get a list of available opti
|
|
97
102
|
Options:
|
98
103
|
-c, --color, --no-color Use colored output (default: true)
|
99
104
|
-d, --dump Dump a list of Directories and Git URL's to STDOUT in CSV format
|
100
|
-
-p, --prune=<i> Number of directory levels to remove from the --dump output
|
105
|
+
-p, --prune=<i> Number of directory levels to remove from the --dump output
|
101
106
|
Only valid when --dump or -d specified (Default: 0)
|
102
107
|
-l, --log Create a logfile of all program output to './update_repo.log'.
|
103
|
-
Any older logs will be overwritten
|
108
|
+
Any older logs will be overwritten
|
104
109
|
-t, --timestamp Timestamp the logfile instead of overwriting. Does nothing unless the
|
105
|
-
--log option is also specified
|
110
|
+
--log option is also specified
|
106
111
|
-g, --log-local Create the logfile in the current directory instead of in the users home
|
107
|
-
directory
|
112
|
+
directory
|
108
113
|
-r, --dump-remote Create a dump to screen or log listing all the git remote URLS found in
|
109
|
-
the specified directories
|
114
|
+
the specified directories
|
110
115
|
-V, --verbose Display each repository and the git output to screen
|
111
116
|
-E, --verbose-errors List all the error output from a failing command in the summary, not just the first line
|
112
|
-
-
|
117
|
+
-b, --brief Do not print the header, footer or summary
|
118
|
+
-q, --quiet Run completely silent, with no output to the terminal (except fatal errors)
|
113
119
|
-v, --version Print version and exit
|
114
120
|
-h, --help Show this message
|
115
121
|
```
|
@@ -123,6 +129,7 @@ Add functionality, not in any specific order :
|
|
123
129
|
- Add new repo from the command line that will be cloned to the default repo directory and then updated as usual. Extra flag added for "add only, clone later" for offline use.
|
124
130
|
- Add flag for 'default' repo directory (or another specific directory - if it does not already exist it will be created and added to the standard list) which will be used for new additions.
|
125
131
|
- Add option to only display a (text) tree of the discovered git repositories, not updating them.
|
132
|
+
- Add ability to specify the colors used for each repository result (failure, warning, skipped, updated, default etc). This should only be done from the configuration file. The default settings will probably look pretty bad on a white background for example. Specify from the safe defined list used by the `colorize` gem.
|
126
133
|
- Add Import & Export functionality :
|
127
134
|
* ability to export a text dump of each repo location and remote as a CSV file. `[DONE]`
|
128
135
|
* re-import the above dump on a different machine or after reinstall. Modify the '--prune' command to apply to this function also, removing the required number of directory levels before importing.
|
data/WEBSITE.md
CHANGED
@@ -10,18 +10,18 @@ We are using [NodeJS][node] and [Gulp][gulp] to streamline the build process for
|
|
10
10
|
- [Sass][sass] for the style sheets, however we use the [SCSS][scss] syntax over vanilla Sass in all the code.
|
11
11
|
- [Bootstrap][bootstrap] is used for layout and menus.
|
12
12
|
- [Font Awesome][fontawesome] provides excellent scalable icons and glyphs.
|
13
|
-
- [PrismJS][prism] is an excellent code
|
14
|
-
- The [Mustache][mustache] template language is used in a few places to automate
|
13
|
+
- [PrismJS][prism] is an excellent code highlighter, used when describing code and configuration file layout.
|
14
|
+
- The [Mustache][mustache] template language is used in a few places to automate repetitive HTML coding (For example in the command line parameters)
|
15
15
|
|
16
16
|
|
17
17
|
All the above dependencies are automatically pulled in using the Gulp task and updated using `npm`.
|
18
18
|
|
19
|
-
Primary development is carried out on a Linux machine, but all the above can be
|
19
|
+
Primary development is carried out on a Linux machine, but all the above can be successfully installed and used on Windows or Mac systems too.
|
20
20
|
|
21
21
|
#### Install Node and Gulp.
|
22
22
|
Install the latest 6.x.x LTS version of [Node][node] by following the instructions on their website depending on your operating system. Note that Node version 7.x will not work properly with some of Gulp's dependencies so please use the LTS Version 6. I recommend that you use a Node Version Manager if you want multiple node versions installed - [NVM][nvm] is good for Linux and Mac while [NVM-Windows][nvm-windows] is great for those on windows.
|
23
23
|
Development is currently carried out using Node version 6.10.0 so it may be worth installing that version.
|
24
|
-
When you have NVM installed under
|
24
|
+
When you have NVM installed under Linux and the above version of Node, you can then change to the /web/ directory and simply type:
|
25
25
|
```
|
26
26
|
$ nvm use
|
27
27
|
```
|
@@ -34,7 +34,7 @@ $ npm install -g gulp
|
|
34
34
|
```
|
35
35
|
This will install Gulp globally, you may need to prefix this with the `sudo` command depending on how your machine is configured.
|
36
36
|
#### Install the dependencies.
|
37
|
-
This is really simple once Node and Gulp are installed. Simply switch to the [/web/](web/) folder in
|
37
|
+
This is really simple once Node and Gulp are installed. Simply switch to the [/web/](web/) folder in your local checkout and type:
|
38
38
|
```
|
39
39
|
$ npm install
|
40
40
|
```
|
@@ -51,7 +51,7 @@ $ gulp build
|
|
51
51
|
```
|
52
52
|
|
53
53
|
#### Production Code.
|
54
|
-
When the code is all good and production ready, we will minify the JavaScript, CSS and HTML. This is
|
54
|
+
When the code is all good and production ready, we will minify the JavaScript, CSS and HTML. This is achieved by using the `--prod` switch to gulp:
|
55
55
|
```
|
56
56
|
$ gulp --prod
|
57
57
|
```
|
data/docs/css/site.css
CHANGED
@@ -9179,12 +9179,21 @@ h2 {
|
|
9179
9179
|
background-color: #f5f2f0;
|
9180
9180
|
color: #f33;
|
9181
9181
|
padding: 0 .3em;
|
9182
|
-
font-size: 1.
|
9182
|
+
font-size: 1.2em;
|
9183
9183
|
padding: 5px;
|
9184
9184
|
text-align: justify;
|
9185
9185
|
text-shadow: #aaa 2px 1px 3px;
|
9186
9186
|
}
|
9187
9187
|
|
9188
|
+
.version {
|
9189
|
+
font-weight: bold;
|
9190
|
+
border: thin solid #ccc;
|
9191
|
+
border-radius: 5px;
|
9192
|
+
background-color: #f5f2f0;
|
9193
|
+
color: #444;
|
9194
|
+
padding: 0 .3em;
|
9195
|
+
}
|
9196
|
+
|
9188
9197
|
.icon::before {
|
9189
9198
|
display: inline-block;
|
9190
9199
|
font: normal normal normal 14px/1 FontAwesome;
|
@@ -9221,6 +9230,10 @@ h2 {
|
|
9221
9230
|
padding-top: 65px;
|
9222
9231
|
}
|
9223
9232
|
|
9233
|
+
.about p {
|
9234
|
+
font-size: 120%;
|
9235
|
+
}
|
9236
|
+
|
9224
9237
|
.installation {
|
9225
9238
|
padding-bottom: 30px;
|
9226
9239
|
}
|
data/docs/index.html
CHANGED
@@ -61,11 +61,10 @@
|
|
61
61
|
</div><!-- row -->
|
62
62
|
<div class="row row-body">
|
63
63
|
<div class="col-lg-12 col-md-12">
|
64
|
-
<p>A Simple Gem to keep multiple locally-cloned Git Repositories up to date
|
64
|
+
<p>A Simple Gem to keep multiple locally-cloned Git Repositories up to date. Current release version is <span id="version" class="version"></span></p>
|
65
65
|
<p>The script will simply run <span class="console-output">git pull</span> on every local clone of a git repository that it finds under the specified directory or directories.</p>
|
66
66
|
<p class="important-note">Note: Versions prior to 0.9.4 had a serious bug where the script would crash on startup unless there was an <span class="yaml-tag">exception:</span> defined in the configuration file. This has been fixed from version 0.9.4 onwards.</p>
|
67
67
|
<div class="text-center">
|
68
|
-
<a href="https://badge.fury.io/rb/update_repo"><img src="https://badge.fury.io/rb/update_repo.svg" alt="Gem Version" height="18"></a>
|
69
68
|
<a href="https://travis-ci.org/seapagan/update_repo"><img src="https://travis-ci.org/seapagan/update_repo.svg?branch=master"></a>
|
70
69
|
</div>
|
71
70
|
</div>
|
@@ -176,7 +175,7 @@
|
|
176
175
|
<p><span class="yaml-tag">log_local:</span> - Store the logfile (if this is enabled) in the current working directory instead of the Users' Home directory. Defaults to <b>FALSE</b> (optional). Equivalent to <span class="cmdline">--log-local</span> on the command line.</p>
|
177
176
|
<pre>
|
178
177
|
<code class="language-yaml">
|
179
|
-
|
178
|
+
log_local: true
|
180
179
|
</code>
|
181
180
|
</pre>
|
182
181
|
</div><!-- col -->
|
@@ -217,6 +216,15 @@
|
|
217
216
|
</pre>
|
218
217
|
</div><!-- col -->
|
219
218
|
|
219
|
+
<div class="col-lg-12 col-md-12">
|
220
|
+
<p><span class="yaml-tag">brief:</span> - Do not print the header, footer or summary, defaults to FALSE (optional). If this is set to TRUE, there will be no extra output except that from each git operation or the non-verbose legend. Equivalent to <span class="cmdline">--brief</span> and <span class="cmdline">--no-brief</span> on the command line.</p>
|
221
|
+
<pre>
|
222
|
+
<code class="language-yaml">
|
223
|
+
brief: true
|
224
|
+
</code>
|
225
|
+
</pre>
|
226
|
+
</div><!-- col -->
|
227
|
+
|
220
228
|
<div class="col-lg-12 col-md-12">
|
221
229
|
<p><span class="yaml-tag">quiet:</span> - Enable or disable Quiet mode, defaults to FALSE (optional). If this is specified then there will be nothing printed to the terminal except for fatal errors. Overrules the <span class="cmdline">--verbose</span> mode if also specified. Equivalent to <span class="cmdline">--quiet</span> and <span class="cmdline">--no-quiet</span> on the command line.</p>
|
222
230
|
<pre>
|
@@ -242,6 +250,7 @@
|
|
242
250
|
color: false
|
243
251
|
verbose: true
|
244
252
|
verbose_errors: true
|
253
|
+
brief: false
|
245
254
|
quiet: false
|
246
255
|
</code>
|
247
256
|
</pre>
|
@@ -257,13 +266,14 @@
|
|
257
266
|
-c, --color, --no-color Use colored output (default: true)
|
258
267
|
-d, --dump Dump a list of Directories and Git URL's to STDOUT in CSV format
|
259
268
|
-p, --prune=<i> Number of directory levels to remove from the --dump output. Only valid when --dump or -d specified (Default: 0)
|
260
|
-
-l, --log Create a logfile of all program output to './update_repo.log'. Any older logs will be overwritten
|
261
|
-
-t, --timestamp Timestamp the logfile instead of overwriting. Does nothing unless the --log option is also specified
|
269
|
+
-l, --log Create a logfile of all program output to './update_repo.log'. Any older logs will be overwritten
|
270
|
+
-t, --timestamp Timestamp the logfile instead of overwriting. Does nothing unless the --log option is also specified
|
262
271
|
-g, --log-local Create the logfile in the current directory instead of in the users home directory
|
263
|
-
-r, --dump-remote Create a dump to screen or log listing all the git remote URLS found in the specified directories
|
272
|
+
-r, --dump-remote Create a dump to screen or log listing all the git remote URLS found in the specified directories
|
264
273
|
-V, --verbose Display each repository and the git output to screen
|
265
274
|
-E, --verbose-errors List all the error output from a failing command in the summary, not just the first line
|
266
|
-
-
|
275
|
+
-b, --brief Do not print the header, footer or summary
|
276
|
+
-q, --quiet Run completely silent, with no output to the terminal (except fatal errors)
|
267
277
|
-v, --version Print version and exit
|
268
278
|
-h, --help Show this message
|
269
279
|
</code>
|
@@ -398,6 +408,22 @@
|
|
398
408
|
</ul>
|
399
409
|
</div>
|
400
410
|
</div>
|
411
|
+
<div class="col-lg-12 col-md-12">
|
412
|
+
<div class="cmd-header row-header">
|
413
|
+
<p>Brief Output</p>
|
414
|
+
</div>
|
415
|
+
<div class="cmd-body row-body">
|
416
|
+
<p class="cmd-text">Do not print the Header, Footer or Summary.</p>
|
417
|
+
<p class="cmd-text">Equivalent to the <span class="yaml-tag">brief:</span> YAML configuration file tag.
|
418
|
+
</p>
|
419
|
+
<ul class="opt-list">
|
420
|
+
<li class="cmd-opt"><span class="desc">Long-Form</span> : <span class="cmdline">--brief</span></li>
|
421
|
+
<li class="cmd-opt"><span class="desc">Short-Form</span> : <span class="cmdline">-b</span></li>
|
422
|
+
<li class="cmd-opt"><span class="desc">Negative-Form</span> : <span class="cmdline">--no-brief</span></li>
|
423
|
+
<li class="cmd-opt"><span class="desc">Default</span> : <span class="cmdline">false</span></li>
|
424
|
+
</ul>
|
425
|
+
</div>
|
426
|
+
</div>
|
401
427
|
<div class="col-lg-12 col-md-12">
|
402
428
|
<div class="cmd-header row-header">
|
403
429
|
<p>Quiet</p>
|
data/docs/js/main.js
CHANGED
@@ -1,16 +1,25 @@
|
|
1
1
|
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
2
2
|
(function (global){
|
3
|
-
global.jQuery = require('jquery')
|
4
|
-
var bootstrap = require('bootstrap')
|
3
|
+
global.jQuery = require('jquery');
|
4
|
+
var bootstrap = require('bootstrap');
|
5
|
+
|
5
6
|
|
6
7
|
// Site-specific Javascript
|
7
8
|
|
8
9
|
// return the version number of the latest released Gem
|
9
|
-
function
|
10
|
+
function getgemver () {
|
10
11
|
// URL to the API...
|
11
|
-
var
|
12
|
+
var APIurl = 'https://rubygems.org/api/v1/versions/update_repo/latest.json?callback=?';
|
13
|
+
jQuery.getJSON( APIurl, function( data ) {
|
14
|
+
console.log(data);
|
15
|
+
jQuery("#version").text(data.version);
|
16
|
+
});
|
12
17
|
}
|
13
18
|
|
19
|
+
jQuery(document).ready(function() {
|
20
|
+
getgemver();
|
21
|
+
});
|
22
|
+
|
14
23
|
|
15
24
|
/* **********************************************
|
16
25
|
Begin prism-core.js
|
data/lib/update_repo.rb
CHANGED
@@ -140,7 +140,7 @@ module UpdateRepo
|
|
140
140
|
git.update
|
141
141
|
@metrics[:processed] += 1
|
142
142
|
# update the metrics
|
143
|
-
[:failed, :updated, :unchanged].each do |metric|
|
143
|
+
[:failed, :updated, :unchanged, :warning].each do |metric|
|
144
144
|
@metrics[metric] += 1 if git.status[metric]
|
145
145
|
end
|
146
146
|
@log.repostat(git.status)
|
@@ -118,16 +118,17 @@ module UpdateRepo
|
|
118
118
|
EOS
|
119
119
|
opt :color, 'Use colored output', default: true
|
120
120
|
opt :dump, 'Dump a list of Directories and Git URL\'s to STDOUT in CSV format', default: false
|
121
|
-
opt :prune, "Number of directory levels to remove from the --dump output.\nOnly valid when --dump or -d specified
|
121
|
+
opt :prune, "Number of directory levels to remove from the --dump output.\nOnly valid when --dump or -d specified", default: 0
|
122
122
|
# opt :import, "Import a previous dump of directories and Git repository URL's,\n(created using --dump) then proceed to clone them locally.", default: false
|
123
|
-
opt :log, "Create a logfile of all program output to './update_repo.log'. Any older logs will be overwritten
|
124
|
-
opt :timestamp, 'Timestamp the logfile instead of overwriting. Does nothing unless the --log option is also specified
|
123
|
+
opt :log, "Create a logfile of all program output to './update_repo.log'. Any older logs will be overwritten", default: false
|
124
|
+
opt :timestamp, 'Timestamp the logfile instead of overwriting. Does nothing unless the --log option is also specified', default: false
|
125
125
|
opt :log_local, 'Create the logfile in the current directory instead of in the users home directory', default: false, short: 'g'
|
126
|
-
opt :dump_remote, 'Create a dump to screen or log, listing all the git remote URLS found in the specified directories
|
127
|
-
opt :dump_tree, 'Create a dump to screen or log, listing all subdirectories found below the specified locations in tree format
|
126
|
+
opt :dump_remote, 'Create a dump to screen or log, listing all the git remote URLS found in the specified directories', default: false, short: 'r'
|
127
|
+
opt :dump_tree, 'Create a dump to screen or log, listing all subdirectories found below the specified locations in tree format', default: false, short: 'u'
|
128
128
|
opt :verbose, 'Display each repository and the git output to screen', default: false, short: 'V'
|
129
129
|
opt :verbose_errors, 'List all the error output from a failing command in the summary, not just the first line', default: false, short: 'E'
|
130
|
-
opt :
|
130
|
+
opt :brief, 'Do not print the header, footer or summary', default: false, short: 'b'
|
131
|
+
opt :quiet, 'Run completely silent, with no output to the terminal (except fatal errors)', default: false
|
131
132
|
end
|
132
133
|
end
|
133
134
|
# rubocop:enable Metrics/MethodLength
|
@@ -16,7 +16,7 @@ module UpdateRepo
|
|
16
16
|
# console = ConsoleOutput.new(@log)
|
17
17
|
def initialize(logger, metrics, cmd)
|
18
18
|
@summary = { processed: 'green', updated: 'cyan', skipped: 'yellow',
|
19
|
-
failed: 'red', unchanged: 'white' }
|
19
|
+
failed: 'red', unchanged: 'white', warning: 'light_magenta' }
|
20
20
|
@metrics = metrics
|
21
21
|
@log = logger
|
22
22
|
@cmd = cmd
|
@@ -28,18 +28,20 @@ module UpdateRepo
|
|
28
28
|
# @return [void]
|
29
29
|
# @param [none]
|
30
30
|
def show_header
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
31
|
+
unless @cmd[:brief]
|
32
|
+
# print an informative header before starting
|
33
|
+
print_log "\nGit Repo update utility (v", VERSION, ')',
|
34
|
+
" \u00A9 Grant Ramsay <seapagan@gmail.com>\n"
|
35
|
+
print_log "Using Configuration from '#{@cmd.getconfig.config_path}'\n"
|
36
|
+
# show the logfile location, but only if it is enabled
|
37
|
+
show_logfile
|
38
|
+
# list out the locations that will be searched
|
39
|
+
list_locations
|
40
|
+
# list any exceptions that we have from the config file
|
41
|
+
list_exceptions
|
42
|
+
# save the start time for later display in the footer...
|
43
|
+
@metrics[:start_time] = Time.now
|
44
|
+
end
|
43
45
|
print_log "\n" # blank line before processing starts
|
44
46
|
end
|
45
47
|
|
@@ -47,9 +49,11 @@ module UpdateRepo
|
|
47
49
|
# @return [void]
|
48
50
|
# @param [none]
|
49
51
|
def show_footer
|
50
|
-
|
51
|
-
|
52
|
-
|
52
|
+
unless @cmd[:brief]
|
53
|
+
duration = Time.now - @metrics[:start_time]
|
54
|
+
print_log "\n\nUpdates completed in ", show_time(duration).cyan
|
55
|
+
print_metrics
|
56
|
+
end
|
53
57
|
print_log " \n\n"
|
54
58
|
# close the log file now as we are done, just to be sure ...
|
55
59
|
@log.close
|
@@ -61,7 +65,7 @@ module UpdateRepo
|
|
61
65
|
def print_metrics
|
62
66
|
@summary.each do |metric, color|
|
63
67
|
metric_value = @metrics[metric]
|
64
|
-
output =
|
68
|
+
output = pluralize(metric_value, metric)
|
65
69
|
print_log ' | ', output.send(color.to_sym) unless metric_value.zero?
|
66
70
|
end
|
67
71
|
print_log ' |'
|
@@ -70,24 +70,34 @@ module UpdateRepo
|
|
70
70
|
# print a git output line and update the metrics if an update has occurred
|
71
71
|
# @param line [string] The string containing the git output line
|
72
72
|
# @return [void]
|
73
|
-
# rubocop:disable Metrics/LineLength
|
74
73
|
def handle_output(line)
|
75
|
-
|
76
|
-
|
77
|
-
|
74
|
+
detect_strings = { failed: '^fatal:|^error:',
|
75
|
+
warning: '^warning:',
|
76
|
+
updated: '^Updating\s[0-9a-f]{6,}\.\.[0-9a-f]{6,}',
|
77
|
+
unchanged: '^Already up-to-date.' }
|
78
|
+
|
79
|
+
detect_strings.each do |status, regex|
|
80
|
+
@status[status] = true if line.chomp =~ /#{regex}/
|
81
|
+
end
|
82
|
+
|
83
|
+
print_line(line, @status)
|
84
|
+
|
85
|
+
# need to adjust metrics if both updated and unchanged are true
|
86
|
+
# this happens in rare cases when both the regex are matched. In future,
|
87
|
+
# the regex needs to be made more robust
|
88
|
+
status[:unchanged] = false if @status[:updated] && status[:unchanged]
|
89
|
+
end
|
90
|
+
|
91
|
+
def print_line(line, status)
|
92
|
+
if status[:failed]
|
78
93
|
print_log ' ' * 3, line.red
|
79
94
|
# add new or update the fail matrix with another line
|
80
95
|
update_fail_matrix(line)
|
96
|
+
elsif status[:warning]
|
97
|
+
print_log ' ' * 3, line.light_magenta
|
81
98
|
else
|
82
99
|
print_log ' ' * 3, line.cyan
|
83
|
-
@status[:updated] = true if line =~ /^Updating\s[0-9a-f]{6,}\.\.[0-9a-f]{6,}/
|
84
|
-
@status[:unchanged] = true if line =~ /^Already up-to-date./
|
85
100
|
end
|
86
|
-
# need to adjust metrics if both updated and unchanged are true
|
87
|
-
# this happens in rare cases when both the regex are matched. In future,
|
88
|
-
# the regex needs to be made more robust
|
89
|
-
status[:unchanged] = false if (@status[:updated] && status[:unchanged])
|
90
101
|
end
|
91
|
-
# rubocop:enable Metrics/LineLength
|
92
102
|
end
|
93
103
|
end
|
data/lib/update_repo/helpers.rb
CHANGED
@@ -48,4 +48,17 @@ module Helpers
|
|
48
48
|
end
|
49
49
|
# return nil
|
50
50
|
end
|
51
|
+
|
52
|
+
# only one of our metrics requires pluralization, the :warning metric.
|
53
|
+
# Take care of this in the function below.
|
54
|
+
# @param num [integer] The number of items
|
55
|
+
# @param item [string] The metric to be pluralized if needed
|
56
|
+
# @return [string] Pluralized count and string
|
57
|
+
def pluralize(num, item)
|
58
|
+
if item == :warning && num != 1
|
59
|
+
"#{num} Warnings"
|
60
|
+
else
|
61
|
+
"#{num} #{item.capitalize}"
|
62
|
+
end
|
63
|
+
end
|
51
64
|
end
|
data/lib/update_repo/logger.rb
CHANGED
@@ -87,7 +87,7 @@ module UpdateRepo
|
|
87
87
|
# prefix if exists
|
88
88
|
calling_fn = caller_locations[2].label.gsub(/block in /, '')
|
89
89
|
# array with the functions we want to skip
|
90
|
-
repo_output = %w[do_update handle_output skip_repo update]
|
90
|
+
repo_output = %w[do_update print_line handle_output skip_repo update]
|
91
91
|
# return TRUE if DOES match, FALSE otherwise.
|
92
92
|
repo_output.include?(calling_fn) ? true : false
|
93
93
|
end
|
data/lib/update_repo/metrics.rb
CHANGED
@@ -13,7 +13,8 @@ module UpdateRepo
|
|
13
13
|
def initialize(logger)
|
14
14
|
@log = logger
|
15
15
|
@metrics = { processed: 0, skipped: 0, failed: 0, updated: 0,
|
16
|
-
unchanged: 0, start_time: 0, failed_list: []
|
16
|
+
unchanged: 0, start_time: 0, failed_list: [],
|
17
|
+
warning: 0 }
|
17
18
|
end
|
18
19
|
|
19
20
|
# Read the metric 'key'
|
data/lib/update_repo/version.rb
CHANGED
data/web/gulpfile.js
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
var gulp = require('gulp')
|
2
|
-
var sass = require('gulp-sass')
|
3
|
-
var browserSync = require('browser-sync')
|
1
|
+
var gulp = require('gulp');
|
2
|
+
var sass = require('gulp-sass');
|
3
|
+
var browserSync = require('browser-sync');
|
4
4
|
// var reload = browserSync.reload;
|
5
|
-
var autoprefixer = require('gulp-autoprefixer')
|
6
|
-
var browserify = require('gulp-browserify')
|
7
|
-
var clean = require('gulp-clean')
|
8
|
-
var concat = require('gulp-concat')
|
9
|
-
var merge = require('merge-stream')
|
10
|
-
var newer = require('gulp-newer')
|
11
|
-
var imagemin = require('gulp-imagemin')
|
12
|
-
var injectPartials = require('gulp-inject-partials')
|
13
|
-
var minify = require('gulp-minify')
|
14
|
-
var cssmin = require('gulp-cssmin')
|
15
|
-
var rename = require('gulp-rename')
|
16
|
-
var htmlmin = require('gulp-htmlmin')
|
17
|
-
var gutil = require('gulp-util')
|
18
|
-
var htmlreplace = require('gulp-html-replace')
|
19
|
-
var mustache = require('gulp-mustache')
|
5
|
+
var autoprefixer = require('gulp-autoprefixer');
|
6
|
+
var browserify = require('gulp-browserify');
|
7
|
+
var clean = require('gulp-clean');
|
8
|
+
var concat = require('gulp-concat');
|
9
|
+
var merge = require('merge-stream');
|
10
|
+
var newer = require('gulp-newer');
|
11
|
+
var imagemin = require('gulp-imagemin');
|
12
|
+
var injectPartials = require('gulp-inject-partials');
|
13
|
+
var minify = require('gulp-minify');
|
14
|
+
var cssmin = require('gulp-cssmin');
|
15
|
+
var rename = require('gulp-rename');
|
16
|
+
var htmlmin = require('gulp-htmlmin');
|
17
|
+
var gutil = require('gulp-util');
|
18
|
+
var htmlreplace = require('gulp-html-replace');
|
19
|
+
var mustache = require('gulp-mustache');
|
20
20
|
|
21
21
|
var SOURCEPATHS = {
|
22
22
|
sassSource: 'sass/*.scss',
|
@@ -27,7 +27,7 @@ var SOURCEPATHS = {
|
|
27
27
|
cssSource: 'css/**',
|
28
28
|
imgSource: 'img/**',
|
29
29
|
jsonSource: 'webdata.json'
|
30
|
-
}
|
30
|
+
};
|
31
31
|
|
32
32
|
var APPPATH = {
|
33
33
|
root: '../docs/',
|
@@ -35,55 +35,45 @@ var APPPATH = {
|
|
35
35
|
js: '../docs/js',
|
36
36
|
fonts: '../docs/fonts',
|
37
37
|
img: '../docs/img'
|
38
|
-
}
|
38
|
+
};
|
39
39
|
|
40
40
|
// determine if we want production mode (minified js/css/html) or not
|
41
|
-
var isProduction = false
|
41
|
+
var isProduction = false;
|
42
42
|
if (gutil.env.prod === true) {
|
43
|
-
isProduction = true
|
43
|
+
isProduction = true;
|
44
44
|
}
|
45
45
|
|
46
46
|
gulp.task('clean-all', function () {
|
47
47
|
return gulp.src([APPPATH.root + '/*.html', APPPATH.css + '/*.css', APPPATH.js + '/*.js'], {read: false, force: true})
|
48
|
-
.pipe(clean({force: true}))
|
49
|
-
})
|
50
|
-
|
51
|
-
// gulp.task('clean-css', function () {
|
52
|
-
// return gulp.src(APPPATH.css + '/*.css', {read: false, force: true})
|
53
|
-
// .pipe(clean({force: true}))
|
54
|
-
// })
|
55
|
-
|
56
|
-
// gulp.task('clean-scripts', function () {
|
57
|
-
// return gulp.src(APPPATH.js + '/*.js', {read: false, force: true})
|
58
|
-
// .pipe(clean({force: true}))
|
59
|
-
// })
|
48
|
+
.pipe(clean({force: true}));
|
49
|
+
});
|
60
50
|
|
61
51
|
gulp.task('sass', function () {
|
62
|
-
var bootstrapCSS = gulp.src('./node_modules/bootstrap/dist/css/bootstrap.css')
|
63
|
-
var sassFiles
|
64
|
-
var cssFiles = gulp.src([SOURCEPATHS.cssSource, './node_modules/font-awesome/css/font-awesome.css', './node_modules/prismjs/themes/prism.css'])
|
52
|
+
var bootstrapCSS = gulp.src('./node_modules/bootstrap/dist/css/bootstrap.css');
|
53
|
+
var sassFiles;
|
54
|
+
var cssFiles = gulp.src([SOURCEPATHS.cssSource, './node_modules/font-awesome/css/font-awesome.css', './node_modules/prismjs/themes/prism.css']);
|
65
55
|
|
66
56
|
sassFiles = gulp.src(SOURCEPATHS.sassSource)
|
67
57
|
.pipe(sass({outputStyle: 'expanded'}).on('error', sass.logError))
|
68
|
-
.pipe(autoprefixer())
|
58
|
+
.pipe(autoprefixer());
|
69
59
|
return merge(cssFiles, bootstrapCSS, sassFiles)
|
70
60
|
.pipe(concat('site.css'))
|
71
61
|
.pipe(isProduction ? cssmin({keepSpecialComments: 0}) : gutil.noop())
|
72
62
|
.pipe(isProduction ? rename({suffix: '.min'}) : gutil.noop())
|
73
|
-
.pipe(gulp.dest(APPPATH.css))
|
74
|
-
})
|
63
|
+
.pipe(gulp.dest(APPPATH.css));
|
64
|
+
});
|
75
65
|
|
76
66
|
gulp.task('scripts', function () {
|
77
|
-
var prismJS = './node_modules/prismjs/prism.js'
|
78
|
-
var prismYAML = './node_modules/prismjs/components/prism-yaml.js'
|
79
|
-
var prismWS = './node_modules/prismjs/plugins/normalize-whitespace/prism-normalize-whitespace.js'
|
67
|
+
var prismJS = './node_modules/prismjs/prism.js';
|
68
|
+
var prismYAML = './node_modules/prismjs/components/prism-yaml.js';
|
69
|
+
var prismWS = './node_modules/prismjs/plugins/normalize-whitespace/prism-normalize-whitespace.js';
|
80
70
|
|
81
71
|
gulp.src([SOURCEPATHS.jsSource, prismJS, prismYAML, prismWS])
|
82
72
|
.pipe(concat('main.js'))
|
83
73
|
.pipe(browserify())
|
84
74
|
.pipe(isProduction ? minify({noSource: true}) : gutil.noop())
|
85
|
-
.pipe(gulp.dest(APPPATH.js))
|
86
|
-
})
|
75
|
+
.pipe(gulp.dest(APPPATH.js));
|
76
|
+
});
|
87
77
|
|
88
78
|
gulp.task('html', function () {
|
89
79
|
return gulp.src(SOURCEPATHS.htmlSource)
|
@@ -93,20 +83,20 @@ gulp.task('html', function () {
|
|
93
83
|
.pipe(mustache(SOURCEPATHS.jsonSource))
|
94
84
|
.pipe(isProduction ? htmlreplace({'css': 'css/site.min.css', 'js': 'js/main-min.js'}) : gutil.noop())
|
95
85
|
.pipe(isProduction ? htmlmin({collapseWhitespace: true, removeComments: true}) : gutil.noop())
|
96
|
-
.pipe(gulp.dest(APPPATH.root))
|
97
|
-
})
|
86
|
+
.pipe(gulp.dest(APPPATH.root));
|
87
|
+
});
|
98
88
|
|
99
89
|
gulp.task('images', function () {
|
100
90
|
return gulp.src(SOURCEPATHS.imgSource)
|
101
91
|
.pipe(newer(APPPATH.img))
|
102
92
|
.pipe(imagemin())
|
103
|
-
.pipe(gulp.dest(APPPATH.img))
|
104
|
-
})
|
93
|
+
.pipe(gulp.dest(APPPATH.img));
|
94
|
+
});
|
105
95
|
|
106
96
|
gulp.task('moveFonts', function () {
|
107
97
|
gulp.src(['./node_modules/bootstrap/dist/fonts/**', './node_modules/font-awesome/fonts/**'])
|
108
|
-
.pipe(gulp.dest(APPPATH.fonts))
|
109
|
-
})
|
98
|
+
.pipe(gulp.dest(APPPATH.fonts));
|
99
|
+
});
|
110
100
|
|
111
101
|
gulp.task('serve', ['sass', 'scripts'], function () {
|
112
102
|
browserSync.init([APPPATH.css + '/*.css', APPPATH.root + '/*.html', APPPATH.js + '/*.js'], {
|
@@ -114,20 +104,20 @@ gulp.task('serve', ['sass', 'scripts'], function () {
|
|
114
104
|
baseDir: APPPATH.root
|
115
105
|
},
|
116
106
|
open: false
|
117
|
-
})
|
118
|
-
})
|
107
|
+
});
|
108
|
+
});
|
119
109
|
|
120
110
|
gulp.task('output-env', function () {
|
121
|
-
return isProduction ? gutil.log(gutil.colors.red.bold.underline('Running PRODUCTION environment')) : gutil.log(gutil.colors.green.bold.underline('Running DEVELOPMENT environment'))
|
122
|
-
})
|
111
|
+
return isProduction ? gutil.log(gutil.colors.red.bold.underline('Running PRODUCTION environment')) : gutil.log(gutil.colors.green.bold.underline('Running DEVELOPMENT environment'));
|
112
|
+
});
|
123
113
|
|
124
114
|
gulp.task('watch', ['output-env', 'serve', 'clean-all', 'moveFonts', 'images', 'html'], function () {
|
125
|
-
gulp.watch([SOURCEPATHS.sassSource, SOURCEPATHS.sassPartials, SOURCEPATHS.cssSource], ['sass'])
|
126
|
-
gulp.watch([SOURCEPATHS.jsSource], ['scripts'])
|
127
|
-
gulp.watch([SOURCEPATHS.imgSource], ['images'])
|
128
|
-
gulp.watch([SOURCEPATHS.htmlSource, SOURCEPATHS.htmlPartials, SOURCEPATHS.jsonSource], ['html'])
|
129
|
-
})
|
115
|
+
gulp.watch([SOURCEPATHS.sassSource, SOURCEPATHS.sassPartials, SOURCEPATHS.cssSource], ['sass']);
|
116
|
+
gulp.watch([SOURCEPATHS.jsSource], ['scripts']);
|
117
|
+
gulp.watch([SOURCEPATHS.imgSource], ['images']);
|
118
|
+
gulp.watch([SOURCEPATHS.htmlSource, SOURCEPATHS.htmlPartials, SOURCEPATHS.jsonSource], ['html']);
|
119
|
+
});
|
130
120
|
|
131
|
-
gulp.task('default', ['watch'])
|
121
|
+
gulp.task('default', ['watch']);
|
132
122
|
|
133
|
-
gulp.task('build', ['output-env', 'sass', 'scripts', 'clean-all', 'moveFonts', 'images', 'html'])
|
123
|
+
gulp.task('build', ['output-env', 'sass', 'scripts', 'clean-all', 'moveFonts', 'images', 'html']);
|
data/web/index.html
CHANGED
@@ -14,11 +14,10 @@
|
|
14
14
|
</div><!-- row -->
|
15
15
|
<div class="row row-body">
|
16
16
|
<div class="col-lg-12 col-md-12">
|
17
|
-
<p>A Simple Gem to keep multiple locally-cloned Git Repositories up to date
|
17
|
+
<p>A Simple Gem to keep multiple locally-cloned Git Repositories up to date. Current release version is <span id="version" class="version"></span></p>
|
18
18
|
<p>The script will simply run <span class="console-output">git pull</span> on every local clone of a git repository that it finds under the specified directory or directories.</p>
|
19
19
|
<p class="important-note">Note: Versions prior to 0.9.4 had a serious bug where the script would crash on startup unless there was an <span class="yaml-tag">exception:</span> defined in the configuration file. This has been fixed from version 0.9.4 onwards.</p>
|
20
20
|
<div class="text-center">
|
21
|
-
<a href="https://badge.fury.io/rb/update_repo"><img src="https://badge.fury.io/rb/update_repo.svg" alt="Gem Version" height="18"></a>
|
22
21
|
<a href="https://travis-ci.org/seapagan/update_repo"><img src="https://travis-ci.org/seapagan/update_repo.svg?branch=master"></a>
|
23
22
|
</div>
|
24
23
|
</div>
|
@@ -129,7 +128,7 @@
|
|
129
128
|
<p><span class="yaml-tag">log_local:</span> - Store the logfile (if this is enabled) in the current working directory instead of the Users' Home directory. Defaults to <b>FALSE</b> (optional). Equivalent to <span class="cmdline">--log-local</span> on the command line.</p>
|
130
129
|
<pre>
|
131
130
|
<code class="language-yaml">
|
132
|
-
|
131
|
+
log_local: true
|
133
132
|
</code>
|
134
133
|
</pre>
|
135
134
|
</div><!-- col -->
|
@@ -170,6 +169,15 @@
|
|
170
169
|
</pre>
|
171
170
|
</div><!-- col -->
|
172
171
|
|
172
|
+
<div class="col-lg-12 col-md-12">
|
173
|
+
<p><span class="yaml-tag">brief:</span> - Do not print the header, footer or summary, defaults to FALSE (optional). If this is set to TRUE, there will be no extra output except that from each git operation or the non-verbose legend. Equivalent to <span class="cmdline">--brief</span> and <span class="cmdline">--no-brief</span> on the command line.</p>
|
174
|
+
<pre>
|
175
|
+
<code class="language-yaml">
|
176
|
+
brief: true
|
177
|
+
</code>
|
178
|
+
</pre>
|
179
|
+
</div><!-- col -->
|
180
|
+
|
173
181
|
<div class="col-lg-12 col-md-12">
|
174
182
|
<p><span class="yaml-tag">quiet:</span> - Enable or disable Quiet mode, defaults to FALSE (optional). If this is specified then there will be nothing printed to the terminal except for fatal errors. Overrules the <span class="cmdline">--verbose</span> mode if also specified. Equivalent to <span class="cmdline">--quiet</span> and <span class="cmdline">--no-quiet</span> on the command line.</p>
|
175
183
|
<pre>
|
@@ -195,6 +203,7 @@
|
|
195
203
|
color: false
|
196
204
|
verbose: true
|
197
205
|
verbose_errors: true
|
206
|
+
brief: false
|
198
207
|
quiet: false
|
199
208
|
</code>
|
200
209
|
</pre>
|
@@ -210,13 +219,14 @@
|
|
210
219
|
-c, --color, --no-color Use colored output (default: true)
|
211
220
|
-d, --dump Dump a list of Directories and Git URL's to STDOUT in CSV format
|
212
221
|
-p, --prune=<i> Number of directory levels to remove from the --dump output. Only valid when --dump or -d specified (Default: 0)
|
213
|
-
-l, --log Create a logfile of all program output to './update_repo.log'. Any older logs will be overwritten
|
214
|
-
-t, --timestamp Timestamp the logfile instead of overwriting. Does nothing unless the --log option is also specified
|
222
|
+
-l, --log Create a logfile of all program output to './update_repo.log'. Any older logs will be overwritten
|
223
|
+
-t, --timestamp Timestamp the logfile instead of overwriting. Does nothing unless the --log option is also specified
|
215
224
|
-g, --log-local Create the logfile in the current directory instead of in the users home directory
|
216
|
-
-r, --dump-remote Create a dump to screen or log listing all the git remote URLS found in the specified directories
|
225
|
+
-r, --dump-remote Create a dump to screen or log listing all the git remote URLS found in the specified directories
|
217
226
|
-V, --verbose Display each repository and the git output to screen
|
218
227
|
-E, --verbose-errors List all the error output from a failing command in the summary, not just the first line
|
219
|
-
-
|
228
|
+
-b, --brief Do not print the header, footer or summary
|
229
|
+
-q, --quiet Run completely silent, with no output to the terminal (except fatal errors)
|
220
230
|
-v, --version Print version and exit
|
221
231
|
-h, --help Show this message
|
222
232
|
</code>
|
data/web/js/scripts.js
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
global.jQuery = require('jquery')
|
2
|
-
var bootstrap = require('bootstrap')
|
1
|
+
global.jQuery = require('jquery');
|
2
|
+
var bootstrap = require('bootstrap');
|
3
|
+
|
data/web/js/site.js
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
// Site-specific Javascript
|
2
2
|
|
3
3
|
// return the version number of the latest released Gem
|
4
|
-
function
|
4
|
+
function getgemver () {
|
5
5
|
// URL to the API...
|
6
|
-
var
|
6
|
+
var APIurl = 'https://rubygems.org/api/v1/versions/update_repo/latest.json?callback=?';
|
7
|
+
jQuery.getJSON( APIurl, function( data ) {
|
8
|
+
console.log(data);
|
9
|
+
jQuery("#version").text(data.version);
|
10
|
+
});
|
7
11
|
}
|
12
|
+
|
13
|
+
jQuery(document).ready(function() {
|
14
|
+
getgemver();
|
15
|
+
});
|
data/web/sass/site.scss
CHANGED
@@ -64,12 +64,16 @@ h2 {
|
|
64
64
|
|
65
65
|
.important-note {
|
66
66
|
@include hilight-box($color: $important-hilight-color);
|
67
|
-
font-size: 1.
|
67
|
+
font-size: 1.2em;
|
68
68
|
padding: 5px;
|
69
69
|
text-align: justify;
|
70
70
|
text-shadow: $text-shadow-color 2px 1px 3px;
|
71
71
|
}
|
72
72
|
|
73
|
+
.version {
|
74
|
+
@include hilight-box($color: $filename-hilight-color);
|
75
|
+
}
|
76
|
+
|
73
77
|
.icon::before {
|
74
78
|
display: inline-block;
|
75
79
|
font: normal normal normal 14px/1 FontAwesome;
|
@@ -110,6 +114,10 @@ h2 {
|
|
110
114
|
|
111
115
|
.container {
|
112
116
|
}
|
117
|
+
|
118
|
+
p {
|
119
|
+
font-size: 120%;
|
120
|
+
}
|
113
121
|
}
|
114
122
|
|
115
123
|
//INSTALLATION
|
data/web/webdata.json
CHANGED
@@ -72,6 +72,15 @@
|
|
72
72
|
"negative" : "--no-verbose-errors",
|
73
73
|
"default" : "false"
|
74
74
|
},
|
75
|
+
{
|
76
|
+
"title" : "Brief Output",
|
77
|
+
"text" : "Do not print the Header, Footer or Summary.",
|
78
|
+
"equivalent" : "brief:",
|
79
|
+
"long-form" : "--brief",
|
80
|
+
"short-form" : "-b",
|
81
|
+
"negative" : "--no-brief",
|
82
|
+
"default" : "false"
|
83
|
+
},
|
75
84
|
{
|
76
85
|
"title" : "Quiet",
|
77
86
|
"text" : "No output will be displayed to screen during the running of script, except for any fatal errors.",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: update_repo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grant Ramsay
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|