Module: GreenHat::Shell::Gitlab
- Defined in:
- lib/greenhat/shell/gitlab.rb
Overview
Logs
Class Method Summary collapse
- .architecture ⇒ Object
- .help ⇒ Object
- .ls ⇒ Object
-
.services(raw = {}) ⇒ Object
Print service info / shared report method.
- .status ⇒ Object
- .version ⇒ Object
Class Method Details
.architecture ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/greenhat/shell/gitlab.rb', line 34 def self.architecture results = Archive.all.map { |x| GitLab.identify_node(x) } GitLab.node_types.each do |entry| list = results.select { |x| (x.services & entry.pattern).any? }.map(&:host).join(', ') next if list.blank? puts entry.name.pastel(:bright_green) puts list puts end end |
.help ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/greenhat/shell/gitlab.rb', line 10 def self.help puts "\u2500".pastel(:cyan) * 20 puts "#{'GitLab'.pastel(:yellow)} - Tanuki power" puts "\u2500".pastel(:cyan) * 20 puts 'Command Summary'.pastel(:blue) puts ' services'.pastel(:green) puts ' Show services status and version' puts puts ' status'.pastel(:green) puts ' Show gitlab-ctl status' puts puts ' architecture'.pastel(:green) puts ' Show node responsibility. E.g. Webservice, Gitaly, and etc' puts puts ' version'.pastel(:green) puts ' Show GitLab software version' puts end |
.ls ⇒ Object
6 7 8 |
# File 'lib/greenhat/shell/gitlab.rb', line 6 def self.ls help end |
.services(raw = {}) ⇒ Object
Print service info / shared report method
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/greenhat/shell/gitlab.rb', line 58 def self.services(raw = {}) _files, flags, _args = Args.parse(raw, [:truncate]) results = {} Archive.all.each do |archive| result = GitLab.services(archive) next unless result # Generated Output results[archive.friendly_name.pastel(:blue)] = result end # Print ShellHelper.show(results, flags) end |
.status ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/greenhat/shell/gitlab.rb', line 75 def self.status Thing.where(type: 'gitlab_status').each do |file| next unless file.data puts file.friendly_name file.data.each_value do |services| output = services.each_with_index.flat_map do |service, i| color = service.status == 'run' ? :green : :red pad = i.zero? ? 18 : 0 [ "#{service.status}:", service.name.ljust(pad).pastel(color), "#{service.pid_uptime};".ljust(pad) ] end puts output.join(' ') end puts end end |
.version ⇒ Object
47 48 49 50 51 52 53 54 55 |
# File 'lib/greenhat/shell/gitlab.rb', line 47 def self.version Thing.where(type: 'gitlab/version-manifest.json').each do |file| next unless file.data puts file.friendly_name puts Semantic::Version.new(file.data.build_version).to_s.pastel(:yellow) puts end end |