rhllor 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +14 -0
- data/Rakefile +1 -0
- data/bin/rhllor +86 -0
- data/lib/rhllor.rb +39 -0
- data/lib/rhllor/version.rb +3 -0
- data/project/__artifactId__/.gitlab-ci.yml +15 -0
- data/project/__artifactId__/__artifactId__-api/pom.xml +59 -0
- data/project/__artifactId__/__artifactId__-core/pom.xml +123 -0
- data/project/__artifactId__/__artifactId__-core/src/main/java/com/ricebook/rhllor/__artifactId__/Application.java +66 -0
- data/project/__artifactId__/__artifactId__-core/src/main/resources/bootstrap-production.yaml +10 -0
- data/project/__artifactId__/__artifactId__-core/src/main/resources/bootstrap-test.yaml +95 -0
- data/project/__artifactId__/__artifactId__-core/src/main/resources/bootstrap.yaml +3 -0
- data/project/__artifactId__/app.yaml +20 -0
- data/project/__artifactId__/pom.xml +69 -0
- data/rhllor.gemspec +35 -0
- metadata +121 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bf93f21531391899be204429d3a27aaaa95c8f6c
|
4
|
+
data.tar.gz: b0e11713343ef67394ca0afedcde8736be8ae139
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ef8526d578a637a1fab37700554b2f942549a6eaa717b80ecff5820e40a78f686fb565ba5d2d46970b89eb16e2e8f5a7cfbe2317df442be2a09cb35fc4641737
|
7
|
+
data.tar.gz: ac05c19f6a0e7ad81eb82ba0c112b25419b36cb240e1358aafffd13844c41d4a7e7ff3c9670f1b7bea688f9c80bd9ebdfda76b9eb5e78b51267cdcd7b50e9617
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 ScienJus
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/rhllor
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rhllor'
|
3
|
+
require 'tty-prompt'
|
4
|
+
|
5
|
+
prompt = TTY::Prompt.new
|
6
|
+
|
7
|
+
components = %w(jersey jdbc redis hbase kafka-consumer kafka-producer thrift-client thrift-server elastic-job)
|
8
|
+
selected_components = prompt.multi_select("请选择需要的组件", components)
|
9
|
+
|
10
|
+
config = prompt.collect do
|
11
|
+
key(:name).ask('给你的项目起个名字', required: true)
|
12
|
+
|
13
|
+
if selected_components.include?('jersey')
|
14
|
+
key(:jersey) do
|
15
|
+
puts '开始配置Jersey'
|
16
|
+
key(:port).ask('输入端口号', default: 8080, convert: :int)
|
17
|
+
key(:application_path).ask('输入Application Path', default: '')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
if selected_components.include?('jdbc')
|
22
|
+
key(:jdbc) do
|
23
|
+
puts '开始配置MySQL'
|
24
|
+
key(:name).ask('输入数据源名称', required: true)
|
25
|
+
key(:url).ask('输入URL', required: true)
|
26
|
+
key(:username).ask('输入用户名', required: true)
|
27
|
+
key(:password).ask('输入密码', required: true)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
if selected_components.include?('redis')
|
32
|
+
key(:redis) do
|
33
|
+
puts '开始配置Redis'
|
34
|
+
key(:url).ask('输入URL', default: 'test.redis.ricebook.net:8881')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
if selected_components.include?('hbase')
|
39
|
+
key(:hbase) do
|
40
|
+
puts '开始配置HBase'
|
41
|
+
key(:quorum).ask('输入Zookeeper地址', required: true)
|
42
|
+
key(:port).ask('输入端口号', default: 2181, convert: :int)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
if selected_components.include?('kafka-consumer')
|
47
|
+
puts '开始配置Kafka Consumer'
|
48
|
+
key(:kafka_consumer) do
|
49
|
+
key(:url).ask('输入地址', required: true)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
if selected_components.include?('kafka-producer')
|
54
|
+
puts '开始配置Kafka Producer'
|
55
|
+
key(:kafka_producer) do
|
56
|
+
key(:url).ask('输入地址', required: true)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
if selected_components.include?('thrift-server')
|
61
|
+
puts '开始配置Thrift Server'
|
62
|
+
key(:thrift_server) do
|
63
|
+
key(:name).ask('输入名称', required: true)
|
64
|
+
key(:port).ask('输入端口号', required: true, convert: :int)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
if selected_components.include?('elastic-job')
|
69
|
+
puts '开始配置Elastic Job'
|
70
|
+
key(:elastic_job) do
|
71
|
+
key(:url).ask('输入Zookeeper地址', required: true)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
if selected_components.include?('thrift-client')
|
77
|
+
config[:thrift_client] = true
|
78
|
+
end
|
79
|
+
|
80
|
+
config[:time] = Time.now.strftime("%Y-%m-%d %H:%M:%S")
|
81
|
+
|
82
|
+
puts '开始创建项目'
|
83
|
+
|
84
|
+
Rhllor::RhllorCli.init(config)
|
85
|
+
|
86
|
+
puts '创建成功'
|
data/lib/rhllor.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'liquid'
|
3
|
+
|
4
|
+
module Rhllor
|
5
|
+
class RhllorCli
|
6
|
+
def self.init(config)
|
7
|
+
project_path = File.expand_path(File.join(File.dirname(__FILE__), '../project'))
|
8
|
+
Dir.glob("#{project_path}/**/{*,.*}")
|
9
|
+
.select{ |template_path| File.file?(template_path) }
|
10
|
+
.reject{ |template_path| template_path.include?('.DS_Store') } # 排除掉该死的隐藏文件
|
11
|
+
.each do |template_path|
|
12
|
+
|
13
|
+
relative_path = template_path.sub(project_path, '').gsub('__artifactId__', config[:name])
|
14
|
+
current_path = File.join(Dir.pwd, relative_path)
|
15
|
+
# 创建文件夹
|
16
|
+
dirname = File.dirname(current_path)
|
17
|
+
FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
|
18
|
+
# 生成文件
|
19
|
+
puts "Writing #{current_path}..."
|
20
|
+
File.open(current_path, 'w') do |out|
|
21
|
+
template = File.open(template_path).read()
|
22
|
+
content = Liquid::Template.parse(template).render(config.deep_stringify_keys())
|
23
|
+
out.write(content)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# Liquid 不支持 Symbol 我要死了
|
31
|
+
class Hash
|
32
|
+
def deep_stringify_keys
|
33
|
+
result = {}
|
34
|
+
each do |key, value|
|
35
|
+
result[key.to_s] = value.is_a?(Hash) ? value.deep_stringify_keys() : value
|
36
|
+
end
|
37
|
+
result
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
image: "hub.ricebook.net/base/ubuntu:Java-2016.04.20"
|
2
|
+
test_job:
|
3
|
+
stage: "test"
|
4
|
+
script:
|
5
|
+
- "echo 'start building'"
|
6
|
+
{%- if thrift_server %}
|
7
|
+
- "mvn --quiet clean package -Dmaven.test.skip=true -rf {{ name }}-core"
|
8
|
+
{%- else %}
|
9
|
+
- "mvn --quiet clean package -Dmaven.test.skip=true"
|
10
|
+
{%- endif %}
|
11
|
+
- "cp {{ name }}-core/target/{{ name }}-core-1.0-SNAPSHOT.jar {{ name }}.jar"
|
12
|
+
- "echo 'build done'"
|
13
|
+
artifacts:
|
14
|
+
paths:
|
15
|
+
- "{{ name }}.jar"
|
@@ -0,0 +1,59 @@
|
|
1
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
2
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
3
|
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
4
|
+
<parent>
|
5
|
+
<artifactId>{{ name }}</artifactId>
|
6
|
+
<groupId>com.ricebook.rhllor</groupId>
|
7
|
+
<version>1.0-SNAPSHOT</version>
|
8
|
+
</parent>
|
9
|
+
<modelVersion>4.0.0</modelVersion>
|
10
|
+
|
11
|
+
<artifactId>{{ name }}-api</artifactId>
|
12
|
+
<packaging>jar</packaging>
|
13
|
+
|
14
|
+
<name>{{ name }}-api</name>
|
15
|
+
<url>http://maven.apache.org</url>
|
16
|
+
|
17
|
+
<properties>
|
18
|
+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
19
|
+
</properties>
|
20
|
+
|
21
|
+
{%- if thrift_server %}
|
22
|
+
|
23
|
+
<dependencies>
|
24
|
+
<dependency>
|
25
|
+
<groupId>org.apache.thrift</groupId>
|
26
|
+
<artifactId>libthrift</artifactId>
|
27
|
+
</dependency>
|
28
|
+
</dependencies>
|
29
|
+
{%- endif %}
|
30
|
+
|
31
|
+
{%- if thrift_server %}
|
32
|
+
|
33
|
+
<build>
|
34
|
+
<plugins>
|
35
|
+
<plugin>
|
36
|
+
<groupId>org.apache.thrift.tools</groupId>
|
37
|
+
<artifactId>maven-thrift-plugin</artifactId>
|
38
|
+
<version>0.1.11</version>
|
39
|
+
<executions>
|
40
|
+
<execution>
|
41
|
+
<id>thrift-sources</id>
|
42
|
+
<phase>generate-sources</phase>
|
43
|
+
<goals>
|
44
|
+
<goal>compile</goal>
|
45
|
+
</goals>
|
46
|
+
</execution>
|
47
|
+
<execution>
|
48
|
+
<id>thrift-test-sources</id>
|
49
|
+
<phase>generate-test-sources</phase>
|
50
|
+
<goals>
|
51
|
+
<goal>testCompile</goal>
|
52
|
+
</goals>
|
53
|
+
</execution>
|
54
|
+
</executions>
|
55
|
+
</plugin>
|
56
|
+
</plugins>
|
57
|
+
</build>
|
58
|
+
{%- endif %}
|
59
|
+
</project>
|
@@ -0,0 +1,123 @@
|
|
1
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
2
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
3
|
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
4
|
+
<parent>
|
5
|
+
<artifactId>{{ name }}</artifactId>
|
6
|
+
<groupId>com.ricebook.rhllor</groupId>
|
7
|
+
<version>1.0-SNAPSHOT</version>
|
8
|
+
</parent>
|
9
|
+
<modelVersion>4.0.0</modelVersion>
|
10
|
+
|
11
|
+
<artifactId>{{ name }}-core</artifactId>
|
12
|
+
<packaging>jar</packaging>
|
13
|
+
|
14
|
+
<name>{{ name }}-core</name>
|
15
|
+
<url>http://maven.apache.org</url>
|
16
|
+
|
17
|
+
<dependencies>
|
18
|
+
<!--API-->
|
19
|
+
<dependency>
|
20
|
+
<groupId>com.ricebook.rhllor</groupId>
|
21
|
+
<artifactId>{{ name }}-api</artifactId>
|
22
|
+
<version>1.0-SNAPSHOT</version>
|
23
|
+
</dependency>
|
24
|
+
|
25
|
+
<!--Config-->
|
26
|
+
<dependency>
|
27
|
+
<groupId>org.springframework.cloud</groupId>
|
28
|
+
<artifactId>spring-cloud-config-client</artifactId>
|
29
|
+
</dependency>
|
30
|
+
|
31
|
+
<!--Rhllor-->
|
32
|
+
{{ '' }}
|
33
|
+
{%- if jersey -%}
|
34
|
+
<dependency>
|
35
|
+
<groupId>com.ricebook.rhllor</groupId>
|
36
|
+
<artifactId>spring-boot-starter-jersey</artifactId>
|
37
|
+
</dependency>
|
38
|
+
|
39
|
+
{% endif -%}
|
40
|
+
|
41
|
+
{%- if jdbc -%}
|
42
|
+
<dependency>
|
43
|
+
<groupId>com.ricebook.rhllor</groupId>
|
44
|
+
<artifactId>spring-boot-starter-jdbc</artifactId>
|
45
|
+
</dependency>
|
46
|
+
|
47
|
+
{% endif -%}
|
48
|
+
|
49
|
+
{%- if redis -%}
|
50
|
+
<dependency>
|
51
|
+
<groupId>com.ricebook.rhllor</groupId>
|
52
|
+
<artifactId>spring-boot-starter-cache</artifactId>
|
53
|
+
</dependency>
|
54
|
+
|
55
|
+
{% endif -%}
|
56
|
+
|
57
|
+
{%- if hbase -%}
|
58
|
+
<dependency>
|
59
|
+
<groupId>com.ricebook.rhllor</groupId>
|
60
|
+
<artifactId>spring-boot-starter-hbase</artifactId>
|
61
|
+
</dependency>
|
62
|
+
|
63
|
+
{% endif -%}
|
64
|
+
|
65
|
+
{%- if kafka_consumer or kafka_producer -%}
|
66
|
+
<dependency>
|
67
|
+
<groupId>com.ricebook.rhllor</groupId>
|
68
|
+
<artifactId>spring-boot-starter-kafka</artifactId>
|
69
|
+
</dependency>
|
70
|
+
|
71
|
+
{% endif -%}
|
72
|
+
|
73
|
+
{%- if thrift_client -%}
|
74
|
+
<dependency>
|
75
|
+
<groupId>com.ricebook.rhllor</groupId>
|
76
|
+
<artifactId>spring-boot-starter-thrift-client</artifactId>
|
77
|
+
</dependency>
|
78
|
+
|
79
|
+
{% endif -%}
|
80
|
+
|
81
|
+
{%- if thrift_server -%}
|
82
|
+
<dependency>
|
83
|
+
<groupId>com.ricebook.rhllor</groupId>
|
84
|
+
<artifactId>spring-boot-starter-thrift-server</artifactId>
|
85
|
+
</dependency>
|
86
|
+
|
87
|
+
{% endif -%}
|
88
|
+
|
89
|
+
{%-if elastic_job -%}
|
90
|
+
<dependency>
|
91
|
+
<groupId>com.ricebook.rhllor</groupId>
|
92
|
+
<artifactId>spring-boot-starter-elastic-job</artifactId>
|
93
|
+
</dependency>
|
94
|
+
|
95
|
+
{% endif -%}
|
96
|
+
<dependency>
|
97
|
+
<groupId>com.ricebook.rhllor</groupId>
|
98
|
+
<artifactId>spring-boot-starter-agent</artifactId>
|
99
|
+
</dependency>
|
100
|
+
|
101
|
+
<dependency>
|
102
|
+
<groupId>com.ricebook.rhllor</groupId>
|
103
|
+
<artifactId>spring-boot-starter-actuator</artifactId>
|
104
|
+
</dependency>
|
105
|
+
</dependencies>
|
106
|
+
|
107
|
+
<build>
|
108
|
+
<plugins>
|
109
|
+
<plugin>
|
110
|
+
<groupId>org.springframework.boot</groupId>
|
111
|
+
<artifactId>spring-boot-maven-plugin</artifactId>
|
112
|
+
<version>1.3.6.RELEASE</version>
|
113
|
+
<executions>
|
114
|
+
<execution>
|
115
|
+
<goals>
|
116
|
+
<goal>repackage</goal>
|
117
|
+
</goals>
|
118
|
+
</execution>
|
119
|
+
</executions>
|
120
|
+
</plugin>
|
121
|
+
</plugins>
|
122
|
+
</build>
|
123
|
+
</project>
|
@@ -0,0 +1,66 @@
|
|
1
|
+
package com.ricebook.rhllor.{{ name }};
|
2
|
+
|
3
|
+
{%- if jersey %}
|
4
|
+
import com.ricebook.rhllor.spring.boot.jersey.EnableJerseyConfiguration;
|
5
|
+
import com.ricebook.rhllor.spring.boot.jersey.exception.RhllorExceptionMapper;
|
6
|
+
import com.ricebook.rhllor.spring.boot.jersey.exception.RhllorValidationConfigurationContextResolver;
|
7
|
+
import com.ricebook.rhllor.spring.boot.jersey.exception.RhllorValidationExceptionMapper;
|
8
|
+
import com.ricebook.rhllor.spring.boot.jersey.filter.DynamicFilterFactory;
|
9
|
+
import com.ricebook.rhllor.spring.boot.jersey.provider.EnumParamConverterProvider;
|
10
|
+
import org.glassfish.jersey.media.multipart.MultiPartFeature;
|
11
|
+
import org.glassfish.jersey.server.spring.scope.RequestContextFilter;
|
12
|
+
{%- endif %}
|
13
|
+
|
14
|
+
{%- if elastic_job %}
|
15
|
+
import com.ricebook.rhllor.spring.boot.starter.elasticjob.EnableElasticJobConfiguration;
|
16
|
+
{%- endif %}
|
17
|
+
|
18
|
+
{%- if kafka_consumer %}
|
19
|
+
import org.springframework.kafka.annotation.EnableKafka;
|
20
|
+
{%- endif %}
|
21
|
+
|
22
|
+
import org.springframework.boot.SpringApplication;
|
23
|
+
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
24
|
+
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
25
|
+
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
|
26
|
+
import org.springframework.boot.autoconfigure.jooq.JooqAutoConfiguration;
|
27
|
+
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
|
28
|
+
|
29
|
+
|
30
|
+
/**
|
31
|
+
* @author Rhllor Cli
|
32
|
+
* @date {{ time }}
|
33
|
+
*/
|
34
|
+
{%- if jersey %}
|
35
|
+
@EnableJerseyConfiguration(
|
36
|
+
scanPackage = "com.ricebook.rhllor.{{ name }}.resource",
|
37
|
+
applicationPath = "{{ jersey.application_path }}",
|
38
|
+
componentClasses = {
|
39
|
+
MultiPartFeature.class,
|
40
|
+
RequestContextFilter.class,
|
41
|
+
DynamicFilterFactory.class,
|
42
|
+
EnumParamConverterProvider.class,
|
43
|
+
RhllorExceptionMapper.class,
|
44
|
+
RhllorValidationExceptionMapper.class,
|
45
|
+
RhllorValidationConfigurationContextResolver.class,
|
46
|
+
})
|
47
|
+
{%- endif %}
|
48
|
+
{%- if elastic_job %}
|
49
|
+
@EnableElasticJobConfiguration(scanPackage = "com.ricebook.rhllor.{{ name }}.task")
|
50
|
+
{%- endif %}
|
51
|
+
{%- if kafka_consumer %}
|
52
|
+
@EnableKafka
|
53
|
+
{%- endif %}
|
54
|
+
@SpringBootApplication(exclude = {
|
55
|
+
DataSourceAutoConfiguration.class,
|
56
|
+
DataSourceTransactionManagerAutoConfiguration.class,
|
57
|
+
HibernateJpaAutoConfiguration.class,
|
58
|
+
JooqAutoConfiguration.class,
|
59
|
+
})
|
60
|
+
public class Application {
|
61
|
+
|
62
|
+
public static void main(String[] args) throws Exception {
|
63
|
+
new SpringApplication(Application.class).run(args);
|
64
|
+
}
|
65
|
+
|
66
|
+
}
|
@@ -0,0 +1,95 @@
|
|
1
|
+
spring:
|
2
|
+
profiles: test
|
3
|
+
application:
|
4
|
+
name: {{ name }}
|
5
|
+
cloud:
|
6
|
+
config:
|
7
|
+
uri: http://config-centre.test.rhllor.cn/
|
8
|
+
password: J2f(8J!onz
|
9
|
+
label: master
|
10
|
+
|
11
|
+
{{ '' }}
|
12
|
+
{%- if jersey -%}
|
13
|
+
server:
|
14
|
+
port: {{ jersey.port }}
|
15
|
+
|
16
|
+
{% endif -%}
|
17
|
+
|
18
|
+
{%- if jdbc -%}
|
19
|
+
mysql:
|
20
|
+
more:
|
21
|
+
{{ jdbc.name }}:
|
22
|
+
userName: {{ jdbc.username }}
|
23
|
+
passWord: {{ jdbc.password }}
|
24
|
+
decrypt: false
|
25
|
+
masterUrl: jdbc:mysql://{{ jdbc.url }}/matrix?useUnicode=true&characterEncoding=utf8
|
26
|
+
slaveUrl:
|
27
|
+
- jdbc:mysql://{{ jdbc.url }}/matrix?useUnicode=true&characterEncoding=utf8
|
28
|
+
- jdbc:mysql://{{ jdbc.url }}/matrix?useUnicode=true&characterEncoding=utf8
|
29
|
+
|
30
|
+
{% endif -%}
|
31
|
+
|
32
|
+
{%- if redis -%}
|
33
|
+
redis:
|
34
|
+
timeout: 5000
|
35
|
+
connection: {{ redis.url }}
|
36
|
+
cluster:
|
37
|
+
soTimeout: 2000
|
38
|
+
connTimeout: 2000
|
39
|
+
maxRedirection: 5
|
40
|
+
pool:
|
41
|
+
maxTotal: 1024
|
42
|
+
maxIdle: 200
|
43
|
+
minIdle: 20
|
44
|
+
maxWaitMillis: 1000
|
45
|
+
testOnBorrow: true
|
46
|
+
|
47
|
+
{% endif -%}
|
48
|
+
|
49
|
+
{%- if hbase -%}
|
50
|
+
hbase:
|
51
|
+
quorum: {{ hbase.quorum }}
|
52
|
+
port: {{ hbase.port }}
|
53
|
+
|
54
|
+
{% endif -%}
|
55
|
+
|
56
|
+
{%- if thrift_server -%}
|
57
|
+
thrift:
|
58
|
+
server:
|
59
|
+
{{ thrift_server.name }}:
|
60
|
+
port: {{ thrift_server.port }}
|
61
|
+
|
62
|
+
{% endif -%}
|
63
|
+
|
64
|
+
{%- if kafka_consumer or kafka_producer -%}
|
65
|
+
kafka:
|
66
|
+
{% if kafka_consumer -%}
|
67
|
+
consumer:
|
68
|
+
bootstrap-servers: {{ kafka_consumer.url }}
|
69
|
+
groupId: {{ name }}-test
|
70
|
+
concurrency: 1
|
71
|
+
offset: latest
|
72
|
+
poll-time: 10
|
73
|
+
{% endif -%}
|
74
|
+
{% if kafka_producer -%}
|
75
|
+
producer:
|
76
|
+
bootstrapServers: {{ kafka_producer.url }}
|
77
|
+
{% endif -%}
|
78
|
+
{{ '' }}
|
79
|
+
{% endif -%}
|
80
|
+
|
81
|
+
rhllor:
|
82
|
+
{%- if elastic_job %}
|
83
|
+
elasticjob:
|
84
|
+
zookeeper_server_list: {{ elastic_job.url }}
|
85
|
+
namespace: {{ name }}
|
86
|
+
max_retries: 1
|
87
|
+
session_timeout_ms: 60000
|
88
|
+
connection_timeout_ms: 15000
|
89
|
+
base_sleep_time_ms: 1000
|
90
|
+
max_sleep_time_ms: 3000
|
91
|
+
{%- endif %}
|
92
|
+
agent:
|
93
|
+
enable: true
|
94
|
+
metrics:
|
95
|
+
enable: true
|
@@ -0,0 +1,20 @@
|
|
1
|
+
appname: "{{ name }}"
|
2
|
+
entrypoints:
|
3
|
+
prod:
|
4
|
+
cmd: "/opt/jdk/bin/java -jar {{ name }}.jar --spring.profiles.active=production"
|
5
|
+
{%- if jersey -%}
|
6
|
+
{{ '' }}
|
7
|
+
ports:
|
8
|
+
- "{{ jersey.port }}/tcp"
|
9
|
+
{%- endif %}
|
10
|
+
network_mode: bridge
|
11
|
+
test:
|
12
|
+
cmd: "/opt/jdk/bin/java -jar {{ name }}.jar --spring.profiles.active=test"
|
13
|
+
{%- if jersey -%}
|
14
|
+
{{ '' }}
|
15
|
+
ports:
|
16
|
+
- "{{ jersey.port }}/tcp"
|
17
|
+
{%- endif %}
|
18
|
+
network_mode: bridge
|
19
|
+
build: "echo 'already done in CI'"
|
20
|
+
base: "hub.ricebook.net/base/alpine:Java-2016.04.20"
|
@@ -0,0 +1,69 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
3
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
4
|
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
5
|
+
<modelVersion>4.0.0</modelVersion>
|
6
|
+
|
7
|
+
<groupId>com.ricebook.rhllor</groupId>
|
8
|
+
<artifactId>{{ name }}</artifactId>
|
9
|
+
<packaging>pom</packaging>
|
10
|
+
<version>1.0-SNAPSHOT</version>
|
11
|
+
<modules>
|
12
|
+
<module>{{ name }}-core</module>
|
13
|
+
<module>{{ name }}-api</module>
|
14
|
+
</modules>
|
15
|
+
|
16
|
+
<repositories>
|
17
|
+
<repository>
|
18
|
+
<id>ricebook</id>
|
19
|
+
<name>Nexus Ricebook Repository</name>
|
20
|
+
<url>http://nexus.ricebook.net:8081/content/groups/public/</url>
|
21
|
+
</repository>
|
22
|
+
</repositories>
|
23
|
+
|
24
|
+
<distributionManagement>
|
25
|
+
<repository>
|
26
|
+
<id>ricebook-releases</id>
|
27
|
+
<name>ricebook</name>
|
28
|
+
<url>http://nexus.ricebook.net:8081/content/repositories/releases/</url>
|
29
|
+
</repository>
|
30
|
+
|
31
|
+
<snapshotRepository>
|
32
|
+
<id>ricebook-snapshots</id>
|
33
|
+
<name>ricebook</name>
|
34
|
+
<url>http://nexus.ricebook.net:8081/content/repositories/snapshots/</url>
|
35
|
+
</snapshotRepository>
|
36
|
+
</distributionManagement>
|
37
|
+
|
38
|
+
<dependencyManagement>
|
39
|
+
<dependencies>
|
40
|
+
<dependency>
|
41
|
+
<groupId>com.ricebook.rhllor</groupId>
|
42
|
+
<artifactId>spring-boot-starter-dependencies</artifactId>
|
43
|
+
<version>1.13.0-SNAPSHOT</version>
|
44
|
+
<type>pom</type>
|
45
|
+
<scope>import</scope>
|
46
|
+
</dependency>
|
47
|
+
</dependencies>
|
48
|
+
</dependencyManagement>
|
49
|
+
|
50
|
+
<build>
|
51
|
+
<plugins>
|
52
|
+
<plugin>
|
53
|
+
<groupId>org.apache.maven.plugins</groupId>
|
54
|
+
<artifactId>maven-compiler-plugin</artifactId>
|
55
|
+
<configuration>
|
56
|
+
<source>1.8</source>
|
57
|
+
<target>1.8</target>
|
58
|
+
</configuration>
|
59
|
+
</plugin>
|
60
|
+
{%- if jersey %}
|
61
|
+
<plugin>
|
62
|
+
<groupId>com.ricebook.rhllor</groupId>
|
63
|
+
<artifactId>doc-plugin</artifactId>
|
64
|
+
<version>1.3-SNAPSHOT</version>
|
65
|
+
</plugin>
|
66
|
+
{%- endif %}
|
67
|
+
</plugins>
|
68
|
+
</build>
|
69
|
+
</project>
|
data/rhllor.gemspec
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rhllor/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rhllor"
|
8
|
+
spec.version = Rhllor::VERSION
|
9
|
+
spec.authors = ["xieenlong"]
|
10
|
+
spec.email = ["xieenlong@ricebok.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Rhllor Cli}
|
13
|
+
spec.description = %q{「懒」才是第一生产力!Rhllor项目生成脚手架}
|
14
|
+
spec.homepage = "http://enjoy.ricebook.com"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "bin"
|
27
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
31
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
+
spec.add_dependency "tty-prompt"
|
33
|
+
spec.add_dependency "liquid", "~> 4.0.0.rc3"
|
34
|
+
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rhllor
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- xieenlong
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-10-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: tty-prompt
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: liquid
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 4.0.0.rc3
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 4.0.0.rc3
|
69
|
+
description: 「懒」才是第一生产力!Rhllor项目生成脚手架
|
70
|
+
email:
|
71
|
+
- xieenlong@ricebok.com
|
72
|
+
executables:
|
73
|
+
- rhllor
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- .gitignore
|
78
|
+
- CODE_OF_CONDUCT.md
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- bin/rhllor
|
84
|
+
- lib/rhllor.rb
|
85
|
+
- lib/rhllor/version.rb
|
86
|
+
- project/__artifactId__/.gitlab-ci.yml
|
87
|
+
- project/__artifactId__/__artifactId__-api/pom.xml
|
88
|
+
- project/__artifactId__/__artifactId__-core/pom.xml
|
89
|
+
- project/__artifactId__/__artifactId__-core/src/main/java/com/ricebook/rhllor/__artifactId__/Application.java
|
90
|
+
- project/__artifactId__/__artifactId__-core/src/main/resources/bootstrap-production.yaml
|
91
|
+
- project/__artifactId__/__artifactId__-core/src/main/resources/bootstrap-test.yaml
|
92
|
+
- project/__artifactId__/__artifactId__-core/src/main/resources/bootstrap.yaml
|
93
|
+
- project/__artifactId__/app.yaml
|
94
|
+
- project/__artifactId__/pom.xml
|
95
|
+
- rhllor.gemspec
|
96
|
+
homepage: http://enjoy.ricebook.com
|
97
|
+
licenses:
|
98
|
+
- MIT
|
99
|
+
metadata:
|
100
|
+
allowed_push_host: https://rubygems.org
|
101
|
+
post_install_message:
|
102
|
+
rdoc_options: []
|
103
|
+
require_paths:
|
104
|
+
- lib
|
105
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - '>='
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
requirements: []
|
116
|
+
rubyforge_project:
|
117
|
+
rubygems_version: 2.4.6
|
118
|
+
signing_key:
|
119
|
+
specification_version: 4
|
120
|
+
summary: Rhllor Cli
|
121
|
+
test_files: []
|