Class: TinyCI::Runner
- Inherits:
-
Object
- Object
- TinyCI::Runner
- Includes:
- GitUtils, Logging, Subprocesses
- Defined in:
- lib/tinyci/runner.rb
Overview
Responsible for managing the running of TinyCI against a single git object.
Instance Attribute Summary collapse
-
#builder ⇒ TinyCI::Executor
Returns the Builder object.
-
#tester ⇒ TinyCI::Executor
Returns the Tester object.
Instance Method Summary collapse
-
#initialize(working_dir: '.', commit:, time: nil, logger: nil, config: nil) ⇒ Runner
constructor
Constructor, allows injection of generic configuration params.
-
#run! ⇒ Boolean
Runs the TinyCI system against the single git object referenced in
@commit.
Methods included from GitUtils
#git_cmd, #git_directory_path, #inside_bare_repo?, #inside_git_directory?, #inside_repository?, #inside_work_tree?, #repo_root
Methods included from Subprocesses
#execute, #execute_pipe, #execute_stream
Constructor Details
#initialize(working_dir: '.', commit:, time: nil, logger: nil, config: nil) ⇒ Runner
Constructor, allows injection of generic configuration params.
36 37 38 39 40 41 42 |
# File 'lib/tinyci/runner.rb', line 36 def initialize(working_dir: '.', commit:, time: nil, logger: nil, config: nil) @working_dir = working_dir @logger = logger @config = config @commit = commit @time = time || commit_time end |
Instance Attribute Details
#builder ⇒ TinyCI::Executor
Returns the Builder object. Used solely for testing at this time.
22 23 24 |
# File 'lib/tinyci/runner.rb', line 22 def builder @builder end |
#tester ⇒ TinyCI::Executor
Returns the Tester object. Used solely for testing at this time.
22 23 24 |
# File 'lib/tinyci/runner.rb', line 22 def tester @tester end |
Instance Method Details
#run! ⇒ Boolean
Runs the TinyCI system against the single git object referenced in @commit.
47 48 49 50 51 52 53 54 55 56 57 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 |
# File 'lib/tinyci/runner.rb', line 47 def run! begin ensure_path target_path setup_log log_info "Commit: #{@commit}" log_info "Cleaning..." clean log_info "Exporting..." ensure_path export_path export begin load_config rescue ConfigMissingError => e log_error e. log_error 'Removing export...' clean return false end @builder ||= instantiate_builder @tester ||= instantiate_tester log_info "Building..." @builder.build log_info "Testing..." @tester.test log_info "Finished #{@commit}" rescue => e raise e if ENV['TINYCI_ENV'] == 'test' log_error e log_error e.backtrace return false ensure end true end |