Class: JiraMetrics
- Inherits:
-
Thor
- Object
- Thor
- JiraMetrics
- Defined in:
- lib/jirametrics.rb
Class Method Summary collapse
Instance Method Summary collapse
- #__print_version ⇒ Object
- #download ⇒ Object
- #export ⇒ Object
- #go ⇒ Object
- #info(key) ⇒ Object
- #mcp ⇒ Object
- #stitch(stitch_file = 'stitcher.erb') ⇒ Object
Class Method Details
.exit_on_failure? ⇒ Boolean
10 11 12 |
# File 'lib/jirametrics.rb', line 10 def self.exit_on_failure? true end |
Instance Method Details
#__print_version ⇒ Object
17 18 19 |
# File 'lib/jirametrics.rb', line 17 def __print_version puts Gem.loaded_specs['jirametrics'].version end |
#download ⇒ Object
32 33 34 35 |
# File 'lib/jirametrics.rb', line 32 def download load_config [:config] Exporter.instance.download(name_filter: [:name] || '*') end |
#export ⇒ Object
24 25 26 27 |
# File 'lib/jirametrics.rb', line 24 def export load_config [:config] Exporter.instance.export(name_filter: [:name] || '*') end |
#go ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/jirametrics.rb', line 40 def go load_config [:config] Exporter.instance.download(name_filter: [:name] || '*') load_config [:config] Exporter.instance.export(name_filter: [:name] || '*') end |
#info(key) ⇒ Object
50 51 52 53 |
# File 'lib/jirametrics.rb', line 50 def info key load_config [:config] Exporter.instance.info(key, name_filter: [:name] || '*') end |
#mcp ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/jirametrics.rb', line 58 def mcp # Redirect stdout to stderr for the entire startup phase so that any # incidental output (from config files, gem loading, etc.) does not # corrupt the JSON-RPC channel before the MCP transport takes over. original_stdout = $stdout.dup $stdout.reopen($stderr) load_config [:config] require 'jirametrics/mcp_server' Exporter.instance.file_system.log_only = true projects = {} aggregates = {} Exporter.instance.each_project_config(name_filter: [:name] || '*') do |project| project.evaluate_next_level project.run load_only: true projects[project.name || 'default'] = { issues: project.issues, today: project.time_range.end.to_date, end_time: project.time_range.end } rescue StandardError => e if e..start_with? 'This is an aggregated project' names = project.aggregate_project_names aggregates[project.name] = names if names.any? next end next if e..start_with? 'No data found' raise end $stdout.reopen(original_stdout) original_stdout.close McpServer.new(projects: projects, aggregates: aggregates, timezone_offset: Exporter.instance.timezone_offset).run end |