Module: Templatron

Defined in:
lib/templatron/cli.rb,
lib/templatron/config.rb,
lib/templatron/version.rb,
lib/templatron/collector.rb,
lib/templatron/generator.rb

Defined Under Namespace

Classes: AbstractCommand, BuildCommand, Collector, Generator, ListCommand, MainCommand

Constant Summary collapse

PREFIX =

This part will be joined to the user Dir.home

'.templatron'
PLACEHOLDER_REG =
/{\$(\d*)\W?([\w\s]*)}/
VERSION =
'0.2.1'

Class Method Summary collapse

Class Method Details

.executeObject

Public: CLI Stuff, parse command line inputs to determine what to do



67
68
69
# File 'lib/templatron/cli.rb', line 67

def self.execute
  MainCommand.run
end

.placeholder_block_reg(key) ⇒ Object

Public: Retrieve the placeholder reg block which contains the whole placeholder markup

key - Key to look for

Returns the regex needed to retrieve the whole placeholder markup



29
30
31
# File 'lib/templatron/config.rb', line 29

def self.placeholder_block_reg(key)
  /({\$\d*\W?[#{key}]*})/
end

.placeholder_reg(match_i) ⇒ Object

Public: Retrieve the placeholder reg for replacement

match_i - Match key

Returns the regex for replacement



19
20
21
# File 'lib/templatron/config.rb', line 19

def self.placeholder_reg(match_i)
  /{\$#{match_i}\W?([\w\s]*)}/
end

.templates_pathObject

Public: Retrieve the full path which stores templates



10
11
12
# File 'lib/templatron/config.rb', line 10

def self.templates_path
  File.join(Dir.home, PREFIX)
end