-
Notifications
You must be signed in to change notification settings - Fork 1k
/
Copy pathcontribute.rb
25 lines (21 loc) · 901 Bytes
/
contribute.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
difficulty 3
description "This is the final level, the goal is to contribute to this repository by making a pull request on GitHub. Please note that this level is designed to encourage you to add a valid contribution to Githug, not testing your ability to create a pull request. Contributions that are likely to be accepted are levels, bug fixes and improved documentation."
solution do
location = "/tmp/githug"
FileUtils.rm_rf(location)
puts "Cloning repository to #{location}"
`git clone https://github.com/Gazler/githug #{location}`
contributor = false
repo = Grit::Repo.new(location)
repo.commits('master', false).each do |commit|
if commit.author.name == repo.config["user.name"]
if commit.author.email == repo.config["user.email"]
contributor = true
end
end
end
contributor
end
hint do
puts "Forking the repository would be a good start!"
end