Merge lp:~rockstar/convoy/raw-and-min-metadata into lp:convoy

Proposed by Paul Hummer
Status: Rejected
Rejected by: Paul Hummer
Proposed branch: lp:~rockstar/convoy/raw-and-min-metadata
Merge into: lp:convoy
Diff against target: 82 lines (+19/-7)
2 files modified
convoy/meta.py (+4/-2)
convoy/tests/test_meta.py (+15/-5)
To merge this branch: bzr merge lp:~rockstar/convoy/raw-and-min-metadata

Description of the change

Since convoy isn't doing much of the heavy lifting in the toggle between raw and min versions of the js, this is my attempt at the simplest thing that could possibly work. We then use loader.js to conditionally load min or raw based on the filter: property of the debug (which is the second part of this work, and should be done after this lands.

To post a comment you must log in.

Unmerged revisions

17. By Paul Hummer

Add MINPATH to the entry

16. By Paul Hummer

Don't default to using the minified version

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'convoy/meta.py'
2--- convoy/meta.py 2011-08-17 17:49:26 +0000
3+++ convoy/meta.py 2011-08-31 22:27:24 +0000
4@@ -101,7 +101,9 @@
5 relpath = (
6 prefix + fname.replace(root + os.path.sep, "")
7 ).replace(os.path.sep, "/")
8- entry["path"] = "%s-min%s" % (
9+ entry["path"] = "%s%s" % (
10+ os.path.splitext(relpath))
11+ entry["minpath"] = "%s-min%s" % (
12 os.path.splitext(relpath))
13
14 entry["type"] = "js"
15@@ -199,7 +201,7 @@
16 value = LITERAL_RE.sub(literal_sub, json.dumps(value))
17 if key == "after" and module_info["type"] == "css":
18 value = "CORE_CSS + %s" % value
19- if key == "path":
20+ if key == "path" or key == "minpath":
21 value = value.replace(
22 '"%s/' % self.prefix, 'PREFIX + "/')
23 module_decl.append("module_info[%s] = %s" %
24
25=== modified file 'convoy/tests/test_meta.py'
26--- convoy/tests/test_meta.py 2011-08-17 19:05:23 +0000
27+++ convoy/tests/test_meta.py 2011-08-31 22:27:24 +0000
28@@ -303,7 +303,9 @@
29 prefix = got[:18]
30 modules = "\n\n".join(got.split("\n\n")[1:-1])
31 self.assertEquals(prefix, "var LAZR_CONFIG = ")
32- self.assertTrue('[PATH] = "anim/anim-min.js"' in modules)
33+ self.assertTrue('[PATH] = "anim/anim.js"' in modules)
34+ #MINPATH
35+ self.assertTrue('[MINPATH] = "anim/anim-min.js"' in modules)
36 self.assertFalse('[SKINNABLE] = FALSE' in modules)
37 self.assertTrue('[TYPE] = JS' in modules)
38 self.assertTrue('[USE] = [DOM]' in modules)
39@@ -343,7 +345,9 @@
40 '[PATH] = PREFIX + '
41 '"/anim/assets/skins/sam/anim-skin.css"' in modules)
42 self.assertTrue(
43- '[PATH] = PREFIX + "/anim/anim-min.js"' in modules)
44+ '[PATH] = PREFIX + "/anim/anim.js"' in modules)
45+ self.assertTrue(
46+ '[MINPATH] = PREFIX + "/anim/anim-min.js"' in modules)
47 self.assertTrue('[SKINNABLE] = TRUE' in modules)
48 self.assertTrue('[TYPE] = JS' in modules)
49 self.assertTrue('[TYPE] = CSS' in modules)
50@@ -384,7 +388,9 @@
51 self.assertTrue(
52 '[PATH] = "anim/assets/skins/sam/anim-skin.css"' in modules)
53 self.assertTrue(
54- '[PATH] = "anim/anim-min.js"' in modules)
55+ '[PATH] = "anim/anim.js"' in modules)
56+ self.assertTrue(
57+ '[MINPATH] = "anim/anim-min.js"' in modules)
58 self.assertTrue('[SKINNABLE] = TRUE' in modules)
59 self.assertTrue('[TYPE] = JS' in modules)
60 self.assertTrue('[TYPE] = CSS' in modules)
61@@ -418,7 +424,9 @@
62 self.assertEquals(prefix, "var LAZR_CONFIG = ")
63 self.assertFalse(' PREFIX =' in got, got)
64 self.assertTrue(
65- '[PATH] = "anim-min.js"' in modules)
66+ '[PATH] = "anim.js"' in modules)
67+ self.assertTrue(
68+ '[MINPATH] = "anim-min.js"' in modules)
69 self.assertTrue('[TYPE] = JS' in modules)
70 self.assertTrue('[USE] = [DOM]' in modules)
71 self.assertTrue('[REQUIRES] = [WIDGET]' in modules)
72@@ -469,7 +477,9 @@
73 '[PATH] = PREFIX + "/anim/assets/skins/sam/purty-anim-skin.css"'
74 in modules)
75 self.assertTrue(
76- '[PATH] = PREFIX + "/anim/anim-min.js"' in modules)
77+ '[PATH] = PREFIX + "/anim/anim.js"' in modules)
78+ self.assertTrue(
79+ '[MINPATH] = PREFIX + "/anim/anim-min.js"' in modules)
80 self.assertTrue('[SKINNABLE] = TRUE' in modules)
81 self.assertTrue('[TYPE] = JS' in modules)
82 self.assertTrue('[TYPE] = CSS' in modules)

Subscribers

People subscribed via source and target branches

to all changes: