get project templates from Basecamp API

 @return [Array<Logan::ProjectTemplate>] array of {Logan::ProjectTemplate} instances
772462
def project_templates
      response = self.class.get '/project_templates.json'
      handle_response(response, Proc.new {|h| Logan::ProjectTemplate.new(h) })
    end
888069
private Set<String> getPagePathsForTemplate(String[] templates, String rootPath, SlingHttpServletRequest request) {
    Set<String> pagePaths = new HashSet<>();

    if (templates != null && templates.length > 0) {
      try {
        NodeIterator nodes = searchNodesByTemplate(templates, rootPath, request);
        while (nodes.hasNext()) {
          Node node = nodes.nextNode();
          String path = StringUtils.removeEnd(node.getPath(), "/jcr:content");
          pagePaths.add(path);
        }
      }
      catch (RepositoryException ex) {
        log.warn("Seaching nodes by template failed.", ex);
      }
    }

    return pagePaths;
  }
544902
def _get_template_texts(source_list=None,
                        template='jinja',
                        defaults=None,
                        context=None,
                        **kwargs):
    '''
    
    '''

    ret = {'name': '_get_template_texts',
           'changes': {},
           'result': True,
           'comment': '',
           'data': []}

    if source_list is None:
        return _error(ret,
                      '_get_template_texts called with empty source_list')

    txtl = []

    for (source, source_hash) in source_list:

        context_dict = defaults if defaults else {}
        if context:
            context_dict = salt.utils.dictupdate.merge(context_dict, context)
        rndrd_templ_fn = __salt__['cp.get_template'](
            source,
            '',
            template=template,
            saltenv=__env__,
            context=context_dict,
            **kwargs
        )
        log.debug('cp.get_template returned %s (Called with: %s)',
                  rndrd_templ_fn, source)
        if rndrd_templ_fn:
            tmplines = None
            with salt.utils.files.fopen(rndrd_templ_fn, 'rb') as fp_:
                tmplines = fp_.read()
                tmplines = salt.utils.stringutils.to_unicode(tmplines)
                tmplines = tmplines.splitlines(True)
            if not tmplines:
                msg = 'Failed to read rendered template file {0} ({1})'.format(
                    rndrd_templ_fn, source
                )
                log.debug(msg)
                ret['name'] = source
                return _error(ret, msg)
            txtl.append(''.join(tmplines))
        else:
            msg = 'Failed to load template file {0}'.format(source)
            log.debug(msg)
            ret['name'] = source
            return _error(ret, msg)

    ret['data'] = txtl
    return ret
956232
def find_template(t)
      x = menus[t]
      if x
        return x, Gopher::Rendering::Menu
      end
      x = text_templates[t]
      if x
        return x, Gopher::Rendering::Text
      end
    end
231856
def get_templates(load_all=True, **kwargs):
    
    if load_all is False:
        templates = db.DBSession.query(Template).all()
    else:
        templates = db.DBSession.query(Template).options(joinedload_all('templatetypes.typeattrs')).all()

    return templates
719807
function getModulesTasks(baseTask, app) {
	var tasks = [];
	var modules = getModules(app);

	if (modules) {
		for (index = 0; index < modules.length; ++index) {
		    tasks.push(baseTask + '.' + modules[index]);
		}
	}

	return tasks;
}
1117792
def list_scan_templates
      templates = JSON.parse(AJAX.get(self, '/api/2.0/scan_templates'))
      templates['resources'].map { |t| ScanTemplateSummary.new(t) }
    end
390641
def get_template_dirs(self):
        
        def if_not_empty(dir):
            if not os.path.exists(dir):
                return
            for root, dirs, files in os.walk(dir):
                if dirs:
                    return True
                for f in files:
                    if f != 'readme.txt':
                        return True
                    
        template_dirs = [os.path.join(self.project_dir, x) for x in settings.GLOBAL.TEMPLATE_DIRS or []]
        taglibs_dirs = []
        for p in reversed(self.apps):
            app_path = get_app_dir(p)
            path = os.path.join(app_path, 'templates')
            if if_not_empty(path):
                template_dirs.append(path)

            path = os.path.join(app_path, 'taglibs')
            if if_not_empty(path):
                taglibs_dirs.append(path)

        Dispatcher.template_dirs = template_dirs
        Dispatcher.taglibs_dirs = taglibs_dirs
1169860
def find_templates(name, prefix, partial, details, key=nil, locals=[])
      return [] if @@resolver_options[:only] && !@@resolver_options[:only].include?(prefix)

      path = build_path(name, prefix)
      conditions = {
        :path    => path,
        :locale  => [normalize_array(details[:locale]).first, nil],
        :format  => normalize_array(details[:formats]),
        :handler => normalize_array(details[:handlers]),
        :partial => partial || false
      }.merge(details[:additional_criteria].presence || {})

      @@model.find_model_templates(conditions).map do |record|
        Rails.logger.debug "Rendering template from database: #{path} (#{record.format})"
        initialize_template(record)
      end
    end
107579
def get_template_names(self):
        
        if self.request.is_ajax():
            return [self.list_template_name]
        else:
            return super(Search, self).get_template_names()
999965
def get_templates(model):
    
    for template_name, template in templates.items():
        if issubclass(template.model, model):
            yield (template_name, template.layout._meta.verbose_name)
1039407
private function _getTemplateList()
    {
        $dirlist = CommonFunctions::gdc(PSI_APP_ROOT.'/templates/');
        sort($dirlist);
        foreach ($dirlist as $file) {
            $tpl_ext = substr($file, strlen($file) - 4);
            $tpl_name = substr($file, 0, strlen($file) - 4);
            if ($tpl_ext === ".css") {
                if (preg_match("/(\S+)_bootstrap$/", $tpl_name, $ar_buf)) {
                    array_push($this->_bootstrap_templates, $ar_buf[1]);
                } else {
                    array_push($this->_templates, $tpl_name);
                }
            }
        }
    }
1037844
def populate_files_from_whole_templates
        @whole_templates.each {|x| FileUtils.cp(FileUtils.join_paths(@template_path, x), FileUtils.join_paths(@install_path, @project_name, x)) } unless @whole_templates.nil?
      end
177811
def find_templates():
    
    templates = []
    templates_directory = (inspect.getsourcefile(lambda: 0).rstrip('__init__.py') +
                           'templates')
    template_files = os.listdir(templates_directory)
    for template_file in template_files:
        if template_file.startswith('.') or not template_file.endswith('.py'):
            continue
        # Hack for dev development and disutils
        try:
            template_module = importlib.import_module('templates.{}'.format(
               template_file.rstrip('.py')
            ))
        except ImportError:
            template_module = importlib.import_module('ross.templates.{}'.format(
               template_file.rstrip('.py')
            ))
        # Iterate throw items in template.
        # If there are variable ends with 'templates',
        # extend templates list with it.
        for (name, content) in template_module.__dict__.items():
            if name.endswith('templates'):
                for (regex_text, data_func) in content:
                    templates.append((re.compile(regex_text, re.IGNORECASE), data_func))
    return templates
735612
def generate_steps_templates
      Bebox::PROVISION_STEPS.each do |step|
        ssh_key = ''
        step_dir = Bebox::Provision.step_name(step)
        templates_path = Bebox::Project::templates_path
        # Generate site.pp template
        generate_file_from_template("#{templates_path}/puppet/#{step}/manifests/site.pp.erb", "#{self.path}/puppet/steps/#{step_dir}/manifests/site.pp", {nodes: []})
        # Generate hiera.yaml template
        generate_file_from_template("#{templates_path}/puppet/#{step}/hiera/hiera.yaml.erb", "#{self.path}/puppet/steps/#{step_dir}/hiera/hiera.yaml", {step_dir: step_dir})
        # Generate common.yaml template
        generate_file_from_template("#{templates_path}/puppet/#{step}/hiera/data/common.yaml.erb", "#{self.path}/puppet/steps/#{step_dir}/hiera/data/common.yaml", {step_dir: step_dir, ssh_key: ssh_key, project_name: self.shortname})
      end
    end
182997
def get_projects(custom_headers:nil)
      response = get_projects_async(custom_headers:custom_headers).value!
      response.body unless response.nil?
    end
732962
def list_report_templates
      r = execute(make_xml('ReportTemplateListingRequest', {}))
      templates = []
      if r.success
        r.res.elements.each('//ReportTemplateSummary') do |template|
          templates << ReportTemplateSummary.parse(template)
        end
      end
      templates
    end