Class CommandLine
In: lib/command_line.rb
Parent: Object

Methods

Public Class methods

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

[Source]

    # File lib/command_line.rb, line 7
 7:   def self.set_template(args)
 8:     if args.include?("-m")
 9:       index = args.index("-m")
10:       if args[index + 1] == "demo"
11:         args[index + 1] = template("demo.rb")
12:       elsif args[index+1] == "module"
13:         args[index + 1] = template("module.rb")
14:       end
15:     elsif args.include?("--template")
16:       index = args.index("--template")
17:       if args[index + 1] == "demo"
18:         args[index + 1] = template("demo.rb")
19:       elsif args[index+1] == "module"
20:         args[index + 1] = template("module.rb")
21:       end
22:     else
23:       args << "-m" << template("blank.rb")
24:     end
25: 
26:   end

Return the file for the given template.

[Source]

    # File lib/command_line.rb, line 36
36:   def self.template(file_name)
37:     File.join(template_dir, file_name)
38:   end

Return the directory where the BrowserCMS templates reside.

[Source]

    # File lib/command_line.rb, line 29
29:   def self.template_dir
30:     current_file = File.expand_path(File.dirname(__FILE__))
31:     gem_dir = File.join(current_file, "..")
32:     template_dir = File.join(gem_dir, "templates")
33:   end

[Validate]