tbgit 1.0.0 → 1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 79c2967cde856714bce60cf664f8be7adc3e7812
4
- data.tar.gz: b566769fe5d56253d6592c84675fa535bc2772ca
3
+ metadata.gz: 94635ee4762c4d5e5dc0e28679c657c67c1643c6
4
+ data.tar.gz: 77117c9fdd487dcdfb6fa1154740029a4ab49402
5
5
  SHA512:
6
- metadata.gz: d85851c9450b364b65c35dc0428f28a83e4f493835796ad076bad72220340b2496eb731cbe0640ff378bd3fa87bef8c9b5e2b3d184d718f28a6eb0be53f9d3ba
7
- data.tar.gz: 6295061e28c79499a9aa8510f769479671eda32b2a08aaaccd20246da276f1fdbeb43edc92b9c1dc128235a85b5e778c5107ba3fc4ae3298d7a40cd660a5bd34
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
@@ -31,6 +31,8 @@ when "merge"
31
31
  tbgit.merge_and_commit
32
32
  when "status"
33
33
  tbgit.git_status
34
+ when "each"
35
+ tbgit.on_each_gather
34
36
  when "add-remotes"
35
37
  tbgit.gather
36
38
  tbgit.spacer
data/lib/tbgit/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tbgit
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
data/lib/tbgit.rb CHANGED
@@ -173,17 +173,54 @@ module Main
173
173
 
174
174
  end
175
175
 
176
- def git_status
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
- puts "git status " + branch
182
- system "git status " + branch
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"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tbgit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charlie Proctor