-
Notifications
You must be signed in to change notification settings - Fork 50
first stab at templating app_domain and app_name strings #627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b0c8ead
5771215
07b735f
2d06ace
10f0691
7eb54d3
9203fb2
03ad766
f727690
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |
| <html> | ||
| <head> | ||
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | ||
| <title>code.pyret.org</title> | ||
| <title>{{APP_NAME}}</title> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dumb question: does faq get templated by server.js? I forget which pages actually get all the template variables. Is it all of them?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like it doesn't: Is there any reason not to pass |
||
| <link rel="stylesheet" href="/css/reset.css" /> | ||
| <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" /> | ||
| <link rel="stylesheet" href="/css/shared.css" /> | ||
|
|
@@ -27,15 +27,15 @@ | |
| <body> | ||
| <div id="header"> | ||
| <a id="logo" href="http://www.pyret.org/"></a> | ||
| <h1>Information <code>code.pyret.org</code> Uses and Stores</h1> | ||
| <h1>Information <code>{{APP_NAME}}</code> Uses and Stores</h1> | ||
| </div> | ||
| <div id="toolbar"> | ||
| </div> | ||
| <div id="main" style="width: 40em; padding-left: 2em;"> | ||
|
|
||
| <h3>What permissions does code.pyret.org ask for and why?</h3> | ||
| <h3>What permissions does {{APP_NAME}} ask for and why?</h3> | ||
|
|
||
| <p>code.pyret.org asks for several permissions when you log in:</p> | ||
| <p>{{APP_NAME}} asks for several permissions when you log in:</p> | ||
|
|
||
| <ul> | ||
|
|
||
|
|
@@ -59,28 +59,28 @@ <h3>Where are things stored in my Drive?</h3> | |
|
|
||
| <p> | ||
| The site initially makes a single folder in your Google Drive, called | ||
| <code>code.pyret.org</code>, and stores all of your programs there, with the | ||
| <code>{{APP_NAME}}</code>, and stores all of your programs there, with the | ||
| names you choose for them. They are all created with you as the owner, and | ||
| private to your account. There is also a directory called | ||
| <code>code.pyret.org.compiled</code> that is used for caching compiled copies | ||
| <code>{{APP_NAME}}.compiled</code> that is used for caching compiled copies | ||
| of programs. | ||
| </p> | ||
|
|
||
| <p> | ||
| If you <em>publish</em> programs, the site creates a new folder, called | ||
| <code>code.pyret.org.shared</code>, and makes <em>publicly-readable | ||
| <code>{{APP_NAME}}.shared</code>, and makes <em>publicly-readable | ||
| copies</em> of programs you publish in that directory. If you delete this | ||
| files in this folder, links for those programs you have shared with others | ||
| will stop working, but any copies others have made will be theirs to keep. | ||
| Each time you publish a program, a new copy is created from its current | ||
| contents. | ||
| </p> | ||
|
|
||
| <h3>How can I remove the access code.pyret.org has to my data?</h3> | ||
| <h3>How can I remove the access {{APP_NAME}} has to my data?</h3> | ||
|
|
||
| <p> You can always go to <a | ||
| href="https://security.google.com/settings/security/permissions?pli=1">https://security.google.com/settings/security/permissions?pli=1</a> | ||
| and remove all access that code.pyret.org has to your account. | ||
| and remove all access that {{APP_NAME}} has to your account. | ||
| Your programs and the created folders will <em>not</em> be | ||
| deleted if you do so. You can always manually delete the folder and its | ||
| contents yourself.</p> | ||
|
|
@@ -98,7 +98,7 @@ <h3>How can I see old versions of my programs?</h3> | |
|
|
||
| <h3 id="logging">What information is sent back to the Pyret team?</h3> | ||
|
|
||
| <p>We collect basic information about your use of code.pyret.org to help us | ||
| <p>We collect basic information about your use of {{APP_NAME}} to help us | ||
| improve the language and editor, and enable some debugging. We send back | ||
| information about errors, authentication, whether features such as the | ||
| type-checker are used, and preferences (such as which mode you choose to | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| var assert = require("assert"); | ||
| var tester = require("../test-util/util.js"); | ||
| var webdriver = require("selenium-webdriver"); | ||
|
|
||
| // Add endpoints here to extend template-variable checking to more static pages | ||
| var static_pages = [ | ||
| "/faq", | ||
| ]; | ||
|
|
||
| describe("Make sure template variables are used in static pages", function() { | ||
| static_pages.forEach(function(endpoint) { | ||
| describe(endpoint, function() { | ||
| beforeEach(tester.setup); | ||
| afterEach(tester.teardown); | ||
|
|
||
| it("should substitute APP_NAME and APP_DOMAIN", function(done) { | ||
| this.timeout(20000); | ||
| var self = this; | ||
|
|
||
| self.browser.get(self.base + endpoint); | ||
|
|
||
| // Verify the page title does not contain raw Mustache tokens | ||
| self.browser.getTitle().then(function(title) { | ||
| assert.ok( | ||
| !title.includes("{{APP_NAME}}"), | ||
| endpoint + " title should not contain unsubstituted {{APP_NAME}}, got: " + title | ||
| ); | ||
| assert.ok( | ||
| title.length > 0, | ||
| endpoint + " title should not be empty" | ||
| ); | ||
| }); | ||
|
|
||
| // Verify the page body does not contain any raw Mustache tokens | ||
| self.browser.findElement(webdriver.By.tagName("body")).getText().then(function(bodyText) { | ||
| assert.ok( | ||
| !bodyText.includes("{{APP_NAME}}"), | ||
| endpoint + " body should not contain unsubstituted {{APP_NAME}}" | ||
| ); | ||
| assert.ok( | ||
| !bodyText.includes("{{APP_DOMAIN}}"), | ||
| endpoint + " body should not contain unsubstituted {{APP_DOMAIN}}" | ||
| ); | ||
| assert.ok( | ||
| !bodyText.includes("{{"), | ||
| endpoint + " body should not contain any unsubstituted Mustache tokens" | ||
| ); | ||
| }); | ||
|
|
||
| // Verify that the actual APP_NAME value appears somewhere on the page | ||
| // (Since .env sets APP_NAME=TESTING, this confirms real substitution occurred) | ||
| var appName = process.env.APP_NAME; | ||
| if (appName) { | ||
| self.browser.findElement(webdriver.By.tagName("body")).getText().then(function(bodyText) { | ||
| assert.ok( | ||
| bodyText.includes(appName), | ||
| endpoint + " body should contain the APP_NAME value '" + appName + "'" | ||
| ); | ||
| }); | ||
| } | ||
|
|
||
| self.browser.call(done); | ||
| }); | ||
| }); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the
&here? Any escaping that we should include/avoid? Should probably justify the difference.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oooh, good call.