Class: Processing::Creator

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-processing/exporters/creator.rb

Overview

An abstract class providing common methods for real creators

Direct Known Subclasses

BasicSketch, ClassSketch, Inner

Constant Summary collapse

ALL_DIGITS =
/\A\d+\Z/

Instance Method Summary collapse

Instance Method Details

#already_exist(path) ⇒ Object


74
75
76
77
78
79
80
# File 'lib/ruby-processing/exporters/creator.rb', line 74

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

#usageObject

Show the help/usage message for create.


83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/ruby-processing/exporters/creator.rb', line 83

def usage
  puts "\nUsage: rp5 create <sketch_to_generate> <width> <height> <mode>\nmode can be P2D / P3D.\nUse    --wrap for a sketch wrapped as a class\nUse    --inner to generated a ruby version of 'java' Inner class\nExamples: rp5 create app 800 600\nrp5 create app 800 600 p3d --wrap\nrp5 create inner_class --inner\n\n"
end