class Pyonnuka::Command
Public Class Methods
discriminate_command(command)
click to toggle source
# File lib/pyonnuka/command.rb, line 4 def discriminate_command(command) if command[0].nil? out_help return end case command[0] when 'new' app_path = command[1] return unless validate_app_path(app_path) generator = Pyonnuka::Generators::AppGenerator.new(app_path) generator.start when 'ikeikegogo' Pyonnuka::Application::Server.start(ARGV) when '-h' out_help when '-v' puts "Pyonnuka #{Pyonnuka::VERSION}" end end
Private Class Methods
out_help()
click to toggle source
# File lib/pyonnuka/command.rb, line 29 def out_help puts <<"EOS" Example: pyonnuka new ~/Code/Ruby/taskapp This generates a skeletal Pyonnuka installation in ~/Code/Ruby/taskapp. See the README in the newly created application to get going. Pyonnuka options: -h # Show this help message -v # Show this pyonnuka version EOS end
validate_app_path(app_path)
click to toggle source
# File lib/pyonnuka/command.rb, line 42 def validate_app_path(app_path) return true if app_path.present? && ['Pyonnuka', 'pyonnuka'].exclude?(app_path) puts app_path.nil? ? 'required application path' : 'Invalid application name pyonnuka. Please choose another name' false end