Sha256: 94cb47fadd3fbb24075dfc8b2184aabacb2826ce6ece5505c88809dc83ca1782

Contents?: true

Size: 756 Bytes

Versions: 3

Compression:

Stored size: 756 Bytes

Contents

require 'wlog/commands/commandable'
require 'wlog/domain/static_configurations'

module Wlog
# To check if template dir exists or not. Make dirs. Add sample template.
# @author Simon Symeonidis
class BootstrapTemplates < Commandable
  include StaticConfigurations

  def initialize
  end

  def execute
    unless File.exists? TemplateDir
      FileUtils.mkdir_p TemplateDir
    end

    unless File.exists? TemplateSampleFile
      write_default_template!
    end
  end

private

  # Write a default template 
  def write_default_template!
    fh = File.open(TemplateSampleFile, 'w')
    data = "A list of issues:
<% @issues.each do |issue| %>
  <%= \"\#{issue.id}  \#{issue.description}\" %>
<% end %>"
    fh.write(data)
    fh.close
  nil end

end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wlog-1.1.7 lib/wlog/commands/bootstrap_templates.rb
wlog-1.1.6 lib/wlog/commands/bootstrap_templates.rb
wlog-1.1.5 lib/wlog/commands/bootstrap_templates.rb