| @@ -21,7 +21,7 @@ Trustie (确实)是一个以大众化协同开发、开放式资源共享、 | |||
| * Redis 5+ | |||
| * NodeJS > 13.0.0 | |||
| * imagemagick | |||
| ### Steps | |||
| @@ -65,7 +65,7 @@ default: &default | |||
| **因目前gitea平台api受限,暂时推荐从forge平台获取gitea部署文件进行部署:https://forgeplus.trustie.net/projects/Trustie/gitea-binary** | |||
| #### 配置gitea服务步骤 | |||
| **配置gitea服务步骤** | |||
| 1. 部署gitea服务,并注册root账户 | |||
| 2. 修改forge平台的 config/configuration.yml中的gitea服务指向地址,如: | |||
| @@ -80,60 +80,64 @@ gitea: | |||
| #### 6. 安装redis环境 | |||
| **请自行搜索各平台如何安装部署redis环境** | |||
| #### 7. 安装imagemagick插件 | |||
| - Mac OS X | |||
| ```bash | |||
| brew install imagemagick ghostscript | |||
| ``` | |||
| - Linux | |||
| ```bash | |||
| sudo apt-get install -y imagemagick | |||
| ``` | |||
| #### 7. 创建数据库 | |||
| #### 8. 创建数据库 | |||
| **开发环境为development, 生成环境为production** | |||
| ```bash | |||
| rails db:create RAILS_ENV=development | |||
| ``` | |||
| #### 8. 导入数据表结构 | |||
| #### 9. 导入数据表结构 | |||
| ```bash | |||
| bundle exec rake sync_table_structure:import_csv | |||
| ``` | |||
| #### 9. 执行migrate迁移文件 | |||
| #### 10. 执行migrate迁移文件 | |||
| **开发环境为development, 生成环境为production** | |||
| ```bash | |||
| rails db:migrate RAILS_ENV=development | |||
| ``` | |||
| #### 10. clone前端代码 | |||
| #### 11. clone前端代码 | |||
| **将前端代码克隆到public/react目录下,目录结构应该是: public/react/build** | |||
| ```bash | |||
| git clone -b standalone https://git.trustie.net/jasder/build.git | |||
| ``` | |||
| #### 11. 启动redis(此处已mac系统为例) | |||
| #### 12. 启动redis(此处已mac系统为例) | |||
| ```bash | |||
| redis-server& | |||
| ``` | |||
| #### 12. 启动sidekiq | |||
| #### 13. 启动sidekiq | |||
| **开发环境为development, 生成环境为production** | |||
| ```bash | |||
| bundle exec sidekiq -C config/sidekiq.yml -e production -d | |||
| ``` | |||
| #### 13. 启动rails服务 | |||
| #### 14. 启动rails服务 | |||
| ```bash | |||
| rails s | |||
| ``` | |||
| #### 14. 浏览器访问 | |||
| 在浏览器中输入如下地址访问: | |||
| ```bash | |||
| http://localhost:3000/ | |||
| ``` | |||
| #### 15. 浏览器访问 | |||
| 在浏览器中输入如下地址访问: | |||
| ```bash | |||
| http://localhost:3000/ | |||
| ``` | |||
| #### 15. 其他说明 | |||
| #### 16. 其他说明 | |||
| 通过页面注册都第一个用户为平台管理员用户 | |||
| ## 页面展示 | |||
| @@ -8,7 +8,7 @@ class VersionReleasesController < ApplicationController | |||
| version_releases = Gitea::Versions::ListService.new(@user.gitea_token, @user.try(:login), @repository.try(:identifier)).call | |||
| @version_releases = version_releases | |||
| @user_permission = current_user.present? && (current_user == @user || current_user.admin?) | |||
| @forge_releases = @repository.version_releases.select(:id,:version_gid).includes(:attachments) | |||
| @forge_releases = @repository.version_releases.select(:id,:version_gid, :created_at).includes(:attachments) | |||
| end | |||
| def new | |||
| @@ -17,8 +17,8 @@ json.releases do | |||
| json.tarball_url re["tarball_url"] | |||
| json.zipball_url re["zipball_url"] | |||
| json.draft re["draft"] ? "草稿" : (re["prerelease"] ? "预发行" : "稳定") | |||
| json.created_at format_time(re["created_at"].to_s.to_time) | |||
| json.published_at format_time(re["published_at"].to_s.to_time) | |||
| json.created_at format_time(version.created_at.to_s.to_time) | |||
| json.published_at format_time(version.created_at.to_s.to_time) | |||
| json.user_name user.present? ? user.try(:show_real_name) : "" | |||
| json.image_url user.present? ? url_to_avatar(user) : "" | |||
| else | |||
| @@ -33,8 +33,8 @@ json.releases do | |||
| json.tarball_url re["tarball_url"] | |||
| json.zipball_url re["zipball_url"] | |||
| json.draft re["draft"] ? "草稿" : (re["prerelease"] ? "预发行" : "稳定") | |||
| json.created_at format_time(re["created_at"].to_s.to_time) | |||
| json.published_at format_time(re["published_at"].to_s.to_time) | |||
| json.created_at format_time(version.created_at.to_s.to_time) | |||
| json.published_at format_time(version.created_at.to_s.to_time) | |||
| json.user_name user.present? ? user.try(:show_real_name) : "" | |||
| json.image_url user.present? ? url_to_avatar(user) : "" | |||
| end | |||