commit-live-cli 0.0.11 → 0.0.12
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/commit-live/lesson/git-helper.rb +19 -12
- data/lib/commit-live/lesson/open.rb +5 -1
- data/lib/commit-live/version.rb +1 -1
- 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: 0aea2c473eea988b5bdb7f1c13ce6b26e323610b
|
4
|
+
data.tar.gz: 5a1520b6bd145c4c03246d16b772884456c54099
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3619d5873942a10d81c40a7973e68a891758ce3969b70b80e5419592534f968f78ff2e645b6f67381a692e3ddad18a6c992432afbd823f0e6c99e40b4cb724a4
|
7
|
+
data.tar.gz: 86c7c8db6f4a3a7dfeca500126957c463ee8b41ee341d7934d7639f232fba60699cd075532ca5078e9d465e012a6d9745bfd5421aa5dc774ba9121965b40a9cd
|
@@ -1,13 +1,12 @@
|
|
1
1
|
require "commit-live/lesson/current"
|
2
2
|
require "commit-live/lesson/status"
|
3
|
-
require "commit-live/tests/runner"
|
4
3
|
require "commit-live/netrc-interactor"
|
5
4
|
require "commit-live/github"
|
6
5
|
|
7
6
|
module CommitLive
|
8
7
|
class Submit
|
9
8
|
class GitHelper
|
10
|
-
attr_reader :git, :currentLesson, :netrc, :status
|
9
|
+
attr_reader :git, :currentLesson, :netrc, :status, :lessonName
|
11
10
|
attr_accessor :remote_name
|
12
11
|
|
13
12
|
REPO_BELONGS_TO_US = [
|
@@ -19,21 +18,33 @@ module CommitLive
|
|
19
18
|
@netrc = CommitLive::NetrcInteractor.new()
|
20
19
|
@currentLesson = CommitLive::Current.new
|
21
20
|
@status = CommitLive::Status.new
|
21
|
+
@lessonName = repo_name(remote: 'origin')
|
22
22
|
end
|
23
23
|
|
24
24
|
def commitAndPush
|
25
25
|
checkRemote
|
26
|
-
|
26
|
+
|
27
|
+
currentLesson.getCurrentLesson(lessonName)
|
28
|
+
lessonData = currentLesson.getAttr('data')
|
29
|
+
testCasePassed = lessonData['test_case_pass']
|
30
|
+
# Check if User passed test cases
|
27
31
|
if testCasePassed
|
32
|
+
# Push to User's Github
|
28
33
|
addChanges
|
29
34
|
commitChanges
|
30
|
-
|
31
35
|
push
|
32
|
-
|
33
|
-
|
36
|
+
|
37
|
+
pullRequestSubmitted = lessonData['submitted_pull_request']
|
38
|
+
if !pullRequestSubmitted
|
39
|
+
# Create Pull Request
|
40
|
+
createPullRequest
|
41
|
+
update_lesson_status
|
42
|
+
end
|
43
|
+
|
44
|
+
puts "Done."
|
34
45
|
else
|
35
|
-
puts "
|
36
|
-
puts "Please
|
46
|
+
puts "It seems you have not passed all the test cases."
|
47
|
+
puts "Please execute `clive test` before submitting your code!"
|
37
48
|
exit
|
38
49
|
end
|
39
50
|
end
|
@@ -107,8 +118,6 @@ module CommitLive
|
|
107
118
|
|
108
119
|
def createPullRequest
|
109
120
|
puts 'Creating Pull Request...'
|
110
|
-
lessonName = repo_name(remote: 'origin')
|
111
|
-
currentLesson.getCurrentLesson(lessonName)
|
112
121
|
userGithub = CommitLive::Github.new()
|
113
122
|
netrc.read(machine: 'ga-extra')
|
114
123
|
username = netrc.login
|
@@ -122,7 +131,6 @@ module CommitLive
|
|
122
131
|
"#{username}:master",
|
123
132
|
"PR by #{username}"
|
124
133
|
)
|
125
|
-
puts "Lesson submitted successfully!"
|
126
134
|
end
|
127
135
|
rescue Octokit::Error => err
|
128
136
|
puts "Error while creating PR!"
|
@@ -140,7 +148,6 @@ module CommitLive
|
|
140
148
|
end
|
141
149
|
|
142
150
|
def update_lesson_status
|
143
|
-
lessonName = repo_name(remote: 'origin')
|
144
151
|
status.update('submitted_pull_request', lessonName)
|
145
152
|
end
|
146
153
|
end
|
@@ -28,9 +28,11 @@ module CommitLive
|
|
28
28
|
if !lessonData['current_track'].nil?
|
29
29
|
@lessonName = lessonData['current_track']['track_slug']
|
30
30
|
isAssignment = lessonData['current_track']['assignment_flag']
|
31
|
+
forked = lessonData['current_track']['forked']
|
31
32
|
else
|
32
33
|
@lessonName = lessonData['track_slug']
|
33
34
|
isAssignment = lessonData['assignment_flag']
|
35
|
+
forked = lessonData['forked']
|
34
36
|
end
|
35
37
|
if !isAssignment
|
36
38
|
puts "This is a read only lesson!"
|
@@ -44,7 +46,9 @@ module CommitLive
|
|
44
46
|
# change group owner
|
45
47
|
change_grp_owner
|
46
48
|
# lesson forked API change
|
47
|
-
|
49
|
+
if !forked
|
50
|
+
lesson_status.update('forked', lessonName)
|
51
|
+
end
|
48
52
|
end
|
49
53
|
# install dependencies
|
50
54
|
# cd into it and invoke bash
|
data/lib/commit-live/version.rb
CHANGED