@@ -35,7 +35,7 @@ def find_exercise_dirs(path)
35
35
def scan_exercise ( path )
36
36
temp_file = ::Tempfile . new ( 'langs' )
37
37
clean ( path )
38
- exec ( " scan-exercise" , path , temp_file . path )
38
+ exec ( ' scan-exercise' , path , temp_file . path )
39
39
clean ( path )
40
40
JSON . parse ( File . read ( temp_file ) )
41
41
end
@@ -45,27 +45,36 @@ def get_test_case_methods(exercise_path)
45
45
end
46
46
47
47
def make_stubs ( from_dir , to_dir )
48
- exec ( " prepare-stubs" , from_dir , to_dir )
48
+ exec ( ' prepare-stubs' , from_dir , to_dir )
49
49
end
50
50
51
51
def make_solutions ( from_dir , to_dir )
52
- exec ( " prepare-solutions" , from_dir , to_dir )
52
+ exec ( ' prepare-solutions' , from_dir , to_dir )
53
53
end
54
54
55
55
def clean ( project )
56
- exec ( " clean" , project , " ignored" )
56
+ exec ( ' clean' , project , ' ignored' )
57
57
end
58
58
59
59
def get_exercise_config ( from_dir )
60
60
temp_file = ::Tempfile . new ( 'langs' )
61
- exec ( " get-exercise-packaging-configuration" , from_dir , temp_file . path )
61
+ exec ( ' get-exercise-packaging-configuration' , from_dir , temp_file . path )
62
62
JSON . parse ( File . read ( temp_file ) )
63
63
end
64
64
65
65
private
66
+
66
67
def exec ( cmd , exercise_path , output_path )
67
68
res = SystemCommands . sh! ( 'java' , '-jar' , jar_path , cmd , '--exercisePath' , exercise_path , '--outputPath' , output_path )
68
69
Rails . logger . debug ( res )
69
70
res
71
+ rescue StandardError => e
72
+ begin
73
+ langs_output = File . read ( output_path )
74
+ Rails . logger . error ( "Executing tmc-langs failed! Tmc-langs output: #{ langs_output } " )
75
+ rescue StandardError => e
76
+ Rails . logger . error ( "Could not read tmc-langs results: #{ e } " )
77
+ end
78
+ raise e
70
79
end
71
80
end
0 commit comments