Class: Statixite::JekyllTemplateValidator

Inherits:
ActiveModel::Validator
  • Object
show all
Defined in:
app/validators/statixite/jekyll_template_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate(record) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/validators/statixite/jekyll_template_validator.rb', line 3

def validate(record)
  begin
    if record.build_option == 'custom'
      Timeout::timeout(30) {
        Git.ls_remote(record.template_repo)
      }
    end
  rescue StandardError => e
    Rails.logger.error e
    record.errors[:template_repo] << "Can't read from remote"
  end
end