Class: Moku::Task::ValidatePin

Inherits:
Object
  • Object
show all
Defined in:
lib/moku/task/validate_pin.rb

Overview

Validates that the project correctly specifies its ruby version

  • There is a .ruby-version present

  • It specifies only a major version (e.g. 2.5)

  • If the Gemfile includes a 'ruby' directive, it should specify only a major version.

Instance Method Summary collapse

Constructor Details

#initializeValidatePin

Returns a new instance of ValidatePin.


17
18
19
# File 'lib/moku/task/validate_pin.rb', line 17

def initialize
  @errors = []
end

Instance Method Details

#call(artifact) ⇒ Status

Parameters:

Returns:


23
24
25
26
27
28
29
30
31
# File 'lib/moku/task/validate_pin.rb', line 23

def call(artifact)
  @errors += Validator::Gemfile.new(artifact).errors
  @errors += Validator::RubyVersion.new(artifact).errors
  if errors.empty?
    Status.success
  else
    Status.failure(errors.join("\n"))
  end
end