Class: Rpub::Commands::Generate

Inherits:
Rpub::Command show all
Defined in:
lib/rpub/commands/generate.rb

Instance Attribute Summary

Attributes inherited from Rpub::Command

#args, #options

Instance Method Summary (collapse)

Methods inherited from Rpub::Command

#initialize

Constructor Details

This class inherits a constructor from Rpub::Command

Instance Method Details

- (Object) run



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rpub/commands/generate.rb', line 4

def run
  all = [options.styles, options.layout, options.config].all? do |b|
    b.nil? || b == false
  end

  if (options.styles.nil? && all) || (!options.styles.nil? && options.styles)
    source.write 'styles.css', source.read(Rpub.support_file('styles.css'))
  end

  if (options.layout.nil? && all) || (!options.layout.nil? && options.layout)
    source.write 'layout.html', source.read(Rpub.support_file('layout.html'))
  end

  if (options.config.nil? && all) || (!options.config.nil? && options.config)
    source.write 'config.yml', source.read(Rpub.support_file('config.yml'))
  end
end