teachers_pet 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -2
- data/lib/teachers_pet/actions/add_collaborators.rb +21 -0
- data/lib/teachers_pet/actions/add_to_team.rb +0 -6
- data/lib/teachers_pet/actions/base.rb +6 -0
- data/lib/teachers_pet/actions/forks.rb +31 -0
- data/lib/teachers_pet/actions/merge_pull_requests.rb +18 -0
- data/lib/teachers_pet/commands/add_collaborators.rb +13 -0
- data/lib/teachers_pet/commands/add_to_team.rb +1 -0
- data/lib/teachers_pet/commands/forks.rb +12 -0
- data/lib/teachers_pet/commands/merge_pull_requests.rb +11 -0
- data/lib/teachers_pet/version.rb +1 -1
- data/spec/commands/add_collaborators_spec.rb +84 -0
- data/spec/commands/{fork_collab_spec.rb → forks_spec.rb} +43 -43
- data/spec/commands/merge_pull_requests_spec.rb +29 -0
- metadata +40 -32
- data/lib/teachers_pet/actions/fork_collab.rb +0 -33
- data/lib/teachers_pet/commands/fork_collab.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 237378cc3ef99f43b205dd00666e73b31d0fd08c
|
4
|
+
data.tar.gz: 6ae28a5c307127776aef86f6f40570fa38b6603f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6045ed09c10c41e2167b5f87223d2a46b91e99d2473f73d1b0bff31e17683a830328e7833596d6d2aace1c4e859049b5d66e42a6d961a19bbf8260e5a02ad3ef
|
7
|
+
data.tar.gz: b23a23912a4c70d10a47d2092693d19272173ea1a3cc65fd7f352d046ec5b119fcc4fe49976550cd2d5fc4e6e95c19c426d4e1fefa4299d11628649b5501cd3b
|
data/README.md
CHANGED
@@ -92,9 +92,13 @@ You may need to give other people access to various repositories using teams –
|
|
92
92
|
|
93
93
|
When using the [sandboxing](https://education.github.com/guide/sandboxing) setup, you will need to create the repositories for the students. For each assignment, use the `create_repos` action to create a repository for each student. The repositories are technically created per team, but if you use `create_student_teams` first, then there will be one team per student.
|
94
94
|
|
95
|
+
### Forks
|
96
|
+
|
97
|
+
If you need to grab the list of users who have forked a particular repository – e.g. to use with another command – you can run the `forks` command, and the results will be written to a file.
|
98
|
+
|
95
99
|
### Collaborator access
|
96
100
|
|
97
|
-
Give [collaborator access](https://help.github.com/articles/what-are-the-different-access-permissions#collaborator) to everyone who has forked your repository using `
|
101
|
+
Give [collaborator access](https://help.github.com/articles/what-are-the-different-access-permissions#collaborator) to everyone who has forked your repository using `add_collaborators`. Mostly useful for GitHub demonstrations, where usernames can quickly be collected via `forks`, and then the students can be quickly given access to a repository.
|
98
102
|
|
99
103
|
### Pushing starter files
|
100
104
|
|
@@ -104,10 +108,14 @@ When creating repositories for students, you will often want to include boilerpl
|
|
104
108
|
|
105
109
|
After running `create_repos`, instructors can open issues in student repos as a way to list requirements of the assignment, goals, or instructions for patching, using the `open_issue` command.
|
106
110
|
|
107
|
-
###
|
111
|
+
### Clone repositories for grading
|
108
112
|
|
109
113
|
When grading, use the `clone_repos` command to clone all the repositories in the organization that match the username-repository naming scheme that is generated when `create_repos` is run.
|
110
114
|
|
115
|
+
### Merge all open pull requests
|
116
|
+
|
117
|
+
When running a GitHub workshop, it's nice to be able to merge a bunch of pull requests on a particular repository all at once. `merge_pull_requests` will handle this for you.
|
118
|
+
|
111
119
|
## Related projects
|
112
120
|
|
113
121
|
* https://education.github.com/guide
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module TeachersPet
|
2
|
+
module Actions
|
3
|
+
class AddCollaborators < Base
|
4
|
+
def repository
|
5
|
+
self.options[:repository]
|
6
|
+
end
|
7
|
+
|
8
|
+
def run
|
9
|
+
self.init_client
|
10
|
+
|
11
|
+
members = self.read_members_file
|
12
|
+
members.each do |login|
|
13
|
+
unless self.options[:dry_run]
|
14
|
+
result = self.client.add_collab(self.repository, login)
|
15
|
+
end
|
16
|
+
puts "#{login} - #{result}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,12 +1,6 @@
|
|
1
1
|
module TeachersPet
|
2
2
|
module Actions
|
3
3
|
class AddToTeam < Base
|
4
|
-
def read_members_file
|
5
|
-
file = self.options[:members]
|
6
|
-
puts "Loading members to add:"
|
7
|
-
read_file(file).keys
|
8
|
-
end
|
9
|
-
|
10
4
|
def team_name
|
11
5
|
file = self.options[:members]
|
12
6
|
File.basename(file, File.extname(file))
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'csv'
|
2
|
+
|
3
|
+
module TeachersPet
|
4
|
+
module Actions
|
5
|
+
class Forks < Base
|
6
|
+
def repository
|
7
|
+
self.options[:repository]
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_forks
|
11
|
+
self.client.forks(self.repository)
|
12
|
+
end
|
13
|
+
|
14
|
+
def run
|
15
|
+
self.init_client
|
16
|
+
forks = self.get_forks
|
17
|
+
|
18
|
+
CSV.open(self.options[:output], 'wb') do |csv|
|
19
|
+
forks.each do |fork|
|
20
|
+
login = fork.owner.login
|
21
|
+
if fork.owner.type == "User"
|
22
|
+
csv << [login]
|
23
|
+
else
|
24
|
+
puts "Ignoring organization: @#{login}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module TeachersPet
|
2
|
+
module Actions
|
3
|
+
class MergePullRequests < Base
|
4
|
+
def run
|
5
|
+
repository = self.options[:repository]
|
6
|
+
|
7
|
+
self.init_client
|
8
|
+
|
9
|
+
open_pull_requests = self.client.pull_requests(repository, state: 'open')
|
10
|
+
open_pull_requests.each do |pr|
|
11
|
+
print "Merging #{pr.html_url}..."
|
12
|
+
client.merge_pull_request(repository, pr.number)
|
13
|
+
puts "done"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module TeachersPet
|
2
|
+
class Cli
|
3
|
+
option :repository, required: true, banner: 'OWNER/REPO'
|
4
|
+
option :members, required: true, banner: 'PATH', desc: "The path to the file containing the list of usernames to add."
|
5
|
+
option :dry_run, type: :boolean, default: false
|
6
|
+
common_options
|
7
|
+
|
8
|
+
desc "add_collaborators", "Give collaborator access to each provided user."
|
9
|
+
def add_collaborators
|
10
|
+
TeachersPet::Actions::AddCollaborators.new(options).run
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module TeachersPet
|
2
2
|
class Cli
|
3
3
|
option :organization, required: true
|
4
|
+
# TODO make team name configurable
|
4
5
|
option :members, required: true, banner: 'PATH', desc: "The path to the file containing the list of members to add. The filename will be used as the name of the team, e.g. `path/to/instructors.csv` will use the 'instructors' team."
|
5
6
|
common_options
|
6
7
|
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module TeachersPet
|
2
|
+
class Cli
|
3
|
+
option :repository, required: true, banner: 'OWNER/REPO'
|
4
|
+
option :output, banner: 'PATH', default: 'students.csv'
|
5
|
+
common_options
|
6
|
+
|
7
|
+
desc "forks", "Pull the list of users who have forked a particular repository."
|
8
|
+
def forks
|
9
|
+
TeachersPet::Actions::Forks.new(options).run
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module TeachersPet
|
2
|
+
class Cli
|
3
|
+
option :repository, required: true, banner: 'OWNER/REPO'
|
4
|
+
common_options
|
5
|
+
|
6
|
+
desc 'merge_pull_requests', "Merges all open pull requests on a particular repository"
|
7
|
+
def merge_pull_requests
|
8
|
+
TeachersPet::Actions::MergePullRequests.new(options).run
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/teachers_pet/version.rb
CHANGED
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'add_collaborators' do
|
4
|
+
include CommandHelpers
|
5
|
+
|
6
|
+
def stub_add_students
|
7
|
+
student_usernames.map do |username|
|
8
|
+
stub_request(:put, "https://testteacher:abc123@api.github.com/repos/testorg/testrepo/collaborators/#{username}")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
context 'through CLI' do
|
13
|
+
it "requires the repository be specified" do
|
14
|
+
expect {
|
15
|
+
teachers_pet(:add_collaborators)
|
16
|
+
}.to raise_error(Thor::RequiredArgumentMissingError, /--repository/)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "passes the options to the action" do
|
20
|
+
expect_to_be_run_with(TeachersPet::Actions::AddCollaborators,
|
21
|
+
'api' => 'https://api.github.com/',
|
22
|
+
'dry_run' => false,
|
23
|
+
'members' => students_list_fixture_path,
|
24
|
+
'password' => 'abc123',
|
25
|
+
'repository' => 'testorg/testrepo',
|
26
|
+
'username' => ENV['USER'],
|
27
|
+
'web' => 'https://www.github.com/'
|
28
|
+
)
|
29
|
+
|
30
|
+
teachers_pet(:add_collaborators,
|
31
|
+
repository: 'testorg/testrepo',
|
32
|
+
members: students_list_fixture_path,
|
33
|
+
password: 'abc123'
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "succeeds for basic auth" do
|
38
|
+
request_stubs = student_usernames.map do |username|
|
39
|
+
stub_request(:put, "https://testteacher:abc123@api.github.com/repos/testorg/testrepo/collaborators/#{username}")
|
40
|
+
end
|
41
|
+
|
42
|
+
teachers_pet(:add_collaborators,
|
43
|
+
repository: 'testorg/testrepo',
|
44
|
+
members: students_list_fixture_path,
|
45
|
+
username: 'testteacher',
|
46
|
+
password: 'abc123'
|
47
|
+
)
|
48
|
+
|
49
|
+
request_stubs.each do |request_stub|
|
50
|
+
expect(request_stub).to have_been_requested.once
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
it "succeeds for OAuth" do
|
55
|
+
request_stubs = student_usernames.map do |username|
|
56
|
+
stub_request(:put, "https://api.github.com/repos/testorg/testrepo/collaborators/#{username}").with(headers: {'Authorization'=>'token tokentokentoken'})
|
57
|
+
end
|
58
|
+
|
59
|
+
teachers_pet(:add_collaborators,
|
60
|
+
repository: 'testorg/testrepo',
|
61
|
+
members: students_list_fixture_path,
|
62
|
+
token: 'tokentokentoken'
|
63
|
+
)
|
64
|
+
|
65
|
+
request_stubs.each do |request_stub|
|
66
|
+
expect(request_stub).to have_been_requested.once
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
it "prints the users on a dry run" do
|
71
|
+
output = capture(:stdout) do
|
72
|
+
teachers_pet(:add_collaborators,
|
73
|
+
repository: 'testorg/testrepo',
|
74
|
+
members: students_list_fixture_path,
|
75
|
+
username: 'testteacher',
|
76
|
+
password: 'abc123',
|
77
|
+
dry_run: true
|
78
|
+
)
|
79
|
+
end
|
80
|
+
|
81
|
+
expect(output).to include('teststudent1')
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -1,30 +1,60 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe '
|
3
|
+
describe 'forks' do
|
4
4
|
include CommandHelpers
|
5
5
|
|
6
|
+
let(:members_file){ 'students.csv' }
|
7
|
+
|
8
|
+
after do
|
9
|
+
FileUtils.rm_f(members_file)
|
10
|
+
end
|
11
|
+
|
6
12
|
context 'through CLI' do
|
7
13
|
it "requires the repository be specified" do
|
8
14
|
expect {
|
9
|
-
teachers_pet(:
|
15
|
+
teachers_pet(:forks)
|
10
16
|
}.to raise_error(Thor::RequiredArgumentMissingError, /--repository/)
|
11
17
|
end
|
12
18
|
|
13
19
|
it "passes the options to the action" do
|
14
|
-
expect_to_be_run_with(TeachersPet::Actions::
|
20
|
+
expect_to_be_run_with(TeachersPet::Actions::Forks,
|
15
21
|
'api' => 'https://api.github.com/',
|
16
|
-
'
|
22
|
+
'output' => members_file,
|
17
23
|
'password' => 'abc123',
|
18
24
|
'repository' => 'testorg/testrepo',
|
19
25
|
'username' => ENV['USER'],
|
20
26
|
'web' => 'https://www.github.com/'
|
21
27
|
)
|
22
|
-
teachers_pet(:
|
28
|
+
teachers_pet(:forks, repository: 'testorg/testrepo', password: 'abc123')
|
29
|
+
end
|
30
|
+
|
31
|
+
context "with a different filename" do
|
32
|
+
let(:members_file){ './users.txt' }
|
33
|
+
|
34
|
+
it "writes to that file" do
|
35
|
+
request_stub = stub_get_json('https://testteacher:abc123@api.github.com/repos/testorg/testrepo/forks?per_page=100', [
|
36
|
+
{
|
37
|
+
owner: {
|
38
|
+
login: 'teststudent',
|
39
|
+
type: 'User'
|
40
|
+
}
|
41
|
+
}
|
42
|
+
])
|
43
|
+
|
44
|
+
teachers_pet(:forks,
|
45
|
+
repository: 'testorg/testrepo',
|
46
|
+
output: members_file,
|
47
|
+
username: 'testteacher',
|
48
|
+
password: 'abc123'
|
49
|
+
)
|
50
|
+
|
51
|
+
expect(File.read(members_file)).to eq("teststudent\n")
|
52
|
+
expect(request_stub).to have_been_requested.once
|
53
|
+
end
|
23
54
|
end
|
24
55
|
|
25
56
|
it "succeeds for basic auth" do
|
26
|
-
|
27
|
-
request_stubs << stub_get_json('https://testteacher:abc123@api.github.com/repos/testorg/testrepo/forks?per_page=100', [
|
57
|
+
request_stub = stub_get_json('https://testteacher:abc123@api.github.com/repos/testorg/testrepo/forks?per_page=100', [
|
28
58
|
{
|
29
59
|
owner: {
|
30
60
|
login: 'teststudent',
|
@@ -32,22 +62,19 @@ describe 'fork_collab' do
|
|
32
62
|
}
|
33
63
|
}
|
34
64
|
])
|
35
|
-
request_stubs << stub_request(:put, 'https://testteacher:abc123@api.github.com/repos/testorg/testrepo/collaborators/teststudent')
|
36
65
|
|
37
|
-
teachers_pet(:
|
66
|
+
teachers_pet(:forks,
|
38
67
|
repository: 'testorg/testrepo',
|
39
68
|
username: 'testteacher',
|
40
69
|
password: 'abc123'
|
41
70
|
)
|
42
71
|
|
43
|
-
|
44
|
-
|
45
|
-
end
|
72
|
+
expect(File.read(members_file)).to eq("teststudent\n")
|
73
|
+
expect(request_stub).to have_been_requested.once
|
46
74
|
end
|
47
75
|
|
48
76
|
it "succeeds for OAuth" do
|
49
|
-
|
50
|
-
request_stubs << stub_get_json('https://api.github.com/repos/testorg/testrepo/forks?per_page=100', [
|
77
|
+
request_stub = stub_get_json('https://api.github.com/repos/testorg/testrepo/forks?per_page=100', [
|
51
78
|
{
|
52
79
|
owner: {
|
53
80
|
login: 'teststudent',
|
@@ -56,39 +83,12 @@ describe 'fork_collab' do
|
|
56
83
|
}
|
57
84
|
]).with(headers: {'Authorization' => 'token tokentokentoken'})
|
58
85
|
|
59
|
-
|
60
|
-
with(headers: {'Authorization' => 'token tokentokentoken'})
|
61
|
-
|
62
|
-
teachers_pet(:fork_collab,
|
86
|
+
teachers_pet(:forks,
|
63
87
|
repository: 'testorg/testrepo',
|
64
88
|
token: 'tokentokentoken'
|
65
89
|
)
|
66
90
|
|
67
|
-
|
68
|
-
expect(request_stub).to have_been_requested.once
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
it "prints the users on a dry run" do
|
73
|
-
request_stub = stub_get_json('https://testteacher:abc123@api.github.com/repos/testorg/testrepo/forks?per_page=100', [
|
74
|
-
{
|
75
|
-
owner: {
|
76
|
-
login: 'teststudent',
|
77
|
-
type: 'User'
|
78
|
-
}
|
79
|
-
}
|
80
|
-
])
|
81
|
-
|
82
|
-
output = capture(:stdout) do
|
83
|
-
teachers_pet(:fork_collab,
|
84
|
-
repository: 'testorg/testrepo',
|
85
|
-
username: 'testteacher',
|
86
|
-
password: 'abc123',
|
87
|
-
dry_run: true
|
88
|
-
)
|
89
|
-
end
|
90
|
-
|
91
|
-
expect(output).to include('teststudent')
|
91
|
+
expect(File.read(members_file)).to eq("teststudent\n")
|
92
92
|
expect(request_stub).to have_been_requested.once
|
93
93
|
end
|
94
94
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'merge_pull_requests' do
|
4
|
+
include CommandHelpers
|
5
|
+
|
6
|
+
it "merges all open pull requests in a particular repository" do
|
7
|
+
request_stubs = []
|
8
|
+
request_stubs << stub_get_json("https://testteacher:abc123@api.github.com/repos/testorg/testrepo/pulls?per_page=100&state=open", [
|
9
|
+
{ id: 1, html_url: "https://github.com/testorg/testrepo/pull/1", number: 1 },
|
10
|
+
{ id: 2, html_url: "https://github.com/testorg/testrepo/pull/2", number: 2 },
|
11
|
+
{ id: 3, html_url: "https://github.com/testorg/testrepo/pull/3", number: 3 }
|
12
|
+
])
|
13
|
+
|
14
|
+
(1..3).to_a.each do |i|
|
15
|
+
request_stubs << stub_request(:put, "https://testteacher:abc123@api.github.com/repos/testorg/testrepo/pulls/#{i}/merge")
|
16
|
+
end
|
17
|
+
|
18
|
+
teachers_pet(:merge_pull_requests,
|
19
|
+
repository: 'testorg/testrepo',
|
20
|
+
|
21
|
+
username: 'testteacher',
|
22
|
+
password: 'abc123'
|
23
|
+
)
|
24
|
+
|
25
|
+
request_stubs.each do |request_stub|
|
26
|
+
expect(request_stub).to have_been_requested.once
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
metadata
CHANGED
@@ -1,153 +1,153 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teachers_pet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Britton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '4.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: octokit
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 3.1.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 3.1.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: require_all
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 1.3.2
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.3.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: thor
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 0.19.1
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.19.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '1.5'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.5'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: guard-rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '4.2'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '4.2'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - ~>
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '3.0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - ~>
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '3.0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: simplecov
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - ~>
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: 0.7.1
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - ~>
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 0.7.1
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: webmock
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - ~>
|
143
|
+
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '1.17'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - ~>
|
150
|
+
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '1.17'
|
153
153
|
description:
|
@@ -157,9 +157,9 @@ executables:
|
|
157
157
|
extensions: []
|
158
158
|
extra_rdoc_files: []
|
159
159
|
files:
|
160
|
-
- .gitignore
|
161
|
-
- .rspec
|
162
|
-
- .travis.yml
|
160
|
+
- ".gitignore"
|
161
|
+
- ".rspec"
|
162
|
+
- ".travis.yml"
|
163
163
|
- CONTRIBUTING.md
|
164
164
|
- Gemfile
|
165
165
|
- Guardfile
|
@@ -168,32 +168,38 @@ files:
|
|
168
168
|
- Rakefile
|
169
169
|
- bin/teachers_pet
|
170
170
|
- lib/teachers_pet.rb
|
171
|
+
- lib/teachers_pet/actions/add_collaborators.rb
|
171
172
|
- lib/teachers_pet/actions/add_to_team.rb
|
172
173
|
- lib/teachers_pet/actions/base.rb
|
173
174
|
- lib/teachers_pet/actions/clone_repos.rb
|
174
175
|
- lib/teachers_pet/actions/create_repos.rb
|
175
176
|
- lib/teachers_pet/actions/create_student_teams.rb
|
176
|
-
- lib/teachers_pet/actions/
|
177
|
+
- lib/teachers_pet/actions/forks.rb
|
178
|
+
- lib/teachers_pet/actions/merge_pull_requests.rb
|
177
179
|
- lib/teachers_pet/actions/open_issue.rb
|
178
180
|
- lib/teachers_pet/actions/push_files.rb
|
179
181
|
- lib/teachers_pet/cli.rb
|
180
182
|
- lib/teachers_pet/client_decorator.rb
|
183
|
+
- lib/teachers_pet/commands/add_collaborators.rb
|
181
184
|
- lib/teachers_pet/commands/add_to_team.rb
|
182
185
|
- lib/teachers_pet/commands/clone_repos.rb
|
183
186
|
- lib/teachers_pet/commands/create_repos.rb
|
184
187
|
- lib/teachers_pet/commands/create_student_teams.rb
|
185
|
-
- lib/teachers_pet/commands/
|
188
|
+
- lib/teachers_pet/commands/forks.rb
|
189
|
+
- lib/teachers_pet/commands/merge_pull_requests.rb
|
186
190
|
- lib/teachers_pet/commands/open_issue.rb
|
187
191
|
- lib/teachers_pet/commands/push_files.rb
|
188
192
|
- lib/teachers_pet/configuration.rb
|
189
193
|
- lib/teachers_pet/version.rb
|
190
194
|
- spec/actions/base_spec.rb
|
191
195
|
- spec/cli_spec.rb
|
196
|
+
- spec/commands/add_collaborators_spec.rb
|
192
197
|
- spec/commands/add_to_team_spec.rb
|
193
198
|
- spec/commands/clone_repos_spec.rb
|
194
199
|
- spec/commands/create_repos_spec.rb
|
195
200
|
- spec/commands/create_student_teams_spec.rb
|
196
|
-
- spec/commands/
|
201
|
+
- spec/commands/forks_spec.rb
|
202
|
+
- spec/commands/merge_pull_requests_spec.rb
|
197
203
|
- spec/commands/open_issue_spec.rb
|
198
204
|
- spec/commands/push_files_spec.rb
|
199
205
|
- spec/fixtures/empty
|
@@ -216,28 +222,30 @@ require_paths:
|
|
216
222
|
- lib
|
217
223
|
required_ruby_version: !ruby/object:Gem::Requirement
|
218
224
|
requirements:
|
219
|
-
- -
|
225
|
+
- - ">="
|
220
226
|
- !ruby/object:Gem::Version
|
221
227
|
version: 1.9.3
|
222
228
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
223
229
|
requirements:
|
224
|
-
- -
|
230
|
+
- - ">="
|
225
231
|
- !ruby/object:Gem::Version
|
226
232
|
version: '0'
|
227
233
|
requirements: []
|
228
234
|
rubyforge_project:
|
229
|
-
rubygems_version: 2.
|
235
|
+
rubygems_version: 2.2.2
|
230
236
|
signing_key:
|
231
237
|
specification_version: 4
|
232
238
|
summary: Command line tools to help teachers use GitHub in their classrooms
|
233
239
|
test_files:
|
234
240
|
- spec/actions/base_spec.rb
|
235
241
|
- spec/cli_spec.rb
|
242
|
+
- spec/commands/add_collaborators_spec.rb
|
236
243
|
- spec/commands/add_to_team_spec.rb
|
237
244
|
- spec/commands/clone_repos_spec.rb
|
238
245
|
- spec/commands/create_repos_spec.rb
|
239
246
|
- spec/commands/create_student_teams_spec.rb
|
240
|
-
- spec/commands/
|
247
|
+
- spec/commands/forks_spec.rb
|
248
|
+
- spec/commands/merge_pull_requests_spec.rb
|
241
249
|
- spec/commands/open_issue_spec.rb
|
242
250
|
- spec/commands/push_files_spec.rb
|
243
251
|
- spec/fixtures/empty
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module TeachersPet
|
2
|
-
module Actions
|
3
|
-
class ForkCollab < Base
|
4
|
-
def repository
|
5
|
-
self.options[:repository]
|
6
|
-
end
|
7
|
-
|
8
|
-
def get_forks
|
9
|
-
self.client.forks(self.repository)
|
10
|
-
end
|
11
|
-
|
12
|
-
def promote
|
13
|
-
self.init_client
|
14
|
-
forks = self.get_forks
|
15
|
-
forks.each do |fork|
|
16
|
-
login = fork.owner.login
|
17
|
-
if fork.owner.type == "User"
|
18
|
-
unless self.options[:dry_run]
|
19
|
-
result = self.client.add_collab(self.repository, login)
|
20
|
-
end
|
21
|
-
puts "#{login} - #{result}"
|
22
|
-
else
|
23
|
-
puts "#{login} - false (Organization)"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def run
|
29
|
-
self.promote
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
module TeachersPet
|
2
|
-
class Cli
|
3
|
-
option :repository, required: true, banner: 'OWNER/REPO'
|
4
|
-
option :dry_run, type: :boolean, default: false
|
5
|
-
common_options
|
6
|
-
|
7
|
-
desc "fork_collab", "Give collaborator access to everyone who has forked a particular repository."
|
8
|
-
def fork_collab
|
9
|
-
TeachersPet::Actions::ForkCollab.new(options).run
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|