Merge lp:~chipaca/snappy/description into lp:~snappy-dev/snappy/snappy-moved-to-github

Proposed by John Lenton on 2015-05-05
Status: Merged
Approved by: Sergio Schvezov on 2015-05-05
Approved revision: 444
Merged at revision: 441
Proposed branch: lp:~chipaca/snappy/description
Merge into: lp:~snappy-dev/snappy/snappy-moved-to-github
Prerequisite: lp:~chipaca/snappy/vendor
Diff against target: 67 lines (+16/-5)
3 files modified
snappy/common_test.go (+5/-0)
snappy/snapp.go (+7/-2)
snappy/snapp_test.go (+4/-3)
To merge this branch: bzr merge lp:~chipaca/snappy/description
Reviewer Review Type Date Requested Status
Sergio Schvezov 2015-05-05 Approve on 2015-05-05
Review via email: mp+258276@code.launchpad.net

Commit Message

Expose description for local snaps.

To post a comment you must log in.
review: Needs Information
Sergio Schvezov (sergiusens) wrote :

thanks for this, readme.md really needs to part its way (not related to your work though, good stuff)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'snappy/common_test.go'
2--- snappy/common_test.go 2015-04-30 16:56:15 +0000
3+++ snappy/common_test.go 2015-05-05 16:43:08 +0000
4@@ -71,6 +71,11 @@
5 return "", err
6 }
7
8+ readmeMd := path.Join(metaDir, "readme.md")
9+ if err := ioutil.WriteFile(readmeMd, []byte("Hello\nApp"), 0644); err != nil {
10+ return "", err
11+ }
12+
13 if err := addDefaultApparmorJSON(tempdir, "hello-app_hello_1.10.json"); err != nil {
14 return "", err
15 }
16
17=== modified file 'snappy/snapp.go'
18--- snappy/snapp.go 2015-05-05 16:43:08 +0000
19+++ snappy/snapp.go 2015-05-05 16:43:08 +0000
20@@ -166,6 +166,7 @@
21 hash string
22 isActive bool
23 isInstalled bool
24+ description string
25
26 basedir string
27 }
28@@ -474,6 +475,11 @@
29 part.isActive = true
30 }
31
32+ // get the click *title* from readme.md and use that as the *description*.
33+ if description, _, err := parseReadme(filepath.Join(part.basedir, "meta", "readme.md")); err == nil {
34+ part.description = description
35+ }
36+
37 // read hash, its ok if its not there, some older versions of
38 // snappy did not write this file
39 hashesData, err := ioutil.ReadFile(filepath.Join(part.basedir, "meta", "hashes.yaml"))
40@@ -513,8 +519,7 @@
41
42 // Description returns the description
43 func (s *SnapPart) Description() string {
44- // TODO: implement.
45- return "NOT IMPLEMENTED"
46+ return s.description
47 }
48
49 // Namespace returns the namespace
50
51=== modified file 'snappy/snapp_test.go'
52--- snappy/snapp_test.go 2015-05-05 16:43:08 +0000
53+++ snappy/snapp_test.go 2015-05-05 16:43:08 +0000
54@@ -139,9 +139,10 @@
55 snap, err := NewInstalledSnapPart(snapYaml, testNamespace)
56 c.Assert(err, IsNil)
57 c.Assert(snap, NotNil)
58- c.Assert(snap.Name(), Equals, "hello-app")
59- c.Assert(snap.Version(), Equals, "1.10")
60- c.Assert(snap.IsActive(), Equals, false)
61+ c.Check(snap.Name(), Equals, "hello-app")
62+ c.Check(snap.Version(), Equals, "1.10")
63+ c.Check(snap.IsActive(), Equals, false)
64+ c.Check(snap.Description(), Equals, "Hello")
65
66 services := snap.Services()
67 c.Assert(services, HasLen, 1)

Subscribers

People subscribed via source and target branches