Sha256: d131c5cb1f5d1f83072c1c40ed46b87b87f39c499916d5af87e1494f4656a8bd
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
require 'fileutils' require 'erb' module CukePages class Site attr_reader :features def initialize(output_dir_path, features = []) @site_dir_path = File.join(output_dir_path, "cukepages-site") @features = features end def generate copy_resources index_template_path = File.join(TEMPLATES_DIR, "index.erb") feature_template_path = File.join(TEMPLATES_DIR, "feature.erb") index_file_path = File.join(@site_dir_path, "index.html") File.open(index_file_path, "w") { |f| content = ERB.new(File.read(index_template_path)).result(binding) f.syswrite(content) } @features.each { |feature| feature_file_path = File.join(@site_dir_path, "#{feature.ref}.html") File.open(feature_file_path, "w") { |f| content = ERB.new(File.read(feature_template_path)).result(binding) f.syswrite(content) } } end private def copy_resources FileUtils.cp_r("#{RESOURCES_DIR}/.", @site_dir_path) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cukepages-0.0.4 | lib/cukepages/site.rb |