GitHub Issue | n/a |
Type | New Feature |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-05-09T17:48:39.000+0000 |
Affected Version/s | n/a |
Fix Version/s | 2014 Sprint 07, 2014 Sprint 07 Tooling, 2014 Sprint 09 Tooling, Release 3.3.0 |
Components | CLI |
Labels | qe-testadded |
Reporter | Stephen Feather |
Assignee | Chris Barber |
Created | 2014-03-12T23:42:29.000+0000 |
Updated | 2014-05-30T18:09:51.000+0000 |
Currently custom templates can be built and placed in the templates folder in the root of each installed SDK.
Would like to have an entry called *paths.templates* added to the *config.json* that could be searched for custom templates (and possibly overwrite/overrule those located in the {sdk}/templates folder) when creating a new project.
This would allow large enterprise orgs to:
share common project templates across development environments
reduce the time to adopt a new sdk (currently requires moving custom templates to the new sdk on all systems)
reduce required storage space caused by duplication
@Praveen Innamuri should know about this and see if there's a way for Studio to use these CLI functions (TISTUD-6260)
Titanium CLI master pull request: https://github.com/appcelerator/titanium/pull/125 Titanium Mobile master pull request: https://github.com/appcelerator/titanium_mobile/pull/5569
There are a number of new ways to specify templates!
Default template
This will use the default template that comes with Titanium Mobile. It basically looks in the SDK's "templates/app" folder.Global template directory
Now "ti create" will also scan all Titanium install locations for a "templates" directory containing the template you specified:Custom template paths
You can add more search paths via thepaths.templates
config option. You set this value to the path containing the templates. In this example,/path/to/mytemplates
contains a template called "foo".Local directory
Local zip file
Remote zip file
New Template Structure
Templates now have a different file structure. You should have a "templates" directory containing all the files that will be automatically copied. You may have a "hooks" folder as well containing a Titanium CLI hook that allows you to tie into one of the several available hooks. Any other directory is ignored, so you could drop a package.json, readme, node_modules, whatever in the template directory.Template Hooks
Hooks give you the ability to do custom things when creating a project.Available FUNCTION hooks: *
create.copyFiles
** You can change the source directory being copied ** For example, you may not have a "template" directory, instead you could change it to something else *create.populateTiappXml
** You can tweak properties, add properties, add modules, do whatever you want! Available EVENT hooks: *create.pre.platform.<PLATFORM NAME>
** This will fire for each platform that you are create the project for (i.e. android, iphone, mobileweb, etc) *create.post.platform.<PLATFORM NAME>
** This will fire for each platform that you are create the project for (i.e. android, iphone, mobileweb, etc) *create.post
** Fired after all platforms have finished *create.finalize
** Fired when the creation has completed or erroredHappy [~sfeather]?
Like the proverbial pig in mud. Thanks man.
Reopening this ticket usig following configurations : Mac :10.9.2 Studio - 3.3.0.201404211130 SDK - 3.3.0.v20140422163054 acs-1.0.14 alloy-1.4.0-dev npm-1.3.2 titanium-3.3.0-dev titanium-code-processor-1.1.1-beta1 Xcode :5.1.1 Test steps followed are : 1. Create a folder named "templates" at any location 2. Copy attached example foo.zip (extracted version) 3.On terminal write : ti config paths.templates /path/to/template folder created in first step. 4.ti create --template foo and provide rest of the project creation details 5.Error occured
[~sfeather] is this working for you? I'm wondering if the reopened report is an edge case.
@ingo Message seen, will be tomorrow or Wednesday before I can get to it to re-test.
Fixed. Titanium SDK master pull request: https://github.com/appcelerator/titanium_mobile/pull/5661
Tested with: Mac osx 10.9.3 Mavericks Appcelerator Studio, build: 3.3.0.201405271647 Titanium SDK, build: 3.3.0.v20140528144113 Node.JS Version: v0.10.13 NPM Version: 1.3.2 acs@1.0.14 alloy@1.4.0-beta npm@1.3.2 titanium@3.3.0-beta titanium-code-processor@1.1.1
Actual result