Merge branch 'master' into 4167-no-more-calico

This commit is contained in:
Zachary Corleissen
2017-08-07 14:08:35 -07:00
committed by GitHub
644 changed files with 10657 additions and 8757 deletions
+5 -1
View File
@@ -1,4 +1,8 @@
> NOTE: Please check the “Allow edits from maintainers” box (see image below) to > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> For 1.8 Features: set Milestone to `1.8` and Base Branch to `release-1.8`
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> NOTE: Please check the “Allow edits from maintainers” box (see image below) to
> [allow reviewers to fix problems](https://help.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork/) on your patch and speed up the review process. > [allow reviewers to fix problems](https://help.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork/) on your patch and speed up the review process.
> >
> Please delete this note before submitting the pull request. > Please delete this note before submitting the pull request.
+1 -1
View File
@@ -1,4 +1,4 @@
assignees: approvers:
- smarterclayton - smarterclayton
- janetkuo - janetkuo
- pwittrock - pwittrock
+1 -1
View File
@@ -39,7 +39,7 @@ gems:
# disabled gems # disabled gems
# - jekyll-redirect-from # - jekyll-redirect-from
include: [_redirects] include: [_redirects,_headers]
# SEO # SEO
logo: /images/favicon.png logo: /images/favicon.png
+3
View File
@@ -0,0 +1,3 @@
# Instructions for Glossary snippets
Markdown snippets of glossary terms to be reused throughout the documentation should be placed in this directory.
+5
View File
@@ -220,6 +220,11 @@
/docs/whatisk8s /docs/concepts/overview/what-is-kubernetes 301 /docs/whatisk8s /docs/concepts/overview/what-is-kubernetes 301
#
# pattern matching redirects
#
/docs/user-guide/kubectl/kubectl_* /docs/user-guide/kubectl/v1.7/#:splat 200
# #
# redirects from /js/redirects.js # redirects from /js/redirects.js
# #
@@ -1,5 +1,5 @@
--- ---
assignees: approvers:
- k8s-merge-robot - k8s-merge-robot
title: 认识 Kubernetes? title: 认识 Kubernetes?
@@ -1,5 +1,5 @@
--- ---
assignees: approvers:
- thockin - thockin
title: CentOS title: CentOS
--- ---
@@ -1,5 +1,5 @@
--- ---
assignees: approvers:
- erictune - erictune
- thockin - thockin
title: Offline title: Offline
@@ -92,11 +92,11 @@ LABEL local
LOCALBOOT 0 LOCALBOOT 0
``` ```
至此,您应当已经配置好一个可用的PXELINUX环境用来运行CoreOS节点了您可以通过在本地运行VirtualBox或者物理裸机来验证这一点 至此,您应当已经配置好一个可用的PXELINUX环境用来运行CoreOS节点了您可以使用VirtualBox或者物理裸机上对PXELINUX环境所提供的服务进行验证
## 添加CoreOS至PXE ## 添加CoreOS至PXE
本节将介绍如何在一个现有的PXELINUX环境上设置CoreOS镜像。 本节描述在已有PXELINUX环境的前提下,如何配置CoreOS镜像与之并存
1. 查找或者创建TFTP根目录,后续所有步骤都将基于此目录。 1. 查找或者创建TFTP根目录,后续所有步骤都将基于此目录。
* 本文中我们假设`/tftpboot`是根目录。 * 本文中我们假设`/tftpboot`是根目录。
@@ -199,13 +199,13 @@ subnet 10.20.30.0 netmask 255.255.255.0 {
1. 第一种方式是将云配置文件模版化,然后通过编程的方式为不同的集群提供不同的配置。 1. 第一种方式是将云配置文件模版化,然后通过编程的方式为不同的集群提供不同的配置。
2. 第二种方式是运行一个服务发现协议从而可以在云环境中做服务的自动发现。 2. 第二种方式是运行一个服务发现协议从而可以在云环境中做服务的自动发现。
在本demo中,我们仅简单地创建一个静态的单一`etcd`服务器运行Kubernetes并提供`etcd`的主要服务 在本示例中,我们将通过静态方式创建一个etcd服务器,用于运行Kubernetes主控组件,并用作etcd主节点
由于我们的集群处于一个离线的环境中,所以大部分的CoreOS和Kubernetes帮助进程是受限的。为了完成部署,我们需要下载Kubernetes的各可执行文件到本地然后再启动运行。 由于我们的集群处于一个离线的环境中,所以大部分的CoreOS和Kubernetes帮助进程是受限的。为了完成部署,我们需要下载Kubernetes的各可执行文件到本地然后再启动运行。
一种简单的方案是在DHCP/TFTP主机上搭建一个简易的web服务器,从而环境中的CoreOS PXE机器可以从其上下载各可执行文件。 一种简单的方案是在DHCP/TFTP主机上搭建一个简易的web服务器,从而环境中的CoreOS PXE机器可以从其上下载各可执行文件。
为了达到这一目标,我们将启动一个`apache`服务器并提供运行Kuberetes所需要的各可执行文件。 为了达到这一目标,我们将启动一个`apache`服务器并提供运行Kubernetes所需要的各可执行文件。
以下脚本运行在上文中准备好的PXE服务器上: 以下脚本运行在上文中准备好的PXE服务器上:
@@ -705,4 +705,4 @@ IaaS Provider | Config. Mgmt | OS | Networking | Docs
-------------------- | ------------ | ------ | ---------- | --------------------------------------------- | ---------| ---------------------------- -------------------- | ------------ | ------ | ---------- | --------------------------------------------- | ---------| ----------------------------
Bare-metal (Offline) | CoreOS | CoreOS | flannel | [docs](/docs/getting-started-guides/coreos/bare_metal_offline) | | Community ([@jeffbean](https://github.com/jeffbean)) Bare-metal (Offline) | CoreOS | CoreOS | flannel | [docs](/docs/getting-started-guides/coreos/bare_metal_offline) | | Community ([@jeffbean](https://github.com/jeffbean))
有关所有解决方案的支持级别信息,请参阅[解决方案列表](/docs/getting-started-guides/#table-of-solutions)。 有关所有解决方案的支持级别信息,请参阅[解决方案列表](/docs/getting-started-guides/#table-of-solutions)。
+1 -1
View File
@@ -1,5 +1,5 @@
--- ---
assignees: approvers:
- k8s-merge-robot - k8s-merge-robot
title: 认识 Kubernetes? title: 认识 Kubernetes?
+32
View File
@@ -1,3 +1,4 @@
/* Callouts */
.caution, .note, .warning { .caution, .note, .warning {
padding: 20px; padding: 20px;
margin: 20px 0; margin: 20px 0;
@@ -17,3 +18,34 @@
.warning { .warning {
border-left-color: #d9534f; border-left-color: #d9534f;
} }
/* Feature States */
.beta, .stable, .alpha, .deprecated {
margin-top: 20px;
padding: 15px;
background-color: #fafafa;
border: 1px solid transparent;
border-radius:4px;
}
.beta {
color: #31708f;
border-color: #bce8f1;
}
.stable {
color: #3c763d;
border-color: #d6e9c6;
}
.alpha {
color: #8a6d3b;
border-color: #faebcc;
}
.deprecated {
color: #a94442;
border-color: #ebccd1;
}
+1 -1
View File
@@ -1,4 +1,4 @@
assignees: approvers:
- derekwaynecarr - derekwaynecarr
- mikedanese - mikedanese
+1 -1
View File
@@ -1,5 +1,5 @@
--- ---
assignees: approvers:
- bgrant0607 - bgrant0607
- erictune - erictune
- lavalamp - lavalamp
+1 -1
View File
@@ -1,5 +1,5 @@
--- ---
assignees: approvers:
- bprashanth - bprashanth
- davidopp - davidopp
- derekwaynecarr - derekwaynecarr
+1 -1
View File
@@ -1,5 +1,5 @@
--- ---
assignees: approvers:
- erictune - erictune
- lavalamp - lavalamp
- ericchiang - ericchiang
+3 -3
View File
@@ -1,5 +1,5 @@
--- ---
assignees: approvers:
- erictune - erictune
- lavalamp - lavalamp
- deads2k - deads2k
@@ -45,7 +45,7 @@ properties:
- Wildcard: - Wildcard:
- `*` matches all non-resource requests. - `*` matches all non-resource requests.
- `/foo/*` matches all subpaths of `/foo/`. - `/foo/*` matches all subpaths of `/foo/`.
- `readonly`, type boolean, when true, means that the policy only applies to get, list, and watch operations. - `readonly`, type boolean, when true, means that the Resource-matching policy only applies to get, list, and watch operations, Non-resource-matching policy only applies to get operation.
**NOTES:** An unset property is the same as a property set to the zero value for its type **NOTES:** An unset property is the same as a property set to the zero value for its type
(e.g. empty string, 0, false). However, unset should be preferred for (e.g. empty string, 0, false). However, unset should be preferred for
@@ -152,4 +152,4 @@ file:
The apiserver will need to be restarted to pickup the new policy lines. The apiserver will need to be restarted to pickup the new policy lines.
{% endcapture %} {% endcapture %}
{% include templates/concept.md %} {% include templates/concept.md %}
+1 -1
View File
@@ -1,5 +1,5 @@
--- ---
assignees: approvers:
- erictune - erictune
- lavalamp - lavalamp
- deads2k - deads2k
+1 -1
View File
@@ -1,5 +1,5 @@
--- ---
assignees: approvers:
- timstclair - timstclair
- deads2k - deads2k
- liggitt - liggitt
+2 -2
View File
@@ -1,5 +1,5 @@
--- ---
assignees: approvers:
- erictune - erictune
- deads2k - deads2k
- liggitt - liggitt
@@ -754,7 +754,7 @@ Here are two approaches for managing this transition:
Run both the RBAC and ABAC authorizers, and include the legacy ABAC policy: Run both the RBAC and ABAC authorizers, and include the legacy ABAC policy:
``` ```
--authorization-mode=RBAC,ABAC --authorization-policy-file=mypolicy.jsonl --authorization-mode=RBAC,ABAC --authorization-policy-file=mypolicy.json
``` ```
The RBAC authorizer will attempt to authorize requests first. If it denies an API request, The RBAC authorizer will attempt to authorize requests first. If it denies an API request,
+1 -1
View File
@@ -1,5 +1,5 @@
--- ---
assignees: approvers:
- erictune - erictune
- lavalamp - lavalamp
- deads2k - deads2k
+2 -2
View File
@@ -1,5 +1,5 @@
--- ---
assignees: approvers:
- jbeda - jbeda
title: Authenticating with Bootstrap Tokens title: Authenticating with Bootstrap Tokens
--- ---
@@ -127,7 +127,7 @@ commands.
In addition to authentication, the tokens can be used to sign a ConfigMap. This In addition to authentication, the tokens can be used to sign a ConfigMap. This
is used early in a cluster bootstrap process before the client trusts the API is used early in a cluster bootstrap process before the client trusts the API
server. The signed ConfigMap can be authenicated by the shared token. server. The signed ConfigMap can be authenticated by the shared token.
The ConfigMap that is signed is `cluster-info` in the `kube-public` namespace. The ConfigMap that is signed is `cluster-info` in the `kube-public` namespace.
The typical flow is that a client reads this ConfigMap while unauthenticated and The typical flow is that a client reads this ConfigMap while unauthenticated and
+5 -5
View File
@@ -1,5 +1,5 @@
--- ---
assignees: approvers:
- davidopp - davidopp
- lavalamp - lavalamp
title: Building Large Clusters title: Building Large Clusters
@@ -7,11 +7,11 @@ title: Building Large Clusters
## Support ## Support
At {{page.version}}, Kubernetes supports clusters with up to 1000 nodes. More specifically, we support configurations that meet *all* of the following criteria: At {{page.version}}, Kubernetes supports clusters with up to 5000 nodes. More specifically, we support configurations that meet *all* of the following criteria:
* No more than 2000 nodes * No more than 5000 nodes
* No more than 60000 total pods * No more than 150000 total pods
* No more than 120000 total containers * No more than 300000 total containers
* No more than 100 pods per node * No more than 100 pods per node
<br> <br>
@@ -1,5 +1,5 @@
--- ---
assignees: approvers:
- smarterclayton - smarterclayton
- lavalamp - lavalamp
- whitlockjc - whitlockjc
+1 -1
View File
@@ -1,4 +1,4 @@
assignees: approvers:
- madhusudancs - madhusudancs
- mml - mml
- nikhiljindal - nikhiljindal
+1 -1
View File
@@ -1,5 +1,5 @@
--- ---
assignees: approvers:
- madhusudancs - madhusudancs
- mml - mml
- nikhiljindal - nikhiljindal
+1 -1
View File
@@ -1,4 +1,4 @@
assignees: approvers:
- davidopp - davidopp
- lavalamp - lavalamp
+1 -1
View File
@@ -129,7 +129,7 @@ TaintBasedEvictions=true|false (ALPHA - default=false)
--storage-media-type string The media type to use to store objects in storage. Some resources or storage backends may only support a specific media type and will ignore this setting. (default "application/vnd.kubernetes.protobuf") --storage-media-type string The media type to use to store objects in storage. Some resources or storage backends may only support a specific media type and will ignore this setting. (default "application/vnd.kubernetes.protobuf")
--storage-versions string The per-group version to store resources in. Specified in the format "group1/version1,group2/version2,...". In the case where objects are moved from one group to the other, you may specify the format "group1=group2/v1beta1,group3/v1beta1,...". You only need to pass the groups you wish to change from the defaults. It defaults to a list of preferred versions of all registered groups, which is derived from the KUBE_API_VERSIONS environment variable. (default "admission.k8s.io/v1alpha1,admissionregistration.k8s.io/v1alpha1,apps/v1beta1,authentication.k8s.io/v1,authorization.k8s.io/v1,autoscaling/v1,batch/v1,certificates.k8s.io/v1beta1,componentconfig/v1alpha1,extensions/v1beta1,federation/v1beta1,imagepolicy.k8s.io/v1alpha1,networking.k8s.io/v1,policy/v1beta1,rbac.authorization.k8s.io/v1beta1,settings.k8s.io/v1alpha1,storage.k8s.io/v1,v1") --storage-versions string The per-group version to store resources in. Specified in the format "group1/version1,group2/version2,...". In the case where objects are moved from one group to the other, you may specify the format "group1=group2/v1beta1,group3/v1beta1,...". You only need to pass the groups you wish to change from the defaults. It defaults to a list of preferred versions of all registered groups, which is derived from the KUBE_API_VERSIONS environment variable. (default "admission.k8s.io/v1alpha1,admissionregistration.k8s.io/v1alpha1,apps/v1beta1,authentication.k8s.io/v1,authorization.k8s.io/v1,autoscaling/v1,batch/v1,certificates.k8s.io/v1beta1,componentconfig/v1alpha1,extensions/v1beta1,federation/v1beta1,imagepolicy.k8s.io/v1alpha1,networking.k8s.io/v1,policy/v1beta1,rbac.authorization.k8s.io/v1beta1,settings.k8s.io/v1alpha1,storage.k8s.io/v1,v1")
--target-ram-mb int Memory limit for apiserver in MB (used to configure sizes of caches, etc.) --target-ram-mb int Memory limit for apiserver in MB (used to configure sizes of caches, etc.)
--tls-ca-file string If set, this certificate authority will used for secure access from Admission Controllers. This must be a valid PEM-encoded CA bundle. Altneratively, the certificate authority can be appended to the certificate provided by --tls-cert-file. --tls-ca-file string If set, this certificate authority will used for secure access from Admission Controllers. This must be a valid PEM-encoded CA bundle. Alternatively, the certificate authority can be appended to the certificate provided by --tls-cert-file.
--tls-cert-file string File containing the default x509 Certificate for HTTPS. (CA cert, if any, concatenated after server cert). If HTTPS serving is enabled, and --tls-cert-file and --tls-private-key-file are not provided, a self-signed certificate and key are generated for the public address and saved to /var/run/kubernetes. --tls-cert-file string File containing the default x509 Certificate for HTTPS. (CA cert, if any, concatenated after server cert). If HTTPS serving is enabled, and --tls-cert-file and --tls-private-key-file are not provided, a self-signed certificate and key are generated for the public address and saved to /var/run/kubernetes.
--tls-private-key-file string File containing the default x509 private key matching --tls-cert-file. --tls-private-key-file string File containing the default x509 private key matching --tls-cert-file.
--tls-sni-cert-key namedCertKey A pair of x509 certificate and private key file paths, optionally suffixed with a list of domain patterns which are fully qualified domain names, possibly with prefixed wildcard segments. If no domain patterns are provided, the names of the certificate are extracted. Non-wildcard matches trump over wildcard matches, explicit domain patterns trump over extracted names. For multiple key/certificate pairs, use the --tls-sni-cert-key multiple times. Examples: "example.crt,example.key" or "foo.crt,foo.key:*.foo.com,foo.com". (default []) --tls-sni-cert-key namedCertKey A pair of x509 certificate and private key file paths, optionally suffixed with a list of domain patterns which are fully qualified domain names, possibly with prefixed wildcard segments. If no domain patterns are provided, the names of the certificate are extracted. Non-wildcard matches trump over wildcard matches, explicit domain patterns trump over extracted names. For multiple key/certificate pairs, use the --tls-sni-cert-key multiple times. Examples: "example.crt,example.key" or "foo.crt,foo.key:*.foo.com,foo.com". (default [])
+1 -1
View File
@@ -45,7 +45,7 @@ kube-controller-manager
--concurrent-service-syncs int32 The number of services that are allowed to sync concurrently. Larger number = more responsive service management, but more CPU (and network) load (default 1) --concurrent-service-syncs int32 The number of services that are allowed to sync concurrently. Larger number = more responsive service management, but more CPU (and network) load (default 1)
--concurrent-serviceaccount-token-syncs int32 The number of service account token objects that are allowed to sync concurrently. Larger number = more responsive token generation, but more CPU (and network) load (default 5) --concurrent-serviceaccount-token-syncs int32 The number of service account token objects that are allowed to sync concurrently. Larger number = more responsive token generation, but more CPU (and network) load (default 5)
--concurrent_rc_syncs int32 The number of replication controllers that are allowed to sync concurrently. Larger number = more responsive replica management, but more CPU (and network) load (default 5) --concurrent_rc_syncs int32 The number of replication controllers that are allowed to sync concurrently. Larger number = more responsive replica management, but more CPU (and network) load (default 5)
--configure-cloud-routes Should CIDRs allocated by allocate-node-cidrs be configured on the cloud provider. (default true) --configure-cloud-routes Should CIDRs allocated by allocate-node-cidrs be configured on the cloud provider. If using a network overlay which will handle routing independent of the cloud provider, set this to false. (default true)
--contention-profiling Enable lock contention profiling, if profiling is enabled --contention-profiling Enable lock contention profiling, if profiling is enabled
--controller-start-interval duration Interval between starting controller managers. --controller-start-interval duration Interval between starting controller managers.
--controllers stringSlice A list of controllers to enable. '*' enables all on-by-default controllers, 'foo' enables the controller named 'foo', '-foo' disables the controller named 'foo'. --controllers stringSlice A list of controllers to enable. '*' enables all on-by-default controllers, 'foo' enables the controller named 'foo', '-foo' disables the controller named 'foo'.
+1 -1
View File
@@ -1,5 +1,5 @@
--- ---
assignees: approvers:
- mikedanese - mikedanese
- luxas - luxas
- errordeveloper - errordeveloper
@@ -1,5 +1,5 @@
--- ---
assignees: approvers:
- liggitt - liggitt
title: Kubelet authentication/authorization title: Kubelet authentication/authorization
--- ---
+1 -1
View File
@@ -1,5 +1,5 @@
--- ---
assignees: approvers:
- ericchiang - ericchiang
- mikedanese - mikedanese
- jcbsmpsn - jcbsmpsn
+1 -1
View File
@@ -1,4 +1,4 @@
assignees: approvers:
- derekwaynecarr - derekwaynecarr
- janetkuo - janetkuo
+1 -1
View File
@@ -1,4 +1,4 @@
assignees: approvers:
- davidopp - davidopp
- madhusudancs - madhusudancs
+2 -2
View File
@@ -1,5 +1,5 @@
--- ---
assignees: approvers:
- jlowdermilk - jlowdermilk
- justinsb - justinsb
- quinton-hoole - quinton-hoole
@@ -74,7 +74,7 @@ located in a single zone. Users that want a highly available control
plane should follow the [high availability](/docs/admin/high-availability) instructions. plane should follow the [high availability](/docs/admin/high-availability) instructions.
## Walkthough ## Walkthrough
We're now going to walk through setting up and using a multi-zone We're now going to walk through setting up and using a multi-zone
cluster on both GCE & AWS. To do so, you bring up a full cluster cluster on both GCE & AWS. To do so, you bring up a full cluster
+1 -1
View File
@@ -1,4 +1,4 @@
assignees: approvers:
- derekwaynecarr - derekwaynecarr
- janetkuo - janetkuo
+1 -1
View File
@@ -1,5 +1,5 @@
--- ---
assignees: approvers:
- Random-Liu - Random-Liu
title: Validate Node Setup title: Validate Node Setup
--- ---
+1 -1
View File
@@ -1,5 +1,5 @@
--- ---
assignees: approvers:
- thockin - thockin
title: Kubernetes OpenVSwitch GRE/VxLAN networking title: Kubernetes OpenVSwitch GRE/VxLAN networking
--- ---
+1 -1
View File
@@ -1,3 +1,3 @@
assignees: approvers:
- derekwaynecarr - derekwaynecarr
+1 -1
View File
@@ -1,5 +1,5 @@
--- ---
assignees: approvers:
- davidopp - davidopp
title: Configuring Kubernetes with Salt title: Configuring Kubernetes with Salt
--- ---
+1 -1
View File
@@ -1,5 +1,5 @@
--- ---
assignees: approvers:
- bprashanth - bprashanth
- davidopp - davidopp
- lavalamp - lavalamp
+1 -1
View File
@@ -153,7 +153,7 @@ function generateNestedNav(parent, nest) {
function generateNavJson(data) { function generateNavJson(data) {
var navJson = JSON.stringify(data); var navJson = JSON.stringify(data);
navScript = `(function(){navData = ${navJson}})();`; navScript = `(function(){navData = ${navJson};})();`;
fs.writeFile('./navData.js', navScript, function(err) { fs.writeFile('./navData.js', navScript, function(err) {
if (err) { if (err) {
return console.log(err); return console.log(err);
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -2
View File
@@ -59,8 +59,7 @@ publishTask('ejs', ['build'], function () {
'package.json', 'package.json',
'ejs.js', 'ejs.js',
'ejs.min.js', 'ejs.min.js',
'lib/**', 'lib/**'
'test/**'
]); ]);
}); });
+1
View File
@@ -4,6 +4,7 @@ Embedded JavaScript templates
[![Build Status](https://img.shields.io/travis/mde/ejs/master.svg?style=flat)](https://travis-ci.org/mde/ejs) [![Build Status](https://img.shields.io/travis/mde/ejs/master.svg?style=flat)](https://travis-ci.org/mde/ejs)
[![Developing Dependencies](https://img.shields.io/david/dev/mde/ejs.svg?style=flat)](https://david-dm.org/mde/ejs?type=dev) [![Developing Dependencies](https://img.shields.io/david/dev/mde/ejs.svg?style=flat)](https://david-dm.org/mde/ejs?type=dev)
[![Known Vulnerabilities](https://snyk.io/test/npm/ejs/badge.svg?style=flat-square)](https://snyk.io/test/npm/ejs)
## Installation ## Installation
+73 -48
View File
@@ -122,16 +122,36 @@ exports.resolveInclude = function(name, filename, isDir) {
* @param {Options} options compilation options * @param {Options} options compilation options
* @return {String} * @return {String}
*/ */
function getIncludePath(path, options){ function getIncludePath(path, options) {
var includePath; var includePath;
var filePath;
var views = options.views;
// Abs path
if (path.charAt(0) == '/') { if (path.charAt(0) == '/') {
includePath = exports.resolveInclude(path.replace(/^\/*/,''), options.root || '/', true); includePath = exports.resolveInclude(path.replace(/^\/*/,''), options.root || '/', true);
} }
// Relative paths
else { else {
if (!options.filename) { // Look relative to a passed filename first
throw new Error('`include` use relative path requires the \'filename\' option.'); if (options.filename) {
filePath = exports.resolveInclude(path, options.filename);
if (fs.existsSync(filePath)) {
includePath = filePath;
}
}
// Then look in any views directories
if (!includePath) {
if (Array.isArray(views) && views.some(function (v) {
filePath = exports.resolveInclude(path, v, true);
return fs.existsSync(filePath);
})) {
includePath = filePath;
}
}
if (!includePath) {
throw new Error('Could not find include include file.');
} }
includePath = exports.resolveInclude(path, options.filename);
} }
return includePath; return includePath;
} }
@@ -391,8 +411,13 @@ exports.renderFile = function () {
// in the data, copy them to options // in the data, copy them to options
if (arguments.length === 3) { if (arguments.length === 3) {
// Express 4 // Express 4
if (data.settings && data.settings['view options']) { if (data.settings) {
utils.shallowCopyFromList(opts, data.settings['view options'], _OPTS_EXPRESS); if (data.settings['view options']) {
utils.shallowCopyFromList(opts, data.settings['view options'], _OPTS_EXPRESS);
}
if (data.settings.views) {
opts.views = data.settings.views;
}
} }
// Express 3 and lower // Express 3 and lower
else { else {
@@ -443,6 +468,7 @@ function Template(text, opts) {
options.rmWhitespace = opts.rmWhitespace; options.rmWhitespace = opts.rmWhitespace;
options.root = opts.root; options.root = opts.root;
options.localsName = opts.localsName || exports.localsName || _DEFAULT_LOCALS_NAME; options.localsName = opts.localsName || exports.localsName || _DEFAULT_LOCALS_NAME;
options.views = opts.views;
if (options.strict) { if (options.strict) {
options._with = false; options._with = false;
@@ -506,10 +532,6 @@ Template.prototype = {
src = this.source; src = this.source;
} }
if (opts.debug) {
console.log(src);
}
if (opts.client) { if (opts.client) {
src = 'escapeFn = escapeFn || ' + escapeFn.toString() + ';' + '\n' + src; src = 'escapeFn = escapeFn || ' + escapeFn.toString() + ';' + '\n' + src;
if (opts.compileDebug) { if (opts.compileDebug) {
@@ -520,6 +542,9 @@ Template.prototype = {
if (opts.strict) { if (opts.strict) {
src = '"use strict";\n' + src; src = '"use strict";\n' + src;
} }
if (opts.debug) {
console.log(src);
}
try { try {
fn = new Function(opts.localsName + ', escapeFn, include, rethrow', src); fn = new Function(opts.localsName + ', escapeFn, include, rethrow', src);
@@ -612,7 +637,7 @@ Template.prototype = {
+ ' try {' + '\n' + ' try {' + '\n'
+ includeObj.source + includeObj.source
+ ' } catch (e) {' + '\n' + ' } catch (e) {' + '\n'
+ ' rethrow(e, __lines, __filename, __line);' + '\n' + ' rethrow(e, __lines, __filename, __line, escapeFn);' + '\n'
+ ' }' + '\n' + ' }' + '\n'
+ ' ; }).call(this)' + '\n'; + ' ; }).call(this)' + '\n';
}else{ }else{
@@ -658,43 +683,43 @@ Template.prototype = {
return arr; return arr;
}, },
_addOutput: function (line) {
if (this.truncate) {
// Only replace single leading linebreak in the line after
// -%> tag -- this is the single, trailing linebreak
// after the tag that the truncation mode replaces
// Handle Win / Unix / old Mac linebreaks -- do the \r\n
// combo first in the regex-or
line = line.replace(/^(?:\r\n|\r|\n)/, '');
this.truncate = false;
}
else if (this.opts.rmWhitespace) {
// rmWhitespace has already removed trailing spaces, just need
// to remove linebreaks
line = line.replace(/^\n/, '');
}
if (!line) {
return line;
}
// Preserve literal slashes
line = line.replace(/\\/g, '\\\\');
// Convert linebreaks
line = line.replace(/\n/g, '\\n');
line = line.replace(/\r/g, '\\r');
// Escape double-quotes
// - this will be the delimiter during execution
line = line.replace(/"/g, '\\"');
this.source += ' ; __append("' + line + '")' + '\n';
},
scanLine: function (line) { scanLine: function (line) {
var self = this; var self = this;
var d = this.opts.delimiter; var d = this.opts.delimiter;
var newLineCount = 0; var newLineCount = 0;
function _addOutput() {
if (self.truncate) {
// Only replace single leading linebreak in the line after
// -%> tag -- this is the single, trailing linebreak
// after the tag that the truncation mode replaces
// Handle Win / Unix / old Mac linebreaks -- do the \r\n
// combo first in the regex-or
line = line.replace(/^(?:\r\n|\r|\n)/, '');
self.truncate = false;
}
else if (self.opts.rmWhitespace) {
// rmWhitespace has already removed trailing spaces, just need
// to remove linebreaks
line = line.replace(/^\n/, '');
}
if (!line) {
return;
}
// Preserve literal slashes
line = line.replace(/\\/g, '\\\\');
// Convert linebreaks
line = line.replace(/\n/g, '\\n');
line = line.replace(/\r/g, '\\r');
// Escape double-quotes
// - this will be the delimiter during execution
line = line.replace(/"/g, '\\"');
self.source += ' ; __append("' + line + '")' + '\n';
}
newLineCount = (line.split('\n').length - 1); newLineCount = (line.split('\n').length - 1);
switch (line) { switch (line) {
@@ -723,7 +748,7 @@ Template.prototype = {
case '-' + d + '>': case '-' + d + '>':
case '_' + d + '>': case '_' + d + '>':
if (this.mode == Template.modes.LITERAL) { if (this.mode == Template.modes.LITERAL) {
_addOutput(); this._addOutput(line);
} }
this.mode = null; this.mode = null;
@@ -759,13 +784,13 @@ Template.prototype = {
break; break;
// Literal <%% mode, append as raw output // Literal <%% mode, append as raw output
case Template.modes.LITERAL: case Template.modes.LITERAL:
_addOutput(); this._addOutput(line);
break; break;
} }
} }
// In string mode, just add the output // In string mode, just add the output
else { else {
_addOutput(); this._addOutput(line);
} }
} }
@@ -1428,7 +1453,7 @@ module.exports={
"engine", "engine",
"ejs" "ejs"
], ],
"version": "2.5.5", "version": "2.5.6",
"author": "Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)", "author": "Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)",
"contributors": [ "contributors": [
"Timothy Gu <timothygu99@gmail.com> (https://timothygu.github.io)" "Timothy Gu <timothygu99@gmail.com> (https://timothygu.github.io)"
@@ -1457,7 +1482,7 @@ module.exports={
"node": ">=0.10.0" "node": ">=0.10.0"
}, },
"scripts": { "scripts": {
"test": "mocha", "test": "jake test",
"lint": "eslint \"**/*.js\" Jakefile", "lint": "eslint \"**/*.js\" Jakefile",
"coverage": "istanbul cover node_modules/mocha/bin/_mocha", "coverage": "istanbul cover node_modules/mocha/bin/_mocha",
"doc": "jake doc", "doc": "jake doc",
File diff suppressed because one or more lines are too long
+71 -46
View File
@@ -121,16 +121,36 @@ exports.resolveInclude = function(name, filename, isDir) {
* @param {Options} options compilation options * @param {Options} options compilation options
* @return {String} * @return {String}
*/ */
function getIncludePath(path, options){ function getIncludePath(path, options) {
var includePath; var includePath;
var filePath;
var views = options.views;
// Abs path
if (path.charAt(0) == '/') { if (path.charAt(0) == '/') {
includePath = exports.resolveInclude(path.replace(/^\/*/,''), options.root || '/', true); includePath = exports.resolveInclude(path.replace(/^\/*/,''), options.root || '/', true);
} }
// Relative paths
else { else {
if (!options.filename) { // Look relative to a passed filename first
throw new Error('`include` use relative path requires the \'filename\' option.'); if (options.filename) {
filePath = exports.resolveInclude(path, options.filename);
if (fs.existsSync(filePath)) {
includePath = filePath;
}
}
// Then look in any views directories
if (!includePath) {
if (Array.isArray(views) && views.some(function (v) {
filePath = exports.resolveInclude(path, v, true);
return fs.existsSync(filePath);
})) {
includePath = filePath;
}
}
if (!includePath) {
throw new Error('Could not find include include file.');
} }
includePath = exports.resolveInclude(path, options.filename);
} }
return includePath; return includePath;
} }
@@ -390,8 +410,13 @@ exports.renderFile = function () {
// in the data, copy them to options // in the data, copy them to options
if (arguments.length === 3) { if (arguments.length === 3) {
// Express 4 // Express 4
if (data.settings && data.settings['view options']) { if (data.settings) {
utils.shallowCopyFromList(opts, data.settings['view options'], _OPTS_EXPRESS); if (data.settings['view options']) {
utils.shallowCopyFromList(opts, data.settings['view options'], _OPTS_EXPRESS);
}
if (data.settings.views) {
opts.views = data.settings.views;
}
} }
// Express 3 and lower // Express 3 and lower
else { else {
@@ -442,6 +467,7 @@ function Template(text, opts) {
options.rmWhitespace = opts.rmWhitespace; options.rmWhitespace = opts.rmWhitespace;
options.root = opts.root; options.root = opts.root;
options.localsName = opts.localsName || exports.localsName || _DEFAULT_LOCALS_NAME; options.localsName = opts.localsName || exports.localsName || _DEFAULT_LOCALS_NAME;
options.views = opts.views;
if (options.strict) { if (options.strict) {
options._with = false; options._with = false;
@@ -505,10 +531,6 @@ Template.prototype = {
src = this.source; src = this.source;
} }
if (opts.debug) {
console.log(src);
}
if (opts.client) { if (opts.client) {
src = 'escapeFn = escapeFn || ' + escapeFn.toString() + ';' + '\n' + src; src = 'escapeFn = escapeFn || ' + escapeFn.toString() + ';' + '\n' + src;
if (opts.compileDebug) { if (opts.compileDebug) {
@@ -519,6 +541,9 @@ Template.prototype = {
if (opts.strict) { if (opts.strict) {
src = '"use strict";\n' + src; src = '"use strict";\n' + src;
} }
if (opts.debug) {
console.log(src);
}
try { try {
fn = new Function(opts.localsName + ', escapeFn, include, rethrow', src); fn = new Function(opts.localsName + ', escapeFn, include, rethrow', src);
@@ -611,7 +636,7 @@ Template.prototype = {
+ ' try {' + '\n' + ' try {' + '\n'
+ includeObj.source + includeObj.source
+ ' } catch (e) {' + '\n' + ' } catch (e) {' + '\n'
+ ' rethrow(e, __lines, __filename, __line);' + '\n' + ' rethrow(e, __lines, __filename, __line, escapeFn);' + '\n'
+ ' }' + '\n' + ' }' + '\n'
+ ' ; }).call(this)' + '\n'; + ' ; }).call(this)' + '\n';
}else{ }else{
@@ -657,43 +682,43 @@ Template.prototype = {
return arr; return arr;
}, },
_addOutput: function (line) {
if (this.truncate) {
// Only replace single leading linebreak in the line after
// -%> tag -- this is the single, trailing linebreak
// after the tag that the truncation mode replaces
// Handle Win / Unix / old Mac linebreaks -- do the \r\n
// combo first in the regex-or
line = line.replace(/^(?:\r\n|\r|\n)/, '');
this.truncate = false;
}
else if (this.opts.rmWhitespace) {
// rmWhitespace has already removed trailing spaces, just need
// to remove linebreaks
line = line.replace(/^\n/, '');
}
if (!line) {
return line;
}
// Preserve literal slashes
line = line.replace(/\\/g, '\\\\');
// Convert linebreaks
line = line.replace(/\n/g, '\\n');
line = line.replace(/\r/g, '\\r');
// Escape double-quotes
// - this will be the delimiter during execution
line = line.replace(/"/g, '\\"');
this.source += ' ; __append("' + line + '")' + '\n';
},
scanLine: function (line) { scanLine: function (line) {
var self = this; var self = this;
var d = this.opts.delimiter; var d = this.opts.delimiter;
var newLineCount = 0; var newLineCount = 0;
function _addOutput() {
if (self.truncate) {
// Only replace single leading linebreak in the line after
// -%> tag -- this is the single, trailing linebreak
// after the tag that the truncation mode replaces
// Handle Win / Unix / old Mac linebreaks -- do the \r\n
// combo first in the regex-or
line = line.replace(/^(?:\r\n|\r|\n)/, '');
self.truncate = false;
}
else if (self.opts.rmWhitespace) {
// rmWhitespace has already removed trailing spaces, just need
// to remove linebreaks
line = line.replace(/^\n/, '');
}
if (!line) {
return;
}
// Preserve literal slashes
line = line.replace(/\\/g, '\\\\');
// Convert linebreaks
line = line.replace(/\n/g, '\\n');
line = line.replace(/\r/g, '\\r');
// Escape double-quotes
// - this will be the delimiter during execution
line = line.replace(/"/g, '\\"');
self.source += ' ; __append("' + line + '")' + '\n';
}
newLineCount = (line.split('\n').length - 1); newLineCount = (line.split('\n').length - 1);
switch (line) { switch (line) {
@@ -722,7 +747,7 @@ Template.prototype = {
case '-' + d + '>': case '-' + d + '>':
case '_' + d + '>': case '_' + d + '>':
if (this.mode == Template.modes.LITERAL) { if (this.mode == Template.modes.LITERAL) {
_addOutput(); this._addOutput(line);
} }
this.mode = null; this.mode = null;
@@ -758,13 +783,13 @@ Template.prototype = {
break; break;
// Literal <%% mode, append as raw output // Literal <%% mode, append as raw output
case Template.modes.LITERAL: case Template.modes.LITERAL:
_addOutput(); this._addOutput(line);
break; break;
} }
} }
// In string mode, just add the output // In string mode, just add the output
else { else {
_addOutput(); this._addOutput(line);
} }
} }
+9 -9
View File
@@ -14,13 +14,13 @@
] ]
], ],
"_from": "ejs@>=2.5.2 <3.0.0", "_from": "ejs@>=2.5.2 <3.0.0",
"_id": "ejs@2.5.6", "_id": "ejs@2.5.7",
"_inCache": true, "_inCache": true,
"_location": "/ejs", "_location": "/ejs",
"_nodeVersion": "6.9.1", "_nodeVersion": "6.9.1",
"_npmOperationalInternal": { "_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com", "host": "s3://npm-registry-packages",
"tmp": "tmp/ejs-2.5.6.tgz_1487277787176_0.4875628533773124" "tmp": "tmp/ejs-2.5.7.tgz_1501385411193_0.3807816591579467"
}, },
"_npmUser": { "_npmUser": {
"name": "mde", "name": "mde",
@@ -40,8 +40,8 @@
"_requiredBy": [ "_requiredBy": [
"#DEV:/" "#DEV:/"
], ],
"_resolved": "https://registry.npmjs.org/ejs/-/ejs-2.5.6.tgz", "_resolved": "https://registry.npmjs.org/ejs/-/ejs-2.5.7.tgz",
"_shasum": "479636bfa3fe3b1debd52087f0acb204b4f19c88", "_shasum": "cc872c168880ae3c7189762fd5ffc00896c9518a",
"_shrinkwrap": null, "_shrinkwrap": null,
"_spec": "ejs@^2.5.2", "_spec": "ejs@^2.5.2",
"_where": "/brodocs", "_where": "/brodocs",
@@ -75,8 +75,8 @@
}, },
"directories": {}, "directories": {},
"dist": { "dist": {
"shasum": "479636bfa3fe3b1debd52087f0acb204b4f19c88", "shasum": "cc872c168880ae3c7189762fd5ffc00896c9518a",
"tarball": "https://registry.npmjs.org/ejs/-/ejs-2.5.6.tgz" "tarball": "https://registry.npmjs.org/ejs/-/ejs-2.5.7.tgz"
}, },
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
@@ -107,7 +107,7 @@
"devdoc": "jake doc[dev]", "devdoc": "jake doc[dev]",
"doc": "jake doc", "doc": "jake doc",
"lint": "eslint \"**/*.js\" Jakefile", "lint": "eslint \"**/*.js\" Jakefile",
"test": "mocha" "test": "jake test"
}, },
"version": "2.5.6" "version": "2.5.7"
} }
File diff suppressed because it is too large Load Diff
-1
View File
@@ -1 +0,0 @@
\foo
@@ -1 +0,0 @@
\foo
-7
View File
@@ -1,7 +0,0 @@
<li><a href="foo"><% // double-slash comment %>foo</li>
<li><a href="bar"><% /* C-style comment */ %>bar</li>
<li><a href="baz"><% // double-slash comment with newline
%>baz</li>
<li><a href="qux"><% var x = 'qux'; // double-slash comment @ end of line %><%= x %></li>
<li><a href="fee"><%# ERB style comment %>fee</li>
<li><a href="bah"><%= 'not a ' + '//' + ' comment' %></a></li>
-6
View File
@@ -1,6 +0,0 @@
<li><a href="foo">foo</li>
<li><a href="bar">bar</li>
<li><a href="baz">baz</li>
<li><a href="qux">qux</li>
<li><a href="fee">fee</li>
<li><a href="bah">not a // comment</a></li>
@@ -1 +0,0 @@
<% var a = 'foo' %><% var b = 'bar' %><%= a %>
@@ -1 +0,0 @@
foo
@@ -1 +0,0 @@
<p><%= "lo" + 'ki' %>'s "wheelchair"</p>
@@ -1 +0,0 @@
<p>loki's "wheelchair"</p>
-5
View File
@@ -1,5 +0,0 @@
<ul>
<% if (users) { %>
<p>Has users</p>
<% } %>
</ul>
-8
View File
@@ -1,8 +0,0 @@
ReferenceError: error.ejs:2
1| <ul>
>> 2| <% if (users) { %>
3| <p>Has users</p>
4| <% } %>
5| </ul>
users is not defined
-1
View File
@@ -1 +0,0 @@
<% function foo() return 'foo'; %>
@@ -1 +0,0 @@
<p>Hello world!</p>
@@ -1,5 +0,0 @@
<ul>
<@ pets.forEach(function(pet){ @>
<@- include(path.join(dir, 'pet'), {pet: pet}); @>
<@ }); @>
</ul>
@@ -1 +0,0 @@
<@- include('/include'); @>
@@ -1,3 +0,0 @@
<ul>
<%- include('hello-world'); %>
</ul>
@@ -1,4 +0,0 @@
<ul>
<p>Hello world!</p>
</ul>
@@ -1 +0,0 @@
<style><%- include('style.css', {value: 'bar'}); %></style>
@@ -1,4 +0,0 @@
<style>body {
foo: 'bar';
}
</style>
-5
View File
@@ -1,5 +0,0 @@
<ul>
<@ pets.forEach(function(pet){ @>
<@- include('pet', {pet: pet}); @>
<@ }); @>
</ul>
-12
View File
@@ -1,12 +0,0 @@
<ul>
<li>geddy</li>
<li>neil</li>
<li>alex</li>
</ul>
@@ -1 +0,0 @@
<%- include('../tmp/include') %>
@@ -1 +0,0 @@
<p>Old</p>
@@ -1 +0,0 @@
<style><% var value = 'bar' %><% include style.css %></style>
@@ -1,4 +0,0 @@
<style>body {
foo: 'bar';
}
</style>
@@ -1,5 +0,0 @@
<ul>
<@ pets.forEach(function(pet){ @>
<@ include pet @>
<@ }) @>
</ul>
@@ -1,12 +0,0 @@
<ul>
<li>geddy</li>
<li>neil</li>
<li>alex</li>
</ul>
@@ -1 +0,0 @@
<%- include ../tmp/include_preprocessor %>
@@ -1 +0,0 @@
<p>Old</p>
@@ -1 +0,0 @@
<% include include_preprocessor_line_slurp_child %>
@@ -1,5 +0,0 @@
<div>
12
3
45
</div>
@@ -1,5 +0,0 @@
<div>
1 <%_ if (true) { _%> 2
3
4 <%_ } _%> 5
</div>
@@ -1 +0,0 @@
<p>This is a file with BOM.</p>
@@ -1 +0,0 @@
<li><% include menu/item %></li>
@@ -1 +0,0 @@
<a href="/<%= url %>"><%= title %></a>
-3
View File
@@ -1,3 +0,0 @@
<pre>There should be a space followed by a less-than sign and then two more
spaces in the next line:
< .</pre>
-3
View File
@@ -1,3 +0,0 @@
<pre>There should be a space followed by a less-than sign and then two more
spaces in the next line:
< .</pre>
-15
View File
@@ -1,15 +0,0 @@
<%- include('includes/menu-item', {
url: '/foo'
, title: 'Foo'
}); -%>
<%- include('includes/menu-item', {
url: '/bar'
, title: 'Bar'
}); -%>
<%- include('includes/menu-item', {
url: '/baz'
, title: 'Baz'
}); -%>
-9
View File
@@ -1,9 +0,0 @@
<li><a href="//foo">Foo</a>
</li>
<li><a href="//bar">Bar</a>
</li>
<li><a href="//baz">Baz</a>
</li>
@@ -1,11 +0,0 @@
<% var url = '/foo' -%>
<% var title = 'Foo' -%>
<% include includes/menu-item -%>
<% var url = '/bar' -%>
<% var title = 'Bar' -%>
<% include includes/menu-item -%>
<% var url = '/baz' -%>
<% var title = 'Baz' -%>
<% include includes/menu-item -%>
@@ -1,8 +0,0 @@
<li><a href="//foo">Foo</a>
</li>
<li><a href="//bar">Bar</a>
</li>
<li><a href="//baz">Baz</a>
</li>
-15
View File
@@ -1,15 +0,0 @@
<%- include(varPath, {
url: '/foo'
, title: 'Foo'
}); -%>
<%- include(varPath, {
url: '/bar'
, title: 'Bar'
}); -%>
<%- include(varPath, {
url: '/baz'
, title: 'Baz'
}); -%>
-1
View File
@@ -1 +0,0 @@
<ul><%users.forEach(function(user){%><li><%=user.name%></li><%})%></ul>
-1
View File
@@ -1 +0,0 @@
<ul><li>geddy</li><li>neil</li><li>alex</li></ul>
-5
View File
@@ -1,5 +0,0 @@
<ul>
<% users.forEach(function(user){ %>
<li><%= user.name %></li>
<% }) %>
</ul>
-9
View File
@@ -1,9 +0,0 @@
<ul>
<li>geddy</li>
<li>neil</li>
<li>alex</li>
</ul>
@@ -1,6 +0,0 @@
<ul>
<% var unused1 = 'blah' -%>
<% var unused2 = 'bleh' %>
<% var unused3 = 'bloh' -%>
<% var unused4 = 'bluh' %>
</ul>
@@ -1,4 +0,0 @@
<ul>
</ul>
@@ -1,5 +0,0 @@
<ul>
<% users.forEach(function(user){ -%>
<li><%= user.name %></li>
<% }) -%>
</ul>
@@ -1,5 +0,0 @@
AAA
<% var data = "test"; -%>
BBB
<%= qdata %>
CCC
@@ -1,5 +0,0 @@
<ul>
<li>geddy</li>
<li>neil</li>
<li>alex</li>
</ul>
@@ -1,8 +0,0 @@
This document does not use semicolons in scriptlets.
<%
var a = 'b'
var b = 'c'
var c
c = b
%>
The value of c is: <%= c %>

Some files were not shown because too many files have changed in this diff Show More