commit-live-cli 0.1.5 → 0.1.6
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/cli.rb +1 -1
- data/lib/commit-live/lesson/git-helper.rb +19 -0
- data/lib/commit-live/tests/runner.rb +20 -0
- data/lib/commit-live/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cbd2ff0437f481596381b8f1efa9df84394297a
|
4
|
+
data.tar.gz: d2c618d94b7e0aa18e3d24f5c9b33b364bbbd1aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: addb83172bcf9a6f712672a6f4246e28b3ee2e7e5a7ce467ecc9a7114662a8880a6482fddf1ae294fb836fd5af43b7a1c4f3be10fbf13b2f0f22a28fd3667f84
|
7
|
+
data.tar.gz: ae51babe59560362c9015ddf7c689c45eddcab55d307912941dd00734361b192e5287e5e1e034f9963a88e781a90cfcd18dd60f028383418a149549909faa1dd
|
data/lib/commit-live/cli.rb
CHANGED
@@ -47,7 +47,7 @@ module CommitLive
|
|
47
47
|
CommitLive::Open.new().openALesson(track_slug)
|
48
48
|
end
|
49
49
|
|
50
|
-
desc "submitn <track-slug>", "This will submit your work"
|
50
|
+
desc "submitn <track-slug>", "This will submit your work. (for eg. clive open <track-slug>)"
|
51
51
|
def submit(track_slug)
|
52
52
|
CommitLive::Submit.new().run(track_slug)
|
53
53
|
end
|
@@ -27,6 +27,7 @@ module CommitLive
|
|
27
27
|
def commitAndPush
|
28
28
|
checkRemote
|
29
29
|
check_if_practice_lesson
|
30
|
+
check_if_user_in_right_folder
|
30
31
|
# Check if User passed test cases
|
31
32
|
if is_test_case_passed
|
32
33
|
# Push to User's Github
|
@@ -74,6 +75,10 @@ module CommitLive
|
|
74
75
|
currentLesson.getValue('repoUrl')
|
75
76
|
end
|
76
77
|
|
78
|
+
def title_slug
|
79
|
+
currentLesson.getValue('titleSlug')
|
80
|
+
end
|
81
|
+
|
77
82
|
def check_if_practice_lesson
|
78
83
|
currentLesson.getCurrentLesson(track_slug)
|
79
84
|
if is_project || is_practice
|
@@ -83,6 +88,20 @@ module CommitLive
|
|
83
88
|
end
|
84
89
|
end
|
85
90
|
|
91
|
+
def check_if_user_in_right_folder
|
92
|
+
dirname = File.basename(Dir.getwd)
|
93
|
+
if dirname != title_slug
|
94
|
+
table = Terminal::Table.new do |t|
|
95
|
+
t.rows = [["cd ~/Workspace/code/#{title_slug}/"]]
|
96
|
+
end
|
97
|
+
puts "It seems that you are in the wrong directory."
|
98
|
+
puts "Use the following command to go there"
|
99
|
+
puts table
|
100
|
+
puts "Then use the `clive submit <track-slug>` command"
|
101
|
+
exit 1
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
86
105
|
def setGit
|
87
106
|
begin
|
88
107
|
Git.open(FileUtils.pwd)
|
@@ -6,6 +6,7 @@ require "commit-live/api"
|
|
6
6
|
require "commit-live/sentry"
|
7
7
|
require "commit-live/netrc-interactor"
|
8
8
|
require "commit-live/tests/strategies/python-test"
|
9
|
+
require "terminal-table"
|
9
10
|
|
10
11
|
module CommitLive
|
11
12
|
class Test
|
@@ -20,6 +21,7 @@ module CommitLive
|
|
20
21
|
@track_slug = trackSlug
|
21
22
|
check_lesson_dir
|
22
23
|
check_if_practice_lesson
|
24
|
+
check_if_user_in_right_folder
|
23
25
|
die if !strategy
|
24
26
|
@sentry = CommitLive::Sentry.new()
|
25
27
|
if File.exists?("#{HOME_DIR}/.ga-config")
|
@@ -107,6 +109,10 @@ module CommitLive
|
|
107
109
|
lesson.getValue('testCase')
|
108
110
|
end
|
109
111
|
|
112
|
+
def title_slug
|
113
|
+
lesson.getValue('titleSlug')
|
114
|
+
end
|
115
|
+
|
110
116
|
def is_project_assignment
|
111
117
|
isProjectAssignment = lesson.getValue('isProjectAssignment')
|
112
118
|
!isProjectAssignment.nil? && isProjectAssignment == 1
|
@@ -134,6 +140,20 @@ module CommitLive
|
|
134
140
|
end
|
135
141
|
end
|
136
142
|
|
143
|
+
def check_if_user_in_right_folder
|
144
|
+
dirname = File.basename(Dir.getwd)
|
145
|
+
if dirname != title_slug
|
146
|
+
table = Terminal::Table.new do |t|
|
147
|
+
t.rows = [["cd ~/Workspace/code/#{title_slug}/"]]
|
148
|
+
end
|
149
|
+
puts "It seems that you are in the wrong directory."
|
150
|
+
puts "Use the following command to go there"
|
151
|
+
puts table
|
152
|
+
puts "Then use the `clive test <track-slug>` command"
|
153
|
+
exit 1
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
137
157
|
def dump_results
|
138
158
|
begin
|
139
159
|
Timeout::timeout(15) do
|
data/lib/commit-live/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: commit-live-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- greyatom
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|