Class: HtmlMockup::Cli::Base
- Inherits:
-
Thor
- Object
- Thor
- HtmlMockup::Cli::Base
- Defined in:
- lib/html_mockup/cli.rb
Class Attribute Summary collapse
-
.project ⇒ Object
Returns the value of attribute project.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Base
constructor
A new instance of Base.
- #validate(path = ".") ⇒ Object
Constructor Details
#initialize(*args) ⇒ Base
Returns a new instance of Base.
36 37 38 39 |
# File 'lib/html_mockup/cli.rb', line 36 def initialize(*args) super self.class.project = initialize_project end |
Class Attribute Details
.project ⇒ Object
Returns the value of attribute project.
42 43 44 |
# File 'lib/html_mockup/cli.rb', line 42 def project @project end |
Instance Method Details
#validate(path = ".") ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/html_mockup/cli.rb', line 71 def validate(path=".") filter = ["filter"] || "[^_]*.html" puts "Filtering on #{["filter"]}" if ["filter"] if File.directory?(path) any_invalid = false if (files = Dir.glob("#{path}/**/#{filter}")).any? files.each do |file| if !self.w3cvalidate(file) any_invalid = true end end if !any_invalid puts "All files were considered valid" end else puts "No files matched \"#{filter}\"" end elsif File.readable?(path) self.w3cvalidate(path) else puts "No such file/directory #{path}" end end |