Sha256: 96eee9ad33c2a22423c0ea92facb47f06f3e3749ec2c5e201cc22bf140ff329c

Contents?: true

Size: 508 Bytes

Versions: 4

Compression:

Stored size: 508 Bytes

Contents

module Pronto
  class Runner
    include Plugin

    def self.runners
      repository
    end

    def ruby_file?(path)
      rb_file?(path) || rake_file?(path) || ruby_executable?(path)
    end

    private

    def rb_file?(path)
      File.extname(path) == '.rb'
    end

    def rake_file?(path)
      File.extname(path) == '.rake'
    end

    def ruby_executable?(path)
      line = File.open(path, &:readline)
      line =~ /#!.*ruby/
    rescue ArgumentError, EOFError
      false
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pronto-0.5.3 lib/pronto/runner.rb
pronto-0.5.2 lib/pronto/runner.rb
pronto-0.5.1 lib/pronto/runner.rb
pronto-0.5.0 lib/pronto/runner.rb