release for windows

This commit is contained in:
life
2015-04-20 19:51:20 +08:00
parent d03cce2761
commit 5db148be9f
8 changed files with 130 additions and 83 deletions

4
.gitignore vendored
View File

@ -2,9 +2,9 @@
pkg
bin2
bin/i18n
bin/leanote-linux
bin/leanote-mac
bin/leanote*
bin/release
bin/test.sh
bin/tmp
bin/test
bin/src

View File

@ -10,8 +10,8 @@ import (
"github.com/leanote/leanote/app/controllers/admin"
"github.com/leanote/leanote/app/controllers/member"
_ "github.com/leanote/leanote/app/lea/binder"
"github.com/leanote/leanote/app/lea/session"
"github.com/leanote/leanote/app/lea/memcache"
// "github.com/leanote/leanote/app/lea/session"
// "github.com/leanote/leanote/app/lea/memcache"
"github.com/leanote/leanote/app/lea/route"
"reflect"
"fmt"
@ -33,11 +33,11 @@ func init() {
// AuthFilter, // Invoke the action.
revel.FilterConfiguringFilter, // A hook for adding or removing per-Action filters.
revel.ParamsFilter, // Parse parameters into Controller.Params.
// revel.SessionFilter, // Restore and write the session cookie.
revel.SessionFilter, // Restore and write the session cookie.
// 使用SessionFilter标准版从cookie中得到sessionID, 然后通过MssessionFilter从Memcache中得到
// session, 之后MSessionFilter将session只存sessionID然后返回给SessionFilter返回到web
session.SessionFilter, // leanote session
// session.SessionFilter, // leanote session
// session.MSessionFilter, // leanote memcache session
revel.FlashFilter, // Restore and write the flash cookie.
@ -367,7 +367,7 @@ func init() {
// email配置
InitEmail()
InitVd()
memcache.InitMemcache() // session服务
// memcache.InitMemcache() // session服务
// 其它service
service.InitService()
controllers.InitService()

View File

@ -44,7 +44,7 @@ function log(o) {
-->
<li><a href="/index#download" target="#download" class="smooth-scroll">{{msg . "download"}}</a> </li>
<li><a href="/index#donate" target="#donate" class="smooth-scroll">{{msg . "donate"}}</a> </li>
<li><a id="leanoteBlog" href="{{.leaUrl}}/index" target="_blank" title="lea++, leanote博客平台" class="">lea++</a></li>
<li><a id="leanoteBlog" href="http://lea.leanote.com" target="_blank" title="lea++, leanote博客平台" class="">lea++</a></li>
<li style="position: relative; margin-right: 3px;">
<a href="http://bbs.leanote.com" target="_blank" class="">{{msg . "discussion"}}</a>
<div class="red-circle" style=""></div>
@ -92,7 +92,6 @@ function log(o) {
<ul id="blogNav" class="pull-right">
<li><a href="/index#" target="body" class="smooth-scroll">{{msg . "home"}}</a></li>
<li><a href="/index#download" target="#download" class="smooth-scroll">{{msg . "download"}}</a> </li>
<li><a href="/index#donate" target="#donate" class="smooth-scroll">{{msg . "donate"}}</a> </li>
<li><a id="leanoteBlog" href="{{.leaUrl}}/index" target="_blank" title="lea++, leanote博客平台" class="">lea++</a></li>
<li style="position: relative; margin-right: 3px;">

View File

@ -66,20 +66,6 @@
<hr />
<div class="container" id="download">
<h2 style="margin: 20px 0;text-align: center;">{{msg . "download"}}</h2>
<div class="row">
<div style="width:300px; margin:auto; padding: 10px;">
Linux : <a href="https://github.com/leanote/leanote/releases/download/0.4/leanote-linux-v0.4.bin.tar.gz">leanote-linux-v0.4.bin.tar.gz</a> <br />
MacOS X : <a href="https://github.com/leanote/leanote/releases/download/0.4/leanote-mac-v0.4.bin.tar.gz">leanote-mac-v0.4.bin.tar.gz</a> <br />
<br />
<a href="https://github.com/leanote/leanote#3-how-to-install-leanote">{{msg . "howToInstallLeanote"}}</a>
</div>
</div>
</div>
<hr />
<div class="container" id="donate">
<h2 style="margin: 20px 0;text-align: center;">{{msg . "donate"}}</h2>
<div class="row">

View File

@ -64,20 +64,6 @@
<hr />
<div class="container" id="download">
<h2 style="margin: 20px 0;text-align: center;">{{msg . "download"}}</h2>
<div class="row">
<div style="width:300px; margin:auto; padding: 10px;">
Linux : <a href="https://github.com/leanote/leanote/releases/download/0.4/leanote-linux-v0.4.bin.tar.gz">leanote-linux-v0.4.bin.tar.gz</a> <br />
MacOS X : <a href="https://github.com/leanote/leanote/releases/download/0.4/leanote-mac-v0.4.bin.tar.gz">leanote-mac-v0.4.bin.tar.gz</a> <br />
<br />
<a href="https://github.com/leanote/leanote#3-how-to-install-leanote">{{msg . "howToInstallLeanote"}}</a>
</div>
</div>
</div>
<hr />
<div class="container" id="donate">
<h2 style="margin: 20px 0;text-align: center;">{{msg . "donate"}}</h2>
<div class="row">

View File

@ -2,40 +2,79 @@
# release leanote
# 当前路径
SP=$(cd "$(dirname "$0")"; pwd)
cd $SP
cd ../
# tmp path to store leanote release files
tmp="/Users/life/Desktop/leanote_release"
version=x86_64.v1.0-beta.2
# version
V="v1.0-beta.4"
##=================================
# 1. 先build 成 3个平台, 2种bit = 6种
##=================================
# cd /Documents/Go/package2/src/github.com/leanote/leanote/bin
# GOOS=darwin GOARCH=amd64 go build -o leanote-darwin-amd64 ../app/tmp
cd $SP
# $1 = darwin, linux
# $2 = amd64
function build()
{
echo build-$1-$2
if [ $1 = "linux" -o $1 = "darwin" ]
then
suffix=""
else
suffix=".exe"
fi
GOOS=$1 GOARCH=$2 go build -o leanote-$1-$2$suffix ../app/tmp
}
build "linux" "386";
build "linux" "amd64";
build "darwin" "386";
build "darwin" "amd64";
build "windows" "386";
build "windows" "amd64";
##======================
# 2. release目录准备工作
##======================
rm -rf $tmp/leanote
mkdir -p $tmp/leanote/app
mkdir -p $tmp/leanote/conf
mkdir -p $tmp/leanote/bin
##==================
# 3. 复制
##==================
cd $SP
cd ../
# bin
cp -r ./bin/src $tmp/leanote/bin/
cp ./bin/run.sh $tmp/leanote/bin/
# LICENSE
cp ./LICENSE $tmp/leanote/
cp ./bin/run.bat $tmp/leanote/bin/
# views
cp -r ./app/views $tmp/leanote/app
# 可不要
cp -r ./app/service $tmp/leanote/app/service
cp -r ./app/controllers $tmp/leanote/app/controllers
cp -r ./app/db $tmp/leanote/app/db
cp -r ./app/info $tmp/leanote/app/info
cp -r ./app/lea $tmp/leanote/app/lea
# 可不要, 源码
#cp -r ./app/service $tmp/leanote/app/service
#cp -r ./app/controllers $tmp/leanote/app/controllers
#cp -r ./app/db $tmp/leanote/app/db
#cp -r ./app/info $tmp/leanote/app/info
#cp -r ./app/lea $tmp/leanote/app/lea
# conf
cp ./conf/app.conf-default $tmp/leanote/conf/app.conf
cp ./conf/routes-default $tmp/leanote/conf/routes
cp ./conf/app.conf $tmp/leanote/conf/app.conf
cp ./conf/routes $tmp/leanote/conf/routes
# others
cp -r ./messages ./public ./mongodb_backup $tmp/leanote/
@ -44,40 +83,55 @@ cp -r ./messages ./public ./mongodb_backup $tmp/leanote/
rm -r $tmp/leanote/public/tinymce/classes
rm -r $tmp/leanote/public/upload
mkdir $tmp/leanote/public/upload
mkdir $tmp/leanote/files
rm -r $tmp/leanote/public/.codekit-cache
rm $tmp/leanote/public/.DS_Store
rm $tmp/leanote/public/config.codekit
# make link
cd $tmp/leanote/bin
mkdir ./src/github.com/leanote
# cd $tmp/leanote/bin
# ln -s ../../../../ ./src/github.com/leanote/leanote
# archieve
# << 'BLOCK
# linux
cd $SP
cd ../
cp ./bin/leanote-linux $tmp/leanote/bin/
cd $tmp
tar -cvf $tmp/leanote-linux-$version.bin.tar leanote
gzip $tmp/leanote-linux-$version.bin.tar
# mac
rm $tmp/leanote/bin/leanote-linux
cd $SP
cd ../
cp ./bin/leanote-mac $tmp/leanote/bin/
cd $tmp
tar -cvf $tmp/leanote-mac-$version.bin.tar leanote
gzip $tmp/leanote-mac-$version.bin.tar
##===========
# 4. 打包
##===========
# $1 = linux
# $2 = 386, amd64
cd $SP
cd ../
cp ./bin/leanote-linux $tmp/leanote/bin/
# 创建一个$V的目录存放之
rm -rf $tmp/$V
mkdir $tmp/$V
rm $tmp/bin/src/github.com/leanote/leanote
cp -r $tmp/leanote/* $tmp/leanote_release_github
function tarRelease()
{
echo tar-$1-$2
cd $SP
cd ../
rm $tmp/leanote/bin/leanote-* # 删除之前的bin文件
rm $tmp/leanote/bin/run* # 删除之前的run.sh 或 run.bat
if [ $1 = "linux" -o $1 = "darwin" ]
then
suffix=""
cp ./bin/run.sh $tmp/leanote/bin/
else
cp ./bin/run.bat $tmp/leanote/bin/
suffix=".exe"
fi
cp ./bin/leanote-$1-$2$suffix $tmp/leanote/bin/
cd $tmp
tar -cf $tmp/$V/leanote-$1-$2-$V.bin.tar leanote
gzip $tmp/$V/leanote-$1-$2-$V.bin.tar
}
tarRelease "linux" "386";
tarRelease "linux" "amd64";
tarRelease "darwin" "386";
tarRelease "darwin" "amd64";
tarRelease "windows" "386";
tarRelease "windows" "amd64";
# BLOCK'

23
bin/run.bat Normal file
View File

@ -0,0 +1,23 @@
@echo off
cd..
set SCRIPTPATH=%cd%
: top src directory
set path="%SCRIPTPATH%\bin\src\github.com\leanote"
if not exist "%path%" mkdir "%path%"
: create software link
if exist "%path%\leanote" del /Q "%path%\leanote"
mklink /D "%path%\leanote" %SCRIPTPATH%
: set GOPATH
set GOPATH=%GOPATH%;"%SCRIPTPATH%\bin"
: run
if %processor_architecture%==x86 (
"%SCRIPTPATH%\bin\leanote-windows-386.exe" -importPath github.com/leanote/leanote
) else (
"%SCRIPTPATH%\bin\leanote-windows-amd64.exe" -importPath github.com/leanote/leanote
)

View File

@ -7,17 +7,16 @@ path="$SCRIPTPATH/src/github.com/leanote"
if [ ! -d "$path" ]; then
mkdir -p "$path"
fi
rm -rf $SCRIPTPATH/src/github.com/leanote/leanote # 先删除
ln -s ../../../../ $SCRIPTPATH/src/github.com/leanote/leanote
# set GOPATH
export GOPATH=$GOPATH:$SCRIPTPATH
# run
osName=`uname`
if [ $osName == "Darwin" ]; then
chmod 777 "$SCRIPTPATH/leanote-mac"
"$SCRIPTPATH/leanote-mac" -importPath github.com/leanote/leanote
else
chmod 777 "$SCRIPTPATH/leanote-linux"
"$SCRIPTPATH/leanote-linux" -importPath github.com/leanote/leanote
fi
osName=`uname` # Darwin or Linux
osName=`tr '[A-Z]' '[a-z]' <<<"$osName"` # toLowerCase
bit=`getconf LONG_BIT` # 32, 64
script="$SCRIPTPATH/leanote-$osName-$bit"
chmod 777 $script
$script -importPath github.com/leanote/leanote