-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
(Partially) Fix #2100: add cache slugs. #2208
Conversation
Current coverage is 48.00% (diff: 15.46%)@@ develop #2208 diff @@
==========================================
Files 185 190 +5
Lines 15852 15914 +62
Methods 2720 2733 +13
Messages 0 0
Branches 2689 2693 +4
==========================================
+ Hits 7609 7639 +30
- Misses 8243 8275 +32
Partials 0 0
|
@@ -14,3 +14,7 @@ venv/ | |||
.DS_Store | |||
.idea | |||
.vagrant/* | |||
|
|||
# required for cache slugs |
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.
I think you can add more detail to this comment -- please give enough detail so that someone who is not familiar with all our discussions knows what's going on. It's OK for the comment to span multiple lines.
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.
updated.
Hi @gvishal, this is a good first pass; I've made some comments. Let me know if anything's unclear! One question: did you run the backend tests at all before you committed -- or test this manually? The Travis checks all seem to be failing. I would strongly advise at least testing things manually before you submit a PR; it helps you fix accidental errors. |
…e level html files and corresponding directives/controllers to use it, addressed review comments
@seanlip those tests failed since |
# Oppia uses cache slugs for various resources and we need separate resource | ||
# directories for dev and prod. Resource directories for prod are generated | ||
# via build.py and should not be committed to the repo. | ||
static/prod |
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.
add TODO?
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.
Already there in build.py.
Added methods to return static resource url. Modified app.yaml.
Still reviewing. Lots of changes to catch up on. |
var generatedTargetDir = path.join( | ||
'third_party', 'generated', | ||
isMinificationNeeded ? 'prod' : 'dev'); | ||
isMinificationNeeded ? 'prod' : cacheSlugDev); |
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.
I'm confused about this. This refers to the files generated in /third_party/generated. I don't see why anything needs to change here, nor what it has to do with the cache slug?
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.
This is because we need to make it uniform to use cache slugs. eg. Right now we have urls like /third_party/generated/css/file.css
else we'll have /third_party/generated/dev/css/file.css
, which is a problem.
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.
Oh, sorry -- I seem to have missed this comment, or read an older version of it.
Yep, sounds like there's a good reason for this. Can you add a (long) comment explaining in detail why we choose '' (to someone who's never heard of cache slugs)? That would make this more maintainable going forward.
Thanks!
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.
added
Hi Vishal, I did a fairly careful check of this, and I also ran it with --prod_env. It looks generally good, I have a bunch of comments which I've noted inline. Two other issues:
Also, I noticed some other issues like missing images for interactions and gadgets. Please make sure you test your work by going to the various pages and making sure that things load properly -- don't depend on the reviewer to find them. I may well have missed others. If you want to be thorough, also look at the requests that are being made to the server (in the terminal), and make sure that they're going to the right places; make a note as well of the still-uncached ones, since this is what you'll need to fix in the next stage. Thanks! Also, /cc @BenHenning for info. |
@seanlip For the css issue we can do double math. See: yui/yuicompressor#59 (comment). Or, write a custom fn which modifies the minified css See: yui/yuicompressor#59 (comment) |
Hi @gvishal, replied to your comments! Re the CSS issue, let's do double math for now. Could you please fix that in your PR, and also add a comment to reference the YUI thread in each of the places where you do double math? Thanks! |
var generatedTargetDir = path.join( | ||
'third_party', 'generated', | ||
isMinificationNeeded ? 'prod' : cacheSlugDev); | ||
isMinificationNeeded ? 'prod' : ''); |
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.
Why not keep as 'dev' (like it was before)? Otherwise you kind of end up with a weird dir structure: prod becomes a sibling of css, fonts, js.
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.
Sorry, ignore. Wrote this before seeing your other comment.
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.
Okay.
@@ -325,5 +325,6 @@ <h2 class="activity-title protractor-test-exp-summary-tile-title"> | |||
{{ include_js_file('components/SharingLinksDirective.js') }} | |||
{{ include_js_file('dashboard/Dashboard.js') }} | |||
{{ include_js_file('domain/dashboard/DashboardBackendApiService.js') }} | |||
{{ include_js_file('domain/utilities/UrlInterpolationService.js') }} |
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.
@gvishal I thought you were dropping this import from this and all other pages where it isn't needed?
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.
done.
Just one comment, but otherwise this looks ready for merge. Two things: (a) did you test the new CSS on prod, and does it look correct? Thanks! |
Update: The linter is successfully able to lint both py + js files, but gets stuck processing |
Aha. You could set the linter to ignore the build/ directory? There's no As a note, in develop, there should only be around 244 files to lint. On Friday, July 22, 2016, Vishal Gupta notifications@github.com wrote:
|
I was thinking about the same thing, but build/ wouldn't be generated on travis would it? Also, there are 339 js files in my branch. Here's travis logs for pylint on a separate PR: https://travis-ci.org/oppia/oppia/jobs/146661059 It's an issue with waiting for threads to return. |
Hm, yeah, I don't know why build/ is being generated on travis. Also good call, I was only referring to py files when I said 244. Not sure why the js files are causing issues. Is it the same file each time? What if you run lint on only that file in isolation? (Not sure if it's the specific file, or the number of files, that's the problem.) |
LGTM. Let's hope the travis checks pass, and then we can merge this! |
* Added cache slugs for images and modified all references to the images. * Added interpolation service to get static image url, modified non-page level html files and corresponding directives/controllers to use it, addressed review comments * Modified /script tags * Added cache slugs for i18n * Fixed failing test and added i18n/prod to git ignore. * Cache slugs new approach POC * Modified references for images, scripts and i18n. Added methods to return static resource url. Modified app.yaml. * Modified gulp file and references to oppia.css and third_party css and js files. * Added slugs to extensions * Fixed test for get_cache_slug * Modified build.py and deploy.py * Addressed review comments * Modify imports * Modified src to ng-src and other review comments fixed. * Modified build.py * Minor change * Removed feconf.CACHE_SLUG_DEV and refactored * Added random cache slug * Refactored code. * Modified references for extensions, added extensions to build process and refactored methods in UrlInterpolationService * Fixed bug * Addressed review comments. * Fix failing tests * Fixed bug. * Added tests for urlinterpolationservice. * Added interpolation for interactions and logic_proof.html * Addressed review comments * Addressed review comments * Removed unnecessary include from templates * Modified precommit linter script to fix endless waiting * Commented script and added assets/scripts to exclusions.
* Added cache slugs for images and modified all references to the images. * Added interpolation service to get static image url, modified non-page level html files and corresponding directives/controllers to use it, addressed review comments * Modified /script tags * Added cache slugs for i18n * Fixed failing test and added i18n/prod to git ignore. * Cache slugs new approach POC * Modified references for images, scripts and i18n. Added methods to return static resource url. Modified app.yaml. * Modified gulp file and references to oppia.css and third_party css and js files. * Added slugs to extensions * Fixed test for get_cache_slug * Modified build.py and deploy.py * Addressed review comments * Modify imports * Modified src to ng-src and other review comments fixed. * Modified build.py * Minor change * Removed feconf.CACHE_SLUG_DEV and refactored * Added random cache slug * Refactored code. * Modified references for extensions, added extensions to build process and refactored methods in UrlInterpolationService * Fixed bug * Addressed review comments. * Fix failing tests * Fixed bug. * Added tests for urlinterpolationservice. * Added interpolation for interactions and logic_proof.html * Addressed review comments * Addressed review comments * Removed unnecessary include from templates * Modified precommit linter script to fix endless waiting * Commented script and added assets/scripts to exclusions.
Fix #2100: add cache slugs for.
/cc @seanlip @BenHenning @maitbayev