Class | Limelight::Templates::ProductionTemplater |
In: |
lib/limelight/templates/production_templater.rb
|
Parent: | Templater |
A Templater that creates all the files and directories for a production. When used with "love_story" as the production_path, the following will be the result.
creating directory: ./love_story creating file: ./love_story/production.rb creating file: ./love_story/stages.rb creating file: ./love_story/styles.rb
tokens | [R] |
To create a ProductionTemplater, provide a production_path and the name of the default scene.
# File lib/limelight/templates/production_templater.rb, line 25 25: def initialize(options) 26: production_path = options[:production_path] 27: default_scene_name = options[:scene_path] 28: super(File.dirname(production_path), Templater.source_dir) 29: @production_path = File.basename(production_path) 30: @spec_path = File.join(@production_path, options[:spec_path]) 31: @tokens = {} 32: @tokens[:DEFAULT_SCENE_NAME] = default_scene_name 33: @tokens[:PRODUCTION_NAME] = File.basename(production_path).titleized 34: @tokens[:CURRENT_VERSION] = Limelight::VERSION::STRING 35: end
Generates the files
# File lib/limelight/templates/production_templater.rb, line 39 39: def generate 40: file(File.join(@production_path, "production.rb"), "production/production.rb.template", @tokens) 41: file(File.join(@production_path, "stages.rb"), "production/stages.rb.template", @tokens) 42: file(File.join(@production_path, "styles.rb"), "production/styles.rb.template", @tokens) 43: file(File.join(@spec_path, "spec_helper.rb"), "production/spec/spec_helper.rb.template", @tokens) 44: end