update_repo 0.3.3 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/exe/update_repo +1 -1
- data/lib/update_repo/version.rb +1 -1
- data/lib/update_repo.rb +17 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73a676a06bff85ea1bee76cbd0fd2233c02d97fc
|
4
|
+
data.tar.gz: 3ef767efdc89c3ae2ce51de70d6467e4a5d2c6e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 `.
|
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 (`~/.
|
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
data/lib/update_repo/version.rb
CHANGED
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 = '.
|
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:
|
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'] =
|
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 (
|
74
|
+
the standard configuration file (~/#{CONFIG_FILE}) and automatically update the
|
63
75
|
specified Repositories.
|
64
76
|
|
65
77
|
Options:
|