Class: Locomotive::Wagon::Generators::SiteMetafields

Inherits:
Thor::Group
  • Object
show all
Includes:
CLI::ForceColor, Thor::Actions
Defined in:
lib/locomotive/wagon/generators/site_metafields.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CLI::ForceColor

#force_color_if_asked

Class Method Details

.source_rootObject



46
47
48
# File 'lib/locomotive/wagon/generators/site_metafields.rb', line 46

def self.source_root
  File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'generators', 'site_metafields')
end

Instance Method Details

#add_instructionsObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/locomotive/wagon/generators/site_metafields.rb', line 21

def add_instructions
  append_to_file 'config/site.yml', <<-EOF

# You can control the display of the "Properties" section in the back-office
# metafields_ui:
#   label: Store settings # use a hash for localized versions
#   icon: shopping-cart # FontAwesome icons without the leading "fa-" string.
#   hint: "Lorem ipsum..."

# Each site can have its own set of custom properties organized in namespaces.
# First, define namespaces and their fields in the config/metafields_schema.yml file.
# Finally, set default values below as described in the example.
# You can access them in your liquid templates and snippets:
#   {{ site.metafields.<namespace>.<field> }}
#
# Example:
#
# metafields:
#   shop:
#     address: 700 South Laflin Street
#   theme:
#     background_image: "/samples/background.png"
EOF
end

#create_metafields_schemaObject



15
16
17
18
19
# File 'lib/locomotive/wagon/generators/site_metafields.rb', line 15

def create_metafields_schema
  path = File.join(target_path, 'config', 'metafields_schema.yml')

  template 'schema.yml.tt', path
end