File tree Expand file tree Collapse file tree 5 files changed +61
-8
lines changed
Expand file tree Collapse file tree 5 files changed +61
-8
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/env ruby
2+ # frozen_string_literal: true
3+
4+ require 'stringio'
5+ require_relative '../lib/pyxis'
6+
7+ original_stdout = $stdout
8+ stringio = StringIO . new
9+ $stdout = stringio
10+
11+ start_time = Process . clock_gettime ( Process ::CLOCK_MONOTONIC , :float_second )
12+ config = { debug : true } # we want the error to be raised
13+
14+ begin
15+ result = Pyxis ::Cli . start ( ARGV , config )
16+ successful = true
17+ rescue Thor ::Error , Pyxis ::Error => e
18+ result = "#{ e . class } \n #{ e . message } "
19+ successful = false
20+ end
21+
22+ end_time = Process . clock_gettime ( Process ::CLOCK_MONOTONIC , :float_second )
23+
24+ SemanticLogger . flush
25+
26+ $stdout = original_stdout
27+
28+ SECTION = 'chat_reply'
29+
30+ puts "section_start:#{ Time . now . to_i } :#{ SECTION } \r \033 [0K"
31+
32+ puts "$ pyxis #{ ARGV . join ( ' ' ) } "
33+ puts '```'
34+ puts
35+
36+ puts result || stringio . string
37+
38+ puts
39+ puts '```'
40+ puts "#{ successful ? 'Finished' : 'Failed' } in #{ ( end_time - start_time ) . round ( 2 ) } seconds"
41+
42+ puts "section_end:#{ Time . now . to_i } :#{ SECTION } \r \033 [0K"
43+
44+ exit ( successful )
Original file line number Diff line number Diff line change 33
44require_relative '../lib/pyxis'
55
6- Pyxis ::Cli . start ( ARGV )
6+ result = Pyxis ::Cli . start ( ARGV )
7+ SemanticLogger . flush
8+
9+ puts result
Original file line number Diff line number Diff line change 44Bundler . require
55
66module Pyxis
7+ Error = Class . new ( StandardError )
78end
89
910loader = Zeitwerk ::Loader . for_gem
1011loader . setup
1112loader . eager_load_namespace ( Pyxis ::Logger )
1213loader . eager_load_namespace ( Pyxis ::DryRunEnforcer )
14+ loader . eager_load_namespace ( Pyxis ::Project ::Base )
Original file line number Diff line number Diff line change 33module Pyxis
44 module Commands
55 class Components < Thor
6+ include PermissionHelper
7+
68 desc 'info [BUILD_ID]' , 'Get the component versions for a reticulum build'
79 def info ( build_id )
810 component_versions = ManagedVersioning ::ComponentInfo . new ( build_id ) . execute
911
10- SemanticLogger . flush
11-
12- puts 'Versions of each component'
12+ result = 'Versions of each component'
1313 component_versions . each do |component , version |
14- puts " #{ component } : #{ version } "
14+ result += " \n #{ component } : #{ version } "
1515 end
16+ result
1617 end
1718
1819 desc 'update [COMPONENT]' , 'Update a component in reticulum'
1920 def update ( component )
21+ assert_executed_by_schedule!
22+
2023 updater ( component ) . execute
2124 end
2225
2326 desc 'list' , 'List all available components'
2427 def list
25- puts 'Available components:'
28+ result = 'Available components:'
2629 Pyxis ::Project . components . each do |project |
27- puts " - #{ project . downcase } "
30+ result += " \n - #{ project . downcase } "
2831 end
32+ result
2933 end
3034
3135 desc 'get_version COMPONENT' , 'Get the current version of a component in reticulum'
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ def call(env)
4545
4646SemanticLogger . application = 'pyxis'
4747SemanticLogger . default_level = ENV . fetch ( 'LOG_LEVEL' , 'debug' ) . to_sym
48- SemanticLogger . add_appender ( io : $stdout , level : SemanticLogger . default_level ,
48+ SemanticLogger . add_appender ( io : $stderr , level : SemanticLogger . default_level ,
4949 formatter : Pyxis ::Logger ::NoProcessColorFormatter . new )
5050
5151SemanticLogger . push_tags ( 'dry-run' ) if Pyxis ::GlobalStatus . dry_run?
You can’t perform that action at this time.
0 commit comments