Sha256: e9ee4fda60ac44889eaf9f8b418e7268c35e4a90b56733b2cb16a2a31973c819
Contents?: true
Size: 1.63 KB
Versions: 2
Compression:
Stored size: 1.63 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, stdout: $stdout) @options = options @setup = setup @stdout = stdout 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 @stdout.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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
retest-1.6.2 | lib/retest/command.rb |
retest-1.6.1 | lib/retest/command.rb |