gpack 2.0.0 → 2.0.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.
@@ -0,0 +1,94 @@
1
+
2
+ def gpack(opts)
3
+ puts opts.inspect
4
+ puts "Using Git Executable #{`which git`}"
5
+
6
+ ## TODO - Check propery ruby and git versions
7
+ ## Check is ruby/git module files are properly loaded
8
+ #if `which git`.chomp != "/apps/git/current/bin/git"
9
+ # puts "ERROR: Git and Ruby modules not properly loaded!"
10
+ # puts "\tYour .cshrc should have the following lines for gpack to properly work"
11
+ # puts "\t\tsetenv MODULEPATH /common/modulefiles"
12
+ # puts "\t\tmodule load apps/git-default"
13
+ # puts
14
+ # exit
15
+ #end
16
+
17
+ grepos = parse_gpackrepos()
18
+ download_ssh_key()
19
+ set_ssh_cmd()
20
+
21
+ OptionParser.new do |opts|
22
+ opts.on("-n","--nogui") do
23
+ $SETTINGS["gui"]["show"] = false
24
+ end
25
+ opts.on("-f","--force") do
26
+ $SETTINGS["core"]["force"] = true
27
+ end
28
+ opts.on("-p","--persist") do
29
+ $SETTINGS["gui"]["persist"] = true
30
+ end
31
+ opts.on("-i") do
32
+ $SETTINGS["core"]["install"] = true
33
+ end
34
+ opts.on("-s","--single") do
35
+ $SETTINGS["core"]["parallel"] = false
36
+ end
37
+ end.parse!
38
+
39
+ case opts[0]
40
+ when "install"
41
+ grepos.clone
42
+ when "update"
43
+ grepos.update
44
+ when "check"
45
+ grepos.check
46
+ when "uninstall"
47
+ grepos.remove
48
+ when "archive"
49
+ grepos.archive
50
+ when "lock"
51
+ `rm -f .gpackunlock`
52
+ grepos.set_writeable(false)
53
+ when "unlock"
54
+ `echo "UNLOCKED" >> .gpackunlock`
55
+ grepos.set_writeable(true)
56
+ when "rinse"
57
+ grepos.rinse
58
+ grepos.check # check should be clean
59
+ when "reinstall"
60
+ grepos.remove
61
+ grepos.clone
62
+ when "status"
63
+ grepos.status
64
+ when "list"
65
+ grepos.print
66
+ else "help"
67
+ puts README
68
+ end
69
+
70
+ # Close the SSH tempfile
71
+ if $SETTINGS["ssh"]["key"]
72
+ $SETTINGS["ssh"]["key"].close
73
+ end
74
+
75
+ end
76
+
77
+
78
+ class Colors
79
+ COLOR1 = "\e[1;36;40m"
80
+ COLOR2 = "\e[1;35;40m"
81
+ NOCOLOR = "\e[0m"
82
+ RED = "\e[1;31;40m"
83
+ GREEN = "\e[1;32;40m"
84
+ DARKGREEN = "\e[0;32;40m"
85
+ YELLOW = "\e[1;33;40m"
86
+ DARKCYAN = "\e[0;36;40m"
87
+ end
88
+
89
+ class String
90
+ def color(color)
91
+ return color + self + Colors::NOCOLOR
92
+ end
93
+ end
94
+
@@ -0,0 +1,160 @@
1
+ README=%{
2
+ =====
3
+ GitPack v2.0
4
+ =====
5
+
6
+ From https://github.com/GitPack/GitPackRuby
7
+
8
+ Ruby Implementation of git repository manager. Conceptually simular to a tool like bundle, gradel, ect. GitPack handles the distrubuting of Git repositories without being tied to a specific language; although it does use ruby to execute commands. GitPack specifically is intended to control multiple git repository dependancies on a project where it is required that multiple user's point to the same commit/branch/tag. GitPack simplifies the usage of Git and can be especially beneficial when working with teams where not every user knows how to manage a git repository. GitPack uses a single file "GpackRepos" to specifiy the URL and local destination of repositories that it should manage.
9
+
10
+ * Clones multiple repositories in parallel.
11
+ * Controls read-only permissions on cloned repositories.
12
+ * Pulls multiple repositoires in parallel.
13
+ * Easy clean of repositories that do not have a clean git status.
14
+ * Submodule compatible
15
+
16
+ Structure
17
+ -----
18
+ * ./gpack - The main exectuable. GitPack is self updating and downloads the latest ver. of master from this repository.
19
+ * ./GpackRepos - The main file that GitPack uses to store information about remote repositories URL, the local desitinations where the repositories should be cloned, and user configuration options like read-only, SSH keys, ect. This file is in YAML format
20
+ * ./.gpacklock - Used to store the repository read-only status.
21
+
22
+ Dependancies
23
+ -----
24
+ * Tested in Ruby 2.3
25
+
26
+ Setup
27
+ -----
28
+ Download the gpack bash script to a local directory and make the file executable:
29
+
30
+ .. code::
31
+
32
+ wget https://raw.githubusercontent.com/GitPack/GitPack/master/gpack
33
+ chmod u+x ./gpack
34
+
35
+ Or install via ruby gems
36
+
37
+ .. code::
38
+
39
+ gem install gpack
40
+
41
+ Add repos to GpackRepos file using gpack, an example is shown below:
42
+
43
+ .. code::
44
+
45
+ ./gpack add git@github.com:GitPack/GitPack.git ./GitPack
46
+
47
+ Basic Usage
48
+ -----
49
+
50
+ Installs all repos in GpackRepos file:
51
+
52
+ .. code::
53
+
54
+ ./gpack install
55
+
56
+ Update installed repos in GpackRepos file:
57
+
58
+ .. code::
59
+
60
+ ./gpack update
61
+
62
+
63
+ GpackRepos
64
+ ----------
65
+
66
+ .. code-block:: bash
67
+
68
+ test1:
69
+ url: git@github.com:GitPack/TestRepo1.git
70
+ localdir: ./repos/test1
71
+ branch: master
72
+ lock: true
73
+
74
+ test2:
75
+ url: git@github.com:GitPack/TestRepo2.git
76
+ localdir: ./repos/test2
77
+ branch: master
78
+ lock: false
79
+
80
+ test3:
81
+ url: git@github.com:GitPack/TestRepo3.git
82
+ localdir: ./repos/test3
83
+ branch: master
84
+ lock: false
85
+
86
+ test3_hash:
87
+ url: git@github.com:GitPack/TestRepo3.git
88
+ localdir: ./repos/test3_hash
89
+ branch: b41e58af7
90
+ lock: false
91
+
92
+ test1_tag:
93
+ url: git@github.com:GitPack/TestRepo1.git
94
+ localdir: ./repos/test1_tag
95
+ branch: v2.0
96
+ lock: false
97
+
98
+ # Options for Configuration
99
+ # config:
100
+ # lock: true # Option to disable read-only by default
101
+ # remote_key: http://some.valid.url # Use an external ssh key
102
+ # ssh_command: ssh -v # Custom SSH arguments passed to $GIT_SSH_COMMAND
103
+
104
+
105
+
106
+ Core Commands
107
+ -------------
108
+
109
+ **gpack cmd [-f] [-nogui] [-persist] [-s]**
110
+ * -f,--force: Force operation
111
+ * -s,--single: Single threaded, useful for debug
112
+ * -n,--nogui: Do not pop up xterm windows
113
+ * -p,--persist: Keep xterm windows open even if command is successful
114
+ * -i: Force install (applies only to update command)
115
+
116
+ **add [url] [directory] [branch]**
117
+ Adds a repo to the GpackRepos file given ssh URL and local directory
118
+ relative to current directory
119
+ **check**
120
+ Checks if all repos are clean and match GpackRepos
121
+ **status**
122
+ Runs through each repo and reports the result of git status
123
+ **help**
124
+ Displays this message
125
+ **install**
126
+ Clones repos in repo directory
127
+ -nogui doesn't open terminals when installing
128
+ **uninstall**
129
+ Removes all local repositories listed in the Repositories File
130
+ Add -f to force remove all repositories
131
+ **reinstall**
132
+ The same as running uninstall then reinstall
133
+ **list**
134
+ List all repos in GpackRepos file
135
+ **lock**
136
+ Makes repo read-only, removes from .gpacklock file
137
+ **unlock**
138
+ Allows writing to repo, appends to .gpacklock file
139
+ **update [-i] [-f]**
140
+ Updates the repositories -f will install if not already installed
141
+
142
+
143
+ Details
144
+ -----------
145
+ * Maintains a clean local repository directory by parsing GpackRepos for user-defined repositores that they wish to clone.
146
+ * By default, all cloned repositories have no write access.
147
+
148
+ Future Improvements
149
+ -----
150
+ * GitPack is not Git LFS compatible at the moment. Merge requests with this feature would be accepted.
151
+ * Add command is not implemented
152
+ * Allow GitPack commands to operate on a per-repository basis
153
+ * Lock/Unlock of individual repositores. (Python version has this)
154
+
155
+ Developers
156
+ -----
157
+ * Andrew Porter https://github.com/AndrewRPorter
158
+ * Aaron Cook https://github.com/cookacounty
159
+
160
+ }