Sha256: 6b50f40a32e70dbc6566f4b17add0cbe31100b08f66818f1798daa53d6a6ee50

Contents?: true

Size: 729 Bytes

Versions: 4

Compression:

Stored size: 729 Bytes

Contents

module Pah
  class Template < Rails::Generators::Base
    def static_files
      File.join(TEMPLATE_ROOT, 'files')
    end

    def copy_static_file(path)
      remove_file path
      create_file path, File.read(File.join(static_files, path))
    end

    def will_you_like_to?(question)
      answer = ask("Will you like to #{question} [y,n]".red)
      case answer.downcase
      when 'yes', 'y'
        true
      when 'no', 'n'
        false
      else
        will_you_like_to?(question)
      end
    end

    def ask_unless_test(*params)
      ask(*params)
    end

    def git_commit(message)
      message = "#{message}\n\nGenerated by pah version #{Pah::VERSION}"
      git commit: "-qm '#{message}'"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pah-0.0.20 lib/pah/template.rb
pah-0.0.19 lib/pah/template.rb
pah-0.0.17 lib/pah/template.rb
pah-0.0.16 lib/pah/template.rb