Linux下安装代码统计工具git_stats
安装过程:
C/C++ Code复制内容到剪贴板
- root@iZm5e5xciiu78gnmvqimuiZ:/tmp# yum install ruby -y
- There are no enabled repos.
- Run "yum repolist all" to see the repos you have.
- You can enable repos with yum-config-manager --enable <repo>
- root@iZm5e5xciiu78gnmvqimuiZ:/tmp# apt install ruby
- Reading package lists... Done
- Building dependency tree
- Reading state information... Done
- The following additional packages will be installed:
- fonts-lato javascript-common libjs-jquery libruby2.3 libyaml-0-2 rake ruby-did-you-mean ruby-minitest ruby-net-telnet ruby-power-assert ruby-test-unit
- ruby2.3 rubygems-integration
- Suggested packages:
- apache2 | lighttpd | httpd ri ruby-dev bundler
- The following NEW packages will be installed:
- fonts-lato javascript-common libjs-jquery libruby2.3 libyaml-0-2 rake ruby ruby-did-you-mean ruby-minitest ruby-net-telnet ruby-power-assert
- ruby-test-unit ruby2.3 rubygems-integration
- 0 upgraded, 14 newly installed, 0 to remove and 234 not upgraded.
- Need to get 6,094 kB of archives.
- After this operation, 27.6 MB of additional disk space will be used.
- Do you want to continue? [Y/n] Y
- Get:1 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/main amd64 fonts-lato all 2.0-1 [2,693 kB]
- Get:2 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/main amd64 libyaml-0-2 amd64 0.1.6-3 [47.6 kB]
- Get:3 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/main amd64 javascript-common all 11 [6,066 B]
- Get:4 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/main amd64 libjs-jquery all 1.11.3+dfsg-4 [161 kB]
- Get:5 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/main amd64 rubygems-integration all 1.10 [4,966 B]
- Get:6 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/main amd64 ruby-did-you-mean all 1.0.0-2 [8,390 B]
- Get:7 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/main amd64 ruby-minitest all 5.8.4-2 [36.6 kB]
- Get:8 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/main amd64 ruby-net-telnet all 0.1.1-2 [12.6 kB]
- Get:9 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/main amd64 ruby-power-assert all 0.2.7-1 [7,668 B]
- Get:10 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/main amd64 ruby-test-unit all 3.1.7-2 [60.3 kB]
- Get:11 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-proposed/main amd64 libruby2.3 amd64 2.3.1-2~ubuntu16.04.13 [2,961 kB]
- Get:12 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-proposed/main amd64 ruby2.3 amd64 2.3.1-2~ubuntu16.04.13 [41.0 kB]
- Get:13 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/main amd64 ruby all 1:2.3.0+1 [5,530 B]
- Get:14 http://mirrors.cloud.aliyuncs.com/ubuntu xenial/main amd64 rake all 10.5.0-2 [48.2 kB]
- Fetched 6,094 kB in 0s (11.3 MB/s)
- Selecting previously unselected package fonts-lato.
- (Reading database ... 105305 files and directories currently installed.)
- Preparing to unpack .../fonts-lato_2.0-1_all.deb ...
- Unpacking fonts-lato (2.0-1) .............................................................................................................................]
- Selecting previously unselected package libyaml-0-2:amd64.................................................................................................]
- Preparing to unpack .../libyaml-0-2_0.1.6-3_amd64.deb ...
- Unpacking libyaml-0-2:amd64 (0.1.6-3) ....................................................................................................................]
- Selecting previously unselected package javascript-common.................................................................................................]
- Preparing to unpack .../javascript-common_11_all.deb ...
- Unpacking javascript-common (11) .........................................................................................................................]
- Selecting previously unselected package libjs-jquery......................................................................................................]
- Preparing to unpack .../libjs-jquery_1.11.3+dfsg-4_all.deb ...
- Unpacking libjs-jquery (1.11.3+dfsg-4) ...................................................................................................................]
- Selecting previously unselected package rubygems-integration..............................................................................................]
- Preparing to unpack .../rubygems-integration_1.10_all.deb ...
- Unpacking rubygems-integration (1.10) ...##...............................................................................................................]
- Selecting previously unselected package ruby-did-you-mean.................................................................................................]
- Preparing to unpack .../ruby-did-you-mean_1.0.0-2_all.deb ...
- Unpacking ruby-did-you-mean (1.0.0-2) ...########.........................................................................................................]
- Selecting previously unselected package ruby-minitest.....................................................................................................]
- Preparing to unpack .../ruby-minitest_5.8.4-2_all.deb ...
- Unpacking ruby-minitest (5.8.4-2) ...##################...................................................................................................]
- Selecting previously unselected package ruby-net-telnet.###...............................................................................................]
- Preparing to unpack .../ruby-net-telnet_0.1.1-2_all.deb ...
- Unpacking ruby-net-telnet (0.1.1-2) ...######################.............................................................................................]
- Selecting previously unselected package ruby-power-assert.######..........................................................................................]
- Preparing to unpack .../ruby-power-assert_0.2.7-1_all.deb ...
- Unpacking ruby-power-assert (0.2.7-1) ...#########################........................................................................................]
- Selecting previously unselected package ruby-test-unit.###############....................................................................................]
- Preparing to unpack .../ruby-test-unit_3.1.7-2_all.deb ...
- Unpacking ruby-test-unit (3.1.7-2) ...##################################..................................................................................]
- Selecting previously unselected package libruby2.3:amd64.###################..............................................................................]
- Preparing to unpack .../libruby2.3_2.3.1-2~ubuntu16.04.13_amd64.deb ...
- Unpacking libruby2.3:amd64 (2.3.1-2~ubuntu16.04.13) ...#######################............................................................................]
- Selecting previously unselected package ruby2.3.##################################........................................................................]
- Preparing to unpack .../ruby2.3_2.3.1-2~ubuntu16.04.13_amd64.deb ...
- Unpacking ruby2.3 (2.3.1-2~ubuntu16.04.13) ...######################################......................................................................]
- Selecting previously unselected package ruby.##########################################...................................................................]
- Preparing to unpack .../ruby_1%3a2.3.0+1_all.deb ...
- Unpacking ruby (1:2.3.0+1) ...###########################################################.................................................................]
- Selecting previously unselected package rake.################################################.............................................................]
- Preparing to unpack .../archives/rake_10.5.0-2_all.deb ...
- Unpacking rake (10.5.0-2) ...##################################################################...........................................................]
- Processing triggers for fontconfig (2.11.94-0ubuntu1.1) ...########################################.......................................................]
- Processing triggers for libc-bin (2.23-0ubuntu9) ...
- Processing triggers for man-db (2.7.5-1) ...
- Setting up fonts-lato (2.0-1) ...
- Setting up libyaml-0-2:amd64 (0.1.6-3) ...#############################################################...................................................]
- Setting up javascript-common (11) ...######################################################################...............................................]
- Setting up libjs-jquery (1.11.3+dfsg-4) ...###################################################################............................................]
- Setting up rubygems-integration (1.10) ...########################################################################........................................]
- Setting up ruby-did-you-mean (1.0.0-2) ...############################################################################....................................]
- Setting up ruby-minitest (5.8.4-2) ...####################################################################################................................]
- Setting up ruby-net-telnet (0.1.1-2) ...######################################################################################............................]
- Setting up ruby-power-assert (0.2.7-1) ...########################################################################################........................]
- Setting up ruby-test-unit (3.1.7-2) ...##############################################################################################.....................]
- Setting up libruby2.3:amd64 (2.3.1-2~ubuntu16.04.13) ...#################################################################################.................]
- Setting up ruby2.3 (2.3.1-2~ubuntu16.04.13) ...##############################################################################################.............]
- Setting up ruby (1:2.3.0+1) ...##################################################################################################################.........]
- Setting up rake (10.5.0-2) ...#######################################################################################################################.....]
- Processing triggers for libc-bin (2.23-0ubuntu9) ...#####################################################################################################.]
- root@iZm5e5xciiu78gnmvqimuiZ:/tmp# ruby -v
- ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
- root@iZm5e5xciiu78gnmvqimuiZ:/tmp# gem sources -l
- *** CURRENT SOURCES ***
- https://rubygems.org/
- root@iZm5e5xciiu78gnmvqimuiZ:/tmp# gem sources -a http://mirrors.aliyun.com/rubygems/ --remove https://rubygems.org/
- http://mirrors.aliyun.com/rubygems/ added to sources
- https://rubygems.org/ removed from sources
- root@iZm5e5xciiu78gnmvqimuiZ:/tmp# gem sources -l
- *** CURRENT SOURCES ***
- http://mirrors.aliyun.com/rubygems/
- root@iZm5e5xciiu78gnmvqimuiZ:/tmp# gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
- gpg: directory `/root/.gnupg' created
- gpg: new configuration file `/root/.gnupg/gpg.conf' created
- gpg: WARNING: options in `/root/.gnupg/gpg.conf' are not yet active during this run
- gpg: keyring `/root/.gnupg/secring.gpg' created
- gpg: keyring `/root/.gnupg/pubring.gpg' created
- gpg: requesting key D39DC0E3 from hkp server keys.gnupg.net
- gpg: requesting key 39499BDB from hkp server keys.gnupg.net
- gpg: /root/.gnupg/trustdb.gpg: trustdb created
- gpg: key D39DC0E3: public key "Michal Papis (RVM signing) <mpapis@gmail.com>" imported
- gpg: key 39499BDB: public key "Piotr Kuczynski <piotr.kuczynski@gmail.com>" imported
- gpg: no ultimately trusted keys found
- gpg: Total number processed: 2
- gpg: imported: 2 (RSA: 2)
C/C++ Code复制内容到剪贴板
- root@iZm5e5xciiu78gnmvqimuiZ:/tmp# curl -sSL https://get.rvm.io | bash -s stable
- Downloading https://github.com/rvm/rvm/archive/1.29.9.tar.gz
- Downloading https://github.com/rvm/rvm/releases/download/1.29.9/1.29.9.tar.gz.asc
- gpg: Signature made Wed 10 Jul 2019 04:31:02 PM CST using RSA key ID 39499BDB
- gpg: Good signature from "Piotr Kuczynski <piotr.kuczynski@gmail.com>"
- gpg: WARNING: This key is not certified with a trusted signature!
- gpg: There is no indication that the signature belongs to the owner.
- Primary key fingerprint: 7D2B AF1C F37B 13E2 069D 6956 105B D0E7 3949 9BDB
- GPG verified '/usr/local/rvm/archives/rvm-1.29.9.tgz'
- Creating group 'rvm'
- Installing RVM to /usr/local/rvm/
- Installation of RVM in /usr/local/rvm/ is almost complete:
- * First you need to add all users that will be using rvm to 'rvm' group,
- and logout - login again, anyone using rvm will be operating with `umask u=rwx,g=rwx,o=rx`.
- * To start using RVM you need to run `source /etc/profile.d/rvm.sh`
- in all your open shell windows, in rare cases you need to reopen all shell windows.
- * Please do NOT forget to add your users to the rvm group.
- The installer no longer auto-adds root or users to the rvm group. Admins must do this.
- Also, please note that group memberships are ONLY evaluated at login time.
- This means that users must log out then back in before group membership takes effect!
- Thanks for installing RVM
- Please consider donating to our open collective to help us maintain RVM.
- Donate: https://opencollective.com/rvm/donate
- root@iZm5e5xciiu78gnmvqimuiZ:/tmp# source /etc/profile.d/rvm.sh
- root@iZm5e5xciiu78gnmvqimuiZ:/tmp# rvm -v
- rvm 1.29.9 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
- root@iZm5e5xciiu78gnmvqimuiZ:/tmp# rvm list known
- # MRI Rubies
- [ruby-]1.8.6[-p420]
- [ruby-]1.8.7[-head] # security released on head
- [ruby-]1.9.1[-p431]
- [ruby-]1.9.2[-p330]
- [ruby-]1.9.3[-p551]
- [ruby-]2.0.0[-p648]
- [ruby-]2.1[.10]
- [ruby-]2.2[.10]
- [ruby-]2.3[.8]
- [ruby-]2.4[.6]
- [ruby-]2.5[.5]
- [ruby-]2.6[.3]
- [ruby-]2.7[.0-preview1]
- ruby-head
- # for forks use: rvm install ruby-head-<name> --url https://github.com/github/ruby.git --branch 2.2
- # JRuby
- jruby-1.6[.8]
- jruby-1.7[.27]
- jruby-9.1[.17.0]
- jruby[-9.2.7.0]
- jruby-head
- # Rubinius
- rbx-1[.4.3]
- rbx-2.3[.0]
- rbx-2.4[.1]
- rbx-2[.5.8]
- rbx-3[.107]
- rbx-4[.3]
- rbx-head
- # TruffleRuby
- truffleruby[-19.1.0]
- # Opal
- opal
- # Minimalistic ruby implementation - ISO 30170:2012
- mruby-1.0.0
- mruby-1.1.0
- mruby-1.2.0
- mruby-1.3.0
- mruby-1[.4.1]
- mruby-2[.0.1]
- mruby[-head]
- # Ruby Enterprise Edition
- ree-1.8.6
- ree[-1.8.7][-2012.02]
- # Topaz
- topaz
- # MagLev
- maglev-1.0.0
- maglev-1.1[RC1]
- maglev[-1.2Alpha4]
- maglev-head
- # Mac OS X Snow Leopard Or Newer
- macruby-0.10
- macruby-0.11
- macruby[-0.12]
- macruby-nightly
- macruby-head
- # IronRuby
- ironruby[-1.1.3]
- ironruby-head
C/C++ Code复制内容到剪贴板
- root@iZm5e5xciiu78gnmvqimuiZ:/tmp# rvm install 2.5
- Searching for binary rubies, this might take some time.
- Found remote file https://rubies.travis-ci.org/ubuntu/16.04/x86_64/ruby-2.5.5.tar.bz2
- Checking requirements for ubuntu.
- Installing requirements for ubuntu.
- Updating system.........
- Installing required packages: gawk, autoconf, automake, bison, libffi-dev, libgdbm-dev, libncurses5-dev, libsqlite3-dev, libtool, libyaml-dev, pkg-config, sqlite3, zlib1g-dev, libgmp-dev, libreadline6-dev, libssl-dev..............
- Requirements installation successful.
- ruby-2.5.5 - #configure
- ruby-2.5.5 - #download
- % Total % Received % Xferd Average Speed Time Time Time Current
- Dload Upload Total Spent Left Speed
- 0 0 0 0 0 0 0 0 --:--:-- 0:00:03 --:--:-- 0
- 100 17.2M 100 17.2M 0 0 1687k 0 0:00:10 0:00:10 --:--:-- 3904k
- No checksum for downloaded archive, recording checksum in user configuration.
- ruby-2.5.5 - #validate archive
- ruby-2.5.5 - #extract
- ruby-2.5.5 - #validate binary
- ruby-2.5.5 - #setup
- ruby-2.5.5 - #gemset created /usr/local/rvm/gems/ruby-2.5.5@global
- ruby-2.5.5 - #importing gemset /usr/local/rvm/gemsets/global.gems..................................
- ruby-2.5.5 - #generating global wrappers.......
- ruby-2.5.5 - #gemset created /usr/local/rvm/gems/ruby-2.5.5
- ruby-2.5.5 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
- ruby-2.5.5 - #generating default wrappers.......
- root@iZm5e5xciiu78gnmvqimuiZ:/tmp# ruby -v
- ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux]
C/C++ Code复制内容到剪贴板
- root@iZm5e5xciiu78gnmvqimuiZ:/tmp# gem install git_stats
- Fetching i18n-0.9.5.gem
- Fetching temple-0.8.1.gem
- Fetching json_pure-2.2.0.gem
- Fetching hash-deep-merge-0.1.1.gem
- Fetching tilt-2.0.9.gem
- Fetching lazy_high_charts-1.5.8.gem
- Fetching thor-0.20.3.gem
- Fetching concurrent-ruby-1.1.5.gem
- Fetching haml-5.1.2.gem
- Fetching thread_safe-0.3.6.gem
- Fetching tzinfo-1.2.5.gem
- Fetching activesupport-4.2.11.1.gem
- Fetching rails-deprecated_sanitizer-1.0.3.gem
- Fetching mini_portile2-2.4.0.gem
- Fetching nokogiri-1.10.4.gem
- Fetching rails-dom-testing-1.0.9.gem
- Fetching crass-1.0.4.gem
- Fetching loofah-2.2.3.gem
- Fetching rails-html-sanitizer-1.2.0.gem
- Fetching erubis-2.7.0.gem
- Fetching builder-3.2.3.gem
- Fetching actionview-4.2.11.1.gem
- Fetching rack-1.6.11.gem
- Fetching rack-test-0.6.3.gem
- Fetching actionpack-4.2.11.1.gem
- Fetching git_stats-1.0.17.gem
- Successfully installed tilt-2.0.9
- Successfully installed thor-0.20.3
- Successfully installed hash-deep-merge-0.1.1
- Successfully installed lazy_high_charts-1.5.8
- Successfully installed json_pure-2.2.0
- Successfully installed concurrent-ruby-1.1.5
- Successfully installed i18n-0.9.5
- Successfully installed temple-0.8.1
- Successfully installed haml-5.1.2
- Successfully installed thread_safe-0.3.6
- Successfully installed tzinfo-1.2.5
- Successfully installed activesupport-4.2.11.1
- Successfully installed rails-deprecated_sanitizer-1.0.3
- Successfully installed mini_portile2-2.4.0
- Building native extensions. This could take a while...
- Successfully installed nokogiri-1.10.4
- Successfully installed rails-dom-testing-1.0.9
- Successfully installed crass-1.0.4
- Successfully installed loofah-2.2.3
- Successfully installed rails-html-sanitizer-1.2.0
- Successfully installed erubis-2.7.0
- Successfully installed builder-3.2.3
- Successfully installed actionview-4.2.11.1
- Successfully installed rack-1.6.11
- Successfully installed rack-test-0.6.3
- Successfully installed actionpack-4.2.11.1
- Successfully installed git_stats-1.0.17
- Parsing documentation for tilt-2.0.9
- Installing ri documentation for tilt-2.0.9
- Parsing documentation for thor-0.20.3
- Installing ri documentation for thor-0.20.3
- Parsing documentation for hash-deep-merge-0.1.1
- Installing ri documentation for hash-deep-merge-0.1.1
- Parsing documentation for lazy_high_charts-1.5.8
- Installing ri documentation for lazy_high_charts-1.5.8
- Parsing documentation for json_pure-2.2.0
- Installing ri documentation for json_pure-2.2.0
- Parsing documentation for concurrent-ruby-1.1.5
- Installing ri documentation for concurrent-ruby-1.1.5
- Parsing documentation for i18n-0.9.5
- Installing ri documentation for i18n-0.9.5
- Parsing documentation for temple-0.8.1
- Installing ri documentation for temple-0.8.1
- Parsing documentation for haml-5.1.2
- Installing ri documentation for haml-5.1.2
- Parsing documentation for thread_safe-0.3.6
- Installing ri documentation for thread_safe-0.3.6
- Parsing documentation for tzinfo-1.2.5
- Installing ri documentation for tzinfo-1.2.5
- Parsing documentation for activesupport-4.2.11.1
- Installing ri documentation for activesupport-4.2.11.1
- Parsing documentation for rails-deprecated_sanitizer-1.0.3
- Installing ri documentation for rails-deprecated_sanitizer-1.0.3
- Parsing documentation for mini_portile2-2.4.0
- Installing ri documentation for mini_portile2-2.4.0
- Parsing documentation for nokogiri-1.10.4
- Installing ri documentation for nokogiri-1.10.4
- Parsing documentation for rails-dom-testing-1.0.9
- Installing ri documentation for rails-dom-testing-1.0.9
- Parsing documentation for crass-1.0.4
- Installing ri documentation for crass-1.0.4
- Parsing documentation for loofah-2.2.3
- Installing ri documentation for loofah-2.2.3
- Parsing documentation for rails-html-sanitizer-1.2.0
- Installing ri documentation for rails-html-sanitizer-1.2.0
- Parsing documentation for erubis-2.7.0
- Installing ri documentation for erubis-2.7.0
- Parsing documentation for builder-3.2.3
- Installing ri documentation for builder-3.2.3
- Parsing documentation for actionview-4.2.11.1
- Installing ri documentation for actionview-4.2.11.1
- Parsing documentation for rack-1.6.11
- Installing ri documentation for rack-1.6.11
- Parsing documentation for rack-test-0.6.3
- Installing ri documentation for rack-test-0.6.3
- Parsing documentation for actionpack-4.2.11.1
- Installing ri documentation for actionpack-4.2.11.1
- Parsing documentation for git_stats-1.0.17
- Installing ri documentation for git_stats-1.0.17
- Done installing documentation for tilt, thor, hash-deep-merge, lazy_high_charts, json_pure, concurrent-ruby, i18n, temple, haml, thread_safe, tzinfo, activesupport, rails-deprecated_sanitizer, mini_portile2, nokogiri, rails-dom-testing, crass, loofah, rails-html-sanitizer, erubis, builder, actionview, rack, rack-test, actionpack, git_stats after 23 seconds
- 26 gems installed
- root@iZm5e5xciiu78gnmvqimuiZ:/tmp# apt install mlocate
- Reading package lists... Done
- Building dependency tree
- Reading state information... Done
- mlocate is already the newest version (0.26-1ubuntu2).
- 0 upgraded, 0 newly installed, 0 to remove and 232 not upgraded.
- root@iZm5e5xciiu78gnmvqimuiZ:/tmp# updatedb
C/C++ Code复制内容到剪贴板
- root@iZm5e5xciiu78gnmvqimuiZ:/tmp# find / -name 'git_stats'
- /usr/local/rvm/gems/ruby-2.5.5/bin/git_stats
- /usr/local/rvm/gems/ruby-2.5.5/wrappers/git_stats
- /usr/local/rvm/gems/ruby-2.5.5/gems/git_stats-1.0.17/bin/git_stats
- /usr/local/rvm/gems/ruby-2.5.5/gems/git_stats-1.0.17/lib/git_stats
- root@iZm5e5xciiu78gnmvqimuiZ:/tmp# cd /usr/local/rvm/gems/ruby-2.5.5/gems/git_stats-1.0.17/config/locales/
- root@iZm5e5xciiu78gnmvqimuiZ:/usr/local/rvm/gems/ruby-2.5.5/gems/git_stats-1.0.17/config/locales# cp zh_tw_default.yml zh_default.yml
- root@iZm5e5xciiu78gnmvqimuiZ:/usr/local/rvm/gems/ruby-2.5.5/gems/git_stats-1.0.17/config/locales# vim zh_default.yml
- root@iZm5e5xciiu78gnmvqimuiZ:/usr/local/rvm/gems/ruby-2.5.5/gems/git_stats-1.0.17/config/locales# vim zh.yml
- root@iZm5e5xciiu78gnmvqimuiZ:/usr/local/rvm/gems/ruby-2.5.5/gems/git_stats-1.0.17/config/locales# vim zh_default.yml
- root@iZm5e5xciiu78gnmvqimuiZ:/usr/local/rvm/gems/ruby-2.5.5/gems/git_stats-1.0.17/config/locales# updatedb
以上为安装全过程,完成。
从第八步使用过程
========================================================================================
1、下载安装ruby
C/C++ Code复制内容到剪贴板
- #两种安装方式:
- yum install ruby -y
- apt install ruby
2、添加ruby国内阿里云仓库来提高访问速度,并删除国外访问的仓库。
C/C++ Code复制内容到剪贴板
- gem sources -l
- gem sources -a http://mirrors.aliyun.com/rubygems/ --remove https://rubygems.org/
- gem sources -l
3、安装RAM管理工具。RAM(Ruby Version Manager )是一款RAM的命令行工具,可以使用RAM轻松安装,管理Ruby版本。RVM包含了Ruby的版本管理和Gem库管理(gemset)
C/C++ Code复制内容到剪贴板
- gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
- curl -sSL https://get.rvm.io | bash -s stable
4、升级ruby版本
C/C++ Code复制内容到剪贴板
- ###########查看ruby相关信息,由于后边需要升级先可以升级ruby版本
- source /etc/profile.d/rvm.sh
- rvm -v
- rvm list known
- rvm install 2.5 ####安装ruby2.5
- ruby -v
5、通过gem安装git_stats
C/C++ Code复制内容到剪贴板
- gem install git_stats
6、安装locate
C/C++ Code复制内容到剪贴板
- #两种安装方式
- yum install mlocate -y
- apt install mlocate
- updatedb
7、添加git_stats中文支持,目录在config/locales/下
C/C++ Code复制内容到剪贴板
- find / -name 'git_stats'
- cd /usr/local/rvm/gems/ruby-2.5.5/gems/git_stats-1.0.17/config/locales
- cp zh_tw_default.yml zh_default.yml
- vim zh_default.yml ######修改最上边的zh_tw为zh_cn其他不变
- vim zh.yml ######修改最上边的zh_tw为zh_cn其他不变
- updatedb #####更新下索引
8、为指定工程指定生成分析报告
C/C++ Code复制内容到剪贴板
- [root@zabbix-server user.git]# ######切换到生产 报告的工程下面
- [root@zabbix-server user.git]# git_stats generate -o /data/status7/ --language zh_cn #######指定生成相关的分析报告。-o指定生成报告的路径 --language指定生成的语言。