Merge lp:~chipaca/ubuntu-push/docs-include-examples into lp:ubuntu-push/automatic

Proposed by John Lenton
Status: Merged
Approved by: Roberto Alsina
Approved revision: 139
Merged at revision: 355
Proposed branch: lp:~chipaca/ubuntu-push/docs-include-examples
Merge into: lp:ubuntu-push/automatic
Diff against target: 82 lines (+15/-45)
1 file modified
docs/_common.txt (+15/-45)
To merge this branch: bzr merge lp:~chipaca/ubuntu-push/docs-include-examples
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Review via email: mp+242777@code.launchpad.net

Commit message

Include code examples in docs (instead of repeating).

Description of the change

Make docs include the examples instead of repeating them. DRYer, and betterer.

To post a comment you must log in.
Revision history for this message
Roberto Alsina (ralsina) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'docs/_common.txt'
2--- docs/_common.txt 2014-11-13 14:36:56 +0000
3+++ docs/_common.txt 2014-11-25 13:12:39 +0000
4@@ -7,47 +7,22 @@
5 The helper receives two arguments ``infile`` and ``outfile``. The message is delivered via ``infile`` and the transformed
6 version is placed in ``outfile``.
7
8-This is the simplest possible useful helper, which simply passes the message through unchanged::
9-
10- #!/usr/bin/python3
11-
12- import sys
13- f1, f2 = sys.argv[1:3]
14- open(f2, "w").write(open(f1).read())
15-
16-Helpers need to be added to the click package manifest::
17-
18- {
19- "name": "com.ubuntu.developer.ralsina.hello",
20- "description": "description of hello",
21- "framework": "ubuntu-sdk-14.10-qml-dev2",
22- "architecture": "all",
23- "title": "hello",
24- "hooks": {
25- "hello": {
26- "apparmor": "hello.json",
27- "desktop": "hello.desktop"
28- },
29- "helloHelper": {
30- "apparmor": "helloHelper-apparmor.json",
31- "push-helper": "helloHelper.json"
32- }
33- },
34- "version": "0.2",
35- "maintainer": "Roberto Alsina <roberto.alsina@canonical.com>"
36- }
37+This is the simplest possible useful helper, which simply passes the message through unchanged:
38+
39+.. include:: example-client/helloHelper
40+ :literal:
41+
42+Helpers need to be added to the click package manifest:
43+
44+.. include:: example-client/manifest.json
45+ :literal:
46
47 Here, we created a helloHelper entry in hooks that has an apparmor profile and an additional JSON file for the push-helper hook.
48
49-helloHelper-apparmor.json must contain **only** the push-notification-client policy group and the ubuntu-push-helper template::
50+helloHelper-apparmor.json must contain **only** the push-notification-client policy group and the ubuntu-push-helper template:
51
52- {
53- "template": "ubuntu-push-helper",
54- "policy_groups": [
55- "push-notification-client"
56- ],
57- "policy_version": 1.2
58- }
59+.. include:: example-client/helloHelper-apparmor.json
60+ :literal:
61
62 And helloHelper.json must have at least a exec key with the path to the helper executable relative to the json, and optionally
63 an app_id key containing the short id of one of the apps in the package (in the format packagename_appname without a version).
64@@ -139,15 +114,10 @@
65 Security
66 ~~~~~~~~
67
68-To use the push API, applications need to request permission in their security profile, using something like this::
69+To use the push API, applications need to request permission in their security profile, using something like this:
70
71- {
72- "policy_groups": [
73- "networking",
74- "push-notification-client"
75- ],
76- "policy_version": 1.2
77- }
78+.. include:: example-client/hello.json
79+ :literal:
80
81
82 Ubuntu Push Server API

Subscribers

People subscribed via source and target branches