Sha256: 075179c556cf970509207852e08cd3ec65b572d10d87540eb18847d209bc6987

Contents?: true

Size: 414 Bytes

Versions: 3

Compression:

Stored size: 414 Bytes

Contents

module Statixite
  class JekyllTemplateValidator < ActiveModel::Validator
    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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
statixite-1.0.2 app/validators/statixite/jekyll_template_validator.rb
statixite-1.0.1 app/validators/statixite/jekyll_template_validator.rb
statixite-1.0.0 app/validators/statixite/jekyll_template_validator.rb