update_repo 0.3.3 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e41be9a5f9b005aa6f666a9e439174d4d4e357c7
4
- data.tar.gz: 1a4c8277bde888f513eee2e0bbcbf03fe853fb6b
3
+ metadata.gz: 73a676a06bff85ea1bee76cbd0fd2233c02d97fc
4
+ data.tar.gz: 3ef767efdc89c3ae2ce51de70d6467e4a5d2c6e4
5
5
  SHA512:
6
- metadata.gz: a8dc6f49e949d835af736370847162ca7b93c8d26bd2ea25f17e55ca2909415127e70952ccf305a9b4162a73c9bdeaff478f7da21b52d9447fbc9ab00fac7e40
7
- data.tar.gz: a0e769b2ec965e02f426b339f925f8a8ab42dab80f24c9e442c3817bd6ae76adc0890870538df1786892706ea064d0d373a29fa24e4b00b0b74c5a6a4d2cd6c0
6
+ metadata.gz: 13c1225abb3a6ad9b74a172330b0f5757a3556228d67d9e78e0a4b030e841e5aafdeca26a13182e7f5f553d13c6087ac5938b0dfd2b66afc85a92cd689e397ea
7
+ data.tar.gz: a5d487d0c3cdb9b08205e84f535a3569565843317607993844716e1bd1463b934d0d5fac73215917c7ed2995416defc526a9e0295f82b5adeaf5794b66b641d5
data/README.md CHANGED
@@ -20,7 +20,7 @@ It goes without saying that at the very least a working copy of both [`Git`][git
20
20
  [ruby]: http://www.ruby-lang.org
21
21
 
22
22
  #### Quick start
23
- Create a [YAML](http://yaml.org/)-formatted configuration file `.updatereporc` **in your home directory** that contains at least a 'location' tag pointing to the directory containing the git repositories you wish to have updated :
23
+ Create a [YAML](http://yaml.org/)-formatted configuration file `.updaterepo` **in your home directory** that contains at least a 'location' tag pointing to the directory containing the git repositories you wish to have updated :
24
24
  ```yaml
25
25
  ---
26
26
  location:
@@ -29,7 +29,7 @@ location:
29
29
  ```
30
30
  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.
31
31
 
32
- This file should be located in the users home directory (`~/.updatereporc`).
32
+ This file should be located in the users home directory (`~/.updaterepo`).
33
33
 
34
34
  Run the script :
35
35
  ```
data/exe/update_repo CHANGED
@@ -3,7 +3,7 @@ require 'update_repo'
3
3
 
4
4
  # Catch ctrl-c and abort gracefully without Ruby back trace...
5
5
  Signal.trap('INT') {
6
- print "\r -> ".red, "Aborting on user request.\n"
6
+ print "\r -> ".red, "Aborting on user request.\n\n"
7
7
  exit
8
8
  }
9
9
 
@@ -1,4 +1,4 @@
1
1
  module UpdateRepo
2
2
  # constant, current version of this Gem
3
- VERSION = '0.3.3'.freeze
3
+ VERSION = '0.4.1'.freeze
4
4
  end
data/lib/update_repo.rb CHANGED
@@ -8,7 +8,7 @@ require 'trollop'
8
8
  # Contains Class UpdateRepo::WalkRepo
9
9
  module UpdateRepo
10
10
  # This constant holds the name to the config file, located in ~/
11
- CONFIG_FILE = '.updatereporc'.freeze
11
+ CONFIG_FILE = '.updaterepo'.freeze
12
12
 
13
13
  # An encapsulated class to walk the repo directories and update all Git
14
14
  # repositories found therein.
@@ -22,15 +22,19 @@ module UpdateRepo
22
22
  @skip_count = 0
23
23
  # @ start_time - will be used to get elapsed time
24
24
  @start_time = 0
25
+ # read the options from Trollop and store in temp variable.
26
+ # we do it this way around otherwise if configuration file is missing it
27
+ # gives the error messages even on '--help' and '--version'
28
+ temp_opt = set_options
25
29
  # @config - Class. Reads the configuration from a file in YAML format and
26
30
  # allows easy access to the configuration data
27
- @config = Confoog::Settings.new(filename: '.updatereporc',
31
+ @config = Confoog::Settings.new(filename: CONFIG_FILE,
28
32
  prefix: 'update_repo',
29
33
  autoload: true,
30
34
  autosave: false)
31
- exit 1 unless @config.status[:errors] == Status::INFO_FILE_LOADED
32
35
  # store the command line variables in a configuration variable
33
- @config['cmd'] = set_options
36
+ @config['cmd'] = temp_opt
37
+ config_error unless @config.status[:errors] == Status::INFO_FILE_LOADED
34
38
  end
35
39
 
36
40
  # This function will perform the required actions to traverse the Repo.
@@ -48,6 +52,14 @@ module UpdateRepo
48
52
 
49
53
  private
50
54
 
55
+ def config_error
56
+ if @config.status[:errors] == Status::ERR_CANT_LOAD
57
+ print 'Note that the the default configuration file was '.red,
58
+ "changed to ~/#{CONFIG_FILE} from v0.4.0 onwards\n\n".red
59
+ end
60
+ exit 1
61
+ end
62
+
51
63
  # rubocop:disable Metrics//MethodLength
52
64
  def set_options
53
65
  Trollop.options do
@@ -59,7 +71,7 @@ Usage:
59
71
  update_repo [options]
60
72
 
61
73
  Options are not required. If none are specified then the program will read from
62
- the standard configuration file (~/.updatereporc) and automatically update the
74
+ the standard configuration file (~/#{CONFIG_FILE}) and automatically update the
63
75
  specified Repositories.
64
76
 
65
77
  Options:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: update_repo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grant Ramsay