diff --git a/Gemfile b/Gemfile
index bb94100a5..250176066 100644
--- a/Gemfile
+++ b/Gemfile
@@ -57,7 +57,7 @@ group :development do
gem 'grape-swagger'
gem 'better_errors', '~> 1.1.0'
# gem "query_reviewer"
- # gem 'rack-mini-profiler', '~> 0.9.3'
+ gem 'rack-mini-profiler', '~> 0.9.3'
if RUBY_PLATFORM =~ /w32/
gem 'win32console'
end
diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb
index bec66aeff..c53e1939a 100644
--- a/app/controllers/quality_analysis_controller.rb
+++ b/app/controllers/quality_analysis_controller.rb
@@ -26,14 +26,25 @@ class QualityAnalysisController < ApplicationController
job_name = "#{user_name}-#{rep_id}"
sonar_name = "#{user_name}:#{rep_id}"
+ # 考虑到历史数据:有些用户创建类job但是build失败,即sonar没有结果,这个时候需要把job删除,并且删掉quality_analyses表数据
+ # 如果不要这句则需要迁移数据
+ @sonar_address = Redmine::Configuration['sonar_address']
+ projects_date = open(@sonar_address + "/api/projects/index").read
+ arr = JSON.parse(projects_date).map {|m| m["nm"]} # eg: ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"]
+ quality_an = QualityAnalysis.where(:sonar_name => sonar_name).first
+ if @client.job.exists?(job_name) && QualityAnalysis.where(:sonar_name => sonar_name).select{|qa| arr.include?(qa.sonar_name)}.blank?
+ logger.info("88888888888888888888")
+ aa = @client.job.delete("#{job_name}")
+ quality_an.delete unless quality_an.blank?
+ end
# Checks if the given job exists in Jenkins.
unless @client.job.exists?(job_name)
@g = Gitlab.client
branch = params[:branch]
language = swith_language_type(params[:language])
path = params[:path].blank? ? "./" : params[:path]
- qa = QualityAnalysis.where(:project_id => @project.id, :author_login => user_name).first
- version = qa.nil? ? 1 : qa.sonar_version + 1
+ # qa = QualityAnalysis.where(:project_id => @project.id, :author_login => user_name).first
+ version = quality_an.nil? ? 1 : quality_an.sonar_version + 1
properties = "sonar.projectKey=#{sonar_name}
sonar.projectName=#{sonar_name}
sonar.projectVersion=#{version}
@@ -61,7 +72,7 @@ class QualityAnalysisController < ApplicationController
# 判断调用sonar分析是否成功
# 等待启动时间处理, 最长时间为30分钟
for i in 0..60 do
- sleep(60)
+ sleep(30)
@current_build_status = @client.job.get_current_build_status("#{job_name}")
if (@current_build_status != "not_run" || @current_build_status != "running")
break
@@ -72,25 +83,49 @@ class QualityAnalysisController < ApplicationController
end
end
- @console_build = @client.job.get_console_output("#{job_name}", build_num = 0, start = 0, mode = 'text')
+ # 获取sonar output结果
+ console_build = @client.job.get_console_output("#{job_name}", build_num = 0, start = 0, mode = 'text')["output"]
logger.info("@current_build_status is ==> #{@current_build_status}")
- logger.info("@console_build is ==> #{@console_build}")
- d = @client.job.delete("#{job_name}") if jenkins_job == '200' && code != '201'
- logger.error("delete result ==> #{code}")
- if qa.blank? && @current_build_status == "success"
- QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier,
- :sonar_version => version, :path => path, :branch => branch, :language => language, :sonar_name => "#{user_name}:#{rep_id}")
+ # 两种情况需要删除job:
+ # 1/创建成功但是build失败则删除job
+ # 2/creat和build成功,调用sonar启动失败则删除job
+ # 错误信息存储需存到Trustie数据库,否则一旦job删除则无法获取这些信息
+ if jenkins_job == '200' && code != '201'
+ @client.job.delete("#{job_name}")
else
- qa.update_attribute(:sonar_version, version)
+ if @current_build_status == "failure"
+ reg_console = /Exception:.*?\r/.match(console_build)
+ output = reg_console[0].gsub("\r", "") unless reg_console.nil?
+ se = SonarError.where(:jenkins_job_name => job_name).first
+ se.nil? ? SonarError.create(:project_id => @project.id, :jenkins_job_name => job_name, :output => output) : se.update_column(:output, output)
+ @client.job.delete("#{job_name}")
+ elsif @current_build_status == "success"
+ if quality_an.blank?
+ QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier,
+ :sonar_version => version, :path => path, :branch => branch, :language => language, :sonar_name => "#{user_name}:#{rep_id}")
+ else
+ qa.update_attribute(:sonar_version, version)
+ end
+ end
end
end
rescue => e
puts e
end
respond_to do |format|
- format.html{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => sonar_name, :branch => branch, :current_build_status => @current_build_status, :job_name => job_name)}
- # format.js{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => sonar_name, :branch => branch)}
+ if @current_build_status == "success"
+ format.html{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => sonar_name, :branch => branch, :current_build_status => @current_build_status, :job_name => job_name)}
+ elsif @current_build_status == "failure"
+ format.html{redirect_to error_list_project_quality_analysi_path(:project_id => @project.id, :job_name => job_name)}
+ end
+ end
+ end
+
+ def error_list
+ @error_list = SonarError.where(:jenkins_job_name => params[:job_name]).first
+ respond_to do |format|
+ format.html
end
end
@@ -145,7 +180,7 @@ class QualityAnalysisController < ApplicationController
get_current_build_status = @client.job.get_current_build_status("Hjqreturn-1280")
logger.error("Failed to update job: ==> #{jenkins_job}") unless jenkins_job == '200'
- # 数据更新到Trustie数据库
+ # 数据更新到Trustie数据
if jenkins_job == '200'
logger.info("quality_ananlysis will be updated: ==> #{jenkins_job}")
@quality_analysis.path = path
@@ -168,18 +203,12 @@ class QualityAnalysisController < ApplicationController
@branch = params[:branch]
@resource_id = params[:resource_id]
@sonar_address = Redmine::Configuration['sonar_address']
- @jenkins_address = Redmine::Configuration['jenkins_address']
if params[:resource_id].nil?
@name_flag = true
projects_date = open(@sonar_address + "/api/projects/index").read
arr = JSON.parse(projects_date).map {|m| m["nm"]} # eg: ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"]
@quality_analyses = QualityAnalysis.where(:project_id => @project.id).select{|qa| arr.include?(qa.sonar_name)}
-
else
- if params[:current_build_status] == "failure"
- job_name = params[:job_name]
- @console_build = @client.job.get_console_output("#{job_name}", build_num = 0, start = 0, mode = 'text')["output"]
- end
complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=sqale_rating,function_complexity,duplicated_lines_density,comment_lines_density,sqale_index,lines,file_line,files,functions,classes,directories").read
@complexity =JSON.parse(complexity_date).first
issue_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=blocker_violations,critical_violations,major_violations,minor_violations,info_violations,violations").read
@@ -188,7 +217,6 @@ class QualityAnalysisController < ApplicationController
rescue => e
puts e
end
-
end
# Find project of id params[:project_id]
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index d0904ddf5..4764d1cd7 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -38,7 +38,9 @@ class RepositoriesController < ApplicationController
before_filter :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue]
before_filter :authorize , :except => [:newrepo,:newcreate,:fork, :to_gitlab, :forked, :commit_diff, :project_archive, :quality_analysis]
# 链接gitlab
- before_filter :connect_gitlab, :only => [:quality_analysis]
+ before_filter :connect_gitlab, :only => [:quality_analysis, :show]
+ # 版本库新增权限
+ before_filter :show_rep, :only => [:show]
accept_rss_auth :revisions
# hidden repositories filter // 隐藏代码过滤器
before_filter :check_hidden_repo, :only => [:show, :stats, :revisions, :revision, :diff ]
@@ -361,44 +363,42 @@ update
def show
## TODO: the below will move to filter, done.
- if !User.current.member_of?(@project) && @project.hidden_repo
- render_403
- return
- end
+
+ # 获取版本库目录结构
@entries = @repository.entries(@path, @rev)
- @changeset = @repository.find_changeset_by_name(@rev)
if request.xhr?
@entries ? render(:partial => 'dir_list_content') : render(:nothing => true)
else
- g = Gitlab.client
- @changesets = g.commits(@project.gpid, :ref_name => @rev)
- g_project = g.project(@project.gpid)
+ @changesets = @g.commits(@project.gpid, :ref_name => @rev)
+ # 最近一次提交
+ @changesets_latest_coimmit = @changesets[0]
+ g_project = @g.project(@project.gpid)
# 总的提交数
- @changesets_all_count = @project.gpid.nil? ? 0 : commit_count(@project, @rev)
+ @changesets_all_count = @g.user_static(@project.gpid, :rev => @rev).count
+
+ # 获取默认分支
@g_default_branch = g_project.default_branch.nil? ? "master" : g_project.default_branch
- # 访问该页面的是会后则刷新
- if @project.project_score.nil?
+
+ # 访问版本庫后更新project_score表数据;changeset_num为提交总数
+ project_score = @project.project_score
+ if project_score.nil?
ProjectScore.create(:project_id => @project.id, :score => false)
+ else
+ project_score.update_column(:changeset_num, @changesets_all_count)
end
- # 刷新改页面的时候,更新统计数
- if @changesets_all_count != @project.project_score.changeset_num && @changesets_all_count != 0
- update_commits_count(@project, @changesets_all_count)
- end
- # 最近一次提交
- @changesets_latest_coimmit = @changesets[0]
- unless @changesets[0].blank?
- update_commits_date(@project, @changesets_latest_coimmit)
- end
- @creator = User.where("id =?", @project.user_id).first.try(:login)
- # @properties = @repository.properties(@path, @rev)
- # @repositories = @project.repositories
- # project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT
- # ip = RepositoriesHelper::REPO_IP_ADDRESS
+
+ # unless @changesets_latest_coimmit.blank?
+ # update_commits_date(@project, @changesets_latest_coimmit)
+ # end
+ @creator = @project.owner.to_s
gitlab_address = Redmine::Configuration['gitlab_address']
+
# REDO:需优化,仅测试用
@zip_path = Gitlab.endpoint.to_s + "/projects/" + @project.gpid.to_s + "/repository/archive?&private_token=" + Gitlab.private_token
+
+ # 获取版本库路径,主要分为两种,一种随Gitlab类型,另一种为Git类型,Git类型为无用数据,最终需要删掉这种类型。
if @repository.type.to_s == "Repository::Gitlab"
- @repos_url = gitlab_address.to_s+"/"+@project.owner.to_s+"/"+@repository.identifier+"."+"git"
+ @repos_url = gitlab_address.to_s+"/" + @creator + "/" + @repository.identifier+"."+"git"
else
@repos_url = "http://"+@repository.login.to_s+"_"+@repository.identifier.to_s+"@"+ip.to_s + @repository.url.slice(project_path_cut, @repository.url.length).to_s
end
@@ -653,9 +653,20 @@ update
# 链接gitlab
def connect_gitlab
- @g = Gitlab.client
- unless @project.gpid.nil?
- @g_project = @g.project(@project.gpid)
+ begin
+ @g = Gitlab.client
+ unless @project.gpid.nil?
+ @g_project = @g.project(@project.gpid)
+ end
+ rescue => e
+ logger.error("failed to connect gitlab ==> #{e}")
+ end
+ end
+
+ def show_rep
+ if !User.current.member_of?(@project) && @project.hidden_repo
+ render_403
+ return
end
end
diff --git a/app/models/sonar_error.rb b/app/models/sonar_error.rb
new file mode 100644
index 000000000..05fcfc5b9
--- /dev/null
+++ b/app/models/sonar_error.rb
@@ -0,0 +1,3 @@
+class SonarError < ActiveRecord::Base
+ attr_accessible :jenkins_job_name, :output, :project_id
+end
diff --git a/app/views/quality_analysis/_show.html.erb b/app/views/quality_analysis/_show.html.erb
index 1a7869fd0..0b16a1adb 100644
--- a/app/views/quality_analysis/_show.html.erb
+++ b/app/views/quality_analysis/_show.html.erb
@@ -43,7 +43,15 @@
质量等级<%=@complexity["msr"][9].nil? ? 0 : score_sqale_rating(@complexity["msr"][9]["val"].to_i) %>/5分
可定性评价为:质量<%=@complexity["msr"][9].nil? ? "很好" : sqale_rating_status(@complexity["msr"][9]["val"])[0] %>
-
技术债务<%=@complexity["msr"][8].nil? ? 0 : @complexity["msr"][8]["frmt_val"] %>
+
技术债务
+
+ <% if @complexity["msr"][8].nil? %>
+ 0
+ <% else %>
+ <%= /[0-9]*/.match(@complexity["msr"][8]["frmt_val"])[0] %>天
+ <%= / [0-9]*/.match(@complexity["msr"][8]["frmt_val"]) %>小时
+ <% end %>
+
查看详情
diff --git a/app/views/quality_analysis/create.html.erb b/app/views/quality_analysis/create.html.erb
index e7c81f662..4f01fa2c8 100644
--- a/app/views/quality_analysis/create.html.erb
+++ b/app/views/quality_analysis/create.html.erb
@@ -1,9 +1,11 @@
-<% if @current_build_status == "success" %>
- <%= render :partial => "show", :locals => {:branch => params[:branch]} %>
-<% else %>
- <% if @build_console_result %>
- 运行结果超时
- <% else %>
- <%= render :partial => "console_output" %>
- <% end %>
-<% end %>
\ No newline at end of file
+
+
质量分析
+
+
+
本次分析失败,原因如下:
+ <% if @build_console_result == false %>
+ 分析超时
+ <% else %>
+ <%= h @sonar_error.to_json %>
+ <% end %>
+
\ No newline at end of file
diff --git a/app/views/quality_analysis/error_list.html.erb b/app/views/quality_analysis/error_list.html.erb
new file mode 100644
index 000000000..84f2777fa
--- /dev/null
+++ b/app/views/quality_analysis/error_list.html.erb
@@ -0,0 +1,11 @@
+
+
质量分析
+
+
+
本次分析失败,原因如下:
+ <% if @build_console_result == false %>
+ 分析超时
+ <% else %>
+ <%= h @error_list.output %>
+ <% end %>
+
\ No newline at end of file
diff --git a/app/views/repositories/_dir_list_content.html.erb b/app/views/repositories/_dir_list_content.html.erb
index 4dee108ee..7a378dcb2 100644
--- a/app/views/repositories/_dir_list_content.html.erb
+++ b/app/views/repositories/_dir_list_content.html.erb
@@ -9,7 +9,7 @@
<% if entry.is_dir? %>
-<%# 展开文件目录 %>
+ <%# 展开文件目录 %>
<% end %>
-
-
-
- <%#= h(ent_name), :class => "(entry.is_dir? ? 'icon icon-folder' : "icon icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%>
-<%= link_to h(ent_name),
- {:action => (entry.is_dir? ? 'show' : 'entry'), :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(ent_path), :rev => @rev},
- :class => (entry.is_dir? ? 'icon icon-folder' : "icon icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%>
+ <%= link_to h(ent_name),
+ {:action => (entry.is_dir? ? 'show' : 'entry'), :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(ent_path), :rev => @rev},
+ :class => (entry.is_dir? ? 'icon icon-folder' : "icon icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%>
|
-
-
-<%# if @repository.report_last_commit %>
-<%# end %>
<% end %>
diff --git a/app/views/repositories/_navigation.html.erb b/app/views/repositories/_navigation.html.erb
index d99df5ed1..bf7c19879 100644
--- a/app/views/repositories/_navigation.html.erb
+++ b/app/views/repositories/_navigation.html.erb
@@ -21,9 +21,9 @@
<%= select_tag :branch, options_for_select(@repository.branches, @rev), :id => 'branch' %>
<% end -%>
- <% if !@repository.tags.nil? && @repository.tags.length > 0 -%>
- <%= select_tag :tag, options_for_select([''] + @repository.tags, @rev), :id => 'tag', :style=>" display:none" %>
- <% end -%>
+ <%# if !@repository.tags.nil? && @repository.tags.length > 0 -%>
+ <%#= select_tag :tag, options_for_select([''] + @repository.tags, @rev), :id => 'tag', :style=>" display:none" %>
+ <%# end -%>
<% if @repository.supports_all_revisions? %>
<%= hidden_field_tag 'rev', @rev, :size => 8 %>
diff --git a/app/views/repositories/_quality_analysis.html.erb b/app/views/repositories/_quality_analysis.html.erb
index 0053849a3..936e513f5 100644
--- a/app/views/repositories/_quality_analysis.html.erb
+++ b/app/views/repositories/_quality_analysis.html.erb
@@ -15,7 +15,7 @@
<%= select_tag :language, options_for_select(["java","python","ruby","c++","c#","c"]), :id => 'branch', :class => "analysis-option-box" %>
-
+
diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb
index 05f25822b..823d0c1ad 100644
--- a/app/views/repositories/show.html.erb
+++ b/app/views/repositories/show.html.erb
@@ -1,17 +1,11 @@
-<%= call_hook(:view_repositories_show_contextual, {:repository => @repository, :project => @project}) %>
+<%#= call_hook(:view_repositories_show_contextual, {:repository => @repository, :project => @project}) %>
<%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %>
<% unless @entries.nil? %>
ZIP下载
- <%# if is_project_manager?(User.current, @project.id) && QualityAnalysis.where(:project_id => @project.id).first.nil? %>
- <%# if User.current.member_of?(@project) %>
<% if quality_analysis(User.current.try(:login), @repository.id).nil? && User.current.member_of?(@project) && @project.is_public? %>
<%= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch ), :remote => true, :class => "btn_zipdown fr" %>
<% end %>
- <%# end %>
- <%# else %>
- <%#= link_to "质量分析", project_quality_analysis_path(:project_id => @project.id, :resource_id => @proje), :class => "btn_zipdown fr" %>
- <%# end %>
<% end %>
@@ -23,29 +17,29 @@
该版本库还没有上传代码!
<% end %>
- <% if @repository.type.to_s=="Repository::Gitlab" %>
+ <% if @repository.type.to_s == "Repository::Gitlab" %>
版本库地址:<%= @repos_url %>
<% else %>
版本库地址:<%= h @repository.url %>
<% end %>
-
<% else %>
<%= render :partial => 'navigation' %>
克隆网址:
-
+
<%=link_to "代码统计", stats_repository_project_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :creator => @creator, :default_branch => @g_default_branch ), :class => "fl vl_zip" %>
- <%# 针对公开项目:用户必须创建了项目,否则用户无法同步 %>
+
<% if User.current.id != @project.user_id %>
<%= link_to "".html_safe+"Fork", {:controller => 'repositories', :action => 'forked'}, :class=>"vl_btn", :target => "_blank", :confirm=>"平台将为您创建一个新的同名项目和版本库,请问是否继续?" %>
<%= @project.forked_count.to_i %>
<% end %>
+
<% if @changesets && !@changesets.empty? %>
<% if !user_commit_rep(@changesets_latest_coimmit.author_email).nil? %>
@@ -71,24 +65,14 @@
<% end %>
-
-
<% if !@entries.nil? && authorize_for('repositories', 'browse') %>
- <%# 数据统计 %>
- <%#= render :partial => 'summary' %>
- <%# end %>
<%= render :partial => 'dir_list' %>
<% end %>
-<%#= render_properties(@properties) %>
-
-
-<%#= render_properties(@properties) %>
-
如何提交代码
-<% content_for :header_tags do %>
- <%= stylesheet_link_tag "scm" %>
-<% end %>
+<%# content_for :header_tags do %>
+ <%#= stylesheet_link_tag "scm" %>
+<%# end %>
<% html_title(l(:label_repository)) -%>
diff --git a/config/routes.rb b/config/routes.rb
index bc9abeb35..0ef4c9fcb 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -797,6 +797,7 @@ RedmineApp::Application.routes.draw do
match 'update_jenkins_job'
match 'edit'
match 'create'
+ get 'error_list'
end
end
# resources :files, :only => [:index, :new, :create] do
diff --git a/db/migrate/20160707031248_create_sonar_errors.rb b/db/migrate/20160707031248_create_sonar_errors.rb
new file mode 100644
index 000000000..c55caccce
--- /dev/null
+++ b/db/migrate/20160707031248_create_sonar_errors.rb
@@ -0,0 +1,11 @@
+class CreateSonarErrors < ActiveRecord::Migration
+ def change
+ create_table :sonar_errors do |t|
+ t.integer :project_id
+ t.string :jenkins_job_name
+ t.text :output
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 3258f89c1..93dbba8a4 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20160627090316) do
+ActiveRecord::Schema.define(:version => 20160707031248) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@@ -57,6 +57,18 @@ ActiveRecord::Schema.define(:version => 20160627090316) do
t.integer "user_id", :null => false
end
+ create_table "apply_add_schools", :force => true do |t|
+ t.string "name"
+ t.string "province"
+ t.string "city"
+ t.string "address"
+ t.string "remarks"
+ t.integer "school_id"
+ t.integer "status", :default => 0
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
create_table "apply_homeworks", :force => true do |t|
t.integer "status"
t.integer "user_id"
@@ -1633,10 +1645,11 @@ ActiveRecord::Schema.define(:version => 20160627090316) do
create_table "schools", :force => true do |t|
t.string "name"
t.string "province"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.string "logo_link"
t.string "pinyin"
+ t.integer "school_type", :default => 0
end
create_table "secdomains", :force => true do |t|
@@ -1725,6 +1738,14 @@ ActiveRecord::Schema.define(:version => 20160627090316) do
t.integer "project_id"
end
+ create_table "sonar_errors", :force => true do |t|
+ t.integer "project_id"
+ t.string "jenkins_job_name"
+ t.text "output"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
create_table "ssos", :force => true do |t|
t.integer "user_id"
t.string "openid"
@@ -1849,8 +1870,18 @@ ActiveRecord::Schema.define(:version => 20160627090316) do
t.string "title"
t.text "description"
t.integer "user_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.string "eng_name"
+ t.integer "syllabus_type"
+ t.integer "credit"
+ t.integer "hours"
+ t.integer "theory_hours"
+ t.integer "practice_hours"
+ t.string "applicable_major"
+ t.string "pre_course"
+ t.integer "visits", :default => 0
+ t.integer "des_status", :default => 0
end
add_index "syllabuses", ["user_id"], :name => "index_syllabuses_on_user_id"
diff --git a/lib/gitlab-cli/lib/gitlab/client/repositories.rb b/lib/gitlab-cli/lib/gitlab/client/repositories.rb
index 34915967c..e998ab56b 100644
--- a/lib/gitlab-cli/lib/gitlab/client/repositories.rb
+++ b/lib/gitlab-cli/lib/gitlab/client/repositories.rb
@@ -75,6 +75,17 @@ class Gitlab::Client
end
alias_method :repo_commits, :commits_total_count
+ # Gets total project commits.
+ #
+ # @example
+ # @param [Integer] project The ID of a project.
+ # @param [Hash] options A customizable set of options.
+ # @option options [String] :rev The branch or tag name of a project repository.
+ # @return [Hash]
+ def user_static(project, options={})
+ get("/projects/#{project}/repository/user_static", :query => options)
+ end
+
# Gets a specific commit identified by the commit hash or name of a branch or tag.
#
# @example
diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css
index c86e0f42d..0c67680e8 100644
--- a/public/stylesheets/public.css
+++ b/public/stylesheets/public.css
@@ -246,7 +246,7 @@ a.c_green{ color:#28be6c;}
.b_blue{background:#64bdd9;}
.b_green{background:#28be6c;}
.b_slow_yellow{background:#adde18;}
-.b_yellow{background:#DDDF0D;}
+.b_yellow{background:#e4de4b;}
.b_slow_red{background:#df8538;}
.b_green2 {background:#63c360;}
.b_red {background:#d60308;}
diff --git a/spec/factories/sonar_errors.rb b/spec/factories/sonar_errors.rb
new file mode 100644
index 000000000..a5ed5485f
--- /dev/null
+++ b/spec/factories/sonar_errors.rb
@@ -0,0 +1,7 @@
+FactoryGirl.define do
+ factory :sonar_error do
+ project_id 1
+ jenkins_job_name "MyString"
+ output "MyText"
+ end
+end
diff --git a/spec/models/sonar_error_spec.rb b/spec/models/sonar_error_spec.rb
new file mode 100644
index 000000000..9aae8db29
--- /dev/null
+++ b/spec/models/sonar_error_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe SonarError, :type => :model do
+ pending "add some examples to (or delete) #{__FILE__}"
+end