Skip to content

Commit 86a5c5e

Browse files
Merge pull request #3 from angular/master
Update upstream
2 parents 8998a9e + 233a93f commit 86a5c5e

File tree

16 files changed

+76
-53
lines changed

16 files changed

+76
-53
lines changed

.travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ jobs:
7878
keep_alive &
7979
deploy:
8080
- provider: firebase
81+
# the upload folder for firebase is configured in /firebase.json
8182
skip_cleanup: true
8283
token:
8384
secure: $FIREBASE_TOKEN
@@ -92,7 +93,7 @@ jobs:
9293
secret_access_key:
9394
secure: tHIFdSq55qkyZf9zT/3+VkhUrTvOTMuswxXU3KyWaBrSieZqG0UnUDyNm+n3lSfX95zEl/+rJAWbfvhVSxZi13ndOtvRF+MdI1cvow2JynP0aDSiPffEvVrZOmihD6mt2SlMfhskr5FTduQ69kZG6DfLcve1PPDaIwnbOv3phb8=
9495
bucket: code-angularjs-org-338b8.appspot.com
95-
local-dir: upload
96+
local-dir: uploadCode
9697
detect_encoding: true # detects gzip compression
9798
on:
9899
repo: angular/angular.js

Gruntfile.js

+31-4
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,29 @@ module.exports = function(grunt) {
311311
copy: {
312312
i18n: {
313313
files: [
314-
{ src: 'src/ngLocale/**', dest: 'build/i18n/', expand: true, flatten: true }
314+
{
315+
src: 'src/ngLocale/**',
316+
dest: 'build/i18n/',
317+
expand: true,
318+
flatten: true
319+
}
320+
]
321+
},
322+
deployFirebaseDocs: {
323+
files: [
324+
// The source files are needed by the embedded examples in the docs app.
325+
{
326+
src: 'build/angular*.{js.map,min.js}',
327+
dest: 'uploadDocs/',
328+
expand: true,
329+
flatten: true
330+
},
331+
{
332+
cwd: 'build/docs',
333+
src: '**',
334+
dest: 'uploadDocs/',
335+
expand: true
336+
}
315337
]
316338
}
317339
},
@@ -326,14 +348,14 @@ module.exports = function(grunt) {
326348
dot: true,
327349
dest: dist + '/'
328350
},
329-
firebaseCodeDeploy: {
351+
deployFirebaseCode: {
330352
options: {
331353
mode: 'gzip'
332354
},
333355
src: ['**'],
334356
cwd: 'build',
335357
expand: true,
336-
dest: 'upload/' + deployVersion + '/'
358+
dest: 'uploadCode/' + deployVersion + '/'
337359
}
338360
},
339361

@@ -427,14 +449,19 @@ module.exports = function(grunt) {
427449
'collect-errors',
428450
'write',
429451
'docs',
430-
'copy',
452+
'copy:i18n',
431453
'compress:build'
432454
]);
433455
grunt.registerTask('ci-checks', [
434456
'ddescribe-iit',
435457
'merge-conflict',
436458
'eslint'
437459
]);
460+
grunt.registerTask('prepareFirebaseDeploy', [
461+
'package',
462+
'compress:deployFirebaseCode',
463+
'copy:deployFirebaseDocs'
464+
]);
438465
grunt.registerTask('default', ['package']);
439466
};
440467

docs/app/e2e/app.scenario.js

+19
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,25 @@ describe('docs.angularjs.org', function() {
4949
});
5050

5151

52+
it('should include the files for the embedded examples from the same domain', function() {
53+
browser.get('build/docs/index-production.html#!api/ng/directive/ngClick');
54+
55+
var origin = browser.executeScript('return document.location.origin;');
56+
57+
var exampleIFrame = element(by.name('example-ng-click'));
58+
59+
// This is technically an implementation detail, but if this changes, then there's a good
60+
// chance the deployment process changed
61+
expect(exampleIFrame.getAttribute('src')).toContain('examples/example-ng-click/index.html');
62+
63+
browser.switchTo().frame('example-ng-click');
64+
65+
var scriptEl = element(by.tagName('script'));
66+
67+
// Ensure the included file is from the same domain
68+
expect(scriptEl.getAttribute('src')).toContain(origin);
69+
});
70+
5271

5372
it('should be resilient to trailing slashes', function() {
5473
browser.get('build/docs/index-production.html#!/api/ng/function/angular.noop/');

docs/app/src/app.js

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ angular.module('docsApp', [
1414
'search',
1515
'tutorials',
1616
'versions',
17-
'deployment',
1817
'ui.bootstrap.dropdown'
1918
])
2019

docs/app/src/examples.js

+1-7
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,7 @@ angular.module('examples', [])
1818
return {
1919
restrict: 'C',
2020
scope : true,
21-
controller : ['$scope', 'DEPLOYMENT', function($scope, DEPLOYMENT) {
22-
var exampleIndexFile = (DEPLOYMENT === 'default' ? 'index' : 'index-' + DEPLOYMENT) + '.html';
23-
24-
$scope.getExampleIndex = function(basePath) {
25-
return basePath + '/' + exampleIndexFile;
26-
};
27-
21+
controller : ['$scope', function($scope) {
2822
$scope.setTab = function(index) {
2923
var tab = $scope.tabs[index];
3024
$scope.activeTabIndex = index;

docs/config/index.js

+1-11
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,6 @@ module.exports = new Package('angularjs', [
112112
docTypes: ['indexPage'],
113113
pathTemplate: '.',
114114
outputPathTemplate: '${id}.html'
115-
}, {
116-
docTypes: ['deploymentData'],
117-
pathTemplate: '.',
118-
outputPathTemplate: 'js/${id}.js'
119115
});
120116

121117
computePathsProcessor.pathTemplates.push({
@@ -129,14 +125,8 @@ module.exports = new Package('angularjs', [
129125
outputPathTemplate: 'partials/${area}/${moduleName}/${groupType}.html'
130126
});
131127

132-
computePathsProcessor.pathTemplates.push({
133-
docTypes: ['example'],
134-
pathTemplate: 'examples/${example.id}',
135-
outputPathTemplate: 'examples/${example.id}/index${deploymentQualifier}.html'
136-
});
137-
138128
computeIdsProcessor.idTemplates.push({
139-
docTypes: ['overview', 'tutorial', 'e2e-test', 'indexPage', 'deploymentData'],
129+
docTypes: ['overview', 'tutorial', 'e2e-test', 'indexPage'],
140130
getId: function(doc) { return doc.fileInfo.baseName; },
141131
getAliases: function(doc) { return [doc.id]; }
142132
});

docs/config/processors/index-page.js

-10
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,7 @@ module.exports = function generateIndexPagesProcessor() {
3535

3636
indexDoc.id = 'index' + (deployment.name === 'default' ? '' : '-' + deployment.name);
3737

38-
var deploymentDoc = {
39-
docType: 'deploymentData',
40-
id: 'deployment-data-' + deployment.name,
41-
template: 'angular-service.template.js',
42-
ngModuleName: 'deployment',
43-
serviceName: 'DEPLOYMENT',
44-
serviceValue: deployment.name
45-
};
46-
4738
docs.push(indexDoc);
48-
docs.push(deploymentDoc);
4939
});
5040
}
5141
};

docs/config/services/deployments/debug.js

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ module.exports = function debugDeployment(getVersion) {
2626
'js/all-versions-data.js',
2727
'js/pages-data.js',
2828
'js/nav-data.js',
29-
'js/deployment-data-debug.js',
3029
'js/docs.js'
3130
],
3231
stylesheets: [

docs/config/services/deployments/default.js

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ module.exports = function defaultDeployment(getVersion) {
2626
'js/all-versions-data.js',
2727
'js/pages-data.js',
2828
'js/nav-data.js',
29-
'js/deployment-data-default.js',
3029
'js/docs.min.js'
3130
],
3231
stylesheets: [

docs/config/services/deployments/jquery.js

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ module.exports = function jqueryDeployment(getVersion) {
3030
'js/all-versions-data.js',
3131
'js/pages-data.js',
3232
'js/nav-data.js',
33-
'js/deployment-data-jquery.js',
3433
'js/docs.min.js'
3534
],
3635
stylesheets: [

docs/config/services/deployments/production.js

+10-11
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,24 @@ var angularCodeUrl = '//code.angularjs.org/';
77

88
var cdnUrl = googleCdnUrl + versionInfo.cdnVersion;
99

10-
// The plnkr examples must use the code.angularjs.org repo for the snapshot,
11-
// and the cdn for the tagged version and, if the build is not tagged, the currentVersion.
12-
//
13-
// The currentVersion may not be available on the cdn (e.g. if built locally, or hasn't been pushed
14-
// yet). This will lead to a 404, but this is preferable to loading a version with which the example
15-
// might not work (possibly in subtle ways).
16-
var examplesCdnUrl = versionInfo.currentVersion.isSnapshot ?
10+
// The "examplesCdnUrl" here applies to the examples when they are opened in plnkr.co.
11+
// The embedded examples instead always include the files from the *default* deployment,
12+
// to ensure that the source files are always available.
13+
// The plnkr examples must always use the code.angularjs.org source files.
14+
// We cannot rely on the CDN files here, because they are not deployed by the time
15+
// docs.angularjs.org and code.angularjs.org need them.
16+
var examplesDependencyPath = versionInfo.currentVersion.isSnapshot ?
1717
(angularCodeUrl + 'snapshot') :
18-
(googleCdnUrl + (versionInfo.currentVersion.version || versionInfo.currentVersion));
18+
(angularCodeUrl + (versionInfo.currentVersion.version || versionInfo.currentVersion.version));
1919

2020
module.exports = function productionDeployment(getVersion) {
2121
return {
2222
name: 'production',
2323
examples: {
2424
commonFiles: {
25-
scripts: [examplesCdnUrl + '/angular.min.js']
25+
scripts: [examplesDependencyPath + '/angular.min.js']
2626
},
27-
dependencyPath: examplesCdnUrl + '/'
27+
dependencyPath: examplesDependencyPath
2828
},
2929
scripts: [
3030
cdnUrl + '/angular.min.js',
@@ -43,7 +43,6 @@ module.exports = function productionDeployment(getVersion) {
4343
'https://code.angularjs.org/snapshot/docs/js/all-versions-data.js',
4444
'js/pages-data.js',
4545
'js/nav-data.js',
46-
'js/deployment-data-production.js',
4746
'js/docs.min.js'
4847
],
4948
stylesheets: [

docs/config/templates/examples/runnableExample.template.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</div>
1919
{% endfor %}
2020

21-
<iframe class="runnable-example-frame" ng-src="{{getExampleIndex('{$ doc.example.deployments.default.path $}')}}" name="{$ doc.example.id $}"></iframe>
21+
<iframe class="runnable-example-frame" src="{$ doc.example.deployments.default.outputPath $}" name="{$ doc.example.id $}"></iframe>
2222
</div>
2323
</div>
2424

docs/content/guide/production.ngdoc

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ and adds CSS classes to data-bound elements:
2020
CSS class are attached to the corresponding element. These scope references can then be accessed via
2121
`element.scope()` and `element.isolateScope()`.
2222

23+
- Placeholder comments for structural directives will contain information about what directive
24+
and binding caused the placeholder. E.g. `<!-- ngIf: shouldShow() -->`.
25+
2326
Tools like [Protractor](https://github.com/angular/protractor) and
2427
[Batarang](https://github.com/angular/angularjs-batarang) need this information to run,
2528
but you can disable this in production for a significant performance boost with:

firebase.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"hosting": {
3-
"public": "build/docs",
3+
"public": "uploadDocs",
44
"ignore": [
55
"/index.html",
66
"/index-debug.html",
@@ -16,7 +16,7 @@
1616
"destination": "/index-production.html"
1717
},
1818
{
19-
"source": "**/*!(.jpg|.jpeg|.gif|.png|.html|.js|.json|.css|.svg|.ttf|.woff|.woff2|.eot)",
19+
"source": "**/*!(.jpg|.jpeg|.gif|.png|.html|.js|.map|.json|.css|.svg|.ttf|.woff|.woff2|.eot)",
2020
"destination": "/index-production.html"
2121
}
2222
]

scripts/travis/build.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ case "$JOB" in
4848
"deploy")
4949
# we never deploy on Pull requests, so it's safe to skip the build here
5050
if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then
51-
grunt package
52-
grunt compress:firebaseCodeDeploy
51+
grunt prepareFirebaseDeploy
5352
else
5453
echo "Skipping build because Travis has been triggered by Pull Request"
5554
fi

src/ng/compile.js

+5
Original file line numberDiff line numberDiff line change
@@ -1387,7 +1387,12 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
13871387
* binding information and a reference to the current scope on to DOM elements.
13881388
* If enabled, the compiler will add the following to DOM elements that have been bound to the scope
13891389
* * `ng-binding` CSS class
1390+
* * `ng-scope` and `ng-isolated-scope` CSS classes
13901391
* * `$binding` data property containing an array of the binding expressions
1392+
* * Data properties used by the {@link angular.element#methods `scope()`/`isolateScope()` methods} to return
1393+
* the element's scope.
1394+
* * Placeholder comments will contain information about what directive and binding caused the placeholder.
1395+
* E.g. `<!-- ngIf: shouldShow() -->`.
13911396
*
13921397
* You may want to disable this in production for a significant performance boost. See
13931398
* {@link guide/production#disabling-debug-data Disabling Debug Data} for more.

0 commit comments

Comments
 (0)