Sha256: f9515768465dfa8343ceb7e8ff8cc08cb69645e89dadc1c02dd11c028e787348

Contents?: true

Size: 589 Bytes

Versions: 3

Compression:

Stored size: 589 Bytes

Contents

module Retest
  class Command
    class Rake
      attr_reader :all, :file_system

      def initialize(all:, file_system: FileSystem)
        @file_system = file_system
        @all = all
      end

      def to_s
        return "#{root_command} TEST=<test>" unless all
        root_command
      end

      def run_all(*files, runner:)
        runner.run files.size > 1 ? "\"{#{files.join(',')}}\"" : files.first
      end

      private

      def root_command
        return 'bin/rake test' if file_system.exist? 'bin/rake'

        'bundle exec rake test'
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
retest-1.4.0 lib/retest/command/rake.rb
retest-1.3.0 lib/retest/command/rake.rb
retest-1.3.0.pre lib/retest/command/rake.rb