Merge branch 'develop' into standalone
This commit is contained in:
commit
838fd8b4c9
13
CHANGELOG.md
13
CHANGELOG.md
|
@ -1,6 +1,17 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## [v3.0.0](https://github.com/go-gitea/gitea/releases/tag/v1.13.1) - 2020-12-29
|
## [v3.0.1](https://forgeplus.trustie.net/projects/jasder/forgeplus/releases) - 2021-03-19
|
||||||
|
|
||||||
|
* BUGFIXES
|
||||||
|
* Fix pull reqeust模块中用户头像显示问题
|
||||||
|
* Fix 解决issue模块中,指派用户的问题
|
||||||
|
* Fix 解决合并请求失败的后显示message信息不正确
|
||||||
|
* Fix 代码目录页面,readme文件提供单独的api
|
||||||
|
|
||||||
|
* ENHANCEMENTS
|
||||||
|
* 重构项目详情页面
|
||||||
|
|
||||||
|
## [v3.0.0](https://forgeplus.trustie.net/projects/jasder/forgeplus/releases) - 2020-12-29
|
||||||
|
|
||||||
* BUGFIXES
|
* BUGFIXES
|
||||||
* Fix pull reqeust的访问权限问题 (#14156) (#14171)
|
* Fix pull reqeust的访问权限问题 (#14156) (#14171)
|
||||||
|
|
79
README.md
79
README.md
|
@ -11,13 +11,32 @@ Trustie (确实)是一个以大众化协同开发、开放式资源共享、
|
||||||
## 部署
|
## 部署
|
||||||
|
|
||||||
|
|
||||||
### 1. 安装依赖包
|
### Depends Versions
|
||||||
|
|
||||||
```bash
|
* Ruby 2.4.5
|
||||||
bundle install
|
|
||||||
|
* Rails ~> 5.2
|
||||||
|
|
||||||
|
* MySql ~> 5.6
|
||||||
|
|
||||||
|
* Redis 5+
|
||||||
|
|
||||||
|
* NodeJS > 13.0.0
|
||||||
|
|
||||||
|
### Steps
|
||||||
|
|
||||||
|
#### 1. 克隆稳定版本
|
||||||
|
```
|
||||||
|
git clone -b standalone https://git.trustie.net/jasder/forgeplus.git
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. 配置初始化文件
|
#### 2. 安装依赖包
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd forgeplus && bundle install
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 3. 配置初始化文件
|
||||||
进入项目根目录执行一下命令:
|
进入项目根目录执行一下命令:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@ -27,10 +46,24 @@ touch config/redis.yml
|
||||||
touch config/elasticsearch.yml
|
touch config/elasticsearch.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. 配置gitea服务(可选)
|
#### 4. 配置数据库
|
||||||
|
数据库配置信息请查看/config/database.yml文件,
|
||||||
|
项目默认采用mysql数据库, 如需更改,请自行修改配置信息,
|
||||||
|
默认配置如下:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
default: &default
|
||||||
|
adapter: mysql2
|
||||||
|
host: 127.0.0.1
|
||||||
|
encoding: utf8
|
||||||
|
username: root
|
||||||
|
password: 123456
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 5. 配置gitea服务(可选)
|
||||||
**如需要部署自己的gitea平台,请参考gitea官方平台:https://docs.gitea.io/zh-cn/install-from-binary/**
|
**如需要部署自己的gitea平台,请参考gitea官方平台:https://docs.gitea.io/zh-cn/install-from-binary/**
|
||||||
|
|
||||||
**因目前gitea平台api受限,暂时推荐从forge平台获取gitea部署文件进行部署:https://forgeplus.trustie.net/projects/jasder/gitea-binary
|
**因目前gitea平台api受限,暂时推荐从forge平台获取gitea部署文件进行部署:https://forgeplus.trustie.net/projects/jasder/gitea-binary**
|
||||||
|
|
||||||
#### 配置gitea服务步骤
|
#### 配置gitea服务步骤
|
||||||
1. 部署gitea服务,并注册root账户
|
1. 部署gitea服务,并注册root账户
|
||||||
|
@ -44,45 +77,51 @@ gitea:
|
||||||
base_url: '/api/v1'
|
base_url: '/api/v1'
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4. 安装redis环境
|
#### 6. 安装redis环境
|
||||||
**请自行搜索各平台如何安装部署redis环境**
|
**请自行搜索各平台如何安装部署redis环境**
|
||||||
|
|
||||||
|
|
||||||
### 5. 创建数据库
|
#### 7. 创建数据库
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
rails db:create
|
rails db:create
|
||||||
```
|
```
|
||||||
|
|
||||||
### 6. 导入数据表结构
|
#### 8. 导入数据表结构
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bundle exec rake sync_table_structure:import_csv
|
bundle exec rake sync_table_structure:import_csv
|
||||||
```
|
```
|
||||||
|
|
||||||
### 7. 执行migrate迁移文件
|
#### 9. 执行migrate迁移文件
|
||||||
**开发环境为development, 生成环境为production**
|
**开发环境为development, 生成环境为production**
|
||||||
```bash
|
```bash
|
||||||
rails db:migrate RAILS_ENV=development
|
rails db:migrate RAILS_ENV=development
|
||||||
```
|
```
|
||||||
|
|
||||||
### 8. 启动redis(此处已mac系统为例)
|
#### 10. clone前端代码
|
||||||
|
**将前端代码克隆到public/react目录下,目录结构应该是: public/react/build**
|
||||||
|
```bash
|
||||||
|
git clone -b standalone https://git.trustie.net/jasder/build.git
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 11. 启动redis(此处已mac系统为例)
|
||||||
```bash
|
```bash
|
||||||
redis-server&
|
redis-server&
|
||||||
```
|
```
|
||||||
|
|
||||||
### 9. 启动sidekiq
|
#### 12. 启动sidekiq
|
||||||
**开发环境为development, 生成环境为production**
|
**开发环境为development, 生成环境为production**
|
||||||
```bash
|
```bash
|
||||||
bundle exec sidekiq -C config/sidekiq.yml -e production -d
|
bundle exec sidekiq -C config/sidekiq.yml -e production -d
|
||||||
```
|
```
|
||||||
|
|
||||||
### 10. 启动rails服务
|
#### 13. 启动rails服务
|
||||||
```bash
|
```bash
|
||||||
rails s
|
rails s
|
||||||
```
|
```
|
||||||
|
|
||||||
### 11. 浏览器访问
|
#### 12. 浏览器访问
|
||||||
在浏览器中输入如下地址访问:
|
在浏览器中输入如下地址访问:
|
||||||
```bash
|
```bash
|
||||||
http://localhost:3000/
|
http://localhost:3000/
|
||||||
|
@ -93,26 +132,26 @@ http://localhost:3000/
|
||||||
|
|
||||||
- 代码库
|
- 代码库
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
- 任务管理
|
- 任务管理
|
||||||

|

|
||||||
|
|
||||||
- 任务查看
|
- 任务查看
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
- 任务指派
|
- 任务指派
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
- 里程碑
|
- 里程碑
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### API
|
### API
|
||||||
- [API](api_document.md)
|
- [API文档](https://forgeplus.trustie.net/docs/api)
|
||||||
- [API](showdoc.com.cn)
|
- [API](showdoc.com.cn)
|
||||||
账号:forgeplus@admin.com 密码:forge123
|
账号:forgeplus@admin.com 密码:forge123
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,57 @@
|
||||||
class SettingsController < ApplicationController
|
class SettingsController < ApplicationController
|
||||||
def show
|
def show
|
||||||
@old_projects_url = nil
|
@old_projects_url = nil
|
||||||
@old_projects_url = "https://www.trustie.net/users/#{current_user.try(:login)}/projects" if User.current.logged?
|
get_add_menu
|
||||||
|
get_common_menu
|
||||||
|
get_personal_menu
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def get_add_menu
|
||||||
|
@add = []
|
||||||
|
Site.add.select(:id, :name, :url, :key).to_a.map(&:serializable_hash).each do |site|
|
||||||
|
hash = {}
|
||||||
|
site.each {|k, v|
|
||||||
|
hash.merge!("#{k}": set_site_url(k, v))
|
||||||
|
}
|
||||||
|
@add << hash
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_common_menu
|
||||||
|
@common = []
|
||||||
|
Site.common.select(:id, :name, :url, :key).to_a.map(&:serializable_hash).each do |site|
|
||||||
|
next if site["url"].to_s.include?("current_user") && !User.current.logged?
|
||||||
|
hash = {}
|
||||||
|
site.each {|k, v|
|
||||||
|
hash.merge!("#{k}": set_site_url(k, v))
|
||||||
|
}
|
||||||
|
@common << hash
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_personal_menu
|
||||||
|
@personal = []
|
||||||
|
if User.current.logged?
|
||||||
|
Site.personal.select(:id, :name, :url, :key).to_a.map(&:serializable_hash).each do |site|
|
||||||
|
hash = {}
|
||||||
|
site.each {|k, v|
|
||||||
|
hash.merge!("#{k}": set_site_url(k, v))
|
||||||
|
}
|
||||||
|
@personal << hash
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_site_url(key, value)
|
||||||
|
value =
|
||||||
|
if value.to_s.include?("current_user")
|
||||||
|
split_arr = value.split('current_user')
|
||||||
|
split_arr.length > 1 ? split_arr.join(current_user&.login) : (split_arr << current_user&.login).join('')
|
||||||
|
else
|
||||||
|
value
|
||||||
|
end
|
||||||
|
|
||||||
|
key.to_s === "url" && !value.to_s.start_with?("http") ? [request.protocol, request.host_with_port, value].join('') : value
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -73,6 +73,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Project < ApplicationRecord
|
class Project < ApplicationRecord
|
||||||
include Matchable
|
include Matchable
|
||||||
include Publicable
|
include Publicable
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
# == Schema Information
|
||||||
|
#
|
||||||
|
# Table name: sites
|
||||||
|
#
|
||||||
|
# id :integer not null, primary key
|
||||||
|
# name :string(255)
|
||||||
|
# url :string(255)
|
||||||
|
# key :string(255)
|
||||||
|
# site_type :integer
|
||||||
|
# created_at :datetime not null
|
||||||
|
# updated_at :datetime not null
|
||||||
|
#
|
||||||
|
|
||||||
|
class Site < ApplicationRecord
|
||||||
|
# add: 添加类链接
|
||||||
|
# personal: 个人名下类链接,
|
||||||
|
# common: 普通链接
|
||||||
|
enum site_type: { add: 0, personal: 1, common: 2 }
|
||||||
|
|
||||||
|
def self.set_default_menu
|
||||||
|
set_add_menu!
|
||||||
|
set_personal_menu!
|
||||||
|
set_common_menu!
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def self.set_add_menu!
|
||||||
|
adds= [
|
||||||
|
{name: '新建镜像项目', key: 'add_mirror_project', url: '/projects/mirror/new'},
|
||||||
|
{name: '新建托管项目', key: 'add_common', url: '/projects/deposit/new'},
|
||||||
|
{name: '新建组织', key: 'add_r', url: '/organize/new'}]
|
||||||
|
|
||||||
|
adds.each { |ele|
|
||||||
|
Site.find_or_create_by(key: ele[:key]) do |site|
|
||||||
|
site.name = ele[:name]
|
||||||
|
site.url = ele[:url]
|
||||||
|
site.site_type = Site.site_types[:add]
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.set_personal_menu!
|
||||||
|
personals = [
|
||||||
|
{name: '个人中心', key: 'my_page', url: '/users/current_user'},
|
||||||
|
{name: '我的组织', key: 'my_organizes', url: '/users/current_user/organizes'}
|
||||||
|
]
|
||||||
|
|
||||||
|
personals.each { |ele|
|
||||||
|
Site.find_or_create_by(key: ele[:key]) do |site|
|
||||||
|
site.name = ele[:name]
|
||||||
|
site.url = ele[:url]
|
||||||
|
site.site_type = Site.site_types[:personal]
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.set_common_menu!
|
||||||
|
commons = [
|
||||||
|
{name: '通知', key: 'notice', url: '/users/current_user/user_messages'},
|
||||||
|
{name: '找回密码', key: 'lost_password', url: '/account/lost_password'},
|
||||||
|
{name: '注册', key: 'register', url: '/login?login=false'}
|
||||||
|
]
|
||||||
|
|
||||||
|
commons.each { |ele|
|
||||||
|
Site.find_or_create_by(key: ele[:key]) do |site|
|
||||||
|
site.name = ele[:name]
|
||||||
|
site.url = ele[:url]
|
||||||
|
site.site_type = Site.site_types[:common]
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
|
@ -45,7 +45,18 @@ json.setting do
|
||||||
|
|
||||||
json.main_site current_laboratory.main_site?
|
json.main_site current_laboratory.main_site?
|
||||||
json.new_course default_course_links
|
json.new_course default_course_links
|
||||||
json.old_projects_url @old_projects_url
|
|
||||||
|
|
||||||
|
|
||||||
|
json.add do
|
||||||
|
# json.array! @add, :name, :url, :key
|
||||||
|
json.array! @add
|
||||||
|
end
|
||||||
|
|
||||||
|
json.personal do
|
||||||
|
json.array! @personal
|
||||||
|
end
|
||||||
|
|
||||||
|
json.common do
|
||||||
|
json.array! @common
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#
|
#
|
||||||
default: &default
|
default: &default
|
||||||
adapter: mysql2
|
adapter: mysql2
|
||||||
|
host: 127.0.0.1
|
||||||
encoding: utf8
|
encoding: utf8
|
||||||
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
||||||
username: root
|
username: root
|
||||||
|
@ -51,5 +52,3 @@ test:
|
||||||
production:
|
production:
|
||||||
<<: *default
|
<<: *default
|
||||||
database: forge_production
|
database: forge_production
|
||||||
username: educoderplus
|
|
||||||
password: <%= ENV['EDUCODERPLUS_DATABASE_PASSWORD'] %>
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
resources :edu_settings
|
resources :edu_settings
|
||||||
|
|
||||||
resources :edu_settings
|
|
||||||
scope '/api' do
|
scope '/api' do
|
||||||
namespace :ci do
|
namespace :ci do
|
||||||
resources :languages, only: [:index, :show] do
|
resources :languages, only: [:index, :show] do
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
class CreateSites < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
create_table :sites do |t|
|
||||||
|
t.string :name, comment: "中文名称"
|
||||||
|
t.string :url, comment: "具体链接"
|
||||||
|
t.string :key, comment: "标识"
|
||||||
|
t.integer :site_type, comment: "分类,按照分类编排链接"
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
|
||||||
|
Site.set_default_menu
|
||||||
|
end
|
||||||
|
end
|
45
deploy.md
45
deploy.md
|
@ -16,13 +16,18 @@
|
||||||
|
|
||||||
## Steps
|
## Steps
|
||||||
|
|
||||||
### 1. 安装依赖包
|
### 1. 克隆稳定版本仓库
|
||||||
|
```
|
||||||
|
git clone -b standalone https://git.trustie.net/jasder/forgeplus.git
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. 安装依赖包
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bundle install
|
bundle install
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. 配置初始化文件
|
### 3. 配置初始化文件
|
||||||
进入项目根目录执行一下命令:
|
进入项目根目录执行一下命令:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@ -32,7 +37,21 @@ touch config/redis.yml
|
||||||
touch config/elasticsearch.yml
|
touch config/elasticsearch.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. 配置gitea服务(可选)
|
### 4. 配置数据库
|
||||||
|
数据库配置信息请查看/config/database.yml文件,
|
||||||
|
项目默认采用mysql数据库, 如需更改,请自行修改配置信息,
|
||||||
|
默认配置如下:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
default: &default
|
||||||
|
adapter: mysql2
|
||||||
|
host: 127.0.0.1
|
||||||
|
encoding: utf8
|
||||||
|
username: root
|
||||||
|
password: 123456
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. 配置gitea服务(可选)
|
||||||
**如需要部署自己的gitea平台,请参考gitea官方平台:https://docs.gitea.io/zh-cn/install-from-binary/**
|
**如需要部署自己的gitea平台,请参考gitea官方平台:https://docs.gitea.io/zh-cn/install-from-binary/**
|
||||||
|
|
||||||
**因目前gitea平台api受限,暂时推荐从forge平台获取gitea部署文件进行部署:https://forgeplus.trustie.net/projects/jasder/gitea-binary**
|
**因目前gitea平台api受限,暂时推荐从forge平台获取gitea部署文件进行部署:https://forgeplus.trustie.net/projects/jasder/gitea-binary**
|
||||||
|
@ -49,51 +68,51 @@ gitea:
|
||||||
base_url: '/api/v1'
|
base_url: '/api/v1'
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4. 安装redis环境
|
### 5. 安装redis环境
|
||||||
**请自行搜索各平台如何安装部署redis环境**
|
**请自行搜索各平台如何安装部署redis环境**
|
||||||
|
|
||||||
|
|
||||||
### 5. 创建数据库
|
### 6. 创建数据库
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
rails db:create
|
rails db:create
|
||||||
```
|
```
|
||||||
|
|
||||||
### 6. 导入数据表结构
|
### 7. 导入数据表结构
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bundle exec rake sync_table_structure:import_csv
|
bundle exec rake sync_table_structure:import_csv
|
||||||
```
|
```
|
||||||
|
|
||||||
### 7. 执行migrate迁移文件
|
### 8. 执行migrate迁移文件
|
||||||
**开发环境为development, 生成环境为production**
|
**开发环境为development, 生成环境为production**
|
||||||
```bash
|
```bash
|
||||||
rails db:migrate RAILS_ENV=development
|
rails db:migrate RAILS_ENV=development
|
||||||
```
|
```
|
||||||
|
|
||||||
### 8. clone前端代码
|
### 9. clone前端代码
|
||||||
**将前端代码克隆到public/react目录下,目录结构应该是: public/react/build**
|
**将前端代码克隆到public/react目录下,目录结构应该是: public/react/build**
|
||||||
```bash
|
```bash
|
||||||
git clone -b dev_trustie https://git.trustie.net/jasder/build.git
|
git clone -b standalone https://git.trustie.net/jasder/build.git
|
||||||
```
|
```
|
||||||
|
|
||||||
### 9. 启动redis(此处已mac系统为例)
|
### 10. 启动redis(此处已mac系统为例)
|
||||||
```bash
|
```bash
|
||||||
redis-server&
|
redis-server&
|
||||||
```
|
```
|
||||||
|
|
||||||
### 10. 启动sidekiq
|
### 11. 启动sidekiq
|
||||||
**开发环境为development, 生成环境为production**
|
**开发环境为development, 生成环境为production**
|
||||||
```bash
|
```bash
|
||||||
bundle exec sidekiq -C config/sidekiq.yml -e production -d
|
bundle exec sidekiq -C config/sidekiq.yml -e production -d
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1`. 启动rails服务
|
### 12. 启动rails服务
|
||||||
```bash
|
```bash
|
||||||
rails s
|
rails s
|
||||||
```
|
```
|
||||||
|
|
||||||
### 12. 浏览器访问
|
### 13. 浏览器访问
|
||||||
在浏览器中输入如下地址访问:
|
在浏览器中输入如下地址访问:
|
||||||
```bash
|
```bash
|
||||||
http://localhost:3000/
|
http://localhost:3000/
|
||||||
|
|
Loading…
Reference in New Issue