Skip to content

Commit 553ab9a

Browse files
authored
Merge pull request #92 from rage/refresher-options
Refresher options
2 parents 943052f + 629eb8f commit 553ab9a

File tree

2 files changed

+4
-43
lines changed

2 files changed

+4
-43
lines changed

tmc-langs-util/src/task_executor/course_refresher.rs

Lines changed: 3 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl CourseRefresher {
9898

9999
let course_options = get_course_options(&new_clone_path, &course_name)?;
100100
self.progress_reporter
101-
.finish_step("Updated course options".to_string(), None)?;
101+
.finish_step("Fetched course options".to_string(), None)?;
102102

103103
let new_solution_path = new_cache_path.join("solution");
104104
let new_stub_path = new_cache_path.join("stub");
@@ -281,21 +281,7 @@ fn get_course_options(course_clone_path: &Path, course_name: &str) -> Result<Map
281281
let options_file = course_clone_path.join("course_options.yml");
282282
if options_file.exists() {
283283
let file = file_util::open_file(options_file)?;
284-
let mut course_options: Mapping = serde_yaml::from_reader(file)?;
285-
// try to remove the "courses" map
286-
if let Some(serde_yaml::Value::Mapping(mut courses)) =
287-
course_options.remove(&serde_yaml::Value::String("courses".to_string()))
288-
{
289-
// try to remove the map corresponding to the current course from the "courses" map
290-
if let Some(serde_yaml::Value::Mapping(mapping)) =
291-
courses.remove(&serde_yaml::Value::String(course_name.to_string()))
292-
{
293-
// if found, merge the inner course map with the base map
294-
for (key, value) in mapping {
295-
course_options.insert(key, value);
296-
}
297-
}
298-
}
284+
let course_options: Mapping = serde_yaml::from_reader(file)?;
299285
Ok(course_options)
300286
} else {
301287
Ok(Mapping::new())
@@ -518,7 +504,7 @@ mod test {
518504
}
519505

520506
#[test]
521-
fn updates_course_options() {
507+
fn gets_course_options() {
522508
init();
523509

524510
let temp = tempfile::tempdir().unwrap();
@@ -532,31 +518,6 @@ mod test {
532518
.unwrap())
533519
}
534520

535-
#[test]
536-
fn updates_course_options_merged() {
537-
init();
538-
539-
let temp = tempfile::tempdir().unwrap();
540-
file_to(
541-
&temp,
542-
"course_options.yml",
543-
r#"
544-
courses:
545-
course_1:
546-
option: true
547-
course_2:
548-
other_option: true
549-
"#,
550-
);
551-
let options = get_course_options(temp.path(), "course_1").unwrap();
552-
assert_eq!(options.len(), 1);
553-
assert!(options
554-
.get(&Value::String("option".to_string()))
555-
.unwrap()
556-
.as_bool()
557-
.unwrap())
558-
}
559-
560521
#[test]
561522
fn gets_exercises() {
562523
init();

tmc-langs-util/src/task_executor/submission_processing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use walkdir::{DirEntry, WalkDir};
1010

1111
lazy_static! {
1212
static ref FILES_TO_SKIP_ALWAYS: Regex =
13-
Regex::new(r"\.tmcrc|metadata\.yml|(.*)Hidden(.*)").unwrap();
13+
Regex::new(r"\.tmcrc|^metadata\.yml$|(.*)Hidden(.*)").unwrap();
1414
static ref NON_TEXT_TYPES: Regex =
1515
Regex::new("class|jar|exe|jpg|jpeg|gif|png|zip|tar|gz|db|bin|csv|tsv|sqlite3|^$").unwrap();
1616
}

0 commit comments

Comments
 (0)