jhsu802701/generic_app

View on GitHub
bin/generic_app

Summary

Maintainability
Test Coverage
#!/usr/bin/env ruby

require 'generic_app'

def get_input(default_value)
  value_input = gets.chomp
  if value_input == ''
    default_value
  else
    value_input
  end
end

puts '***********************'
puts 'Welcome to Generic App!'
puts

default_subdir = 'tmp9'
puts
puts "DEFAULT VALUE: #{default_subdir}"
puts 'Enter the directory name you wish to use for your new app:'
subdir_name = get_input(default_subdir)
puts "You chose '#{subdir_name}'."
puts

default_email = 'please-change-me-at-config-initializers-devise@example.com'
puts "DEFAULT VALUE: #{default_email}"
puts "Enter the email address you wish to use for your new app's mailer:"
email = get_input(default_email)

default_title = 'Placeholder Title'
puts "DEFAULT TITLE: #{default_title}"
puts 'Enter the desired title you wish to use for your new app:'
title = get_input(default_title)

GenericApp.create_new(subdir_name, email, title)

puts 'Your new Rails app has been created at'
puts "#{ENV['PWD']}/#{subdir_name} ."
puts
puts 'Go to the README-to_do.txt file for further instructions.'
puts