lib/learn_open/opener.rb in learn-open-1.2.6 vs lib/learn_open/opener.rb in learn-open-1.2.7
- old
+ new
@@ -385,10 +385,14 @@
def ide_environment?
ENV['IDE_CONTAINER'] == "true"
end
+ def ide_git_wip_enabled?
+ ENV['IDE_GIT_WIP'] == "true"
+ end
+
def git_tasks
fork_repo
clone_repo
end
@@ -400,12 +404,25 @@
def dependency_tasks
bundle_install
npm_install
end
+ def restore_files
+ pid = Process.spawn("restore-lab", [:out, :err] => File::NULL)
+ Process.waitpid(pid)
+ end
+
+ def watch_for_changes
+ Process.spawn("while inotifywait -e close_write,create,moved_to -r #{lessons_dir}/#{repo_dir}; do backup-lab; done", [:out, :err] => File::NULL)
+ end
+
def completion_tasks
cleanup_tmp_file
puts "Done."
+ if ide_environment? && ide_git_wip_enabled?
+ restore_files
+ watch_for_changes
+ end
exec("#{ENV['SHELL']} -l")
end
end
end