class Rrr::Run
Attributes
datetime[R]
files[R]
Public Class Methods
new(files)
click to toggle source
# File lib/cli.rb, line 11 def initialize(files) @files = files init && touch && run end
Public Instance Methods
collection()
click to toggle source
# File lib/cli.rb, line 46 def collection @collection ||= begin files.empty? ? list : files end end
init()
click to toggle source
# File lib/cli.rb, line 16 def init @datetime = begin Time.parse(File.open('.rrr', 'r').read) rescue Time.now end end
list()
click to toggle source
# File lib/cli.rb, line 30 def list file_list = FileList.new('spec/**/*_spec.rb') file_list.select{|file| File.ctime(file) > datetime} end
rspec()
click to toggle source
# File lib/cli.rb, line 52 def rspec "rspec" end
run()
click to toggle source
# File lib/cli.rb, line 35 def run if collection.empty? puts "INFO: no recent changes in specs ... running all specs\nINFO: #{rspec}" command = rspec else command = "#{rspec} #{collection.join(' ')}" puts "rrr: #{command}" end system(command) end
touch()
click to toggle source
# File lib/cli.rb, line 24 def touch File.open('.rrr', 'w') do |file| file.write(Time.now) end end