Class: Pronto::Runner

Inherits:
Object
  • Object
show all
Includes:
Plugin
Defined in:
lib/pronto/runner.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Plugin

included

Constructor Details

#initialize(patches, commit = nil) ⇒ Runner

Returns a new instance of Runner.



5
6
7
8
9
# File 'lib/pronto/runner.rb', line 5

def initialize(patches, commit = nil)
  @patches = patches
  @commit = commit
  @config = Config.new
end

Class Method Details

.runnersObject



11
12
13
# File 'lib/pronto/runner.rb', line 11

def self.runners
  repository
end

.titleObject



15
16
17
18
19
20
21
# File 'lib/pronto/runner.rb', line 15

def self.title
  @runner_name ||= begin
    source_path, _line = instance_method(:run).source_location
    file_name, _extension = File.basename(source_path).split('.')
    file_name
  end
end

Instance Method Details

#repo_pathObject



34
35
36
# File 'lib/pronto/runner.rb', line 34

def repo_path
  @patches.first.repo.path
end

#ruby_file?(path) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/pronto/runner.rb', line 30

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

#ruby_patchesObject



23
24
25
26
27
28
# File 'lib/pronto/runner.rb', line 23

def ruby_patches
  return [] unless @patches

  @ruby_patches ||= @patches.select { |patch| patch.additions > 0 }
    .select { |patch| ruby_file?(patch.new_file_full_path) }
end