Sha256: 71147b2b30a7bb16bf308c0206e45cbccde34185f3ea0aabac48a5cd8a85f352

Contents?: true

Size: 1.21 KB

Versions: 45

Compression:

Stored size: 1.21 KB

Contents

class CommandLine

  # 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
  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

  # Return the directory where the BrowserCMS templates reside.
  def self.template_dir
    current_file = File.expand_path(File.dirname(__FILE__))
    gem_dir = File.join(current_file, "..")
    template_dir = File.join(gem_dir, "templates")
  end

  # Return the file for the given template.
  def self.template(file_name)
    File.join(template_dir, file_name)
  end
end

Version data entries

45 entries across 45 versions & 5 rubygems

Version Path
browsercms-artirix-4.0.4 lib/command_line.rb
browsercms-artirix-4.0.3.3 lib/command_line.rb
browsercms-artirix-4.0.3.2 lib/command_line.rb
browsercms-artirix-4.0.3.1 lib/command_line.rb
browsercms-artirix-4.0.3 lib/command_line.rb
browsercms-artirix-4.0.2 lib/command_line.rb
browsercms-artirix-4.0.1.1 lib/command_line.rb
browsercms-artirix-4.0.0.rc1.art4 lib/command_line.rb
browsercms-4.0.0.rc1 lib/command_line.rb
browsercms-4.0.0.beta lib/command_line.rb
browsercms-4.0.0.alpha lib/command_line.rb
browsercms-3.5.7 lib/command_line.rb
browsercms-3.5.6 lib/command_line.rb
browsercms-3.5.5 lib/command_line.rb
browsercms-3.5.4 lib/command_line.rb
browsercms-3.5.3 lib/command_line.rb
browsercms-3.5.2 lib/command_line.rb
browsercms-3.5.1 lib/command_line.rb
browsercms-3.5.0 lib/command_line.rb
browsercms-3.5.0.rc3 lib/command_line.rb