Sha256: 36e862cab8942fe3187651b93676f781c740a8e2eb3da780393470798f68cffd
Contents?: true
Size: 1.64 KB
Versions: 12
Compression:
Stored size: 1.64 KB
Contents
module AmpHtml class Validate require 'highline' require 'launchy' def self.validate url, server_running unless server_running cli = HighLine.new answer = cli.ask 'Is your rails server running? [y/n]' unless answer == 'y' warn 'Rerun `amp-html validate URL` while your server is running' puts 'Starting your rails server ...' exec 'rails s' end end validation_url = url + '#development=1' root_validation_url = 'http://localhost:3000' + '#development=1' if url.present? && url != 'root' Launchy.open( validation_url ) do |exception| warn "Attempted to open #{url} and failed because of: #{exception}. Open #{validation_url} in your browser instead." exit end else if Rails.env.development? Launchy.open( root_validation_url ) do |exception| warn "Attempted to open #{url} and failed because of: #{exception}. Open #{root_validation_url} in your browser instead." exit end else warn 'If you are not in the development environment, you need to specify the exact uri for the site you want to validate.' exit end end puts '=> Open the Developer Console and check for validation errors.' exit end end end
Version data entries
12 entries across 12 versions & 1 rubygems