Skip to content
This repository was archived by the owner on Dec 4, 2025. It is now read-only.

Commit 10babbb

Browse files
committed
support torna rest
1 parent b795814 commit 10babbb

File tree

6 files changed

+53
-2
lines changed

6 files changed

+53
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ gradle smartDocRestAdoc
188188
gradle smartDocPostman
189189
// Generate Open Api 3.0+
190190
gradle smartDocOpenApi
191+
// Generate document and send to Torna
192+
gradle tornaRest
191193
192194
// For Apache Dubbo Rpc
193195
gradle smartDocRpcHtml

README_CN.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ gradle smartDocRestAdoc
182182
gradle smartDocPostman
183183
//生成Open Api 3.0 +规范的json文档
184184
gradle smartDocOpenApi
185+
//生成rest接口文档并推送到Torna平台
186+
gradle tornaRest
185187
186188
// Apache Dubbo Rpc生成
187189
// Generate html

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ plugins {
1919
}
2020

2121
group 'com.github.shalousun'
22-
version '2.0.8'
22+
version '2.0.9'
2323

2424
sourceCompatibility = 1.8
2525

@@ -31,7 +31,7 @@ repositories {
3131

3232
dependencies {
3333
testCompile group: 'junit', name: 'junit', version: '4.13.1'
34-
compile 'com.github.shalousun:smart-doc:2.0.8'
34+
compile 'com.github.shalousun:smart-doc:2.0.9'
3535
}
3636
tasks.withType(JavaCompile) {
3737
options.encoding = "UTF-8"

src/main/java/com/smartdoc/gradle/constant/GlobalConstants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ public interface GlobalConstants {
4949

5050
String RPC_MARKDOWN_TASK = "smartDocRpcMarkdown";
5151

52+
String TORNA_REST_TASK = "tornaRest";
53+
5254
String EXTENSION_NAME = "smartdoc";
5355

5456
String SRC_MAIN_JAVA_PATH = "src/main/java";

src/main/java/com/smartdoc/gradle/constant/TaskConstants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,7 @@ public class TaskConstants {
5050
taskMap.put(GlobalConstants.RPC_ADOC_TASK, RpcAdocTask.class);
5151
// create rpc markdown
5252
taskMap.put(GlobalConstants.RPC_MARKDOWN_TASK, RpcMarkdownTask.class);
53+
// create torna rest
54+
taskMap.put(GlobalConstants.TORNA_REST_TASK,TornaRestTask.class);
5355
}
5456
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* smart-doc https://github.com/shalousun/smart-doc
3+
*
4+
* Copyright (C) 2018-2021 smart-doc
5+
*
6+
* Licensed to the Apache Software Foundation (ASF) under one
7+
* or more contributor license agreements. See the NOTICE file
8+
* distributed with this work for additional information
9+
* regarding copyright ownership. The ASF licenses this file
10+
* to you under the Apache License, Version 2.0 (the
11+
* "License"); you may not use this file except in compliance
12+
* with the License. You may obtain a copy of the License at
13+
*
14+
* http://www.apache.org/licenses/LICENSE-2.0
15+
*
16+
* Unless required by applicable law or agreed to in writing,
17+
* software distributed under the License is distributed on an
18+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19+
* KIND, either express or implied. See the License for the
20+
* specific language governing permissions and limitations
21+
* under the License.
22+
*/
23+
package com.smartdoc.gradle.task;
24+
25+
import com.power.doc.builder.TornaBuilder;
26+
import com.power.doc.model.ApiConfig;
27+
import com.thoughtworks.qdox.JavaProjectBuilder;
28+
import org.gradle.api.logging.Logger;
29+
30+
/**
31+
* @author yu 2021/3/11.
32+
*/
33+
public class TornaRestTask extends DocBaseTask {
34+
35+
@Override
36+
public void executeAction(ApiConfig apiConfig, JavaProjectBuilder javaProjectBuilder, Logger logger) {
37+
try {
38+
TornaBuilder.buildApiDoc(apiConfig, javaProjectBuilder);
39+
} catch (Exception e) {
40+
e.printStackTrace();
41+
}
42+
}
43+
}

0 commit comments

Comments
 (0)