Sha256: caae0639d1174b90365f1791e63242750a1791f01bbb614a026e235fe1bab3c8
Contents?: true
Size: 1.65 KB
Versions: 5
Compression:
Stored size: 1.65 KB
Contents
require_relative 'command/rails' require_relative 'command/rake' require_relative 'command/rspec' require_relative 'command/ruby' module Retest class Command extend Forwardable def self.for_options(options) new(options: options).command end def self.for_setup(setup) new(setup: setup).command end def_delegator :setup, :type def_delegators :options, :params, :full_suite?, :auto? attr_accessor :options, :setup def initialize(options: Options.new, setup: Setup.new, output_stream: STDOUT) @options = options @setup = setup @output_stream = output_stream end def command return default_command if auto? options_command || default_command end def options_command return params[:command] if params[:command] if params[:rspec] then rspec_command elsif params[:rails] then rails_command elsif params[:ruby] then ruby_command elsif params[:rake] then rake_command else end end def setup_command case type when :rake then rake_command when :rspec then rspec_command when :rails then rails_command when :ruby then ruby_command else ruby_command end end def default_command @output_stream.puts "Setup identified: [#{type.upcase}]. Using command: '#{setup_command}'" setup_command end private def rspec_command Rspec.new(all: full_suite?) end def rails_command Rails.new(all: full_suite?) end def rake_command Rake.new(all: full_suite?) end def ruby_command Ruby.new(all: full_suite?) end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
retest-1.6.0 | lib/retest/command.rb |
retest-1.5.0 | lib/retest/command.rb |
retest-1.4.0 | lib/retest/command.rb |
retest-1.3.0 | lib/retest/command.rb |
retest-1.3.0.pre | lib/retest/command.rb |