Class: Slidox::CLI

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



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

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

Instance Method Details

#buildObject



28
29
30
# File 'lib/slidox/cli.rb', line 28

def build
  Slidox::Builder.new.build
end

#new(name) ⇒ Object



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

def new(name)
  source = self.class.source_root.to_s
  target = File.join(Dir.pwd, name)

  ['assets', 'slides'].each do |dir|
    Dir.glob("#{source}/#{dir}/*").
        map { |f| f.gsub("#{source}/", '') }.each do |file|
      copy_file(file, File.join(target, file))
    end
  end

  @name = name
  template('config.yml', File.join(target, 'config.yml'))
end