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
# File 'lib/pronto/runner.rb', line 5

def initialize(patches, commit = nil)
  @patches = patches
  @commit = commit
end

Class Method Details

.runnersObject



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

def self.runners
  repository
end

.titleObject



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

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



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

def repo_path
  @patches.first.repo.path
end

#ruby_file?(path) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#ruby_patchesObject



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

def ruby_patches
  return [] unless @patches

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