Class: Generators::Builder

Inherits:
Templater::Generator
  • Object
show all
Defined in:
lib/staticmatic/builder.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.file(name, *args, &block) ⇒ Object



25
26
27
28
29
# File 'lib/staticmatic/builder.rb', line 25

def self.file(name, *args, &block)
  return if args.first.include?('/sass/')
  args[1] = args[0].gsub('pages/', '') if (args[0] === args[1])
  super(name, *args, &block)
end

.source_rootObject

Define source and desintation



10
# File 'lib/staticmatic/builder.rb', line 10

def self.source_root; Dir.pwd; end

.template(name, *args, &block) ⇒ Object

Override template to ask staticmatic for the correct extension to output



14
15
16
17
18
19
20
21
22
23
# File 'lib/staticmatic/builder.rb', line 14

def self.template(name, *args, &block)
  return if args.first.include?('/layout/')
  return if File.basename(args.first)[0,1] == '_'

  if (args[0] === args[1])
    args[1] = args[0].gsub(File.extname(args.first), '').gsub('pages/', '')
  end

  super(name, *args, &block)
end

Instance Method Details

#destination_rootObject



11
# File 'lib/staticmatic/builder.rb', line 11

def destination_root; File.join(Dir.pwd, 'build'); end