Refresh

This website preview.rubydoc.info/gems/inversion/1.4.0/Inversion/CLI/ApiCommand is currently offline. Cloudflare\'s Always Online™ shows a snapshot of this web page from the Internet Archive\'s Wayback Machine. To check for the live version, click Refresh.

Module: Inversion::CLI::ApiCommand

Extended by:
Subcommand
Defined in:
lib/inversion/cli/api.rb

Overview

Api command

Class Method Summary collapse

Methods included from Subcommand

display_list, display_table, error_string, exit_now!, extended, headline_string, help_now!, highlight_string, hl, load_template, output_blank_line, output_subheader, output_template_header, prompt, success_string, unless_dryrun, visible_chars

Class Method Details

.describe_publications(template) ⇒ Object

Output a list of sections the template publishes.



52
53
54
55
56
57
58
59
60
# File 'lib/inversion/cli/api.rb', line 52

def describe_publications( template )
	ptags = template.node_tree.find_all {|node| node.is_a?(Inversion::Template::PublishTag) }
	return if ptags.empty?

	pubnames = ptags.map( &:key ).map( &:to_s ).uniq.sort
	self.output_subheader "%d Publication/s" % [ pubnames.length ]
	self.display_list( pubnames )
	self.output_blank_line
end

.describe_subscriptions(template) ⇒ Object

Output a list of sections the template subscribes to.



64
65
66
67
68
69
70
71
72
# File 'lib/inversion/cli/api.rb', line 64

def describe_subscriptions( template )
	stags = template.node_tree.find_all {|node| node.is_a?(Inversion::Template::SubscribeTag) }
	return if stags.empty?

	subnames = stags.map( &:key ).map( &:to_s ).uniq.sort
	self.output_subheader "%d Subscription/s" % [ subnames.length ]
	self.display_list( subnames )
	self.output_blank_line
end

.describe_template_api(template) ⇒ Object

Output a description of the ‘template`’s attributes, subscriptions, etc.



41
42
43
44
45
46
47
48
# File 'lib/inversion/cli/api.rb', line 41

def describe_template_api( template )
	attrs = template.attributes.keys.map( &:to_s )
	return if attrs.empty?

	self.output_subheader "%d Attribute/s" % [ attrs.length ]
	self.display_list( attrs )
	self.output_blank_line
end