class Sutty::Cli::Commands::Layout

Attributes

name[R]

Public Class Methods

layouts() click to toggle source
   # File lib/sutty/cli/commands/layout.rb
23 def self.layouts
24   @@layouts ||= Dir.glob(File.join('_data', 'layouts') + '/*.yml').map do |d|
25     File.basename d, '.yml'
26   end
27 end
new(name, options) click to toggle source
   # File lib/sutty/cli/commands/layout.rb
13 def initialize(name, options)
14   @name = name
15   @options = options
16 end

Public Instance Methods

execute(input: $stdin, output: $stdout) click to toggle source
   # File lib/sutty/cli/commands/layout.rb
18 def execute(input: $stdin, output: $stdout)
19   TTY::File.create_file data_layout, YAML.dump(data_default_fields)
20   TTY::File.create_file html_layout, "---\nlayout: default\n---\n\n"
21 end

Private Instance Methods

data_default_fields() click to toggle source
   # File lib/sutty/cli/commands/layout.rb
31 def data_default_fields
32   @data_default_fields ||= {
33     'title' => {
34       'type' => 'string',
35       'label' => {
36         'es' => 'Título',
37         'en' => 'Title'
38       },
39       'help' => {
40         'es' => '',
41         'en' => ''
42       }
43     }
44   }
45 end
data_layout() click to toggle source
   # File lib/sutty/cli/commands/layout.rb
47 def data_layout
48   @data_layout ||= File.join('_data', 'layouts', name + '.yml')
49 end
html_layout() click to toggle source
   # File lib/sutty/cli/commands/layout.rb
51 def html_layout
52   @html_layout ||= File.join('_layouts', name + '.html')
53 end