Commit 8a05dcc1 authored by 杨培's avatar 杨培

Merge remote-tracking branch 'origin/dev' into dev

parents e65cd9ef f8d8e993
...@@ -19,7 +19,6 @@ Thumbs.db ...@@ -19,7 +19,6 @@ Thumbs.db
/vendor /vendor
# composer itself is not needed # composer itself is not needed
composer.phar
# Mac DS_Store Files # Mac DS_Store Files
.DS_Store .DS_Store
......
...@@ -17,8 +17,6 @@ Thumbs.db ...@@ -17,8 +17,6 @@ Thumbs.db
# composer vendor dir # composer vendor dir
/vendor /vendor
# composer itself is not needed
composer.phar
# Mac DS_Store Files # Mac DS_Store Files
.DS_Store .DS_Store
......
...@@ -12,143 +12,112 @@ ...@@ -12,143 +12,112 @@
<!--创建构建输出目录--> <!--创建构建输出目录-->
<target name="prepare" depends="clean"> <target name="prepare" depends="clean">
<mkdir dir="${dir.output}"/> <mkdir dir="${dir.output}"/>
<mkdir dir="${dir.fe_output}"/>
</target> </target>
<!--清空构建输出目录--> <!--清空构建输出目录-->
<target name="clean"> <target name="clean">
<delete dir="${dir.output}"/> <delete dir="${dir.output}"/>
<delete dir="${dir.fe_output}"/>
</target> </target>
<!-- 初始化框架 -->
<target name="package"> <target name="init" depends="prepare">
<echo message="package start"/> <echo message="copy to build start"/>
<copy todir="${dir.output}"> <copy todir="${dir.output}">
<filelist dir="." files="index.php"/> <filelist dir="." files="yii"/>
<filelist dir="." files=".htaccess"/> <filelist dir="." files="composer.json"/>
<filelist dir="." files="composer.lock"/>
<filelist dir="." files=".bowerrc"/>
<filelist dir="." files="init"/>
</copy> </copy>
<copy todir="${dir.output}/system"> <!--copy backend -->
<fileset dir="./system"> <copy todir="${dir.output}/backend">
<fileset dir="./backend">
<include name="**/**"/> <include name="**/**"/>
<exclude name="runtime/**"/>
</fileset> </fileset>
</copy> </copy>
<copy todir="${dir.output}/uploads"> <mkdir dir="${dir.output}/backend/runtime"/>
<fileset dir="./uploads"> <!--copy common -->
<copy todir="${dir.output}/common">
<fileset dir="./common">
<include name="**/**"/> <include name="**/**"/>
</fileset> </fileset>
</copy> </copy>
<copy todir="${dir.output}/static"> <!--copy console -->
<fileset dir="./static"> <copy todir="${dir.output}/console">
<include name="assets/**"/> <fileset dir="./console">
<include name="**/**"/>
<exclude name="/runtime"/>
</fileset> </fileset>
</copy> </copy>
<copy todir="${dir.output}/application">
<fileset dir="./application"> <!--copy environments -->
<exclude name="**/*.log"/> <copy todir="${dir.output}/environments">
<exclude name="./config/constants.php"/> <fileset dir="./environments">
<include name="**/**"/>
</fileset> </fileset>
</copy> </copy>
<tstamp>
<format property="DATE" pattern="%Y%m%d%H%M" locale="zh_ZH"/>
</tstamp>
<copy file="./application/config/constants.php" tofile="${dir.output}/application/config/constants.php"
overwrite="true">
<filterchain>
<replaceregexp>
<regexp pattern='\d{8}(?=\"\).+)' replace="${DATE}"/>
</replaceregexp>
</filterchain>
<!--copy frontend -->
<copy todir="${dir.output}/frontend">
<fileset dir="./frontend">
<include name="**/**"/>
<exclude name="runtime/**"/>
<exclude name="web/assets/**"/>
<exclude name="web/node_modules/**"/>
</fileset>
</copy> </copy>
<echo message="package end"/> <mkdir dir="${dir.output}/frontend/runtime"/>
</target>
<!--copy bin -->
<target name="deploy"> <copy todir="${dir.output}/bin">
<echo message="deploy start"/> <fileset dir="./bin">
<ftpdeploy
host="${ftp.host}"
port="${ftp.port}"
username="${ftp.username}"
password="${ftp.password}"
dir="${ftp.dir}"
passive="true">
<fileset dir="${dir.output}">
<include name="**/**"/> <include name="**/**"/>
<exclude name="index.php"/>
<exclude name=".htaccess"/>
</fileset> </fileset>
</ftpdeploy> </copy>
<echo message="deploy end"/>
</target> <echo message="copy to build end"/>
<target name="fe_build">
<echo message="fe_bulid start"/>
<exec command="${npm} install" passthru="true" dir="${dir.front_end}"/>
<if>
<equals arg1="${platform}" arg2="win"/>
<then>
<exec command=" ${npm} run test" dir="${dir.front_end}" passthru="true"/>
</then>
<else>
<exec command="${npm} run test" passthru="true" dir="${dir.front_end}"/>
</else>
</if>
<echo message="fe_bulid end"/>
</target> </target>
<target name="composer_install"> <!-- install composer npm -->
<echo message="composer install start"/> <target name="install">
<exec command="${php.bin} ${project.basedir}/bin/composer.phar install --optimize-autoloader" passthru="true" <echo message="install composer start"/>
dir="${project.basedir}/application"/> <exec command="${php.bin} ${project.basedir}/bin/composer.phar install --optimize-autoloader --no-dev --prefer-dist"
passthru="true"
dir="${dir.output}"/>
<exec command="${php.bin} ${project.basedir}/bin/composer.phar dump-autoload --optimize" passthru="true" <exec command="${php.bin} ${project.basedir}/bin/composer.phar dump-autoload --optimize" passthru="true"
dir="${project.basedir}/application"/> dir="${dir.output}"/>
<echo message="composer install end"/> <echo message="install composer end"/>
</target> <echo message="build frontend resourse start"/>
<exec command=" ${npm} install" dir="${dir.output}/frontend/web" passthru="true"/>
<exec command=" ${npm} run pro" dir="${dir.output}/frontend/web" passthru="true"/>
<echo message="build frontend resourse end"/>
<target name="fe_build_production"> <echo message="yii2 init start"/>
<echo message="fe_bulid start"/> <exec command="${php.bin} ${dir.output}/init --env=Production --overwrite=y" passthru="true"/>
<exec command="${npm} install" passthru="true" dir="${dir.front_end}"/> <echo message="yii2 init end"/>
<if>
<equals arg1="${platform}" arg2="win"/>
<then>
<exec command=" ${npm} run pro" dir="${dir.front_end}" passthru="true"/>
</then>
<else>
<exec command="${npm} run pro" passthru="true" dir="${dir.front_end}"/>
</else>
</if>
<echo message="fe_bulid end"/>
</target>
<target name="timestamp"> <echo message="delete other start"/>
<tstamp> <delete dir="${dir.output}/bin" />
<format property="DATE" pattern="%Y%m%d%H%M" locale="nl_NL"/> <delete dir="${dir.output}/environments" />
</tstamp> <delete dir="${dir.output}/tests" />
<copy file="./application/config/constants.php" tofile="constants.php" overwrite="true"> <delete dir="${dir.output}/frontend/web/js" />
<filterchain> <delete dir="${dir.output}/frontend/web/css" />
<replaceregexp> <delete dir="${dir.output}/frontend/web/fonts" />
<regexp pattern='\d{8}(?=\"\).+)' replace="${DATE}"/> <delete dir="${dir.output}/frontend/web/img" />
</replaceregexp> <delete dir="${dir.output}/frontend/web/node_modules" />
</filterchain> <delete file="${dir.output}/frontend/web/package.json" />
<delete file="${dir.output}/frontend/web/webpack.config.js" />
<delete file="${dir.output}/composer.json" />
<delete file="${dir.output}/composer.lock" />
</copy> <echo message="delete other end"/>
</target>
<target name="index_testing">
<copy file="./index-testing.php" tofile="./build/index.php" overwrite="true"></copy>
</target> </target>
<target name="index_production"> <target name="delete">
<copy file="././index-production.php" tofile="./build/index.php" overwrite="true"/>
</target>
<target name="production_build">
<delete file="${dir.output}/application/controllers/Test.php"/>
</target> </target>
<target name="all" depends="clean, prepare,composer_install, fe_build,package,index_testing"/> <target name="all" depends="init,install"/>
<target name="build" depends="clean, prepare,fe_build, package"/>
<target name="package" depends="clean, prepare, fe_build,package, deploy"/>
<target name="test" depends="clean, prepare,composer_install,fe_build,package,index_testing, deploy"/>
<target name="production"
depends="clean,prepare,composer_install,fe_build_production,package,index_production,production_build"/>
</project> </project>
...@@ -10,7 +10,7 @@ dir.fe_output=${project.basedir}/static/assets ...@@ -10,7 +10,7 @@ dir.fe_output=${project.basedir}/static/assets
dir.front_end=${project.basedir}/static dir.front_end=${project.basedir}/static
node=node node=node
webpack=webpack webpack=webpack
npm=npm npm=cnpm
ftp.host=114.112.81.8 ftp.host=114.112.81.8
ftp.port=40021 ftp.port=40021
ftp.username=pp_pro ftp.username=pp_pro
......
...@@ -34,9 +34,6 @@ ...@@ -34,9 +34,6 @@
"bower-asset-library": "vendor/bower" "bower-asset-library": "vendor/bower"
} }
}, },
"scripts": {
"post-install-cmd": "php init --env=Development --overwrite=n"
},
"repositories": { "repositories": {
"packagist": { "packagist": {
"type": "composer", "type": "composer",
......
...@@ -4,14 +4,14 @@ return [ ...@@ -4,14 +4,14 @@ return [
'cache' => [ 'cache' => [
'class' => 'yii\redis\Cache', 'class' => 'yii\redis\Cache',
'redis' => [ 'redis' => [
'hostname' => '192.168.1.12', 'hostname' => '192.168.1.21',
'port' => 6380, 'port' => 6380,
'database' => 2, 'database' => 2,
] ]
], ],
'db' => [ 'db' => [
'class' => 'yii\db\Connection', 'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=192.168.1.7;port:3305;dbname=pp_c', 'dsn' => 'mysql:host=192.168.1.7;port=3305;dbname=pp_c',
'username' => 'pp_c', 'username' => 'pp_c',
'password' => 'nF@V5LK#ilb!NEvZ@1Ze#rWm#H', 'password' => 'nF@V5LK#ilb!NEvZ@1Ze#rWm#H',
'charset' => 'utf8', 'charset' => 'utf8',
......
...@@ -98,7 +98,9 @@ var config = { ...@@ -98,7 +98,9 @@ var config = {
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
config.plugins = config.plugins.concat([ config.plugins = config.plugins.concat([
new webpack.DefinePlugin({ new webpack.DefinePlugin({
__BASE_URL__: JSON.stringify('http://dev.zuiketang.com/'), __BASE_URL__: JSON.stringify('http://c.pp.cc/'),
__CDN_URL__: JSON.stringify('http://c.pp.cc/'),
__QINIU_URL__: JSON.stringify('http://dev.qdn.pp.cc/'),
}), }),
new webpack.optimize.UglifyJsPlugin({ new webpack.optimize.UglifyJsPlugin({
compress: { compress: {
...@@ -110,11 +112,9 @@ if (process.env.NODE_ENV === 'production') { ...@@ -110,11 +112,9 @@ if (process.env.NODE_ENV === 'production') {
} else if (process.env.NODE_ENV === 'testing') { } else if (process.env.NODE_ENV === 'testing') {
config.plugins = config.plugins.concat([ config.plugins = config.plugins.concat([
new webpack.DefinePlugin({ new webpack.DefinePlugin({
__LOGIN_LIB_URL__: JSON.stringify("http://testlogin.pp.cc/static/js/lc-login.js"), __BASE_URL__: JSON.stringify('http://dev.zuiketang.com/'),
__BASE_URL__: JSON.stringify('http://testpro.pp.cc'), __CDN_URL__: JSON.stringify('http://dev.zuiketang.com/'),
__PP_URL__: JSON.stringify('http://testt.pp.cc'), __QINIU_URL__: JSON.stringify('http://dev.qdn.pp.cc/'),
__CDN_URL__: JSON.stringify('http://testpro.pp.cc')
}), }),
new webpack.optimize.UglifyJsPlugin({ new webpack.optimize.UglifyJsPlugin({
compress: { compress: {
...@@ -122,7 +122,8 @@ if (process.env.NODE_ENV === 'production') { ...@@ -122,7 +122,8 @@ if (process.env.NODE_ENV === 'production') {
} }
}), }),
new webpack.optimize.OccurenceOrderPlugin() new webpack.optimize.OccurenceOrderPlugin()
]); ])
;
} else { } else {
config.plugins = config.plugins.concat([ config.plugins = config.plugins.concat([
new webpack.DefinePlugin({ new webpack.DefinePlugin({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment