tbgit 1.0.2 → 1.0.3
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 +4 -4
- data/bin/tbgit +3 -1
- data/lib/helptext.rb +51 -0
- data/lib/tbgit/version.rb +1 -1
- data/lib/tbgit.rb +6 -104
- data/tbgit.gemspec +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cfbbff80dc9f1e03335253f8bbd6d519ce6f746
|
4
|
+
data.tar.gz: 9cbbd01fe4c0162aacf11b585868dcdf43fd55de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 641e35604aed563d2a57d7c808ec9af2d473ddeb6f35d9f74e311cba49bc334b889bf90138e586454530e38af612a22ae43bd77e7425643ba06ca4058fb41a77
|
7
|
+
data.tar.gz: b6f2cc86546cfa42e966175c729d5420cd16df714596fb65180e1aa5bc40f766210ddc67e509a5586774ed4c950f14cd448d5cc59e122ae461380ccdfc84441b
|
data/bin/tbgit
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'tbgit'
|
4
|
+
require 'helptext'
|
4
5
|
|
5
6
|
tbgit = Main::TBGit.new
|
7
|
+
helptext = HelpText.new
|
6
8
|
|
7
9
|
case ARGV[0]
|
8
10
|
when "setup"
|
@@ -46,5 +48,5 @@ when "create-locals"
|
|
46
48
|
|
47
49
|
tbgit.create_local_tracking_remotes
|
48
50
|
else
|
49
|
-
|
51
|
+
helptext.helpme
|
50
52
|
end
|
data/lib/helptext.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
class HelpText
|
2
|
+
def helpme
|
3
|
+
puts ""
|
4
|
+
puts "TBGit is a command-line utility to facilitate the management of multiple GitHub student repositories."
|
5
|
+
puts " ~ created by Charlie Proctor at 2014 YEI Tech Bootcamp"
|
6
|
+
puts " ~ partly based off of https://github.com/education/teachers_pet"
|
7
|
+
puts " Commands:"
|
8
|
+
puts " ~ setup sets up a tbgit environment. See decription below"
|
9
|
+
puts " ~ push pushes all local student branches to their remote master branches"
|
10
|
+
puts " ~ pull pulls all remote master branches to local student branches"
|
11
|
+
puts " ~ merge merges a specified branch with each student branch and then commits the changes"
|
12
|
+
puts " ~ status runs `git status` on each students branch and displays the results"
|
13
|
+
puts " ~ each executes a specified series of commands on each local student branch"
|
14
|
+
puts " ~ spec runs rspec on specified files in a students repo"
|
15
|
+
puts ""
|
16
|
+
puts " ~ add-remotes adds each student's repository as a remote"
|
17
|
+
puts " ~ create-locals creates a local branch to track the students remote master branch"
|
18
|
+
puts " ^----> these are both part of the setup process"
|
19
|
+
puts ""
|
20
|
+
puts " TBGit Environment"
|
21
|
+
puts " ~ it's a regular git repository -- with lots of fancy features!"
|
22
|
+
puts " ~ there is a master branch for teachers to work off of (create hw files, etc..)"
|
23
|
+
puts " --> teachers can obviously create and work off other branches if desired"
|
24
|
+
puts " ~ each student's repository is a remote of the git repo"
|
25
|
+
puts " ~ there is a local branch to track each student's remote master branches"
|
26
|
+
puts ""
|
27
|
+
puts " Setup"
|
28
|
+
puts " 1. Teachers create the student repositories (https://github.com/education/teachers_pet works perfectly well for this)"
|
29
|
+
puts " --> make sure the repos are all private, but that you have access to them!"
|
30
|
+
puts " --> initialize these repos with a README or push out a starter file."
|
31
|
+
puts " --> create a file with a list of the students github usernames (one on each line)"
|
32
|
+
puts " --- you will need this during the setup process"
|
33
|
+
puts " 2. Teachers create a repo for themselves. This will serve as the base for the tbgit environment."
|
34
|
+
puts " 3. Change to that repo's directory, execute `tbgit setup`, and follow the instructions."
|
35
|
+
puts ""
|
36
|
+
puts " A Typical Workflow"
|
37
|
+
puts " 1. Teachers create the assignment (on the master branch) and make a final commit when they're ready to deploy it"
|
38
|
+
puts " 2. Teachers pull all the students' repos to make sure they're up to date."
|
39
|
+
puts " --> `tbgit pull`"
|
40
|
+
puts " 3. Teachers merge their master branch with each student's local branch"
|
41
|
+
puts " --> `tbgit merge`"
|
42
|
+
puts " 4. At this point, teachers should check to make sure their were no merge conflicts. If there were, go in and fix them."
|
43
|
+
puts " --> feel free to `git checkout <username>` a few different branches"
|
44
|
+
puts " 4. Teachers push each students local branch to the student's remote master branch"
|
45
|
+
puts " --> `tbgit push`"
|
46
|
+
puts " 5. Make sure it worked. Do a victory lap."
|
47
|
+
puts ""
|
48
|
+
puts " To view student solutions at any point, just `tbgit pull` and `git checkout <username>`"
|
49
|
+
puts ""
|
50
|
+
end
|
51
|
+
end
|
data/lib/tbgit/version.rb
CHANGED
data/lib/tbgit.rb
CHANGED
@@ -105,33 +105,11 @@ module Main
|
|
105
105
|
def update_repos(pushpull)
|
106
106
|
if pushpull == "push"
|
107
107
|
confirm("Each local student branch will be pushed to their remote master branch. Continue?")
|
108
|
+
on_each_exec(["git push <branch> <branch>:master"])
|
108
109
|
else
|
109
110
|
confirm("Each remote student master branch will be pulled to the local branch. Continue?")
|
111
|
+
on_each_exec(["git pull <branch> master"])
|
110
112
|
end
|
111
|
-
|
112
|
-
all_remotes = all_remotes_list
|
113
|
-
all_remotes.each do |branch|
|
114
|
-
branch.delete!("\n")
|
115
|
-
|
116
|
-
if branch != "origin"
|
117
|
-
checkout_command = "git checkout " + branch
|
118
|
-
if pushpull == "push"
|
119
|
-
pushpull_command = "git push " + branch + " " + branch + ":master"
|
120
|
-
else
|
121
|
-
pushpull_command = "git pull " + branch + " master"
|
122
|
-
end
|
123
|
-
|
124
|
-
puts checkout_command
|
125
|
-
system checkout_command
|
126
|
-
|
127
|
-
puts pushpull_command
|
128
|
-
system pushpull_command
|
129
|
-
end
|
130
|
-
|
131
|
-
end
|
132
|
-
|
133
|
-
switch_to_master
|
134
|
-
|
135
113
|
end
|
136
114
|
|
137
115
|
#merges from master (or another branch) to each student branch and commits the changes
|
@@ -144,32 +122,10 @@ module Main
|
|
144
122
|
puts "Commit Message: "
|
145
123
|
message = $stdin.gets.chomp
|
146
124
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
if branch != "origin"
|
152
|
-
checkout_command = "git checkout " + branch
|
153
|
-
merge_command = "git merge --no-commit " + merge_branch.to_s
|
154
|
-
stage_changes = "git add --all"
|
155
|
-
commit_command = "git commit -am '" + message + "'"
|
156
|
-
|
157
|
-
puts checkout_command
|
158
|
-
system checkout_command
|
159
|
-
|
160
|
-
puts merge_command
|
161
|
-
system merge_command
|
162
|
-
|
163
|
-
puts stage_changes
|
164
|
-
system stage_changes
|
165
|
-
|
166
|
-
puts commit_command
|
167
|
-
system commit_command
|
168
|
-
end
|
169
|
-
|
170
|
-
end
|
171
|
-
|
172
|
-
switch_to_master
|
125
|
+
commands = ["git merge --no-commit " + merge_branch.to_s,
|
126
|
+
"git add --all",
|
127
|
+
"git commit -am '" + message + "'"]
|
128
|
+
on_each_exec(commands)
|
173
129
|
|
174
130
|
end
|
175
131
|
|
@@ -244,59 +200,5 @@ module Main
|
|
244
200
|
|
245
201
|
end
|
246
202
|
|
247
|
-
def help
|
248
|
-
puts ""
|
249
|
-
puts "TBGit is a command-line utility to facilitate the management of multiple GitHub student repositories."
|
250
|
-
puts " ~ created by Charlie Proctor at 2014 YEI Tech Bootcamp"
|
251
|
-
puts " ~ partly based off of https://github.com/education/teachers_pet"
|
252
|
-
puts " Commands:"
|
253
|
-
puts " ~ setup sets up a tbgit environment. See decription below"
|
254
|
-
puts " ~ push pushes all local student branches to their remote master branches"
|
255
|
-
puts " ~ pull pulls all remote master branches to local student branches"
|
256
|
-
puts " ~ merge merges a specified branch with each student branch and then commits the changes"
|
257
|
-
puts " ~ status runs `git status` on each students branch and displays the results"
|
258
|
-
puts " ~ each executes a specified series of commands on each local student branch"
|
259
|
-
puts " ~ spec runs rspec on specified files in a students repo"
|
260
|
-
puts ""
|
261
|
-
puts " ~ add-remotes adds each student's repository as a remote"
|
262
|
-
puts " ~ create-locals creates a local branch to track the students remote master branch"
|
263
|
-
puts " ^----> these are both part of the setup process"
|
264
|
-
puts ""
|
265
|
-
puts " TBGit Environment"
|
266
|
-
puts " ~ it's a regular git repository -- with lots of fancy features!"
|
267
|
-
puts " ~ there is a master branch for teachers to work off of (create hw files, etc..)"
|
268
|
-
puts " --> teachers can obviously create and work off other branches if desired"
|
269
|
-
puts " ~ each student's repository is a remote of the git repo"
|
270
|
-
puts " ~ there is a local branch to track each student's remote master branches"
|
271
|
-
puts ""
|
272
|
-
puts " Setup"
|
273
|
-
puts " 1. Teachers create the student repositories (https://github.com/education/teachers_pet works perfectly well for this)"
|
274
|
-
puts " --> make sure the repos are all private, but that you have access to them!"
|
275
|
-
puts " --> initialize these repos with a README or push out a starter file."
|
276
|
-
puts " --> create a file with a list of the students github usernames (one on each line)"
|
277
|
-
puts " --- you will need this during the setup process"
|
278
|
-
puts " 2. Teachers create a repo for themselves. This will serve as the base for the tbgit environment."
|
279
|
-
puts " 3. Change to that repo's directory, execute `tbgit setup`, and follow the instructions."
|
280
|
-
puts ""
|
281
|
-
puts " A Typical Workflow"
|
282
|
-
puts " 1. Teachers create the assignment (on the master branch) and make a final commit when they're ready to deploy it"
|
283
|
-
puts " 2. Teachers pull all the students' repos to make sure they're up to date."
|
284
|
-
puts " --> `tbgit pull`"
|
285
|
-
puts " 3. Teachers merge their master branch with each student's local branch"
|
286
|
-
puts " --> `tbgit merge`"
|
287
|
-
puts " 4. At this point, teachers should check to make sure their were no merge conflicts. If there were, go in and fix them."
|
288
|
-
puts " --> feel free to `git checkout <username>` a few different branches"
|
289
|
-
puts " 4. Teachers push each students local branch to the student's remote master branch"
|
290
|
-
puts " --> `tbgit push`"
|
291
|
-
puts " 5. Make sure it worked. Do a victory lap."
|
292
|
-
puts ""
|
293
|
-
puts " To view student solutions at any point, just `tbgit pull` and `git checkout <username>`"
|
294
|
-
puts ""
|
295
|
-
end
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
203
|
end #class
|
302
204
|
end #module
|
data/tbgit.gemspec
CHANGED
@@ -14,6 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.files += Dir['lib/*.rb'] #add in any .rb files in lib
|
17
18
|
spec.executables = ["tbgit"]
|
18
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
20
|
spec.require_paths = ["lib"]
|
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.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charlie Proctor
|
@@ -52,6 +52,7 @@ files:
|
|
52
52
|
- README.md
|
53
53
|
- Rakefile
|
54
54
|
- bin/tbgit
|
55
|
+
- lib/helptext.rb
|
55
56
|
- lib/tbgit.rb
|
56
57
|
- lib/tbgit/version.rb
|
57
58
|
- tbgit.gemspec
|