Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Unity
提交
b77c6b83
T
Third Party Unity
项目概览
OpenHarmony
/
Third Party Unity
1 年多 前同步成功
通知
36
Star
144
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Unity
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
b77c6b83
编写于
11月 29, 2016
作者:
M
Mark VanderVoord
提交者:
GitHub
11月 29, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #232 from mchernosky/module-create-with-subdir
Fixed error when path provided in module name.
上级
4386cf35
37049a3a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
11 addition
and
6 deletion
+11
-6
auto/generate_module.rb
auto/generate_module.rb
+11
-6
未找到文件。
auto/generate_module.rb
浏览文件 @
b77c6b83
...
...
@@ -10,6 +10,7 @@
require
'rubygems'
require
'fileutils'
require
'pathname'
#TEMPLATE_TST
TEMPLATE_TST
||=
%q[#include "unity.h"
...
...
@@ -116,11 +117,15 @@ class UnityModuleGenerator
############################
def
files_to_operate_on
(
module_name
,
pattern
=
nil
)
#strip any leading path information from the module name and save for later
subfolder
=
File
.
dirname
(
module_name
)
module_name
=
File
.
basename
(
module_name
)
#create triad definition
prefix
=
@options
[
:test_prefix
]
||
'Test'
triad
=
[
{
:ext
=>
'.c'
,
:path
=>
@options
[
:path_src
],
:template
=>
TEMPLATE_SRC
,
:inc
=>
:src
,
:boilerplate
=>
@options
[
:boilerplates
][
:src
]
},
{
:ext
=>
'.h'
,
:path
=>
@options
[
:path_inc
],
:template
=>
TEMPLATE_INC
,
:inc
=>
:inc
,
:boilerplate
=>
@options
[
:boilerplates
][
:inc
]
},
{
:ext
=>
'.c'
,
:path
=>
@options
[
:path_tst
]
+
prefix
,
:template
=>
TEMPLATE_TST
,
:inc
=>
:tst
,
:boilerplate
=>
@options
[
:boilerplates
][
:tst
]
},
triad
=
[
{
:ext
=>
'.c'
,
:path
=>
@options
[
:path_src
],
:prefix
=>
""
,
:template
=>
TEMPLATE_SRC
,
:inc
=>
:src
,
:boilerplate
=>
@options
[
:boilerplates
][
:src
]
},
{
:ext
=>
'.h'
,
:path
=>
@options
[
:path_inc
],
:prefix
=>
""
,
:template
=>
TEMPLATE_INC
,
:inc
=>
:inc
,
:boilerplate
=>
@options
[
:boilerplates
][
:inc
]
},
{
:ext
=>
'.c'
,
:path
=>
@options
[
:path_tst
]
,
:prefix
=>
prefix
,
:template
=>
TEMPLATE_TST
,
:inc
=>
:tst
,
:boilerplate
=>
@options
[
:boilerplates
][
:tst
]
},
]
#prepare the pattern for use
...
...
@@ -138,8 +143,9 @@ class UnityModuleGenerator
triad
.
each
do
|
cfg
|
patterns
.
each_pair
do
|
pattern_file
,
pattern_traits
|
submodule_name
=
create_filename
(
module_name
,
pattern_file
)
filename
=
cfg
[
:prefix
]
+
submodule_name
+
cfg
[
:ext
]
files
<<
{
:path
=>
"
#{
cfg
[
:path
]
}#{
submodule_name
}#{
cfg
[
:ext
]
}
"
,
:path
=>
(
Pathname
.
new
(
"
#{
cfg
[
:path
]
}#{
subfolder
}
"
)
+
filename
).
cleanpath
,
:name
=>
submodule_name
,
:template
=>
cfg
[
:template
],
:boilerplate
=>
cfg
[
:boilerplate
],
...
...
@@ -188,6 +194,7 @@ class UnityModuleGenerator
# Create Source Modules
files
.
each_with_index
do
|
file
,
i
|
FileUtils
.
mkdir_p
(
File
.
dirname
(
file
[
:path
]),
:verbose
=>
false
)
# Create the path first if necessary.
File
.
open
(
file
[
:path
],
'w'
)
do
|
f
|
f
.
write
(
"
#{
file
[
:boilerplate
]
}
\n
"
%
[
file
[
:name
]])
unless
file
[
:boilerplate
].
nil?
f
.
write
(
file
[
:template
]
%
[
file
[
:name
],
...
...
@@ -292,5 +299,3 @@ if ($0 == __FILE__)
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录