plugins/runnables/lib/runnables/tree_mirror/tree_mirror.rb in redcar-0.8.1 vs plugins/runnables/lib/runnables/tree_mirror/tree_mirror.rb in redcar-0.9.0
- old
+ new
@@ -28,17 +28,22 @@
custom = Runnable.new("Custom Command",@project.path,custom_info)
[custom]
end
def load
- groups = {}
- runnable_file_paths.each do |path|
- runnables = []
- name = File.basename(path,".json")
- json = File.read(path)
- this_runnables = JSON(json)["commands"]
- runnables += this_runnables || []
- groups[name.to_s] = runnables.to_a
+ begin
+ groups = {}
+ runnable_file_paths.each do |path|
+ runnables = []
+ name = File.basename(path,".json")
+ json = File.read(path)
+ this_runnables = JSON(json)["commands"]
+ runnables += this_runnables || []
+ groups[name.to_s] = runnables.to_a
+ end
+ rescue Object => e
+ Redcar::Application::Dialog.message_box("There was an error parsing Runnables: #{e.message}")
+ groups = {}
end
if groups.any?
groups.map do |name, runnables|
RunnableGroup.new(name,@project.path,runnables)
\ No newline at end of file