Class: Processing::Creator
- Inherits:
-
Object
- Object
- Processing::Creator
- Defined in:
- lib/jruby_art/creators/creator.rb
Overview
An abstract class providing common methods for real creators
Direct Known Subclasses
Constant Summary collapse
- ALL_DIGITS =
/\A\d+\Z/
Instance Method Summary collapse
- #already_exist(path) ⇒ Object
-
#usage ⇒ Object
Show the help/usage message for create.
Instance Method Details
#already_exist(path) ⇒ Object
97 98 99 100 101 102 103 |
# File 'lib/jruby_art/creators/creator.rb', line 97 def already_exist(path) underscore = StringExtra.new(path).underscore new_file = "#{File.dirname(path)}/#{underscore}.rb" return if !FileTest.exist?(path) && !FileTest.exist?(new_file) puts 'That file already exists!' exit end |
#usage ⇒ Object
Show the help/usage message for create.
106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/jruby_art/creators/creator.rb', line 106 def usage puts "\n Usage: k9 create <sketch_to_generate> <width> <height> <mode>\n mode can be P2D / P3D.\n Use --wrap for a sketch wrapped as a class\n Use --inner to generated a ruby version of 'java' Inner class\n Examples: k9 create app 800 600\n k9 create app 800 600 p3d --wrap\n k9 create inner_class --inner\n\n USAGE\nend\n" |