Sha256: 0a8c8f86bc54fca1e923d4136ef442cf890e2108351e8cbce9f2077635de6dd6
Contents?: true
Size: 1.58 KB
Versions: 2
Compression:
Stored size: 1.58 KB
Contents
# -*- encoding: utf-8 -*- module Coco # Public: Collection of application's helpers methods. # # TODO The app is full of `Dir.pwd`. This is the root project # directory and must be in Configuration class (or Coco module ?). module Helpers class << self # Public: Get html filename (from a ruby filename) suitable for # the coverage directory. # # name - String full path filename. # # Examples # # ruby = '/home/user/my_project/lib/source.rb' # html = Helpers.rb2html(ruby) # #=> '_lib_source.rb.html' # # Returns String HTML filename. def rb2html name name.sub(Dir.pwd, '').tr('/\\', '_') + '.html' end # Public: Get page title for the index.html file. # # Returns String. def index_title project_name = File.basename(Dir.pwd) version = File.read(File.join($COCO_PATH, 'VERSION')).strip "#{project_name} - Code coverage (coco #{version})" end # Public: Expands a bulk of filenames into full path filenames. # # files - List of filenames as an Array of String. # # Returns an Array of String. def expand files files.map {|file| File.expand_path file} end # Public: Get all ruby files from a directory, including # sub-directories. # # directory - String directory to look into. # # Returns an Array of String. def rb_files_from directory rb_files = File.join(directory, "**", "*.rb") Dir.glob(rb_files) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
coco-0.10.0 | lib/coco/helpers.rb |
coco-0.9 | lib/coco/helpers.rb |