Sha256: 060078131005d44d357a46b4b8face0e608392b439429d96590c0460c854b111
Contents?: true
Size: 1.14 KB
Versions: 2
Compression:
Stored size: 1.14 KB
Contents
# frozen_string_literal: true module Guard # The class responsible for running 'busted' command in the proper context. class BustedRunner < Plugin attr_accessor :options, :cmd, :cmd_options, :cmd_all, :cmd_all_options def initialize(options) super @cmd = options[:cmd] @cmd_options = options[:cmd_options] @cmd_all = options[:cmd_all] @cmd_all_options = options[:cmd_all_options] end # Run all tests in the project # # @raise [:task_has_failed] when run_all has failed def run_all puts 'Running all tests' status = system(command_all) throw(:task_has_failed) unless status end def run(paths) puts "Running #{paths.join(', ')}" results = paths.map do |path| if Pathname.new(path).exist? system([command, path].join(' ')) else true end end throw(:task_has_failed) if results.any? { |x| x == false } end private def command [options[:cmd], *options[:cmd_options]].join(' ') end def command_all [options[:cmd_all], *options[:cmd_all_options]].join(' ') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
guard-busted-0.1.2 | lib/guard/busted/runner.rb |
guard-busted-0.1.1 | lib/guard/busted/runner.rb |