tbgit 1.0.0 → 1.0.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 -1
- data/bin/tbgit +2 -0
- data/lib/tbgit/version.rb +1 -1
- data/lib/tbgit.rb +41 -3
- 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: 94635ee4762c4d5e5dc0e28679c657c67c1643c6
|
4
|
+
data.tar.gz: 77117c9fdd487dcdfb6fa1154740029a4ab49402
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf7e40f9c7bd5e37969c43342b7988637b8dac74981aa0da0245bef429b9316c0831069262f9c2235a92536848c9e447e8b69e2490b96ad6bf944fe5ca099fe0
|
7
|
+
data.tar.gz: 601fc398ffa97746179bfd895ab76c8cf73cbe0bc5fdc55cbc9abb5e22f75acc88a38a56f3b317930c0b6d55322dccbe891626984a92379b4eee813b78380398
|
data/README.md
CHANGED
@@ -15,7 +15,8 @@ TBGit is a command-line utility to facilitate the management of multiple GitHub
|
|
15
15
|
- pull pulls all remote master branches to local student branches
|
16
16
|
- merge merges a specified branch with each student branch and then commits the changes
|
17
17
|
- status runs `git status` on each students branch and displays the results
|
18
|
-
|
18
|
+
- each executes a specified series of commands on each local student branch
|
19
|
+
|
19
20
|
- add-remotes adds each student's repository as a remote
|
20
21
|
- create-locals creates a local branch to track the students remote master branch
|
21
22
|
- these are both part of the setup process
|
data/bin/tbgit
CHANGED
data/lib/tbgit/version.rb
CHANGED
data/lib/tbgit.rb
CHANGED
@@ -173,17 +173,54 @@ module Main
|
|
173
173
|
|
174
174
|
end
|
175
175
|
|
176
|
-
|
176
|
+
#gathers the commands to be executed, and then calls on_each_exec(input)
|
177
|
+
def on_each_gather
|
178
|
+
puts "Enter the commands you would like to have executed on each branch, one on each line."
|
179
|
+
puts "'<branch>' will be replaced by the current checked-out branch. Enter a blank line to finish."
|
180
|
+
done = false
|
181
|
+
input = Array.new
|
182
|
+
while !done
|
183
|
+
text = $stdin.gets.chomp
|
184
|
+
if text == ""
|
185
|
+
done = true
|
186
|
+
else
|
187
|
+
input << text
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
on_each_exec(input)
|
192
|
+
|
193
|
+
end
|
194
|
+
|
195
|
+
#takes an array of commands, and executes each command on each student branch
|
196
|
+
def on_each_exec(input)
|
177
197
|
all_remotes = all_remotes_list
|
178
198
|
all_remotes.each do |branch|
|
179
199
|
branch.delete!("\n")
|
180
200
|
|
181
|
-
|
182
|
-
|
201
|
+
if branch != "origin"
|
202
|
+
checkout_command = "git checkout " + branch
|
203
|
+
|
204
|
+
puts checkout_command
|
205
|
+
system checkout_command
|
206
|
+
|
207
|
+
input.each do |command|
|
208
|
+
final_command = command.gsub("<branch>", branch)
|
209
|
+
|
210
|
+
puts final_command
|
211
|
+
system final_command
|
212
|
+
end
|
213
|
+
end
|
183
214
|
|
184
215
|
end
|
216
|
+
switch_to_master
|
185
217
|
end
|
186
218
|
|
219
|
+
|
220
|
+
def git_status
|
221
|
+
on_each_exec(["git status <branch>"])
|
222
|
+
end
|
223
|
+
|
187
224
|
def help
|
188
225
|
puts ""
|
189
226
|
puts "TBGit is a command-line utility to facilitate the management of multiple GitHub student repositories."
|
@@ -195,6 +232,7 @@ module Main
|
|
195
232
|
puts " ~ pull pulls all remote master branches to local student branches"
|
196
233
|
puts " ~ merge merges a specified branch with each student branch and then commits the changes"
|
197
234
|
puts " ~ status runs `git status` on each students branch and displays the results"
|
235
|
+
puts " ~ each executes a specified series of commands on each local student branch"
|
198
236
|
puts ""
|
199
237
|
puts " ~ add-remotes adds each student's repository as a remote"
|
200
238
|
puts " ~ create-locals creates a local branch to track the students remote master branch"
|