unixoid-challenge 0.0.4 → 0.0.5
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/lib/unixoid/controller.rb +13 -1
- data/lib/unixoid/git.rb +9 -4
- 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: 6eb5368f5c071103690171bd1efe6084cfb2f132
|
4
|
+
data.tar.gz: 5643f366e36987be9f0083696a1692e87d3ff1f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5078d25f9c0efb1cd2b7d2d1418b6a340ef749e4e137bf742eaad4ecb32e4a5b951cee1053570231224c569d037a0466e54ac0215e856eb50d0707ec89ff183d
|
7
|
+
data.tar.gz: 15a42e7c7bf3e4bd6bfa765d897aed74eb29a0b174cf6f136bd3003eee274e5c2df10c52355792ee88b58b4216be2d0914cf0de690a1673a60713ced885bbb05
|
data/lib/unixoid/controller.rb
CHANGED
@@ -21,8 +21,12 @@ module Unixoid
|
|
21
21
|
def push_to_github(file)
|
22
22
|
github = Github.create_repo
|
23
23
|
auth_fail! unless github.authenticated?
|
24
|
+
|
25
|
+
git = Git.new(github)
|
26
|
+
get_config(git) unless git.configured?
|
27
|
+
|
24
28
|
puts "Submitting..."
|
25
|
-
|
29
|
+
git.submit(file)
|
26
30
|
puts "Submitted!"
|
27
31
|
end
|
28
32
|
|
@@ -39,6 +43,14 @@ module Unixoid
|
|
39
43
|
puts render_results(results)
|
40
44
|
end
|
41
45
|
|
46
|
+
def get_config(git)
|
47
|
+
puts 'Please enter your full name:'
|
48
|
+
name = gets.chomp
|
49
|
+
puts 'Please enter your e-mail address:'
|
50
|
+
email = gets.chomp
|
51
|
+
git.configure(name, email)
|
52
|
+
end
|
53
|
+
|
42
54
|
def auth_fail!
|
43
55
|
puts 'Incorrect login details. Please run unixoid-challenge again'.red
|
44
56
|
exit 1
|
data/lib/unixoid/git.rb
CHANGED
@@ -14,10 +14,6 @@ module Unixoid
|
|
14
14
|
@runner = Runner.new
|
15
15
|
end
|
16
16
|
|
17
|
-
def self.submit(file, github)
|
18
|
-
new(github).submit(file)
|
19
|
-
end
|
20
|
-
|
21
17
|
def submit(file)
|
22
18
|
create_repo
|
23
19
|
add(file)
|
@@ -51,6 +47,15 @@ module Unixoid
|
|
51
47
|
run('git remote rm origin')
|
52
48
|
end
|
53
49
|
|
50
|
+
def configured?
|
51
|
+
run('git config --get user.email', outcodes: [0, 1]) != '' && run('git config --get user.name', outcodes: [0, 1]) != ''
|
52
|
+
end
|
53
|
+
|
54
|
+
def configure(name, email)
|
55
|
+
run("git config --global user.name '#{name}'")
|
56
|
+
run("git config --global user.email '#{email}'")
|
57
|
+
end
|
58
|
+
|
54
59
|
private
|
55
60
|
|
56
61
|
def username
|