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



34
35
36
37
38
39
40
41
42
# File 'lib/ruby-processing/exporters/creator.rb', line 34

def already_exist(path)
  new_file = "#{File.dirname(path)}/#{path.underscore}.rb"
  if !File.exist?(path) && !File.exist?(new_file)
    return
  else
    puts 'That file already exists!'
    exit
  end
end

#usageObject

Show the help/usage message for create.



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/ruby-processing/exporters/creator.rb', line 45

def usage
  puts <<-USAGE

  Usage: rp5 create <sketch_to_generate> <width> <height> <mode>
  mode can be P2D / P3D.
  Use    --wrap for a sketch wrapped as a class
  Use    --inner to generated a ruby version of 'java' Inner class
  Examples: rp5 create app 800 600
  rp5 create app 800 600 p3d --wrap
  rp5 create inner_class --inner

  USAGE
end