update_repo 0.9.8 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ea51a325f2034931394847abe9affebe15c9f749
4
- data.tar.gz: 423151a48e8c9181257407aa22d875cab4793177
2
+ SHA256:
3
+ metadata.gz: 5904ff9e75b0a3f8ca385929e367660c8b036fa7ef64751910fd64d28b1e0822
4
+ data.tar.gz: a6ac76df0c1dc18a11b82c69835f75f2b884f7a2a871603ef551bc491f5960a2
5
5
  SHA512:
6
- metadata.gz: b42b27c64c860d0981951fe331d8acebd943917da21cf781f08c2d336b7826d276086ecb87ad1cbdcdd3f4af91a6be04c638372326de0df60c239a0ddc671d75
7
- data.tar.gz: 5a66f4057f27b77e49c25a8720944a64f801e2d7ff1fe219afe2d2b4bba6b267931cbae5ba88682a2afc203cc3223fcd74e9e8eedee79b0868c33a35c390ec38
6
+ metadata.gz: e123ca8994c046b218c3379749fdf5946a384b01f2df16f5dac7b376e1aaa67b06c804c869e4cfdb6090bbecb491299fd75afddb335dde5504971ef2993a8f46
7
+ data.tar.gz: ddb71d1eecc47173aec36f1a4a95824a638586a537099362ef4cf9442c4ed4bbee699962e3e6cae8ebb876a4847104a197fd669518e1be7331e0ce7d4e1d44a5
data/.travis.yml CHANGED
@@ -1,13 +1,10 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - 1.9.3-p551
5
- - 2.0.0-p648
6
- - 2.1.10
7
- - 2.2.7
8
- - 2.3.4
9
- - 2.4.1
4
+ - 2.3.8
5
+ - 2.4.5
6
+ - 2.5.3
10
7
 
11
8
  before_install:
12
9
  - gem update --system
13
- - gem install bundler -v 1.15.1
10
+ - gem install bundler -v 1.17.1
@@ -1,7 +1,7 @@
1
1
  require 'update_repo/version'
2
2
  require 'update_repo/helpers'
3
3
  require 'confoog'
4
- require 'trollop'
4
+ require 'optimist'
5
5
  require 'yaml'
6
6
 
7
7
  # this class will encapsulate the command line fucntionality and processing
@@ -76,8 +76,9 @@ module UpdateRepo
76
76
  # @return [void]
77
77
  def check_params
78
78
  return unless true_cmd(:dump)
79
- Trollop.die 'You cannot use --dump AND --import'.red if true_cmd(:import)
80
- Trollop.die 'You cannot use --dump AND --dump-remote'.red if true_cmd(:dump_remote)
79
+
80
+ Optimist.die 'You cannot use --dump AND --import'.red if true_cmd(:import)
81
+ Optimist.die 'You cannot use --dump AND --dump-remote'.red if true_cmd(:dump_remote)
81
82
  end
82
83
  # rubocop:enable Metrics/LineLength
83
84
 
@@ -100,9 +101,9 @@ module UpdateRepo
100
101
  # rubocop:disable Metrics/MethodLength
101
102
  # rubocop:disable Metrics/LineLength
102
103
  def set_options
103
- Trollop.options do
104
+ Optimist.options do
104
105
  version "update_repo version #{VERSION} (C)2017 G. Ramsay\n"
105
- banner <<-EOS
106
+ banner <<-OPTION_TEXT
106
107
 
107
108
  Keep multiple local Git-Cloned Repositories up to date with one command.
108
109
 
@@ -115,7 +116,7 @@ module UpdateRepo
115
116
 
116
117
  Options:
117
118
 
118
- EOS
119
+ OPTION_TEXT
119
120
  opt :color, 'Use colored output', default: true
120
121
  opt :dump, 'Dump a list of Directories and Git URL\'s to STDOUT in CSV format', default: false
121
122
  opt :prune, "Number of directory levels to remove from the --dump output.\nOnly valid when --dump or -d specified", default: 0
@@ -101,6 +101,7 @@ module UpdateRepo
101
101
  def list_exceptions
102
102
  exceptions = @cmd['exceptions']
103
103
  return unless exceptions
104
+
104
105
  print_log "\nExclusions:".underline, ' ',
105
106
  exceptions.join(', ').yellow, "\n"
106
107
  end
@@ -119,6 +120,7 @@ module UpdateRepo
119
120
  # @return [void]
120
121
  def show_logfile
121
122
  return unless @cmd[:log]
123
+
122
124
  print_log "\nLogging to file:".underline, " #{@log.logfile}\n".cyan
123
125
  end
124
126
  end
@@ -7,6 +7,7 @@ module Helpers
7
7
  def trunc_dir(dir, how_many)
8
8
  # make sure we don't lose any root slash if '--prune' is NOT specified
9
9
  return dir if how_many.zero?
10
+
10
11
  # convert to array then lose the first 'how_many' parts
11
12
  path_array = Pathname(dir).each_filename.to_a
12
13
  path_array = path_array.drop(how_many)
@@ -20,6 +20,7 @@ module UpdateRepo
20
20
  skipped: { char: 's', color: 'yellow' } }
21
21
  # don't prepare a logfile unless it's been requested.
22
22
  return unless @cmd[:log]
23
+
23
24
  # generate a filename depending on 'timestamp' setting.
24
25
  filename = generate_filename
25
26
  # open the logfile and set sync mode.
@@ -32,11 +33,11 @@ module UpdateRepo
32
33
  # @return [string] Filename for the logfile.
33
34
  def generate_filename
34
35
  # add a timestamp if requested
35
- if @cmd[:timestamp]
36
- name = 'updaterepo-' + Time.new.strftime('%y%m%d-%H%M%S') + '.log'
37
- else
38
- name = 'updaterepo.log'
39
- end
36
+ name = if @cmd[:timestamp]
37
+ 'updaterepo-' + Time.new.strftime('%y%m%d-%H%M%S') + '.log'
38
+ else
39
+ 'updaterepo.log'
40
+ end
40
41
  # log to local directory instead of home directory if requested
41
42
  if @cmd[:log_local]
42
43
  File.expand_path(File.join('./', name))
@@ -57,6 +58,7 @@ module UpdateRepo
57
58
  end
58
59
  # log to file if that has been enabled
59
60
  return unless @cmd[:log]
61
+
60
62
  @logfile.write(string.join('').gsub(/\e\[(\d+)(;\d+)*m/, ''))
61
63
  end
62
64
 
@@ -67,6 +69,7 @@ module UpdateRepo
67
69
  def repostat(status)
68
70
  # only print if not quiet and not verbose!
69
71
  return if @cmd[:quiet] || @cmd[:verbose]
72
+
70
73
  @legend.each do |key, value|
71
74
  print value[:char].send(value[:color].to_sym) if status[key]
72
75
  end
@@ -85,7 +88,7 @@ module UpdateRepo
85
88
  def repo_text?
86
89
  # get calling function - need to skip first 2, also remove 'block in '
87
90
  # prefix if exists
88
- calling_fn = caller_locations[2].label.gsub(/block in /, '')
91
+ calling_fn = caller_locations(3..3).first.label.gsub(/block in /, '')
89
92
  # array with the functions we want to skip
90
93
  repo_output = %w[do_update print_line handle_output skip_repo update]
91
94
  # return TRUE if DOES match, FALSE otherwise.
@@ -1,4 +1,4 @@
1
1
  module UpdateRepo
2
2
  # constant, current version of this Gem
3
- VERSION = '0.9.8'.freeze
3
+ VERSION = '0.9.9'.freeze
4
4
  end
data/lib/update_repo.rb CHANGED
@@ -8,7 +8,7 @@ require 'update_repo/git_control'
8
8
  require 'yaml'
9
9
  require 'colorize'
10
10
  require 'confoog'
11
- require 'trollop'
11
+ require 'optimist'
12
12
  require 'versionomy'
13
13
  require 'pp'
14
14
 
@@ -59,6 +59,7 @@ module UpdateRepo
59
59
  end
60
60
  gitver = `git --version`.gsub(/git version /, '').chomp
61
61
  return if Versionomy.parse(gitver) >= '1.8.5'
62
+
62
63
  print 'Git version 1.8.5 or greater must be installed, you have '.red,
63
64
  "version #{gitver}!\n".red
64
65
  exit 1
@@ -99,6 +100,7 @@ module UpdateRepo
99
100
  Dir.chdir(dirname) do
100
101
  Dir['**/'].each do |dir|
101
102
  next unless gitdir?(dir)
103
+
102
104
  repo_list.push(path: File.join(dirname, dir), name: dir)
103
105
  end
104
106
  end
@@ -111,6 +113,7 @@ module UpdateRepo
111
113
  # ignore the :reek:NilCheck for this function, may refactor later
112
114
  def notexception?(dir)
113
115
  return true if @cmd.true_cmd(:exceptions).nil?
116
+
114
117
  !config['exceptions'].include?(File.basename(dir))
115
118
  end
116
119