Sha256: 3720e16a4fecc3549e0cf3d1eee2a4ed21dfb28deb544dd6dbae5685ffa186cf

Contents?: true

Size: 733 Bytes

Versions: 8

Compression:

Stored size: 733 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]".green)
      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: "-m '#{message}' -q"
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pah-0.0.28 lib/pah/template.rb
pah-0.0.27 lib/pah/template.rb
pah-0.0.26 lib/pah/template.rb
pah-0.0.25 lib/pah/template.rb
pah-0.0.24 lib/pah/template.rb
pah-0.0.23 lib/pah/template.rb
pah-0.0.22 lib/pah/template.rb
pah-0.0.21 lib/pah/template.rb