games模块开发
This commit is contained in:
parent
5a2c7a4830
commit
6183db782a
|
@ -0,0 +1,3 @@
|
||||||
|
# Place all the behaviors and hooks related to the matching controller here.
|
||||||
|
# All this logic will automatically be available in application.js.
|
||||||
|
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
|
@ -0,0 +1,3 @@
|
||||||
|
// Place all the styles related to the games controller here.
|
||||||
|
// They will automatically be included in application.css.
|
||||||
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -0,0 +1,54 @@
|
||||||
|
class GamesController < ApplicationController
|
||||||
|
layout "base_myshixun"
|
||||||
|
before_filter :find_myshixun, :only => [:index, :game_build]
|
||||||
|
before_filter :find_game, :only => [:show, :game_build]
|
||||||
|
before_filter :allowd_manager, :only => [:game_build]
|
||||||
|
include ApplicationHelper
|
||||||
|
|
||||||
|
def index
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
# REDO:回复状态更新
|
||||||
|
def game_build
|
||||||
|
gitUrl = git_repository_url(@myshixun, "Myshixun")
|
||||||
|
gitUrl = Base64.encode64(gitUrl)
|
||||||
|
taskId = params[:id]
|
||||||
|
jobName = @myshixun.forked_from
|
||||||
|
step = @game.stage
|
||||||
|
|
||||||
|
if @game.status == 0
|
||||||
|
params = {:jobName => "#{jobName}", :taskId => "#{taskId}", :step => "#{step}", :gitUrl => "#{gitUrl}"}
|
||||||
|
uri = URI.parse("http://123.59.135.74:9999/jenkins-exec/api/buildJob")
|
||||||
|
res = uri_exec uri, params
|
||||||
|
# @challenge.update_attribute(:status, 1)
|
||||||
|
end
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def allowd_manager
|
||||||
|
render_403 unless User.current.manager_of_myshixun?(@myshixun)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Find myshixun of id params[:id]
|
||||||
|
def find_myshixun
|
||||||
|
myshixun_id = params[:myshixun_id] || (params[:game] && params[:game][:myshixun_id])
|
||||||
|
@myshixun = Myshixun.find(myshixun_id)
|
||||||
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
render_404
|
||||||
|
end
|
||||||
|
|
||||||
|
def find_game
|
||||||
|
@game = Game.find(params[:id])
|
||||||
|
@myshixun = @game.myshixun
|
||||||
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
render_404
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,2 +1,28 @@
|
||||||
class MyshixunsController < ApplicationController
|
class MyshixunsController < ApplicationController
|
||||||
|
layout 'base_myshixun'
|
||||||
|
skip_before_filter :verify_authenticity_token, :only => [:training_task_status]
|
||||||
|
before_filter :require_login, :except => [:training_task_status]
|
||||||
|
before_filter :find_myshixun, :only => [:show]
|
||||||
|
|
||||||
|
def training_task_status
|
||||||
|
status = params[:status].to_i
|
||||||
|
task_id = params[:taskId]
|
||||||
|
outPut = params[:outPut]
|
||||||
|
message = Base64.decode64(params[:msg]) unless params[:msg].blank?
|
||||||
|
GameOutputs.create(:code => status, :msg => message, :game_id => task_id, :out_put => outPut)
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
respond_to do |format|
|
||||||
|
format.html{redirect_to myshixun_games_path(@myshixun)}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
# Find myshixun of id params[:id]
|
||||||
|
def find_myshixun
|
||||||
|
@myshixun = Myshixun.find(params[:id])
|
||||||
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
render_404
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,24 +2,13 @@
|
||||||
# REDO: 创建版本库权限控制
|
# REDO: 创建版本库权限控制
|
||||||
class ShixunsController < ApplicationController
|
class ShixunsController < ApplicationController
|
||||||
layout 'base_shixun'
|
layout 'base_shixun'
|
||||||
skip_before_filter :verify_authenticity_token, :only => [:training_task_status]
|
before_filter :require_login
|
||||||
|
before_filter :find_shixun, :except => [ :index, :new, :create]
|
||||||
before_filter :require_login, :except => [:training_task_status]
|
|
||||||
before_filter :find_shixun, :except => [ :index, :new, :create, :training_task_status]
|
|
||||||
before_filter :shixun_view_allow, :only => [:show]
|
before_filter :shixun_view_allow, :only => [:show]
|
||||||
before_filter :require_manager, :only => [ :settings, :add_script]
|
before_filter :require_manager, :only => [ :settings, :add_script]
|
||||||
|
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
|
|
||||||
def training_task_status
|
|
||||||
status = params[:status].to_i
|
|
||||||
task_id = params[:taskId]
|
|
||||||
outPut = params[:outPut]
|
|
||||||
message = Base64.decode64(params[:msg]) unless params[:msg].blank?
|
|
||||||
GameOutputs.create(:code => status, :msg => message, :game_id => task_id, :out_put => outPut)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
def shixun_monitor
|
def shixun_monitor
|
||||||
monitor_filter
|
monitor_filter
|
||||||
if @had_exec
|
if @had_exec
|
||||||
|
@ -47,11 +36,11 @@ class ShixunsController < ApplicationController
|
||||||
s.sync_user(User.current)
|
s.sync_user(User.current)
|
||||||
end
|
end
|
||||||
gshixun = g.fork(@shixun.gpid, User.current.gid)
|
gshixun = g.fork(@shixun.gpid, User.current.gid)
|
||||||
new_shixun = copy_shixun(@shixun, gshixun)
|
myshixun = copy_myshixun(@shixun, gshixun)
|
||||||
publish_challenges(@shixun.id, new_shixun.id, position = 1)
|
publish_games(@shixun.id, myshixun.id, position = 1)
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html{redirect_to shixun_challenges_path(new_shixun)}
|
format.html{redirect_to myshixun_games_path(myshixun)}
|
||||||
end
|
end
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
@ -120,20 +109,6 @@ class ShixunsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def rep_tree_changes
|
|
||||||
rev = params[:rev]
|
|
||||||
ent_path = params[:ent_path]
|
|
||||||
gpid = params[:gpid]
|
|
||||||
g = Gitlab.client
|
|
||||||
begin
|
|
||||||
result = g.rep_last_changes(gpid, :rev => rev, :path => ent_path)
|
|
||||||
result = {:message => result.message, :author_name => User.find_by_mail(result.author_email).nil? ? result.author_email : User.find_by_mail(result.author_email).show_name, :time => distance_of_time_in_words(result.time, Time.now)}
|
|
||||||
rescue Exception => e
|
|
||||||
puts e
|
|
||||||
end
|
|
||||||
render :json => result
|
|
||||||
end
|
|
||||||
|
|
||||||
# 添加实训脚本
|
# 添加实训脚本
|
||||||
def add_script
|
def add_script
|
||||||
if @shixun.update_attribute(:script, params[:shixun_script])
|
if @shixun.update_attribute(:script, params[:shixun_script])
|
||||||
|
@ -198,39 +173,40 @@ class ShixunsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def publish_challenges original_shixun_id, new_shixun_id, position
|
def publish_games original_shixun_id, new_shixun_id, position
|
||||||
original_challenge = Challenge.where(:shixun_id => original_shixun_id, :position => position).first
|
original_challenge = Challenge.where(:shixun_id => original_shixun_id, :position => position).first
|
||||||
challenge = Challenge.create(:subject => original_challenge.subject, :description => original_challenge.description,
|
challenge = Game.create(:subject => original_challenge.subject, :description => original_challenge.description,
|
||||||
:position => 1, :shixun_id => new_shixun_id, :user_id => User.current.id)
|
:stage => position, :myshixun_id => new_shixun_id, :user_id => User.current.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
# 复制项目
|
# 复制项目
|
||||||
# gshixun --> gitlab project
|
# gshixun --> gitlab project
|
||||||
def copy_shixun tpm_shixun, gshixun
|
def copy_myshixun tpm_shixun, gshixun
|
||||||
shixun = Shixun.new
|
myshixun = Myshixun.new
|
||||||
shixun.name = tpm_shixun.name
|
myshixun.name = tpm_shixun.name
|
||||||
shixun.description = tpm_shixun.description
|
myshixun.description = tpm_shixun.description
|
||||||
shixun.is_public = tpm_shixun.is_public
|
myshixun.is_public = tpm_shixun.is_public
|
||||||
shixun.parent_id = tpm_shixun.id
|
myshixun.parent_id = tpm_shixun.id
|
||||||
shixun.user_id = User.current.id
|
myshixun.user_id = User.current.id
|
||||||
shixun.gpid = gshixun.id
|
myshixun.gpid = gshixun.id
|
||||||
shixun.forked_form = tpm_shixun.id
|
myshixun.forked_from = tpm_shixun.id
|
||||||
shixun.status = 2
|
|
||||||
if shixun.save
|
if myshixun.save
|
||||||
m = ShixunMember.new(:user_id => User.current.id, :role => 1)
|
m = MyshixunMember.new(:user_id => User.current.id, :role => 1)
|
||||||
shixun.shixun_members << m
|
myshixun.myshixun_members << m
|
||||||
copy_shixun_repository(shixun, gshixun)
|
copy_myshixun_repository(myshixun, gshixun)
|
||||||
return shixun
|
return myshixun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def copy_shixun_repository(shixun, gshixun)
|
def copy_myshixun_repository(myshixun, gshixun)
|
||||||
repository = Repository.factory('Git')
|
repository = Repository.factory('Git')
|
||||||
repository.shixun_id = shixun.id
|
repository.myshixun_id = myshixun.id
|
||||||
repository.type = 'Repository::Gitlab'
|
repository.type = 'Repository::Gitlab'
|
||||||
repository.url = gshixun.name
|
repository.url = gshixun.name
|
||||||
repository.identifier = gshixun.name
|
repository.identifier = gshixun.name
|
||||||
repository.project_id = -1
|
repository.project_id = -1
|
||||||
|
repository.shixun_id = -2
|
||||||
repository = repository.save
|
repository = repository.save
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,8 @@ module ApplicationHelper
|
||||||
def git_repository_url project, type
|
def git_repository_url project, type
|
||||||
if type == "Shixun"
|
if type == "Shixun"
|
||||||
rep_identify = Repository.where(:shixun_id => project.id, :type => "Repository::Gitlab").first.try(:identifier)
|
rep_identify = Repository.where(:shixun_id => project.id, :type => "Repository::Gitlab").first.try(:identifier)
|
||||||
|
eleif type == "Myshixun"
|
||||||
|
rep_identify = Repository.where(:my_shixun_id => project.id, :type => "Repository::Gitlab").first.try(:identifier)
|
||||||
else
|
else
|
||||||
rep_identify = Repository.where(:project_id => project.id, :type => "Repository::Gitlab").first.try(:identifier)
|
rep_identify = Repository.where(:project_id => project.id, :type => "Repository::Gitlab").first.try(:identifier)
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
module GamesHelper
|
||||||
|
end
|
|
@ -0,0 +1,6 @@
|
||||||
|
class Game < ActiveRecord::Base
|
||||||
|
attr_accessible :description, :myshixun_id, :stage, :subject, :user_id, :status
|
||||||
|
belongs_to :myshixun,:touch=> true
|
||||||
|
belongs_to :user
|
||||||
|
has_many :game_comments
|
||||||
|
end
|
|
@ -1,3 +1,13 @@
|
||||||
class Myshixun < ActiveRecord::Base
|
class Myshixun < ActiveRecord::Base
|
||||||
attr_accessible :name,:description, :script, :is_public, :parent_id, :user_id, :forked_count
|
attr_accessible :description, :name, :parent_id, :user_id, :gpid, :forked_from, :visits, :is_public
|
||||||
|
has_many :users, :through => :myshixun_members
|
||||||
|
has_many :myshixun_members
|
||||||
|
has_one :repository
|
||||||
|
has_many :games, :dependent => :destroy, :order => "games.id ASC"
|
||||||
|
|
||||||
|
def owner
|
||||||
|
User.find(self.user_id)
|
||||||
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
render_404
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class MyshixunMember < ActiveRecord::Base
|
||||||
|
attr_accessible :myshixun_id, :role, :user_id
|
||||||
|
belongs_to :myshixun
|
||||||
|
belongs_to :user
|
||||||
|
end
|
|
@ -26,7 +26,7 @@ class Repository < ActiveRecord::Base
|
||||||
|
|
||||||
belongs_to :project
|
belongs_to :project
|
||||||
belongs_to :shixun
|
belongs_to :shixun
|
||||||
belongs_to :shixun
|
belongs_to :myshixun
|
||||||
has_many :changesets, :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC"
|
has_many :changesets, :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC"
|
||||||
has_many :filechanges, :class_name => 'Change', :through => :changesets
|
has_many :filechanges, :class_name => 'Change', :through => :changesets
|
||||||
|
|
||||||
|
|
|
@ -22,5 +22,7 @@ class Shixun < ActiveRecord::Base
|
||||||
|
|
||||||
def owner
|
def owner
|
||||||
User.find(self.user_id)
|
User.find(self.user_id)
|
||||||
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
render_404
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
class ShixunMember < ActiveRecord::Base
|
class ShixunMember < ActiveRecord::Base
|
||||||
attr_accessible :shixun_member_id, :user_id, :role
|
attr_accessible :shixun_id, :user_id, :role
|
||||||
belongs_to :shixun
|
belongs_to :shixun
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
has_many :roles ,:through => :shixun_member_roles, :foreign_key => 'role_id'
|
has_many :roles ,:through => :shixun_member_roles, :foreign_key => 'role_id'
|
||||||
has_many :shixun_member_roles,:dependent => :destroy
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -899,6 +899,12 @@ class User < Principal
|
||||||
(!member.blank? || User.current.admin?) ? true : false
|
(!member.blank? || User.current.admin?) ? true : false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 超级管理员或者role为1
|
||||||
|
def manager_of_myshixun?(myshixun)
|
||||||
|
member = MyshixunMember.where(:user_id => self.id, :myshixun_id => myshixun.id, :role => 1)
|
||||||
|
(!member.blank? || User.current.admin?) ? true : false
|
||||||
|
end
|
||||||
|
|
||||||
def member_of_course?(course)
|
def member_of_course?(course)
|
||||||
courses.to_a.include?(course)
|
courses.to_a.include?(course)
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
all tpis
|
|
@ -0,0 +1,2 @@
|
||||||
|
<%= link_to "提交评测", {:controller => 'games', :action => "game_build", :id => @game, :myshixun_id => @myshixun}, :class => "task-display-span bBlue mt10", :onclick => "training_task_submmit();", :remote => true %>
|
||||||
|
tpi
|
|
@ -0,0 +1,53 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title><%= h html_title %></title>
|
||||||
|
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||||
|
<meta name="keywords" content="issue,bug,tracker" />
|
||||||
|
<%= csrf_meta_tag %>
|
||||||
|
<%= favicon %>
|
||||||
|
<%= javascript_heads %>
|
||||||
|
<%= heads_for_theme %>
|
||||||
|
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/structure','scm','css/public', 'css/project','css/popup','repository','css/gantt', 'css/calendar', 'css/moduel', 'css/font-awesome' %>
|
||||||
|
<%= call_hook :view_layouts_base_html_head %>
|
||||||
|
<!-- page specific tags -->
|
||||||
|
<%= yield :header_tags -%>
|
||||||
|
</head>
|
||||||
|
<%= @shixun %>
|
||||||
|
<!--add by huang-->
|
||||||
|
<body onload="prettyPrint();">
|
||||||
|
<div class="navContainer mb10"> <%= render :partial => User.current.logged? ? 'layouts/logined_header' : 'layouts/unlogin_header' %></div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
|
||||||
|
<div id="Container">
|
||||||
|
<div id="content" class="sy_contanier" style=" width:1000px; margin:0 auto;">
|
||||||
|
TPI实训 <%= @myshixun.id %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= render_flash_messages %>
|
||||||
|
<%= yield %>
|
||||||
|
<%= call_hook :view_layouts_base_content %>
|
||||||
|
<div style="clear:both;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cl"></div>
|
||||||
|
<%= render :partial => 'layouts/footer' %>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<% if hidden_unproject_infos %>
|
||||||
|
<%= render :partial => 'layouts/new_feedback' %>
|
||||||
|
<% end %>
|
||||||
|
<div id="ajax-indicator" style="display:none;">
|
||||||
|
<span><%= l(:label_loading) %></span>
|
||||||
|
</div>
|
||||||
|
<div id="ajax-modal" style="display:none;"></div>
|
||||||
|
<div id="nh_tx_dialog_html" class="white_content" style="display:none;">
|
||||||
|
<%#=render :partial => 'layouts/upload_avatar', :locals => {:source => @project} %>
|
||||||
|
</div>
|
||||||
|
<%= call_hook :view_layouts_base_body_bottom %>
|
||||||
|
</body>
|
||||||
|
<!-- MathJax的配置 -->
|
||||||
|
<script type="text/javascript" src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
|
||||||
|
<%= javascript_include_tag 'cookie','project',"avatars", 'header','prettify','select_list_move','attachments' %>
|
||||||
|
</html>
|
||||||
|
|
|
@ -56,6 +56,19 @@ RedmineApp::Application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
resources :myshixuns do
|
||||||
|
member do
|
||||||
|
|
||||||
|
end
|
||||||
|
collection do
|
||||||
|
|
||||||
|
end
|
||||||
|
resources :games do
|
||||||
|
member do
|
||||||
|
match 'game_build', :via => [:get, :post]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
# Enable Grack support
|
# Enable Grack support
|
||||||
# mount Trustie::Grack.new, at: '/', constraints: lambda { |request| /[-\/\w\.]+\.git\//.match(request.path_info) }, via: [:get, :post]
|
# mount Trustie::Grack.new, at: '/', constraints: lambda { |request| /[-\/\w\.]+\.git\//.match(request.path_info) }, via: [:get, :post]
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
class CreateMyshixuns < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :myshixuns do |t|
|
||||||
|
t.string :name
|
||||||
|
t.text :description
|
||||||
|
t.integer :parent_id
|
||||||
|
t.boolean :is_public, :default => 1
|
||||||
|
t.integer :user_id
|
||||||
|
t.integer :gpid
|
||||||
|
t.integer :forked_from, :default => 0
|
||||||
|
t.integer :visits, :default => 0
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,11 @@
|
||||||
|
class CreateMyshixunMembers < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :myshixun_members do |t|
|
||||||
|
t.integer :myshixun_id
|
||||||
|
t.integer :user_id
|
||||||
|
t.integer :role
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddMyshixunToRepositories < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :repositories, :myshixun_id, :integer
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,13 @@
|
||||||
|
class CreateGames < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :games do |t|
|
||||||
|
t.integer :myshixun_id
|
||||||
|
t.integer :user_id
|
||||||
|
t.string :subject
|
||||||
|
t.text :description
|
||||||
|
t.integer :stage
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddStatusToGame < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :games, :status, :integer, :default => 0
|
||||||
|
end
|
||||||
|
end
|
35
db/schema.rb
35
db/schema.rb
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20170309062850) do
|
ActiveRecord::Schema.define(:version => 20170310072101) do
|
||||||
|
|
||||||
create_table "activities", :force => true do |t|
|
create_table "activities", :force => true do |t|
|
||||||
t.integer "act_id", :null => false
|
t.integer "act_id", :null => false
|
||||||
|
@ -1056,6 +1056,17 @@ ActiveRecord::Schema.define(:version => 20170309062850) do
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "games", :force => true do |t|
|
||||||
|
t.integer "myshixun_id"
|
||||||
|
t.integer "user_id"
|
||||||
|
t.string "subject"
|
||||||
|
t.text "description"
|
||||||
|
t.integer "stage"
|
||||||
|
t.datetime "created_at", :null => false
|
||||||
|
t.datetime "updated_at", :null => false
|
||||||
|
t.integer "status", :default => 0
|
||||||
|
end
|
||||||
|
|
||||||
create_table "groups_users", :id => false, :force => true do |t|
|
create_table "groups_users", :id => false, :force => true do |t|
|
||||||
t.integer "group_id", :null => false
|
t.integer "group_id", :null => false
|
||||||
t.integer "user_id", :null => false
|
t.integer "user_id", :null => false
|
||||||
|
@ -1474,6 +1485,27 @@ ActiveRecord::Schema.define(:version => 20170309062850) do
|
||||||
add_index "messages", ["parent_id"], :name => "messages_parent_id"
|
add_index "messages", ["parent_id"], :name => "messages_parent_id"
|
||||||
add_index "messages", ["root_id"], :name => "index_messages_on_root_id"
|
add_index "messages", ["root_id"], :name => "index_messages_on_root_id"
|
||||||
|
|
||||||
|
create_table "myshixun_members", :force => true do |t|
|
||||||
|
t.integer "myshixun_id"
|
||||||
|
t.integer "user_id"
|
||||||
|
t.integer "role"
|
||||||
|
t.datetime "created_at", :null => false
|
||||||
|
t.datetime "updated_at", :null => false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "myshixuns", :force => true do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.text "description"
|
||||||
|
t.integer "parent_id"
|
||||||
|
t.boolean "is_public", :default => true
|
||||||
|
t.integer "user_id"
|
||||||
|
t.integer "gpid"
|
||||||
|
t.integer "forked_from", :default => 0
|
||||||
|
t.integer "visits", :default => 0
|
||||||
|
t.datetime "created_at", :null => false
|
||||||
|
t.datetime "updated_at", :null => false
|
||||||
|
end
|
||||||
|
|
||||||
create_table "news", :force => true do |t|
|
create_table "news", :force => true do |t|
|
||||||
t.integer "project_id"
|
t.integer "project_id"
|
||||||
t.string "title", :limit => 60, :default => "", :null => false
|
t.string "title", :limit => 60, :default => "", :null => false
|
||||||
|
@ -1941,6 +1973,7 @@ ActiveRecord::Schema.define(:version => 20170309062850) do
|
||||||
t.boolean "is_default", :default => false
|
t.boolean "is_default", :default => false
|
||||||
t.boolean "hidden", :default => false
|
t.boolean "hidden", :default => false
|
||||||
t.integer "shixun_id"
|
t.integer "shixun_id"
|
||||||
|
t.integer "myshixun_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id"
|
add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id"
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe GamesController, :type => :controller do
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,10 @@
|
||||||
|
FactoryGirl.define do
|
||||||
|
factory :game do
|
||||||
|
myshixun_id 1
|
||||||
|
user_id 1
|
||||||
|
subject "MyString"
|
||||||
|
description "MyText"
|
||||||
|
stage ""
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,8 @@
|
||||||
|
FactoryGirl.define do
|
||||||
|
factory :myshixun_member do
|
||||||
|
myshixun_id 1
|
||||||
|
user_id 1
|
||||||
|
role 1
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -1,6 +1,8 @@
|
||||||
FactoryGirl.define do
|
FactoryGirl.define do
|
||||||
factory :myshixun do
|
factory :myshixun do
|
||||||
name "MyString"
|
name "MyString"
|
||||||
|
description "MyText"
|
||||||
|
parent_id 1
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe Game, :type => :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe MyshixunMember, :type => :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
Loading…
Reference in New Issue