IIssNan's Notes

Quick notes


  • 首页

  • 归档

  • 标签

  • 搜索

Apache Ant 中的条件 target

发表于 2011-12-10 | | 阅读次数

target 拥有 if/unless 属性,可以按照一定条件来选择是否执行 target。

结合 property 来说,if/unless 只能判断变量是否存在,而不能判断 property 的值。所以,以下的 target 输出同样的内容:

1
2
3
4
5
6
7
8
9
<property name="switch.lint.on" value="true" />
<target if="switch.lint.on">
<echo> skip lint task </echo>
<target>
<property name="switch.lint.on" value="false" />
<target if="switch.lint.on">
<echo> skip lint task </echo>
<target>

若要判断 property 得值是否与某个值相等,就需要使用 condition:

1
2
3
4
5
6
7
<condition property="switch.lint.on">
<equals arg1="${switch.lint}" arg2="true" />
<condition>
<target if="switch.lint.on">
<echo> skip lint task </echo>
<target>

Mustache

发表于 2011-12-07 | | 阅读次数

设置Apache Ant property 的默认值

发表于 2011-12-03 | | 阅读次数

在ant下实现可选参数,首先想到的一个方法是使用condition task:

1
2
3
<condition name="dir.source" value="someValue" else="defaultValue" />
<isset property="dir.source" />
</condition>

当ant -v时,注意到关于property设置的内容:

1
Override ignored for property "dir.source"

也就是说,property在设置之后,他的值是不能更改的,所以,没有必要使用condition或者if之类的去判断,直接定义默认的值就OK:

1
<property name="dir.source" value="defaultValue" />

jQuery Plugin Boilerplate

发表于 2011-11-30 | | 阅读次数
1
2
3
4
5
6
7
(function(window, $, undefined){
$.fn.kmSlide = function(sDirection, iOffset, iDelay){
return this.each(function(){
// Magic
});
};
})(window, jQuery);

在Git中执行类似Subversion中的项目导出

发表于 2011-11-30 | | 阅读次数

Git 仓库的信息存放在项目根目录的 .git 目录下,手动导出仅需将项目复制一份,然后删除 .git 目录即可。如果是要做批量或自动生成处理,git archive 命令就可以派上用场:

1
2
3
git archive --format zip --output /full/path/to/zipfile.zip master
git archive master | tar -x -C /somewhere/else
git archive master | bzip2 >source-tree.tar.bz2</code></pre>

参考:

  • How to do a “git export”
  • git archive
1…303132…37
IIssNan

IIssNan

胡编一通,乱写一气

183 日志
6 分类
111 标签
RSS
GitHub Twitter 豆瓣 知乎
© 2011 - 2017 IIssNan
由 Hexo 强力驱动
主题 - NexT.Pisces
0%