4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/hexlet/member_cli.rb', line 4
def submit(path)
expanded_path = File.expand_path(path)
lesson_path, exercise_folder_name = File.split(expanded_path)
lesson_folder_name = File.split(lesson_path)[1]
parts = lesson_folder_name.split("_")
if parts[-1] != "lesson"
puts (t "wrong_lesson_folder")
return false
end
lesson_slug = parts[0, parts.size - 1].join("_")
_, e, s = Open3.capture3("make test -C #{path}")
if s == 0
client = build_client
result = client.submit lesson_slug, exercise_folder_name
if result
puts (t :created)
true
else
puts (t :error)
false
end
else
puts (t :bad_tests)
puts e
false
end
end
|