修改 readme 新版本简化描述和使用

This commit is contained in:
杨红岩 2023-09-15 19:33:08 +08:00
parent 979d51cd32
commit ddd93ba521
2 changed files with 79 additions and 104 deletions

103
README.md
View File

@ -53,36 +53,28 @@ with [CEF](https://bitbucket.org/chromiumembedded/cef) binary
- [![LCL](https://img.shields.io/badge/LCL-green)](https://github.com/energye/golcl)
- [![CEF-CEF4Delphi](https://img.shields.io/badge/CEF(Chromium%20Embedded%20Framework)%20CEF4Delphi-green)](https://github.com/salvadordf/CEF4Delphi)
### [Development environment](https://energy.yanghy.cn/course/100/63511b14a749ba0318943f3a)
> Install automatically using the energy command line tool
### [Development Environment](https://energy.yanghy.cn/course/100/63511b14a749ba0318943f3a)
#### Basic needs
> - golang >= 1.18
> - Golang >= 1.18
> - Energy (CEF, liblcl)
#### Environmental installation
- Automatic installation development environment
> Automatically install the complete development environment using the energy command-line tool [Download address](https://energy.yanghy.cn/course/100/1694511322285207)
>
> - energy development environment
>
> Use the energy command line tool to automatically install the development environment
>
> Get [energy](https://github.com/energye/energy) project, or use the precompiled command line tool
> directly [Download address](https://energy.yanghy.cn/course/100/63511b14a749ba0318943f3a)
>
> <p style="color:palevioletred;">If using pre compiled command-line tools, the following steps can be skipped</p>
>
> `git clone https://github.com/energye/energy.git`
>
> Enter the [energy](https://github.com/energye/energy) command line directory
>
> `cd energy/cmd/energy`
>
> Install command line tools
>
> `go install`
>
> Execute the installation command
>
> `energy install .`
> This installation process selectively downloads the following frameworks and tools from the network
| Name | Platform | illustrate |
|-------------|----------------|----------------------------------------------|
| Golang | ALL | Golang Development Environment |
| CEF, liblcl | ALL | CEF Framework |
| NSIS | Windows | Windows Installation package production tool |
| UPX | Windows, Linux | Execute file compression tool |
| 7z | Windows, Linux | CEF Framework compression tool |
### Getting Started Guide - [Transfer gate](https://energy.yanghy.cn)
@ -92,22 +84,17 @@ with [CEF](https://bitbucket.org/chromiumembedded/cef) binary
### Quick Get Start
> Must: You need to install the Go development environment yourself [Golang Install](https://golang.google.cn/dl/)
>
> Use [energy-command-line](https://energy.yanghy.cn/course/100/63511b14a749ba0318943f3a) Command line tool automatic
> installation environment dependency
>
> `energy install .`
>
> Take example/simple as an example
>
> Update latest release dependency
>
> `go mod tidy`
>
> Run `simple` in the IDE or `go run simple.go`
> Using [energy](https://energy.yanghy.cn/course/100/1694511322285207) Command line tools automatically install the complete development environment
### example/simple Code
### Run a simple application in three steps
1. Installation and development environment: `energy install .`
2. Initiate Application: `energy init .`
3. Run Application: `go run main.go`
### sample code
main.go
```go
package main
@ -117,31 +104,25 @@ import (
)
func main() {
//Global initialization must be called by every application
//Global initialization
cef.GlobalInit(nil, nil)
//Create application
cefApp := cef.NewApplication()
//Set URL
cef.BrowserWindow.Config.Url = "https://www.yanghy.cn"
//Run App
cef.Run(cefApp)
//Create an application
app := cef.NewApplication()
//Specify a URL address or local HTML file directory
cef.BrowserWindow.Config.Url = "https://energy.yanghy.cn"
//Run Application
cef.Run(app)
}
```
---
### Pack Project
1. build`energy build .`
2. package`energy package .`
3. The final automatically generated installation package
- windows Using`nsis`Create exe installation package
- linux Using`dpkg`Create deb installation package
- macos Generate`xxx.app`
### Run app
- Windows、Linux
> `go run simple.go`
- MacOS
> `go run simple.go energy_env=dev`
---
### System support

View File

@ -52,27 +52,23 @@
#### 基本需求
> - Golang >= 1.18
> - Energy 开发环境
>
> 使用 energy 命令行工具自动安装开发环境
>
> 获取 [energy](https://github.com/energye/energy) 项目,或直接使用预编译命令行工具 [下载地址](https://energy.yanghy.cn/course/100/63511b14a749ba0318943f3a)
>
> <p style="color:palevioletred;">如果使用预编译命令行工具以下步骤可跳过</p>
> - Energy 开发环境(CEF, liblcl)
#### 环境安装
- 自动安装开发环境
> 使用 energy 命令行工具自动安装完整开发环境 [下载地址](https://energy.yanghy.cn/course/100/1694511322285207)
>
> `git clone https://github.com/energye/energy.git`
>
> 进入 energy 命令行目录
>
> `cd energy/cmd/energy`
>
> 安装命令行工具
>
> `go install`
>
> 执行安装命令
>
> `energy install .`
> 此安装过程有选择性的从网络下载以下框架和工具
| 名称 | 平台 | 说明 |
|-------------|----------------|----------------|
| Golang | ALL | Go语言开发环境 |
| CEF, liblcl | ALL | CEF框架 |
| NSIS | Windows | Windows安装包制作工具 |
| UPX | Windows, Linux | 执行文件压缩工具 |
| 7z | Windows, Linux | CEF框架压缩工具 |
### 入门指南 - [传送门](https://energy.yanghy.cn)
@ -81,21 +77,18 @@
* [文档](https://energy.yanghy.cn/document/300/0)
### 快速入门
> 必须: 你需要自己安装Go开发环境 [Golang安装包](https://golang.google.cn/dl/)
>
> 使用 [energy-command-line](https://energy.yanghy.cn/course/100/63511b14a749ba0318943f3a) 命令行工具自动安装开发环境依赖
>
> `energy install .`
>
> 以example/simple示例为例
>
> 更新最新发布版本依赖
>
> `go mod tidy`
>
> 在IDE中运行 simple 或 go run simple.go
### example/simple 示例代码
> 使用 [energy](https://energy.yanghy.cn/course/100/1694511322285207) 命令行工具自动安装完整开发环境
### 三个步骤运行一个简单应用
1. 安装开发环境: `energy install .`
2. 初始化应用: `energy init .`
3. 运行应用: `go run main.go`
### 示例代码
main.go
```go
package main
@ -105,23 +98,24 @@ import (
)
func main() {
//全局初始化 每个应用都必须调用的
//全局初始化
cef.GlobalInit(nil, nil)
//创建应用
cefApp := cef.NewApplication()
app := cef.NewApplication()
//指定一个URL地址或本地html文件目录
cef.BrowserWindow.Config.Url = "https://energy.yanghy.cn"
//运行应用
cef.Run(cefApp)
cef.Run(app)
}
```
---
### 运行应用
- Windows、Linux
> `go run simple.go`
- MacOS
> `go run simple.go energy_env=dev`
### 项目打包
1. 编译:`energy build .`
2. 打包:`energy package .`
3. 最后自动生的安装包
- windows 使用`nsis`工具生成exe安装包
- linux 使用`dpkg`制作deb安装包
- macos 生成`xxx.app`
### 系统支持