Class: Pronto::RakeTask::TravisPullRequest
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Pronto::RakeTask::TravisPullRequest
- Defined in:
- lib/pronto/rake_task/travis_pull_request.rb
Overview
Provides a custom rake task to use with Travis.
require ‘rubocop/rake/travis_pull_request’ Pronto::Rake::TravisPullRequest.new
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
Instance Method Summary collapse
-
#initialize(*args, &task_block) ⇒ TravisPullRequest
constructor
A new instance of TravisPullRequest.
- #run_task ⇒ Object
Constructor Details
#initialize(*args, &task_block) ⇒ TravisPullRequest
Returns a new instance of TravisPullRequest.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/pronto/rake_task/travis_pull_request.rb', line 15 def initialize(*args, &task_block) setup_ivars(args) unless ::Rake.application.last_comment desc 'Run Pronto on Travis Pull Request' end task(name, *args) do |_, task_args| RakeFileUtils.send(:verbose, verbose) do yield(*[self, task_args].slice(0, task_block.arity)) if task_block run_task end end end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
12 13 14 |
# File 'lib/pronto/rake_task/travis_pull_request.rb', line 12 def name @name end |
#verbose ⇒ Object
Returns the value of attribute verbose.
13 14 15 |
# File 'lib/pronto/rake_task/travis_pull_request.rb', line 13 def verbose @verbose end |
Instance Method Details
#run_task ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/pronto/rake_task/travis_pull_request.rb', line 30 def run_task return if pull_id.nil? || pull_id == 'false' pull_request = client.pull_request(repo_slug, pull_id) formatter = ::Pronto::Formatter::GithubFormatter.new gem_names = ::Pronto::GemNames.new.to_a gem_names.each { |gem_name| require "pronto/#{gem_name}" } ::Pronto.run(pull_request.base.sha, '.', formatter) end |