From 5d35b8b2a2bf01c149b0cbfc8d7617b647b96e95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Tue, 11 Nov 2014 14:43:31 +0100 Subject: [PATCH] =?UTF-8?q?[Template]=20Do=20not=20override=20load=20paths?= =?UTF-8?q?=20with=20=E2=80=98pre=E2=80=99=20dist=20dir=20in=20development?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RubyMotion developers should be able to test changes to the templates from a local development build. --- lib/motion/project/template.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/motion/project/template.rb b/lib/motion/project/template.rb index c52a7b18..93f5d043 100644 --- a/lib/motion/project/template.rb +++ b/lib/motion/project/template.rb @@ -33,12 +33,18 @@ module Motion; module Project # for ERB attr_reader :name + local_templates = File.expand_path(File.join(__FILE__, '../template')) Paths = [ - File.expand_path(File.join(__FILE__, '../template')), + local_templates, File.expand_path(File.join(ENV['HOME'], 'Library/RubyMotion/template')) ] - pre_templates = '/Library/RubyMotionPre/lib/motion/project/template' - Paths << pre_templates if File.exist?(pre_templates) + + # Do not override the template location when using a development version of + # RubyMotion which does have all the templates. + unless File.exist?(File.join(local_templates, 'android.rb')) + pre_templates = '/Library/RubyMotionPre/lib/motion/project/template' + Paths << pre_templates if File.exist?(pre_templates) + end # TODO Caching these and making it based on the Paths constant makes it # less simple to register plugin templates, because you cannot add