Class: Coco::HtmlDirectory
- Inherits:
-
Object
- Object
- Coco::HtmlDirectory
- Defined in:
- lib/coco/writer/html_directory.rb
Overview
I prepare the coverage/ directory for html files.
Instance Attribute Summary collapse
-
#coverage_dir ⇒ Object
readonly
Returns the value of attribute coverage_dir.
Instance Method Summary collapse
-
#clean ⇒ Object
Delete the coverage/ directory.
-
#initialize ⇒ HtmlDirectory
constructor
A new instance of HtmlDirectory.
-
#list ⇒ Object
I list the html files from the coverage directory.
- #setup ⇒ Object
Constructor Details
#initialize ⇒ HtmlDirectory
Returns a new instance of HtmlDirectory.
9 10 11 12 13 14 15 16 17 |
# File 'lib/coco/writer/html_directory.rb', line 9 def initialize @coverage_dir = 'coverage' @css_dir = 'coverage/css' @img_dir = 'coverage/img' css = File.join($COCO_PATH, 'template/css') @css_files = Dir.glob(css + '/*') img = File.join($COCO_PATH, 'template/img') @img_files = Dir.glob(img + '/*') end |
Instance Attribute Details
#coverage_dir ⇒ Object (readonly)
Returns the value of attribute coverage_dir.
7 8 9 |
# File 'lib/coco/writer/html_directory.rb', line 7 def coverage_dir @coverage_dir end |
Instance Method Details
#clean ⇒ Object
Delete the coverage/ directory
20 21 22 |
# File 'lib/coco/writer/html_directory.rb', line 20 def clean FileUtils.remove_dir @coverage_dir if File.exist? @coverage_dir end |
#list ⇒ Object
I list the html files from the coverage directory
32 33 34 35 |
# File 'lib/coco/writer/html_directory.rb', line 32 def list files = Dir.glob("#{@coverage_dir}/*.html") files.map {|file| File.basename(file)} end |
#setup ⇒ Object
24 25 26 27 28 29 |
# File 'lib/coco/writer/html_directory.rb', line 24 def setup FileUtils.makedirs @css_dir FileUtils.makedirs @img_dir FileUtils.cp @css_files, @css_dir FileUtils.cp @img_files, @img_dir end |