Class: Mdtex::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/mdtex/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



7
8
9
# File 'lib/mdtex/cli.rb', line 7

def self.source_root
  File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
end

Instance Method Details

#init(name) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/mdtex/cli.rb', line 12

def init(name)
  templates = {
    "gitignore.tt" => ".gitignore",
    "Rakefile.tt" => "Rakefile",
    "config.yml.tt" => "config.yml",
    "src/document.tex.tt" => "src/document.tex"
  }

  templates.each do |src, dist|
    template(src, "#{name}/#{dist}")
  end

  Dir.chdir(name) { `git init; git add .` }
end