版本库质量分析 ssh链接
This commit is contained in:
parent
0a82de1cf4
commit
0c25e3b13d
2
Gemfile
2
Gemfile
|
@ -6,6 +6,8 @@ unless RUBY_PLATFORM =~ /w32/
|
|||
gem 'iconv'
|
||||
end
|
||||
|
||||
gem 'net-ssh'
|
||||
|
||||
gem 'certified'
|
||||
|
||||
gem 'wechat',path: 'lib/wechat'
|
||||
|
|
|
@ -30,11 +30,11 @@ 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]
|
||||
before_filter :find_project_by_project_id, :only => [:new, :create, :newrepo, :stats, :quality_analyses]
|
||||
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]
|
||||
before_filter :authorize , :except => [:newrepo,:newcreate,:fork, :to_gitlab, :forked, :commit_diff, :project_archive, :quality_analyses]
|
||||
accept_rss_auth :revisions
|
||||
# hidden repositories filter // 隐藏代码过滤器
|
||||
before_filter :check_hidden_repo, :only => [:show, :stats, :revisions, :revision, :diff ]
|
||||
|
@ -43,6 +43,7 @@ class RepositoriesController < ApplicationController
|
|||
helper :project_score
|
||||
#@root_path = RepositoriesHelper::ROOT_PATH
|
||||
$g=Gitlab.client
|
||||
require 'net/ssh'
|
||||
|
||||
rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed
|
||||
def new
|
||||
|
@ -306,6 +307,27 @@ update
|
|||
end
|
||||
end
|
||||
|
||||
def quality_analyses
|
||||
host = "192.168.0.200"
|
||||
port = "1125"
|
||||
username = "git"
|
||||
password = "123123"
|
||||
##显示文件和系统版本
|
||||
server_cmd1 = 'll'
|
||||
server_cmd2 = 'cat /etc/issue'
|
||||
# 连接到远程主机 foobar
|
||||
ssh = Net::SSH.start(host, username, :port => port, :password => password) do |ssh|
|
||||
result = ssh.exec!(server_cmd1)
|
||||
logger.error("#################")
|
||||
puts result
|
||||
result = ssh.exec!(server_cmd2)
|
||||
puts result
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
DestroyRepositoryTask.new.destroy(User.current.id, @repository.id)
|
||||
@repository.hidden = true
|
||||
|
@ -557,6 +579,24 @@ update
|
|||
render 404
|
||||
return
|
||||
end
|
||||
host = "http://192.168.0.200:8893"
|
||||
username = "git"
|
||||
password = "123123"
|
||||
|
||||
##显示文件和系统版本
|
||||
server_cmd1 = 'ls -l'
|
||||
server_cmd2 = 'cat /etc/issue'
|
||||
|
||||
|
||||
# 连接到远程主机 foobar
|
||||
ssh = Net::SSH.start(host, username, :password => password) do |ssh|
|
||||
result = ssh.exec!(server_cmd1)
|
||||
puts result
|
||||
result = ssh.exec!(server_cmd2)
|
||||
puts result
|
||||
end
|
||||
|
||||
|
||||
project_id = @project.gpid
|
||||
# @repository_id = @repository.identifier
|
||||
# creator = params[:creator]
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
test
|
|
@ -2,6 +2,7 @@
|
|||
<div class="project_r_h">
|
||||
<div class="fl"><h2 class="project_h2_repository"><%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %></h2></div>
|
||||
<a href="<%= @zip_path %>" class="btn_zipdown fr" onclick="">ZIP下载</a>
|
||||
<%= link_to "质量分析", quality_analyses_path(:id => @project.id, :repository_id => @repository.identifier) %>
|
||||
|
||||
</div>
|
||||
<div class="repository_con" style="line-height:1.9;">
|
||||
|
|
|
@ -902,6 +902,7 @@ RedmineApp::Application.routes.draw do
|
|||
|
||||
# repositories routes
|
||||
get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats', :as => "stats_repository_project"
|
||||
get 'projects/:id/repository/:repository_id/quality_analyses', :to => 'repositories#quality_analyses', :as => "quality_analyses"
|
||||
get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph'
|
||||
|
||||
get 'projects/:id/repository/:repository_id/changes(/*path(.:ext))', :to => 'repositories#changes'
|
||||
|
@ -920,6 +921,7 @@ RedmineApp::Application.routes.draw do
|
|||
}
|
||||
|
||||
get 'projects/:id/repository/statistics', :to => 'repositories#stats'
|
||||
|
||||
get 'projects/:id/repository/graph', :to => 'repositories#graph'
|
||||
|
||||
get 'projects/:id/repository/changes(/*path(.:ext))', :to => 'repositories#changes'
|
||||
|
|
Loading…
Reference in New Issue