Class: Locomotive::Wagon::CLI::Generate

Inherits:
Thor
  • Object
show all
Includes:
CheckPath, ForceColor
Defined in:
lib/locomotive/wagon/cli.rb

Instance Method Summary collapse

Methods included from ForceColor

#force_color_if_asked

Instance Method Details

#content_type(name, *fields) ⇒ Object



78
79
80
81
82
83
84
85
86
# File 'lib/locomotive/wagon/cli.rb', line 78

def content_type(name, *fields)
  force_color_if_asked(options)

  say('The fields are missing', :red) and return false if fields.empty?

  if path = check_path!
    Locomotive::Wagon.generate :content_type, [name, fields, path], self.options
  end
end

#page(fullpath) ⇒ Object



125
126
127
128
129
130
131
132
# File 'lib/locomotive/wagon/cli.rb', line 125

def page(fullpath)
  force_color_if_asked(options)

  if path = check_path!
    self.options[:default_locales] = self.site_config(path)['locales']
    Locomotive::Wagon.generate :page, [fullpath, path], self.options
  end
end

#public_formObject



171
172
173
174
175
176
177
# File 'lib/locomotive/wagon/cli.rb', line 171

def public_form
  force_color_if_asked(options)

  if path = check_path!
    Locomotive::Wagon.generate :public_form, [path], self.options
  end
end

#relationship(source, type, target) ⇒ Object



103
104
105
106
107
108
109
# File 'lib/locomotive/wagon/cli.rb', line 103

def relationship(source, type, target)
  force_color_if_asked(options)

  if path = check_path!
    Locomotive::Wagon.generate :relationship, [source, type, target, path], self.options
  end
end

#section(slug, *settings) ⇒ Object



162
163
164
165
166
167
168
# File 'lib/locomotive/wagon/cli.rb', line 162

def section(slug, *settings)
  force_color_if_asked(options)

  if path = check_path!
    Locomotive::Wagon.generate :section, [slug, settings, path], self.options
  end
end

#site_metafieldsObject



180
181
182
183
184
185
186
# File 'lib/locomotive/wagon/cli.rb', line 180

def site_metafields
  force_color_if_asked(options)

  if path = check_path!
    Locomotive::Wagon.generate :site_metafields, [path], self.options
  end
end

#snippet(slug) ⇒ Object



142
143
144
145
146
147
148
149
# File 'lib/locomotive/wagon/cli.rb', line 142

def snippet(slug)
  force_color_if_asked(options)

  if path = check_path!
    locales = self.site_config(path)['locales']
    Locomotive::Wagon.generate :snippet, [slug, locales, path], self.options
  end
end

#webpackObject



189
190
191
192
193
194
195
# File 'lib/locomotive/wagon/cli.rb', line 189

def webpack
  force_color_if_asked(options)

  if path = check_path!
    Locomotive::Wagon.generate :webpack, [path], self.options
  end
end