[Template] Do not override load paths with ‘pre’ dist dir in development.

RubyMotion developers should be able to test changes to the templates
from a local development build.
This commit is contained in:
Eloy Durán
2014-11-11 14:43:31 +01:00
parent 60b6a27505
commit 2f9e5a12c9

View File

@@ -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