h5_package_map.H5PackageList.values().each { value -> //http://st0.meiyaapp.com/app/a0d6fce8f08fb3c5617e.zip ---> Meiya/build/tmp/h5/a0d6fce8f08fb3c5617e.zip httpDownloadFile(client, value, new File(tmp, parseFileNameFromUrl(value))) } //解压 tmp.listFiles().each { zip -> if (zip.getName().endsWith("zip")) { //Meiya/build/tmp/h5/a0d6fce8f08fb3c5617e.zip --> a0d6fce8f08fb3c5617e/* unZipIt(zip.getAbsolutePath(), tmp.getAbsolutePath())
String md5 = removeExtFromFileName(zip.getName()) File src = new File(tmp, md5) File asset_dest = new File(assets_h5, md5) if (!src.exists()) { thrownew Exception(src.getAbsolutePath() + " is not exited") } if (!src.renameTo(asset_dest)) { thrownew Exception(src.getAbsolutePath() + " rename failed.") } println "${src.getAbsolutePath()} --> ${asset_dest.getAbsolutePath()}" } } "git status".execute() "git add . --all".execute() println "git commit -m \"Update h5 to $h5_version\"" }
/** * Unzip it * @param zipFile input zip file * @param output zip file output folder */ privatevoidunZipIt(String zipFile, String outputFolder){
byte[] buffer = newbyte[1024];
try { //create output directory is not exists File folder = new File(outputFolder); if (!folder.exists()) { folder.mkdir(); }
//get the zip file content ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFile)); //get the zipped file list entry ZipEntry ze = zis.getNextEntry();
while (ze != null) { String fileName = ze.getName(); File newFile = new File(outputFolder + File.separator + fileName);
if (ze.isDirectory()) { newFile.mkdirs() ze = zis.getNextEntry(); continue; }
// 在每一个子控件的右侧画线 for (int i = 0; i < childCount; i++) { final View child = parent.getChildAt(i); int right = child.getRight() - child.getPaddingRight(); int left = right - mDivider.getIntrinsicWidth(); finalint top = child.getTop() + child.getPaddingTop(); finalint bottom = child.getTop() + child.getHeight() - child.getPaddingBottom();
public class ApiManager { public static final String HEADER_ACCEPT_JSON = "application/json"; public static final String HEADER_ACCEPT = "Accept"; private ApiService mApiService; private static ApiManager sInstance; private Context mContext; public ApiManager(Context context) { mContext=context; }
for skill in Ada Coffe Action Java do echo"I am good at ${skill}Script" done
[slide data-transition=”vertical3d”]
#字符串 [slide]
1 2 3 4 5 6 7 8 9
str='this is a string' #单引号里的任何字符都会原样输出,单引号字符串中的变量是无效的 #单引号字串中不能出现单引号(对单引号使用转义符后也不行)
your_name='qinjx' str="Hello, I know your are \"$your_name\"! \n"
#双引号里可以有变量 #双引号里可以出现转义字符
[slide]
#条件判断与流程控制
1 2 3 4 5 6 7
if condition then command1 command2 ... commandN fi
1
for var in item1 item2 ... itemN; docommand1; command2… done;
1 2 3 4
while condition do command done
另外还有case语句;until语句 [slide]
shell函数
[slide]
1 2 3 4 5 6 7 8 9 10 11 12
#!/bin/bash funWithReturn(){ echo"The function is to get the sum of two numbers..." echo -n "Input first number: " read aNum echo -n "Input another number: " read anotherNum echo"The two numbers are $aNum and $anotherNum !" return $(($aNum+$anotherNum)) } funWithReturn echo"The sum of two numbers is $? !"