Class: JennCad::Project
- Inherits:
-
Object
- Object
- JennCad::Project
- Defined in:
- lib/jenncad/project.rb
Instance Method Summary collapse
- #output_dir ⇒ Object
- #outputs ⇒ Object
- #run ⇒ Object
- #run_export!(part, file) ⇒ Object
- #run_exports ⇒ Object
Instance Method Details
#output_dir ⇒ Object
3 4 5 |
# File 'lib/jenncad/project.rb', line 3 def output_dir "output" end |
#outputs ⇒ Object
7 8 9 |
# File 'lib/jenncad/project.rb', line 7 def outputs self.class.instance_methods(false) - [:config, :outputs, :output_dir] end |
#run ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/jenncad/project.rb', line 11 def run # load all files in subdirectories Dir.glob("*/**/*.rb").each do |file| require "./#{file}" end FileUtils.mkdir_p(output_dir) run_exports end |
#run_export!(part, file) ⇒ Object
20 21 22 |
# File 'lib/jenncad/project.rb', line 20 def run_export!(part, file) part.openscad([output_dir,file].join("/")) end |
#run_exports ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/jenncad/project.rb', line 24 def run_exports outputs.each do |name| part = self.send(name) run_export!(part, "#{name}.scad") if part.respond_to? :print part = self.send(name).print run_export!(part, "#{name}_print.scad") end end end |