Asterisk - The Open Source Telephony Project  18.5.0
Functions | Variables
make_ari_stubs Namespace Reference

Functions

def main (argv)
 
def rel (file)
 

Variables

list API_TRANSFORMS
 
 file
 
list RESOURCES_TRANSFORMS
 
 TOPDIR = os.path.dirname(os.path.abspath(__file__))
 
string WIKI_PREFIX = 'Asterisk 18'
 

Function Documentation

◆ main()

def make_ari_stubs.main (   argv)

Definition at line 69 of file make_ari_stubs.py.

References len(), and load_file().

69 def main(argv):
70  parser = OptionParser(usage="Usage %prog [resources.json] [destdir]")
71 
72  (options, args) = parser.parse_args(argv)
73 
74  if len(args) != 3:
75  parser.error("Wrong number of arguments")
76 
77  source = args[1]
78  dest_dir = args[2]
79  renderer = pystache.Renderer(search_dirs=[TOPDIR], missing_tags='strict')
80  processor = AsteriskProcessor(wiki_prefix=WIKI_PREFIX)
81 
82  # Build the models
83  base_dir = os.path.dirname(source)
84  resources = ResourceListing().load_file(source, processor)
85  for api in resources.apis:
86  api.load_api_declaration(base_dir, processor)
87 
88  # Render the templates
89  for api in resources.apis:
90  for transform in API_TRANSFORMS:
91  transform.render(renderer, api, dest_dir)
92  for transform in RESOURCES_TRANSFORMS:
93  transform.render(renderer, resources, dest_dir)
94 
def main(argv)
static int load_file(const char *filename, char **ret)
Read a TEXT file into a string and return the length.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)

◆ rel()

def make_ari_stubs.rel (   file)
Helper to get a file relative to the script's directory

@parm file: Relative file path.

Definition at line 38 of file make_ari_stubs.py.

38 def rel(file):
39  """Helper to get a file relative to the script's directory
40 
41  @parm file: Relative file path.
42  """
43  return os.path.join(TOPDIR, file)
44 

Variable Documentation

◆ API_TRANSFORMS

list API_TRANSFORMS

Definition at line 47 of file make_ari_stubs.py.

◆ file

file

◆ RESOURCES_TRANSFORMS

list RESOURCES_TRANSFORMS

Definition at line 58 of file make_ari_stubs.py.

◆ TOPDIR

TOPDIR = os.path.dirname(os.path.abspath(__file__))

Definition at line 35 of file make_ari_stubs.py.

◆ WIKI_PREFIX

string WIKI_PREFIX = 'Asterisk 18'

Definition at line 45 of file make_ari_stubs.py.