Method: CommandLine.set_template
- Defined in:
- lib/command_line.rb
.set_template(args) ⇒ Object
Sets the correct Rails application to use. -m demo -> Becomes the /path/to/browsercms/gem/templates/demo.rb -m module -> Becomes the /path/to/browsercms/gem/templates/modeule.rb If blank, becomes the /path/to/browsercms/gem/templates/blank.rb
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/command_line.rb', line 7 def self.set_template(args) if args.include?("-m") index = args.index("-m") if args[index + 1] == "demo" args[index + 1] = template("demo.rb") elsif args[index+1] == "module" args[index + 1] = template("module.rb") end elsif args.include?("--template") index = args.index("--template") if args[index + 1] == "demo" args[index + 1] = template("demo.rb") elsif args[index+1] == "module" args[index + 1] = template("module.rb") end else args << "-m" << template("blank.rb") end end |