| @@ -1,6 +1,17 @@ | |||
| # 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 | |||
| * Fix pull reqeust的访问权限问题 (#14156) (#14171) | |||
| @@ -11,13 +11,32 @@ Trustie (确实)是一个以大众化协同开发、开放式资源共享、 | |||
| ## 部署 | |||
| ### 1. 安装依赖包 | |||
| ### Depends Versions | |||
| * Ruby 2.4.5 | |||
| * 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. 安装依赖包 | |||
| ```bash | |||
| bundle install | |||
| cd forgeplus && bundle install | |||
| ``` | |||
| ### 2. 配置初始化文件 | |||
| #### 3. 配置初始化文件 | |||
| 进入项目根目录执行一下命令: | |||
| ```bash | |||
| @@ -27,10 +46,24 @@ touch config/redis.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平台api受限,暂时推荐从forge平台获取gitea部署文件进行部署:https://forgeplus.trustie.net/projects/jasder/gitea-binary | |||
| **因目前gitea平台api受限,暂时推荐从forge平台获取gitea部署文件进行部署:https://forgeplus.trustie.net/projects/jasder/gitea-binary** | |||
| #### 配置gitea服务步骤 | |||
| 1. 部署gitea服务,并注册root账户 | |||
| @@ -44,45 +77,51 @@ gitea: | |||
| base_url: '/api/v1' | |||
| ``` | |||
| ### 4. 安装redis环境 | |||
| #### 6. 安装redis环境 | |||
| **请自行搜索各平台如何安装部署redis环境** | |||
| ### 5. 创建数据库 | |||
| #### 7. 创建数据库 | |||
| ```bash | |||
| rails db:create | |||
| ``` | |||
| ### 6. 导入数据表结构 | |||
| #### 8. 导入数据表结构 | |||
| ```bash | |||
| bundle exec rake sync_table_structure:import_csv | |||
| ``` | |||
| ### 7. 执行migrate迁移文件 | |||
| #### 9. 执行migrate迁移文件 | |||
| **开发环境为development, 生成环境为production** | |||
| ```bash | |||
| 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 | |||
| redis-server& | |||
| ``` | |||
| ### 9. 启动sidekiq | |||
| #### 12. 启动sidekiq | |||
| **开发环境为development, 生成环境为production** | |||
| ```bash | |||
| bundle exec sidekiq -C config/sidekiq.yml -e production -d | |||
| ``` | |||
| ### 10. 启动rails服务 | |||
| #### 13. 启动rails服务 | |||
| ```bash | |||
| rails s | |||
| ``` | |||
| ### 11. 浏览器访问 | |||
| #### 12. 浏览器访问 | |||
| 在浏览器中输入如下地址访问: | |||
| ```bash | |||
| http://localhost:3000/ | |||
| @@ -93,26 +132,26 @@ http://localhost:3000/ | |||
| - 代码库 | |||
|  | |||
|  | |||
| - 任务管理 | |||
|  | |||
|  | |||
| - 任务查看 | |||
|  | |||
|  | |||
| - 任务指派 | |||
|  | |||
|  | |||
| - 里程碑 | |||
|  | |||
|  | |||
| ### API | |||
| - [API](api_document.md) | |||
| - [API文档](https://forgeplus.trustie.net/docs/api) | |||
| - [API](showdoc.com.cn) | |||
| 账号:forgeplus@admin.com 密码:forge123 | |||
| @@ -1,6 +1,57 @@ | |||
| class SettingsController < ApplicationController | |||
| def show | |||
| @old_projects_url = nil | |||
| @old_projects_url = "https://www.trustie.net/users/#{current_user.try(:login)}/projects" if User.current.logged? | |||
| @old_projects_url = nil | |||
| 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 | |||
| @@ -1,74 +1,75 @@ | |||
| # == Schema Information | |||
| # | |||
| # Table name: projects | |||
| # | |||
| # id :integer not null, primary key | |||
| # name :string(255) default(""), not null | |||
| # description :text(4294967295) | |||
| # homepage :string(255) default("") | |||
| # is_public :boolean default("1"), not null | |||
| # parent_id :integer | |||
| # created_on :datetime | |||
| # updated_on :datetime | |||
| # identifier :string(255) | |||
| # status :integer default("1"), not null | |||
| # lft :integer | |||
| # rgt :integer | |||
| # inherit_members :boolean default("0"), not null | |||
| # project_type :integer default("0") | |||
| # hidden_repo :boolean default("0"), not null | |||
| # attachmenttype :integer default("1") | |||
| # user_id :integer | |||
| # dts_test :integer default("0") | |||
| # enterprise_name :string(255) | |||
| # organization_id :integer | |||
| # project_new_type :integer | |||
| # gpid :integer | |||
| # forked_from_project_id :integer | |||
| # forked_count :integer default("0") | |||
| # publish_resource :integer default("0") | |||
| # visits :integer default("0") | |||
| # hot :integer default("0") | |||
| # invite_code :string(255) | |||
| # qrcode :string(255) | |||
| # qrcode_expiretime :integer default("0") | |||
| # script :text(65535) | |||
| # training_status :integer default("0") | |||
| # rep_identifier :string(255) | |||
| # project_category_id :integer | |||
| # project_language_id :integer | |||
| # license_id :integer | |||
| # ignore_id :integer | |||
| # praises_count :integer default("0") | |||
| # watchers_count :integer default("0") | |||
| # issues_count :integer default("0") | |||
| # pull_requests_count :integer default("0") | |||
| # language :string(255) | |||
| # versions_count :integer default("0") | |||
| # issue_tags_count :integer default("0") | |||
| # closed_issues_count :integer default("0") | |||
| # open_devops :boolean default("0") | |||
| # gitea_webhook_id :integer | |||
| # open_devops_count :integer default("0") | |||
| # recommend :boolean default("0") | |||
| # platform :integer default("0") | |||
| # default_branch :string(255) default("master") | |||
| # website :string(255) | |||
| # | |||
| # Indexes | |||
| # | |||
| # index_projects_on_forked_from_project_id (forked_from_project_id) | |||
| # index_projects_on_identifier (identifier) | |||
| # index_projects_on_is_public (is_public) | |||
| # index_projects_on_lft (lft) | |||
| # index_projects_on_name (name) | |||
| # index_projects_on_platform (platform) | |||
| # index_projects_on_project_type (project_type) | |||
| # index_projects_on_recommend (recommend) | |||
| # index_projects_on_rgt (rgt) | |||
| # index_projects_on_status (status) | |||
| # index_projects_on_updated_on (updated_on) | |||
| # | |||
| # == Schema Information | |||
| # | |||
| # Table name: projects | |||
| # | |||
| # id :integer not null, primary key | |||
| # name :string(255) default(""), not null | |||
| # description :text(4294967295) | |||
| # homepage :string(255) default("") | |||
| # is_public :boolean default("1"), not null | |||
| # parent_id :integer | |||
| # created_on :datetime | |||
| # updated_on :datetime | |||
| # identifier :string(255) | |||
| # status :integer default("1"), not null | |||
| # lft :integer | |||
| # rgt :integer | |||
| # inherit_members :boolean default("0"), not null | |||
| # project_type :integer default("0") | |||
| # hidden_repo :boolean default("0"), not null | |||
| # attachmenttype :integer default("1") | |||
| # user_id :integer | |||
| # dts_test :integer default("0") | |||
| # enterprise_name :string(255) | |||
| # organization_id :integer | |||
| # project_new_type :integer | |||
| # gpid :integer | |||
| # forked_from_project_id :integer | |||
| # forked_count :integer default("0") | |||
| # publish_resource :integer default("0") | |||
| # visits :integer default("0") | |||
| # hot :integer default("0") | |||
| # invite_code :string(255) | |||
| # qrcode :string(255) | |||
| # qrcode_expiretime :integer default("0") | |||
| # script :text(65535) | |||
| # training_status :integer default("0") | |||
| # rep_identifier :string(255) | |||
| # project_category_id :integer | |||
| # project_language_id :integer | |||
| # license_id :integer | |||
| # ignore_id :integer | |||
| # praises_count :integer default("0") | |||
| # watchers_count :integer default("0") | |||
| # issues_count :integer default("0") | |||
| # pull_requests_count :integer default("0") | |||
| # language :string(255) | |||
| # versions_count :integer default("0") | |||
| # issue_tags_count :integer default("0") | |||
| # closed_issues_count :integer default("0") | |||
| # open_devops :boolean default("0") | |||
| # gitea_webhook_id :integer | |||
| # open_devops_count :integer default("0") | |||
| # recommend :boolean default("0") | |||
| # platform :integer default("0") | |||
| # default_branch :string(255) default("master") | |||
| # website :string(255) | |||
| # | |||
| # Indexes | |||
| # | |||
| # index_projects_on_forked_from_project_id (forked_from_project_id) | |||
| # index_projects_on_identifier (identifier) | |||
| # index_projects_on_is_public (is_public) | |||
| # index_projects_on_lft (lft) | |||
| # index_projects_on_name (name) | |||
| # index_projects_on_platform (platform) | |||
| # index_projects_on_project_type (project_type) | |||
| # index_projects_on_recommend (recommend) | |||
| # index_projects_on_rgt (rgt) | |||
| # index_projects_on_status (status) | |||
| # index_projects_on_updated_on (updated_on) | |||
| # | |||
| @@ -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.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 | |||
| @@ -11,6 +11,7 @@ | |||
| # | |||
| default: &default | |||
| adapter: mysql2 | |||
| host: 127.0.0.1 | |||
| encoding: utf8 | |||
| pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> | |||
| username: root | |||
| @@ -51,5 +52,3 @@ test: | |||
| production: | |||
| <<: *default | |||
| 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 | |||
| scope '/api' do | |||
| namespace :ci do | |||
| resources :languages, only: [:index, :show] do | |||
| @@ -379,7 +378,7 @@ Rails.application.routes.draw do | |||
| end | |||
| end | |||
| resource :repositories, path: '/', only: [:show, :create, :edit] do | |||
| resource :repositories, path: '/', only: [:show, :create, :edit] do | |||
| member do | |||
| get :files | |||
| get :detail | |||
| @@ -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 | |||
| @@ -16,13 +16,18 @@ | |||
| ## Steps | |||
| ### 1. 安装依赖包 | |||
| ### 1. 克隆稳定版本仓库 | |||
| ``` | |||
| git clone -b standalone https://git.trustie.net/jasder/forgeplus.git | |||
| ``` | |||
| ### 2. 安装依赖包 | |||
| ```bash | |||
| bundle install | |||
| ``` | |||
| ### 2. 配置初始化文件 | |||
| ### 3. 配置初始化文件 | |||
| 进入项目根目录执行一下命令: | |||
| ```bash | |||
| @@ -32,7 +37,21 @@ touch config/redis.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平台api受限,暂时推荐从forge平台获取gitea部署文件进行部署:https://forgeplus.trustie.net/projects/jasder/gitea-binary** | |||
| @@ -49,51 +68,51 @@ gitea: | |||
| base_url: '/api/v1' | |||
| ``` | |||
| ### 4. 安装redis环境 | |||
| ### 5. 安装redis环境 | |||
| **请自行搜索各平台如何安装部署redis环境** | |||
| ### 5. 创建数据库 | |||
| ### 6. 创建数据库 | |||
| ```bash | |||
| rails db:create | |||
| ``` | |||
| ### 6. 导入数据表结构 | |||
| ### 7. 导入数据表结构 | |||
| ```bash | |||
| bundle exec rake sync_table_structure:import_csv | |||
| ``` | |||
| ### 7. 执行migrate迁移文件 | |||
| ### 8. 执行migrate迁移文件 | |||
| **开发环境为development, 生成环境为production** | |||
| ```bash | |||
| rails db:migrate RAILS_ENV=development | |||
| ``` | |||
| ### 8. clone前端代码 | |||
| ### 9. clone前端代码 | |||
| **将前端代码克隆到public/react目录下,目录结构应该是: public/react/build** | |||
| ```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 | |||
| redis-server& | |||
| ``` | |||
| ### 10. 启动sidekiq | |||
| ### 11. 启动sidekiq | |||
| **开发环境为development, 生成环境为production** | |||
| ```bash | |||
| bundle exec sidekiq -C config/sidekiq.yml -e production -d | |||
| ``` | |||
| ### 1`. 启动rails服务 | |||
| ### 12. 启动rails服务 | |||
| ```bash | |||
| rails s | |||
| ``` | |||
| ### 12. 浏览器访问 | |||
| ### 13. 浏览器访问 | |||
| 在浏览器中输入如下地址访问: | |||
| ```bash | |||
| http://localhost:3000/ | |||