-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnew
executable file
·59 lines (58 loc) · 1.57 KB
/
new
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
echo 'your name in github'
read name
echo 'new repo name'
read repo
echo 'destination folder'
read dest
if [ "$dest" = "" ]
then
cd "$HOME"
else
cd "${dest//'~'/$HOME}"
fi
git clone "git://github.com/WebReflection/gitstrap.git" "$repo"
cd "$repo"
rm -rf .git
rm new
MAKEFILE=`cat Makefile`
echo "${MAKEFILE/REPO = main/REPO = ${repo}}" >Makefile
PACKAGE=`cat package.json`
PACKAGE_NOMAIN="${PACKAGE//main/${repo}}"
PACKAGE_MAINBIN="${PACKAGE_NOMAIN/\"${repo}\":/\"main\":}"
echo "${PACKAGE_MAINBIN//WebReflection/${name}}" >package.json
INDEX=`cat index.html`
echo "${INDEX/TESTS = ['main']/TESTS = ['${repo}']}" >index.html
LICENSE=`cat LICENSE.txt`
echo "${LICENSE/WebReflection/${name}}" >LICENSE.txt
COPYRIGHT=`cat template/copyright`
echo "${COPYRIGHT/WebReflection/${name}}" >template/copyright
REPO_NAME_LENGTH=$(printf "%${#repo}s")
echo "${repo}
${REPO_NAME_LENGTH// /=}
[![build status](https://secure.travis-ci.org/${name}/${repo}.svg)](http://travis-ci.org/${name}/${repo})
" >README.md
TEST=`cat test/main.js`
echo "${TEST//main.node.js/${repo}.node.js}" >test/${repo}.js
rm test/main.js
mv src/main.js src/${repo}.js
make dependencies
make clean
make var
make node
make amd
git init
git add .
git commit -m "${repo} gitstrap initialized"
git remote add origin "[email protected]:${name}/${repo}.git"
echo '------------------------------------'
echo "your new ${repo} repository is ready"
echo '------------------------------------'
echo ''
echo 'do you want to push now ? (y/n)'
read pushorigin
if [ "$pushorigin" = "y" ]; then
git push -u origin master
fi
make test
exit 0