Merge pull request #5 from nutzam/add_jedis_quartz_to_demo_maker

update: 整理一下maker,可以选择redis/quartz/weixin
This commit is contained in:
wpw 2017-11-15 13:13:42 +08:00 committed by GitHub
commit 5b64006257
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 66 additions and 139 deletions

View File

@ -1,4 +1,4 @@
package io.nutz.demo.simple;
package io.nutz.demo.maker;
import java.io.File;
import java.io.FileInputStream;
@ -116,6 +116,7 @@ public class MainLauncher {
if (file.isDirectory())
return;
String name = file.getAbsolutePath().substring(tmpRoot.getAbsolutePath().length() + 1);
System.out.println(">>" + name);
zip.putNextEntry(new ZipEntry(name));
try (FileInputStream ins = new FileInputStream(file)) {
Streams.write(zip, ins);

View File

@ -1,6 +1,7 @@
log4j.rootLogger=debug,Console
log4j.logger.org.eclipse.jetty=info
log4j.logger.org.apache.jasper=info
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout

View File

@ -57,37 +57,32 @@
<el-form-item label="Nutz.Dao">
<el-switch v-model="nb.nutzdao.enable"></el-switch>
</el-form-item>
<el-form-item label="Dao.Cache" v-show="nb.nutzdao.enable">
<el-switch v-model="nb.nutzdao.cache"></el-switch>
</el-form-item>
<!--JETTY-->
<el-form-item label="Jetty">
<el-switch v-model="nb.jetty.enable"></el-switch>
</el-form-item>
<el-form-item label="Host" v-show="nb.jetty.enable">
<el-input v-model="nb.jetty.host"></el-input>
</el-form-item>
<el-form-item label="Port" v-show="nb.jetty.enable">
<el-input v-model="nb.jetty.port"></el-input>
</el-form-item>
<!--JDBC-->
<el-form-item label="Jdbc">
<el-switch v-model="nb.jdbc.enable"></el-switch>
</el-form-item>
<el-form-item label="DriverType" v-show="nb.jdbc.enable">
<el-input v-model="nb.jdbc.driver_type"></el-input>
<!--Redis-->
<el-form-item label="Redis">
<el-switch v-model="nb.redis.enable"></el-switch>
</el-form-item>
<el-form-item label="Url" v-show="nb.jdbc.enable">
<el-input v-model="nb.jdbc.url"></el-input>
<!--Quartz-->
<el-form-item label="Quartz">
<el-switch v-model="nb.quartz.enable"></el-switch>
</el-form-item>
<el-form-item label="Username" v-show="nb.jdbc.enable">
<el-input v-model="nb.jdbc.username"></el-input>
</el-form-item>
<el-form-item label="Password" v-show="nb.jdbc.enable">
<el-input v-model="nb.jdbc.password"></el-input>
<!--WeChat-->
<el-form-item label="WeChat">
<el-switch v-model="nb.weixin.enable"></el-switch>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">立即创建</el-button>
</el-form-item>
@ -109,7 +104,7 @@
</el-row>
<el-row v-if="activeMenu == 2">
<el-col :span="16" :offset="4">
嗯。。。还没想到要写啥
有疑问? 来 <a href="https://nutz.cn">https://nutz.cn</> 就可以了
</el-col>
</el-row>
</el-main>
@ -150,10 +145,18 @@
},
jdbc: {
enable: true,
driver_type: "mysql",
url: "jdbc:mysql://127.0.0.1/demo",
url: "jdbc:h2:mem:~",
username: "root",
password: "root"
},
redis : {
enable : false
},
quartz : {
enable : false
},
weixin : {
enable : false
}
},
nbJson: "",

View File

@ -1,111 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello, So NB!</title>
<link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/bootstrap-theme.min.css">
<script src="/js/vue.js"></script>
<script type="text/javascript" src="/js/jquery-3.2.1.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container-fluid" id="app">
<div class="col-xs-4"></div>
<div class="col-xs-4">
<form action="#" class="form-horizontal">
<div class="control-group">
<label class="col-sm-4 control-label" for="inputPackage">package</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="inputPackage" placeholder="包名" v-model="nb.packageName">
</div>
</div>
<div class="control-group">
<label class="col-sm-4 control-label" for="inputVersion">NB版本</label>
<div class="col-sm-8">
<select class="form-control" id="inputVersion" v-model="nb.version">
<option value="2.0-SNAPSHOT">2.0-SNAPSHOT</option>
<option value="2.0-Preview">2.0-Preview</option>
</select>
</div>
</div>
<div class="control-group">
<label class="col-sm-4 control-label" for="inputNutMvc">Nutz.Mvc</label>
<div class="col-xs-8">
<input type="checkbox" class="form-control" id="inputNutMvc" placeholder="2.0-Preview" v-model="nb.nutzmvc.enable">
</div>
</div>
<div class="control-group">
<label class="col-sm-4 control-label" for="inputNutDao">Nutz.Dao</label>
<div class="col-xs-8">
<input type="checkbox" class="form-control" id="inputNutDao" placeholder="2.0-Preview" v-model="nb.nutzdao.enable">
</div>
</div>
<div class="control-group">
<label class="col-sm-4 control-label" for="inputJetty">Jetty</label>
<div class="col-xs-8">
<input type="checkbox" class="form-control" id="inputJetty" placeholder="2.0-Preview" v-model="nb.jetty.enable">
</div>
</div>
<div class="control-group">
<label class="col-sm-4 control-label" for="inputJdbc">Jdbc</label>
<div class="col-xs-8">
<input type="checkbox" class="form-control" id="inputJdbc" placeholder="2.0-Preview" v-model="nb.jdbc.enable">
</div>
</div>
</form>
<div>
<button @click="nb_build()">生成并下载</button>
</div>
</div>
<div class="col-xs-4"></div>
</div>
<script type="text/javascript">
var app = new Vue({
el : "#app",
data : {
nb : {
packageName : "io.nutz.demo",
version : "2.0-SNAPSHOT",
nutzmvc : {
enable : true
},
nutzdao : {
enable : true,
cache : false
},
jetty: {
enable : true,
port : 8080,
host : "127.0.0.1"
},
jdbc : {
enable : true,
driver_type : "mysql",
url : "jdbc:mysql://127.0.0.1/demo",
username : "root",
password : "root"
}
}
},
methods : {
nb_build : function() {
$.ajax({
url : "/maker/make",
type : "POST",
data : JSON.stringify(app.nb),
dataType : "json",
success : function(re){
if (re && re.ok) {
window.location = "/maker/download/" + re.key;
}
}
});
}
}
});
</script>
</body>
</html>

View File

@ -20,11 +20,11 @@ MainLauncher是入口,启动即可
```
// for windows
set MAVEN_OPTS="-Dfile.encoding=UTF-8"
mvnw.cmd exec:java -Dexec.mainClass="io.nutz.demo.MainLauncher"
mvnw.cmd compile exec:java -Dexec.mainClass="io.nutz.demo.MainLauncher"
// for *uix
set MAVEN_OPTS="-Dfile.encoding=UTF-8"
mvnw exec:java -Dexec.mainClass="io.nutz.demo.MainLauncher"
mvnw compile exec:java -Dexec.mainClass="io.nutz.demo.MainLauncher"
```
## 相关资源

View File

@ -38,6 +38,21 @@
<artifactId>nutzboot-starter-jdbc</artifactId>
<version>${nutzboot.version}</version>
</dependency>
<dependency th:if="${params.redis.enable}">
<groupId>org.nutz</groupId>
<artifactId>nutzboot-starter-redis</artifactId>
<version>${nutzboot.version}</version>
</dependency>
<dependency th:if="${params.quartz.enable}">
<groupId>org.nutz</groupId>
<artifactId>nutzboot-starter-quartz</artifactId>
<version>${nutzboot.version}</version>
</dependency>
<dependency th:if="${params.weixin.enable}">
<groupId>org.nutz</groupId>
<artifactId>nutzboot-starter-weixin</artifactId>
<version>${nutzboot.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
@ -48,6 +63,11 @@
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.196</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>

View File

@ -9,4 +9,11 @@ jdbc.type=druid
jdbc.url=[[${params.jdbc.url}]]
jdbc.username=[[${params.jdbc.username}]]
jdbc.password=[[${params.jdbc.password}]]
[/ ]
[# th:if="${params.redis.enable}" ]
redis.host=127.0.0.1
redis.port=6379
redis.timeout=2000
redis.database=0
[/ ]

View File

@ -1,6 +1,7 @@
log4j.rootLogger=debug,Console
log4j.logger.org.eclipse.jetty=info
log4j.logger.org.apache.jasper=info
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout

View File

@ -20,7 +20,7 @@
</dependency>
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-starter-jedis</artifactId>
<artifactId>nutzboot-starter-redis</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>

View File

@ -5,7 +5,7 @@
<artifactId>nutzboot-parent</artifactId>
<version>2.0-SNAPSHOT</version>
</parent>
<artifactId>nutzboot-starter-jedis</artifactId>
<artifactId>nutzboot-starter-redis</artifactId>
<dependencies>
<dependency>
<groupId>org.nutz</groupId>

View File

@ -1,4 +1,4 @@
package org.nutz.boot.starter.jedis;
package org.nutz.boot.starter.redis;
import org.nutz.boot.ioc.IocLoaderProvider;
import org.nutz.integration.jedis.JedisIocLoader;

View File

@ -1 +1 @@
org.nutz.boot.starter.jedis.JedisStarter
org.nutz.boot.starter.redis.JedisStarter

View File

@ -59,5 +59,10 @@
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>1.7.25</version>
</dependency>
</dependencies>
</project>