Sha256: e7fb9a332349f49cccaecdd6d68ce58f298bcbf58bf0d481bbeff746c515c554
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true require 'quicken/helpers/template' require 'quicken/helpers/file' module Quicken module Plugins class Readme < Quicken::Plugin include Quicken::Helpers::File include Quicken::Helpers::Template def initialize args @template = args.delete(:template) @force = !!args.delete(:force) @variables = args parse template end def call LOGGER.info(:readme) { 'Creating README file' } LOGGER.debug(:readme) { "Compiling template:\n#{template}" } result = compile @variables outcome = write_file 'README.md', result, force: @force if outcome == :file_exists say 'README already present. Skipping...' else say 'Created README file' end end private def template @template ||= DEFAULT end DEFAULT = <<~ERB # <%= project_name %> ### by <%= author_name %> <%= "<\#{author_email}>" if author_email.present? %> --- <%= description %> ERB end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
quicken-ruby-0.1.1 | lib/quicken/plugins/readme.rb |