Class: Inferno::CLI::Main
- Inherits:
-
Thor
- Object
- Thor
- Inferno::CLI::Main
- Defined in:
- lib/inferno/apps/cli/main.rb
Constant Summary collapse
- EXECUTE_HELP =
<<~END_OF_HELP.freeze Run Inferno tests in the command line. Exits with 0 only if test entity passes. Must be run with test kit as working directory. You must have background services running: `bundle exec inferno services start` You can view suite ids with: `bundle exec inferno suites` You can select an output format with the `--outputter` option. Current outputters are console (default), plain, quiet, and json. JSON-formatted output will copy Inferno's REST API: https://inferno-framework.github.io/inferno-core/api-docs/#/Result. Examples: (These examples only work from within the inferno_core directory). `bundle exec inferno execute --suite dev_validator \ --inputs "url:https://hapi.fhir.org/baseR4" \ patient_id:1234321` => Outputs test results `bundle exec inferno execute --suite dev_validator \ --inputs "url:https://hapi.fhir.org/baseR4" \ patient_id:1234321 \ --tests 1.01 1.02` => Run specific tests from suite `bundle exec inferno execute --suite dev_validator \ --inputs "url:https://hapi.fhir.org/baseR4" \ patient_id:1234321 \ --outputter json` => Outputs test results in JSON END_OF_HELP
Class Method Summary collapse
-
.exit_on_failure? ⇒ Boolean
https://github.com/rails/thor/issues/244 - Make Thor exit(1) on Errors/Exceptions.
Instance Method Summary collapse
- #console ⇒ Object
- #evaluate(ig_path) ⇒ Object
- #execute ⇒ Object
- #execute_script(pattern = 'execution_scripts/**/*.yaml') ⇒ Object
-
#initialize(args = [], local_options = {}, config = {}) ⇒ Main
constructor
A new instance of Main.
- #migrate ⇒ Object
- #start ⇒ Object
- #suites ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(args = [], local_options = {}, config = {}) ⇒ Main
Returns a new instance of Main.
18 19 20 21 22 23 |
# File 'lib/inferno/apps/cli/main.rb', line 18 def initialize(args = [], = {}, config = {}) super return unless @options[:inferno_base_url] @options = @options.merge(inferno_base_url: "#{@options[:inferno_base_url].delete_suffix('/')}/") end |
Class Method Details
.exit_on_failure? ⇒ Boolean
https://github.com/rails/thor/issues/244 - Make Thor exit(1) on Errors/Exceptions
302 303 304 |
# File 'lib/inferno/apps/cli/main.rb', line 302 def self.exit_on_failure? true end |
Instance Method Details
#console ⇒ Object
69 70 71 72 |
# File 'lib/inferno/apps/cli/main.rb', line 69 def console Migration.new.run(Logger::INFO) Console.new.run end |
#evaluate(ig_path) ⇒ Object
64 65 66 |
# File 'lib/inferno/apps/cli/main.rb', line 64 def evaluate(ig_path) Evaluate.new.run(ig_path, [:data_path], ) end |
#execute ⇒ Object
296 297 298 299 |
# File 'lib/inferno/apps/cli/main.rb', line 296 def execute Execute.boot_full_inferno Execute.new.run(.dup) # dup to unfreeze Thor options end |
#execute_script(pattern = 'execution_scripts/**/*.yaml') ⇒ Object
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/inferno/apps/cli/main.rb', line 143 def execute_script(pattern = 'execution_scripts/**/*.yaml') matches = Dir.glob(pattern).select { |file| file.end_with?('.yaml', '.yml') }.sort if matches.length > 1 || (matches.empty? && pattern.match?(/[*?\[\]{}]/)) Utils::ExecutionScriptRunner.run_all( pattern:, inferno_base_url: [:inferno_base_url], allow_commands: [:allow_commands], compare_messages: [:compare_messages], compare_result_message: [:compare_result_message], poll_interval: [:poll_interval], default_poll_timeout: [:default_poll_timeout], only_different_messages: [:only_different_messages] ) else ExecuteScript.new(matches.first || pattern, ).run end end |
#migrate ⇒ Object
75 76 77 |
# File 'lib/inferno/apps/cli/main.rb', line 75 def migrate Migration.new.run end |
#start ⇒ Object
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/inferno/apps/cli/main.rb', line 170 def start Migration.new.run(Logger::INFO) without_bundler do command = 'foreman start --env=/dev/null' if `gem list -i foreman`.chomp == 'false' puts "You must install foreman with 'gem install foreman' prior to running Inferno." end if [:watch] if `gem list -i rerun`.chomp == 'false' puts "You must install 'rerun' with 'gem install rerun' to restart on file changes." end command = "rerun \"#{command}\" --background" end exec command end end |