fix(activities): fully qualified activity names

Fixes #7
This commit is contained in:
Sebastian Thiel
2015-03-14 11:23:01 +01:00
parent b43eb0e301
commit 8006bb8ca9
3 changed files with 17 additions and 9 deletions

View File

@@ -43,7 +43,7 @@ Handle the following *Resources* with ease from the central ${link('hub', hub_ur
<%
md_methods = list()
for method in sorted(c.rta_map[r]):
md_methods.append(link('*%s*' % ' '.join(n.lower() for n in reversed(method.split('.'))),
md_methods.append(link('*%s*' % split_camelcase_s(method),
'struct.%s.html' % mb_type(r, method)))
md_resource = split_camelcase_s(r)
sn = singular(canonical_type_name(r))
@@ -154,7 +154,7 @@ Arguments will always be copied or cloned into the builder, to make them indepen
<%def name="test_hub(hub_type, comments=True)">\
use std::default::Default;
use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
# use ${util.library_name()}::${hub_type};
use ${util.library_name()}::${hub_type};
% if comments:
// Get an ApplicationSecret instance by some means. It contains the `client_id` and `client_secret`,
@@ -223,7 +223,7 @@ The **${util.library_name()}** library was generated by ${put_and(copyright.auth
under the *${copyright.license_abbrev}* license.
You can read the full text at the repository's [license file][repo-license].
[repo-license]: ${cargo.repo_base_url + 'LICENSE.md'}
[repo-license]: ${cargo.repo_base_url + '/LICENSE.md'}
</%def>

View File

@@ -257,13 +257,13 @@ ${self._setter_fn(resource, method, m, p, part_prop, ThisType, c)}\
<%block filter="test_block_filter">\
${capture(util.test_prelude) | hide_filter}\
% if request_value:
# use ${util.library_name()}::${request_value.id};
use ${util.library_name()}::${request_value.id};
% endif
% if handle_result:
# use ${util.library_name()}::cmn::Result;
use ${util.library_name()}::cmn::Result;
% endif
% if media_params:
# use std::fs;
use std::fs;
% endif
<%block filter="test_fn_filter">\
${capture(lib.test_hub, hub_type_name, comments=show_all) | hide_filter}

View File

@@ -1,7 +1,7 @@
<%!
from util import (schema_markers, rust_doc_comment, mangle_ident, to_rust_type, put_and,
IO_TYPES, activity_split, enclose_in, REQUEST_MARKER_TRAIT, mb_type, indent_all_but_first_by,
NESTED_TYPE_SUFFIX, RESPONSE_MARKER_TRAIT)
NESTED_TYPE_SUFFIX, RESPONSE_MARKER_TRAIT, split_camelcase_s)
default_traits = ('RustcEncodable', 'Clone', 'Default')
%>\
@@ -107,8 +107,16 @@ ${s.get('description', 'There is no detailed description.')}
This type is used in activities, which are methods you may call on this type or where this type is involved in.
The list links the activity name, along with information about where it is used (one of ${put_and(enclose_in('*', IO_TYPES))}).
${''.join("* [%s](struct.%s.html) (%s)\n" % (activity_split(a)[2], mb_type(*activity_split(a)[1:3]), iot and '|'.join(iot) or 'none')
for a, iot in c.sta_map[s.id].iteritems())}
% for a, iot in c.sta_map[s.id].iteritems():
<%
_, name, method = activity_split(a)
struct_url = 'struct.' + mb_type(name, method) + '.html'
method_name = split_camelcase_s(method) + ' ' + split_camelcase_s(name)
value_type = '|'.join(iot) or 'none'
%>\
* [${method_name}](${struct_url}) (${value_type})
% endfor
% else:
This type is not used in any activity, and only used as *part* of another schema.