diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb
index 21e094407..77acdfd05 100644
--- a/app/controllers/quality_analysis_controller.rb
+++ b/app/controllers/quality_analysis_controller.rb
@@ -30,20 +30,20 @@ class QualityAnalysisController < ApplicationController
sonar.sources=#{path}
sonar.language=#{language.downcase}
sonar.sourceEncoding=utf-8"
- git_url = gitlab_address.to_s+"/"+@project.owner.to_s+"/"+ identifier+"."+"git"
+ git_url = gitlab_address.to_s+"/"+@project.owner.to_s+"/"+ identifier + "."+"git"
-
- # # modify config
+ # # # modify config
@doc = Nokogiri::XML(File.open(File.join(Rails.root, 'tmp', 'config.xml')))
@doc.at_xpath("//hudson.plugins.git.UserRemoteConfig/url").content = git_url
@doc.at_xpath("//hudson.plugins.git.BranchSpec/name").content = "*/#{branch}"
@doc.at_xpath("//hudson.plugins.sonar.SonarRunnerBuilder/properties").content = properties #sonar-properties
-
+ #
# replace config.xml of jenkins
@client = @client.job.create("#{user_name}_#{identifier}", @doc.to_xml)
# relace gitlab hook
# genkins address
@g.add_project_hook(@project.gpid,"http://123.59.135.93:8890/project/#{user_name}_#{identifier}")
+ QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier)
end
def index
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index 3f630ce51..cbb5b2f69 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -30,13 +30,13 @@ class RepositoriesController < ApplicationController
menu_item :settings, :only => [:new, :create, :edit, :update, :destroy, :committers]
default_search_scope :changesets
- before_filter :find_project_by_project_id, :only => [:new, :create, :newrepo, :stats, :quality_analyses]
+ before_filter :find_project_by_project_id, :only => [:new, :create, :newrepo, :stats, :quality_analysis]
before_filter :find_repository, :only => [:edit, :update, :destroy, :committers]
before_filter :find_project_repository, :except => [:new, :create, :newcreate, :edit, :update, :destroy, :committers, :newrepo, :to_gitlab, :forked, :project_archive]
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_analyses]
+ before_filter :authorize , :except => [:newrepo,:newcreate,:fork, :to_gitlab, :forked, :commit_diff, :project_archive, :quality_analysis]
# 链接gitlab
- before_filter :connect_gitlab, :only => [:quality_analyses]
+ before_filter :connect_gitlab, :only => [:quality_analysis]
accept_rss_auth :revisions
# hidden repositories filter // 隐藏代码过滤器
before_filter :check_hidden_repo, :only => [:show, :stats, :revisions, :revision, :diff ]
@@ -309,7 +309,7 @@ update
end
end
- def quality_analyses
+ def quality_analysis
gitlab_branches = @g.branches(@project.gpid)
@branch_names = gitlab_branches.map{|b| b.name}
@gitlab_default_branch = @g.project(@project.gpid).default_branch
diff --git a/app/models/quality_analysis.rb b/app/models/quality_analysis.rb
new file mode 100644
index 000000000..45778ff3f
--- /dev/null
+++ b/app/models/quality_analysis.rb
@@ -0,0 +1,3 @@
+class QualityAnalysis < ActiveRecord::Base
+ attr_accessible :author_login, :project_id, :rep_identifier
+end
diff --git a/app/views/repositories/_quality_analyses.html.erb b/app/views/repositories/_quality_analysis.html.erb
similarity index 77%
rename from app/views/repositories/_quality_analyses.html.erb
rename to app/views/repositories/_quality_analysis.html.erb
index bf45ba167..64dd837b7 100644
--- a/app/views/repositories/_quality_analyses.html.erb
+++ b/app/views/repositories/_quality_analysis.html.erb
@@ -1,4 +1,4 @@
-<%= form_tag( url_for(:controller => 'quality_analysis', :action => 'create', :project_id => @project.id), :remote => true , :class => 'resourcesSearchloadBox mt10', :id => 'quality_analyses_form') do %>
+<%= form_tag( url_for(:controller => 'quality_analysis', :action => 'create', :project_id => @project.id, :user_id => User.current.id, :identifier => @repository.identifier), :remote => true , :class => 'resourcesSearchloadBox mt10', :id => 'quality_analyses_form') do %>
<%= select_tag :branch, options_for_select(["#{@gitlab_default_branch}"]+ @branch_names, @rev), :id => 'branch' %>
<%= select_tag :language, options_for_select(["Java","C","PHP", "Web"]), :id => 'branch' %>
diff --git a/app/views/repositories/quality_analyses.js.erb b/app/views/repositories/quality_analysis.js.erb
similarity index 89%
rename from app/views/repositories/quality_analyses.js.erb
rename to app/views/repositories/quality_analysis.js.erb
index 89d8685cf..c9427c246 100644
--- a/app/views/repositories/quality_analyses.js.erb
+++ b/app/views/repositories/quality_analysis.js.erb
@@ -1,4 +1,4 @@
-$('#ajax-modal').html('<%= escape_javascript( render :partial => 'repositories/quality_analyses', :locals => {}) %>');
+$('#ajax-modal').html('<%= escape_javascript( render :partial => 'repositories/quality_analysis', :locals => {}) %>');
showModal('ajax-modal', '615px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("");
diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb
index d1c041d73..1e874544a 100644
--- a/app/views/repositories/show.html.erb
+++ b/app/views/repositories/show.html.erb
@@ -2,7 +2,7 @@