首页 > 代码库 > 将已有的tactic项目导出成template
将已有的tactic项目导出成template
http://community.southpawtech.com/content/template-project-creation-best-practices
Template Project Creation Best Practices
how to create a template project in 3.8.0.rc04 and above.
如何在tactic 3.8.0.rc04版本中创建template project
Making a Distributable TACTIC Template Project
制作一个可以发布的TACTIC 模板项目
TACTIC has the capacity to create custom distributable project types. The configuration database can be exported from an existing project and then re-importing that into another TACTIC installation. This project will then become a template to reuse for other projects.
TACTIC能够创建一个自定义的项目类型。配置的数据库可以从一个以后的项目中导出,然后冲亲导入到另外一个TACTIC中。这个项目将会变成一个template模板以便其他项目使用
Namespace Conflicts
命名空间冲突
The most important consideration for creating an exportable project template is namespace issues. It is vital that there is virtually no chance that a project template will conflict with existing projects in a TACTIC installation.
在到处模板项目时最终要的需要注意的一点就是命名空间冲突的问题。这个是非常非常致命的问题。
Most of the project definition occurs in the config tables within a project’s database. These are trivial to export and do not pose any problems with conflicts.
项目内大部分指定的条目都是在项目自己的数据库中,这些条目在导出时基本只会产生轻微的冲突问题。
However, there are a number of tables that are still shared amongst all the projects. It is these tables that run the risk of conflicting with other existing projects. The tables that are needed for configuration that can be used in defining a project are:
但是有一些数据是在不同的项目之间共享使用的。这些数据如果是冲突了就会带来致命的问题。这些数据包括:
project
project_type
schema
search_object
pipeline
login_group
notification
NOTE: at present, it is not possible to create a template with custom columns on any of these search types.
注意:目前还不能在创建一个template的时候创建以上自定义的条目。
Approach:
The first step is to decide on a prefix that will be unique. Generally, the prefix will be a short identifier for the project/facility/company and will be used to prepend data in all important identifying columns. Using your own company name, for example, for the template is a good convention. Southpaw uses the prefix “spt”.
第一步就是要确定一个唯一的前缀。一般情况下,前缀是一个短的id 用来辨别project / facility/ company在所有重要的条目中。比如用你们公司的名字,比如southpaw 就使用spt作为前缀
Checklist:
需要检查的list:
The following is a checklist that should be used to ensure that a project will not conflict. For examples, the TACTIC Scrum project is used.
下面这些就是一个检查的list,这个list用来明确project将来不会冲突。例如tactic scrum项目就使用了:
1. project:
The “code” column will need to be unique and should have the prefix prepended to the project code.. For example, the TACTIC scrum project template has the project code of “spt_scrum”. The “type” column should be the same as the “code” column because this project is the template and defines the “type” of project.
code = “spt_scrum”
type = “spt_scrum”
project “code”这一栏需要是unique,type 需要和code一样。
2. schema
The schema “code” column should be the same as above in the project “code” column.
code = “spt_scrum”
schema code这一栏也要是 spt_scrum
3. project_type:
The project_type code should be the same as the project code
code = “spt_scrum”
project_type code 也要是 “spt_srum”
4. search_object:
The search_object namespace needs to equal the project code. This is by convention. Also all the “search_type” column should be prepended with the namespace
namespace = “spt_scrum”
search_type = “spt_scrum/ticket”
5. pipeline:
The code of the pipeline should be prepended with the project code.
code = “spt_scrum/ticket_status”
6. login_group:
All groups need to be prepended with the with the project type:
login_group = “spt_scrum/supervisor
Following these simple rules, it will be possible to export a project as a template and then reimport it into any existing TACTIC installation.
依照以上的简单的步骤,我们就可以把一个project到处成一个template 供其他tactic使用
How to Prepare A Project To Become A Template:
到处template的一些准备工作
a) In the Sidebar, go to:
Database Views -> Global Config/Data -> Project Types
b) Look through the entries in the column named code. Verify that the project to export exists in this list.
If it does not exist:
i) Add a new Project Type entry with the project code as the code.
For example:
code: toy_factory
base_type: simple
c) Next, in the Sidebar go:
Admin Views -> Global -> Projects
d) Find the project to export, look at the column named: type
e) Verify that the column named type is the same as the code entered into the Project Type table.
For the example above, use:
type: toy_factory
f) Go to Project > Project Schema (which is the same view as the link found under:
Advanced Project Setup > Create Schema)
g) In the panel at the bottom named: sType List, change the value in the column named: database to:
{project}
The significance of this type "toy_factory" is that it corresponds to the prefix of all the sTypes you have created in the original projects e.g. toy_factory/part, toy_factory/package. It ensures these related sTypes are copied to the template project.
To actually save out the template project zip file
Follow the above guidelines.
In the Global > Projects Tab, check the checkbox for a project you want to turn into a template.
It will then appear in Global > Template Projects tab. In the Template Projects tab, you will see an Update button for each project. Clicking on it saves the corresponding project as a template zip file ready to be imported. If there is an existing one, it will be saved over. It is saved in <TACTIC_DATA_DIR>/templates.
将已有的tactic项目导出成template