module Prairie

Constants

COMMIT_MESSAGE_TEMPLATE
ISSUE_TEMPLATE
PULL_REQUEST_TEMPLATE
VERSION

Public Class Methods

run() click to toggle source
# File lib/prairie.rb, line 48
def self.run
  puts 'Do you want to create ./github/ISSUE_TEMPLATE.md (y/n)?'
  input = gets.chomp
  if input == 'y'
    Dir.mkdir('./.github') unless FileTest.exist?('./.github')
    FileUtils.touch('./.github/ISSUE_TEMPLATE.md')
    File.open('./.github/ISSUE_TEMPLATE.md', 'w') do |f|
      f.puts(ISSUE_TEMPLATE)
    end
    puts 'Created! .github/ISSUE_TEMPLATE.md'
  end

  puts 'Do you want to create ./github/PULL_REQUEST_TEMPLATE.md (y/n)?'
  input = gets.chomp
  if input == 'y'
    Dir.mkdir('./.github') unless FileTest.exist?('./.github')
    FileUtils.touch('./.github/PULL_REQUEST_TEMPLATE.md')
    File.open('./.github/PULL_REQUEST_TEMPLATE.md', 'w') do |f|
      f.puts(PULL_REQUEST_TEMPLATE)
    end
    puts 'Created! .github/PULL_REQUEST_TEMPLATE.md'
  end

  puts 'Do you want to create ./.gitmessage (y/n)?'
  input = gets.chomp
  if input == 'y'
    FileUtils.touch('./.gitmessage')
    File.open('./.gitmessage', 'w') do |f|
      f.puts(COMMIT_MESSAGE_TEMPLATE)
    end
    puts 'Created! .gitmessage'
  end
end