update_repo 0.9.5 → 0.9.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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +31 -0
  3. data/.csslintrc +2 -0
  4. data/.eslintignore +1 -0
  5. data/.eslintrc.yml +277 -0
  6. data/.gitignore +2 -0
  7. data/.reek +3 -0
  8. data/.rubocop.yml +7 -0
  9. data/.travis.yml +4 -4
  10. data/README.md +53 -2
  11. data/Vagrantfile +11 -0
  12. data/WEBSITE.md +73 -0
  13. data/docs/CNAME +2 -0
  14. data/docs/css/site.css +9485 -0
  15. data/docs/fonts/FontAwesome.otf +0 -0
  16. data/docs/fonts/fontawesome-webfont.eot +0 -0
  17. data/docs/fonts/fontawesome-webfont.svg +2671 -0
  18. data/docs/fonts/fontawesome-webfont.ttf +0 -0
  19. data/docs/fonts/fontawesome-webfont.woff +0 -0
  20. data/docs/fonts/fontawesome-webfont.woff2 +0 -0
  21. data/docs/fonts/glyphicons-halflings-regular.eot +0 -0
  22. data/docs/fonts/glyphicons-halflings-regular.svg +288 -0
  23. data/docs/fonts/glyphicons-halflings-regular.ttf +0 -0
  24. data/docs/fonts/glyphicons-halflings-regular.woff +0 -0
  25. data/docs/fonts/glyphicons-halflings-regular.woff2 +0 -0
  26. data/docs/index.html +554 -0
  27. data/docs/js/main.js +13669 -0
  28. data/lib/update_repo.rb +1 -1
  29. data/lib/update_repo/cmd_config.rb +10 -8
  30. data/lib/update_repo/console_output.rb +2 -2
  31. data/lib/update_repo/git_control.rb +27 -7
  32. data/lib/update_repo/logger.rb +1 -1
  33. data/lib/update_repo/version.rb +1 -1
  34. data/update_repo.gemspec +1 -0
  35. data/vagrant-support/bootstrap-sudo.sh +14 -0
  36. data/vagrant-support/bootstrap.sh +37 -0
  37. data/web/.nvmrc +1 -0
  38. data/web/.scss-lint.yml +45 -0
  39. data/web/gulpfile.js +133 -0
  40. data/web/index.html +260 -0
  41. data/web/js/scripts.js +2 -0
  42. data/web/js/site.js +7 -0
  43. data/web/package.json +48 -0
  44. data/web/partials/_contribute.html +22 -0
  45. data/web/partials/_footer.html +16 -0
  46. data/web/partials/_header.html +25 -0
  47. data/web/partials/_license.html +38 -0
  48. data/web/partials/_navbar.html +24 -0
  49. data/web/sass/partials/_colors.scss +36 -0
  50. data/web/sass/partials/_fonts.scss +3 -0
  51. data/web/sass/partials/_mixins.scss +8 -0
  52. data/web/sass/partials/_variables.scss +3 -0
  53. data/web/sass/site.scss +263 -0
  54. data/web/webdata.json +112 -0
  55. metadata +44 -3
data/lib/update_repo.rb CHANGED
@@ -136,7 +136,7 @@ module UpdateRepo
136
136
  # update_repo('/Repo/linux/stable')
137
137
  def update_repo(dirpath)
138
138
  # create the git instance and then perform the update
139
- git = GitControl.new(dirpath, @log, @metrics)
139
+ git = GitControl.new(dirpath, @log, @metrics, @cmd)
140
140
  git.update
141
141
  @metrics[:processed] += 1
142
142
  # update the metrics
@@ -104,17 +104,18 @@ module UpdateRepo
104
104
  version "update_repo version #{VERSION} (C)2016 G. Ramsay\n"
105
105
  banner <<-EOS
106
106
 
107
- Keep multiple local Git-Cloned Repositories up to date with one command.
107
+ Keep multiple local Git-Cloned Repositories up to date with one command.
108
108
 
109
- Usage:
110
- update_repo [options]
109
+ Usage:
110
+ update_repo [options]
111
111
 
112
- Options are not required. If none are specified then the program will read from
113
- the standard configuration file (~/#{CONFIG_FILE}) and automatically update the
114
- specified Repositories.
112
+ Options are not required. If none are specified then the program will read from
113
+ the standard configuration file (~/#{CONFIG_FILE}) and automatically update the
114
+ specified Repositories.
115
115
 
116
- Options:
117
- EOS
116
+ Options:
117
+
118
+ EOS
118
119
  opt :color, 'Use colored output', default: true
119
120
  opt :dump, 'Dump a list of Directories and Git URL\'s to STDOUT in CSV format', default: false
120
121
  opt :prune, "Number of directory levels to remove from the --dump output.\nOnly valid when --dump or -d specified.", default: 0
@@ -125,6 +126,7 @@ EOS
125
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'
126
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'
127
128
  opt :verbose, 'Display each repository and the git output to screen', default: false, short: 'V'
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'
128
130
  opt :quiet, 'Run completely silent, with no output to the terminal (except fatal errors).', default: false
129
131
  end
130
132
  end
@@ -79,7 +79,7 @@ module UpdateRepo
79
79
  # print out any and all errors into a nice list
80
80
  @metrics[:failed_list].each do |failed|
81
81
  print_log "\n [", 'x'.red, "] #{failed[:loc]}"
82
- print_log "\n -> ", "\"#{failed[:line].chomp}\"".red
82
+ print_log "\n -> ", failed[:line].chomp.red
83
83
  end
84
84
  end
85
85
 
@@ -91,7 +91,7 @@ module UpdateRepo
91
91
  @metrics[:failed_list].uniq! { |error| error[:loc] }
92
92
  end
93
93
 
94
- # Print a list of any defined expections that will not be updated.
94
+ # Print a list of any defined exceptions that will not be updated.
95
95
  # @return [void]
96
96
  # @param [none]
97
97
  def list_exceptions
@@ -16,14 +16,16 @@ module UpdateRepo
16
16
  # @param dir [string] The directory location of this local repo.
17
17
  # @param logger [instance] pointer to the Logger class
18
18
  # @param metrics [instance] pointer to the Metrics class
19
+ # @param cmd [instance] pointer to the command options class
19
20
  # @return [void]
20
21
  # @example
21
22
  # git = GitControl.new(repo_url, @logger, @metrics)
22
- def initialize(dir, logger, metrics)
23
+ def initialize(dir, logger, metrics, cmd)
23
24
  @status = { updated: false, failed: false, unchanged: false }
24
25
  @dir = dir
25
26
  @log = logger
26
27
  @metrics = metrics
28
+ @cmd = cmd
27
29
  end
28
30
 
29
31
  # Update the git repo that was specified in the initializer.
@@ -48,18 +50,36 @@ module UpdateRepo
48
50
  `git -C #{@dir} config remote.origin.url`.chomp
49
51
  end
50
52
 
53
+ # adds a line to the fail matrix (with it's location) if it does not already
54
+ # exist, otherwise it will add the line to the end of the previous for that
55
+ # location
56
+ # @param lin [string] The string containing the Git output line
57
+ # @return [void]
58
+ def update_fail_matrix(line)
59
+ err_loc = "#{@dir} (#{repo_url})"
60
+ # see if this error already has some text (metric exists)
61
+ err = @metrics[:failed_list].find { |fail| fail[:loc] == err_loc }
62
+ # if so we append this new line to it otherwise create the metric
63
+ if err && @cmd[:verbose_errors]
64
+ err[:line] = err[:line] + ' ' * 7 + line
65
+ else
66
+ @metrics[:failed_list].push(loc: err_loc, line: line)
67
+ end
68
+ end
69
+
51
70
  # print a git output line and update the metrics if an update has occurred
52
71
  # @param line [string] The string containing the git output line
53
72
  # @return [void]
54
73
  # rubocop:disable Metrics/LineLength
55
74
  def handle_output(line)
56
- if line.chomp =~ /^fatal:|^error:/
57
- print_log ' ', line.red
58
- @status[:failed] = true
59
- err_loc = "#{@dir} (#{repo_url})"
60
- @metrics[:failed_list].push(loc: err_loc, line: line)
75
+ @status[:failed] = true if line.chomp =~ /^fatal:|^error:/
76
+ # @status[:failed] will persist throughout this entire git call.
77
+ if @status[:failed]
78
+ print_log ' ' * 3, line.red
79
+ # add new or update the fail matrix with another line
80
+ update_fail_matrix(line)
61
81
  else
62
- print_log ' ', line.cyan
82
+ print_log ' ' * 3, line.cyan
63
83
  @status[:updated] = true if line =~ /^Updating\s[0-9a-f]{7}\.\.[0-9a-f]{7}/
64
84
  @status[:unchanged] = true if line =~ /^Already up-to-date./
65
85
  end
@@ -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 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
@@ -1,4 +1,4 @@
1
1
  module UpdateRepo
2
2
  # constant, current version of this Gem
3
- VERSION = '0.9.5'.freeze
3
+ VERSION = '0.9.6'.freeze
4
4
  end
data/update_repo.gemspec CHANGED
@@ -1,6 +1,7 @@
1
1
  # coding: utf-8
2
2
  # rubocop:disable LineLength
3
3
  # rubocop:disable Metrics/BlockLength
4
+
4
5
  lib = File.expand_path('../lib', __FILE__)
5
6
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
7
  require 'update_repo/version'
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # add PPA for latest Git version...
4
+ add-apt-repository ppa:git-core/ppa
5
+
6
+ # update package lists and upgrade the system...
7
+ apt-get update
8
+ apt-get -y full-upgrade
9
+
10
+ # install some required packages...
11
+ apt-get -y install git
12
+ # install Ruby compile dependencies...
13
+ apt-get -y install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev
14
+
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env bash
2
+ # these will run as the default non-privileged user.
3
+
4
+ # install rbenv ruby version manager
5
+ export PATH="$HOME/.rbenv/bin:$PATH"
6
+ curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-installer | bash
7
+ # install dynamic bash extension
8
+ cd ~/.rbenv && src/configure && make -C src
9
+ # add the rbenv setup to our profile, only if it is not already there
10
+ if ! grep -qc 'rbenv init' /home/ubuntu/.bashrc ; then
11
+ echo "## Adding rbenv to .bashrc ##"
12
+ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
13
+ echo 'eval "$(rbenv init -)"' >> ~/.bashrc
14
+ fi
15
+ # run the above command locally so we can get rbenv to work on this provisioning shell
16
+ eval "$(rbenv init -)"
17
+ # set up .gemrc to avoid installing documentation for each gem...
18
+ echo "gem: --no-document" > ~/.gemrc
19
+ # install the required ruby version and set as default
20
+ rbenv install 2.4.0
21
+ rbenv global 2.4.0
22
+ gem update --system
23
+ gem update
24
+ gem install bundler
25
+
26
+ # install nvm Node Version Manager and good version of node...
27
+ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
28
+ export NVM_DIR="$HOME/.nvm"
29
+ [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
30
+ nvm install 6.10.0
31
+ nvm use 6.10.0
32
+ npm install gulp -g
33
+
34
+ # install the required deps for Ruby...
35
+ cd /vagrant && bundle install
36
+ # install required Node deps for the website...
37
+ cd /vagrant/web && npm install
data/web/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ 6.10.0
@@ -0,0 +1,45 @@
1
+ ---
2
+ scss_files: './sass/'
3
+
4
+ linters:
5
+ BorderZero:
6
+ enabled: true
7
+ ColorKeyword:
8
+ enabled: true
9
+ ColorVariable:
10
+ enabled: true
11
+ Comment:
12
+ enabled: true
13
+ EmptyLineBetweenBlocks:
14
+ enabled: true
15
+ EmptyRule:
16
+ enabled: false
17
+ FinalNewline:
18
+ enabled: true
19
+ HexLength:
20
+ enabled: true
21
+ HexNotation:
22
+ enabled: true
23
+ IdSelector:
24
+ enabled: true
25
+ ImportantRule:
26
+ enabled: false
27
+ Indentation:
28
+ enabled: true
29
+ LeadingZero:
30
+ enabled: true
31
+ MergeableSelector:
32
+ enabled: true
33
+ PropertySortOrder:
34
+ enabled: true
35
+ Shorthand:
36
+ enabled: true
37
+ SingleLinePerSelector:
38
+ enabled: true
39
+ StringQuotes:
40
+ enabled: true
41
+ TrailingWhitespace:
42
+ enabled: true
43
+ VendorPrefix:
44
+ enabled: true
45
+
data/web/gulpfile.js ADDED
@@ -0,0 +1,133 @@
1
+ var gulp = require('gulp')
2
+ var sass = require('gulp-sass')
3
+ var browserSync = require('browser-sync')
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')
20
+
21
+ var SOURCEPATHS = {
22
+ sassSource: 'sass/*.scss',
23
+ sassPartials: 'sass/partials/*.scss',
24
+ htmlSource: '*.html',
25
+ htmlPartials: 'partials/*.html',
26
+ jsSource: 'js/**',
27
+ cssSource: 'css/**',
28
+ imgSource: 'img/**',
29
+ jsonSource: 'webdata.json'
30
+ }
31
+
32
+ var APPPATH = {
33
+ root: '../docs/',
34
+ css: '../docs/css',
35
+ js: '../docs/js',
36
+ fonts: '../docs/fonts',
37
+ img: '../docs/img'
38
+ }
39
+
40
+ // determine if we want production mode (minified js/css/html) or not
41
+ var isProduction = false
42
+ if (gutil.env.prod === true) {
43
+ isProduction = true
44
+ }
45
+
46
+ gulp.task('clean-all', function () {
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
+ // })
60
+
61
+ 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'])
65
+
66
+ sassFiles = gulp.src(SOURCEPATHS.sassSource)
67
+ .pipe(sass({outputStyle: 'expanded'}).on('error', sass.logError))
68
+ .pipe(autoprefixer())
69
+ return merge(cssFiles, bootstrapCSS, sassFiles)
70
+ .pipe(concat('site.css'))
71
+ .pipe(isProduction ? cssmin({keepSpecialComments: 0}) : gutil.noop())
72
+ .pipe(isProduction ? rename({suffix: '.min'}) : gutil.noop())
73
+ .pipe(gulp.dest(APPPATH.css))
74
+ })
75
+
76
+ 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'
80
+
81
+ gulp.src([SOURCEPATHS.jsSource, prismJS, prismYAML, prismWS])
82
+ .pipe(concat('main.js'))
83
+ .pipe(browserify())
84
+ .pipe(isProduction ? minify({noSource: true}) : gutil.noop())
85
+ .pipe(gulp.dest(APPPATH.js))
86
+ })
87
+
88
+ gulp.task('html', function () {
89
+ return gulp.src(SOURCEPATHS.htmlSource)
90
+ .pipe(injectPartials({
91
+ removeTags: true
92
+ }))
93
+ .pipe(mustache(SOURCEPATHS.jsonSource))
94
+ .pipe(isProduction ? htmlreplace({'css': 'css/site.min.css', 'js': 'js/main-min.js'}) : gutil.noop())
95
+ .pipe(isProduction ? htmlmin({collapseWhitespace: true, removeComments: true}) : gutil.noop())
96
+ .pipe(gulp.dest(APPPATH.root))
97
+ })
98
+
99
+ gulp.task('images', function () {
100
+ return gulp.src(SOURCEPATHS.imgSource)
101
+ .pipe(newer(APPPATH.img))
102
+ .pipe(imagemin())
103
+ .pipe(gulp.dest(APPPATH.img))
104
+ })
105
+
106
+ gulp.task('moveFonts', function () {
107
+ gulp.src(['./node_modules/bootstrap/dist/fonts/**', './node_modules/font-awesome/fonts/**'])
108
+ .pipe(gulp.dest(APPPATH.fonts))
109
+ })
110
+
111
+ gulp.task('serve', ['sass', 'scripts'], function () {
112
+ browserSync.init([APPPATH.css + '/*.css', APPPATH.root + '/*.html', APPPATH.js + '/*.js'], {
113
+ server: {
114
+ baseDir: APPPATH.root
115
+ },
116
+ open: false
117
+ })
118
+ })
119
+
120
+ 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
+ })
123
+
124
+ 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
+ })
130
+
131
+ gulp.task('default', ['watch'])
132
+
133
+ gulp.task('build', ['output-env', 'sass', 'scripts', 'clean-all', 'moveFonts', 'images', 'html'])
data/web/index.html ADDED
@@ -0,0 +1,260 @@
1
+ <!-- partial:partials/_header.html -->
2
+ <!-- partial -->
3
+
4
+ <!-- partial:partials/_navbar.html -->
5
+ <!-- partial -->
6
+
7
+ <!-- ABOUT -->
8
+ <section class="about" id='about'>
9
+ <div class="container">
10
+ <div class="row row-header">
11
+ <div class="col-lg-12 col-md-12">
12
+ <h1 class="icon fa-info-circle">About</h1>
13
+ </div>
14
+ </div><!-- row -->
15
+ <div class="row row-body">
16
+ <div class="col-lg-12 col-md-12">
17
+ <p>A Simple Gem to keep multiple locally-cloned Git Repositories up to date.</p>
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
+ <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
+ <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
+ <a href="https://travis-ci.org/seapagan/update_repo"><img src="https://travis-ci.org/seapagan/update_repo.svg?branch=master"></a>
23
+ </div>
24
+ </div>
25
+ </div><!-- row -->
26
+ </div><!-- container -->
27
+ </section>
28
+ <!-- ABOUT END -->
29
+
30
+ <!-- INSTALLATION -->
31
+ <section class="installation" id="installation">
32
+ <div class="container">
33
+ <div class="row row-header">
34
+ <div class="col-lg-12 col-md-12">
35
+ <h1 class="icon fa-download">Installation</h1>
36
+ </div>
37
+ </div><!-- row -->
38
+ <div class="row row-body">
39
+ <div class="col-lg-12 col-md-12">
40
+ <p>A working copy of both <a href="http://www.ruby-lang.org" target="_blank" class="icon fa-external-link">Ruby</a> and <a href="http://git-scm.com" target="_blank" class="icon fa-external-link">Git</a> need to be installed on your machine. <b>Git version 1.8.5 or greater is required</b>, the script will not run with an older version or indeed without Git installed. Ruby version 1.9.3 and newer are supported.</p>
41
+ <p>Currently the script has only been tested under Linux, not Windows however Windows testing is next in the grand plan!</p>
42
+ <p>Simply install from the command prompt as you would any other gem. Note that you may require <b>'sudo'</b> depending how Ruby is installed on your system.</p>
43
+ <pre><code>gem install update_repo</code></pre>
44
+ </div>
45
+ </div><!-- row -->
46
+ </div><!-- container -->
47
+ </section>
48
+ <!-- INSTALLATION END -->
49
+
50
+ <!-- USAGE -->
51
+ <section class="usage" id="usage">
52
+ <div class="container">
53
+ <div class="row row-header">
54
+ <div class="col-lg-12 col-md-12">
55
+ <h1 class="icon fa-check-square-o">Usage</h1>
56
+ </div>
57
+ </div><!-- row -->
58
+ <div class="row row-body">
59
+ <div class="col-lg-12 col-md-12">
60
+ <h2>Quick Start</h2>
61
+ <p>Create a <a class="icon fa-external-link" target="_blank" href="http://yaml.org/">YAML</a>-formatted configuration file called <span class="filename">.updaterepo</span> (note the 'dot' at the start!) in your home directory that contains at least a <span class="yaml-tag">location:</span> tag pointing to the directory containing the git repositories you wish to have updated :</p>
62
+ <pre>
63
+ <code class="language-yaml">
64
+ ---
65
+ location:
66
+ - /media/myuser/git-repos
67
+ - /data/RepoDir
68
+ </code>
69
+ </pre>
70
+ <p>The directory or directories specified (there can be 1 root directory or as many as you wish) must already exist, and can be nested as deep as you wish with many repositories in many subdirectories.</p>
71
+ <p>This is the most basic example of a configuration file and there are other options that can be added to fine-tune the operation - see the description of configuration options below.</p>
72
+ <p>Now, run the script from anywhere :</p>
73
+ <pre><code>update_repo</code></pre>
74
+ <p><b>Note:</b> From version 0.9.0 onwards, the default mode of operation is <b>non-verbose</b>. If you wish the same output as previous versions then specify <span class="cmdline">--verbose</span> on the command line or <span class="yaml-tag">verbose: true</span> in the configuration file.</p>
75
+ </div>
76
+ </div><!-- row -->
77
+ </div><!-- container -->
78
+ </section>
79
+ <!-- USAGE END -->
80
+
81
+ <!-- CONFIGURATION -->
82
+ <section class="configuration" id="configuration">
83
+ <div class="container">
84
+ <div class="row row-header">
85
+ <div class="col-lg-12 col-md-12">
86
+ <h1 class="icon fa-cog">Configuration</h1>
87
+ </div>
88
+ </div><!-- row -->
89
+ <div class="row row-body">
90
+ <div class="col-lg-12 col-md-12">
91
+ <h2>Configuration file</h2>
92
+ <p>The configuration file defaults to <span class="filename">~/.updaterepo</span> and is a standard <a href="http://yaml.org/" class="icon fa-external-link">YAML</a> formatted text file. If this configuration file is not found, the script will terminate with an error.</p>
93
+ <p>The first line <b>must</b> contain only the YAML frontmatter of 3 dashes (<span class="yaml-tag">---</span>). After that, the following sections can follow in any order. Only the <span class="yaml-tag">location:</span> section is compulsory, and that must contain at least one entry.</p>
94
+ </div><!-- col -->
95
+
96
+ <div class="col-lg-12 col-md-12">
97
+ <p><span class="yaml-tag">location:</span> - at least one directory which contains the locally cloned repository(s) to update. There is no limit on how many directories can be listed :</p>
98
+ <pre>
99
+ <code class="language-yaml">
100
+ ---
101
+ location:
102
+ - /media/myuser/git-repos
103
+ - /data/RepoDir
104
+ </code>
105
+ </pre>
106
+ </div><!-- col -->
107
+
108
+ <div class="col-lg-12 col-md-12">
109
+ <p><span class="yaml-tag">exceptions:</span> - an (optional) list of repositories that will NOT be updated automatically. Use this for repositories that need special handling, or should only be manually updated. Note that the name specified is that of the <b>directory</b> holding the repository (has the <span class="filename">.git</span> directory inside) :</p>
110
+ <pre>
111
+ <code class="language-yaml">
112
+ exceptions:
113
+ - ubuntu-trusty
114
+ - update_repo
115
+ </code>
116
+ </pre>
117
+ </div><!-- col -->
118
+
119
+ <div class="col-lg-12 col-md-12">
120
+ <p><span class="yaml-tag">log:</span> - Log all output to the file <span class="filename">updaterepo.log</span> in the user's Home directory, defaults to <b>FALSE</b> (optional). This file would be overwritten on next run unless you also specify the <span class="yaml-tag">timestamp:</span> option. Equivalent to <span class="cmdline">--log</span> and <span class="cmdline">--no-log</span> on the command line.</p>
121
+ <pre>
122
+ <code class="language-yaml">
123
+ log: true
124
+ </code>
125
+ </pre>
126
+ </div><!-- col -->
127
+
128
+ <div class="col-lg-12 col-md-12">
129
+ <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
+ <pre>
131
+ <code class="language-yaml">
132
+ log: true
133
+ </code>
134
+ </pre>
135
+ </div><!-- col -->
136
+
137
+ <div class="col-lg-12 col-md-12">
138
+ <p><span class="yaml-tag">timestamp:</span> - timestamp the output files instead of overwriting them, defaults to FALSE (optional). Equivalent to <span class="cmdline">--timestamp</span> and <span class="cmdline">--no-timestamp</span> on the command line.</p>
139
+ <pre>
140
+ <code class="language-yaml">
141
+ timestamp: true
142
+ </code>
143
+ </pre>
144
+ </div><!-- col -->
145
+
146
+ <div class="col-lg-12 col-md-12">
147
+ <p><span class="yaml-tag">color:</span> - Enable or disable coloured output, defaults to TRUE (optional). Equivalent to <span class="cmdline">--color</span> and <span class="cmdline">--no-color</span> on the command line.</p>
148
+ <pre>
149
+ <code class="language-yaml">
150
+ color: false
151
+ </code>
152
+ </pre>
153
+ </div><!-- col -->
154
+
155
+ <div class="col-lg-12 col-md-12">
156
+ <p><span class="yaml-tag">verbose:</span> - Enable or disable Verbose mode, defaults to FALSE (optional). In this mode all the output of the git processes will be displayed to screen as will the local location and remote URL. Equivalent to <span class="cmdline">--verbose</span> and <span class="cmdline">--no-verbose</span> on the command line.</p>
157
+ <pre>
158
+ <code class="language-yaml">
159
+ verbose: true
160
+ </code>
161
+ </pre>
162
+ </div><!-- col -->
163
+
164
+ <div class="col-lg-12 col-md-12">
165
+ <p><span class="yaml-tag">verbose_errors:</span> - Enable or disable Verbose error reporting in the summary, defaults to FALSE (optional). If this is set to TRUE, the end-of-job summary will list all the error output lines from any failing Git processes, not just the first line. Equivalent to <span class="cmdline">--verbose-errors</span> and <span class="cmdline">--no-verbose-errors</span> on the command line.</p>
166
+ <pre>
167
+ <code class="language-yaml">
168
+ verbose_errors: true
169
+ </code>
170
+ </pre>
171
+ </div><!-- col -->
172
+
173
+ <div class="col-lg-12 col-md-12">
174
+ <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
+ <pre>
176
+ <code class="language-yaml">
177
+ quiet: true
178
+ </code>
179
+ </pre>
180
+ </div><!-- col -->
181
+
182
+ <div class="col-lg-12 col-md-12">
183
+ <p>Putting these together, below is an example <span class="filename">.updaterepo</span> file :</p>
184
+ <pre>
185
+ <code class="language-yaml">
186
+ ---
187
+ location:
188
+ - /media/myuser/git-repos
189
+ - /data/RepoDir
190
+ exceptions:
191
+ - ubuntu-trusty
192
+ - update_repo
193
+ log: true
194
+ timestamp: true
195
+ color: false
196
+ verbose: true
197
+ verbose_errors: true
198
+ quiet: false
199
+ </code>
200
+ </pre>
201
+ </div><!-- col -->
202
+
203
+ <div class="col-lg-12 col-md-12">
204
+ <h2>Command line switches</h2>
205
+ <p>Command line switches are not compulsory. If none are specified then the program will read from the standard configuration file <span class="filename">~/.updaterepo</span> and automatically update the specified Repositories. However, if specified then they will take precedence over options from the configuration file.</p>
206
+ <p>Enter <code class="language-markup">update_repo --help</code> at the command prompt to get a list of available options :</p>
207
+ <pre>
208
+ <code class="language-markup">
209
+ Options:
210
+ -c, --color, --no-color Use colored output (default: true)
211
+ -d, --dump Dump a list of Directories and Git URL's to STDOUT in CSV format
212
+ -p, --prune=&lt;i&gt; 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.
215
+ -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.
217
+ -V, --verbose Display each repository and the git output to screen
218
+ -E, --verbose-errors List all the error output from a failing command in the summary, not just the first line
219
+ -q, --quiet Run completely silent, with no output to the terminal (except fatal errors).
220
+ -v, --version Print version and exit
221
+ -h, --help Show this message
222
+ </code>
223
+ </pre>
224
+ </div><!-- col -->
225
+
226
+ {{#switches}}
227
+ <div class="col-lg-12 col-md-12">
228
+ <div class="cmd-header row-header">
229
+ <p>{{title}}</p>
230
+ </div>
231
+ <div class="cmd-body row-body">
232
+ <p class="cmd-text">{{text}}</p>
233
+ <p class="cmd-text">{{#equivalent}}Equivalent to the <span class="yaml-tag">{{equivalent}}</span> YAML configuration file tag.{{/equivalent}}{{^equivalent}}No equivalent in the YAML Configuration file.{{/equivalent}}
234
+ </p>
235
+ <ul class="opt-list">
236
+ <li class="cmd-opt"><span class="desc">Long-Form</span> : <span class="cmdline">{{long-form}}</span></li>
237
+ <li class="cmd-opt"><span class="desc">Short-Form</span> : <span class="cmdline">{{short-form}}</span></li>
238
+ <li class="cmd-opt"><span class="desc">Negative-Form</span> : <span class="cmdline">{{negative}}{{^negative}}None.{{/negative}}</span></li>
239
+ <li class="cmd-opt"><span class="desc">Default</span> : <span class="cmdline">{{default}}</span></li>
240
+ </ul>
241
+ </div>
242
+ </div>
243
+ {{/switches}}
244
+ </div><!-- row -->
245
+ </div><!-- container -->
246
+ </section>
247
+ <!-- CONFIGURATION END -->
248
+
249
+ <section class="contribute" id="contribute">
250
+ <!-- partial:partials/_contribute.html -->
251
+ <!-- partial -->
252
+ </section>
253
+
254
+ <section class="license" id="license">
255
+ <!-- partial:partials/_license.html -->
256
+ <!-- partial -->
257
+ </section>
258
+
259
+ <!-- partial:partials/_footer.html -->
260
+ <!-- partial -->