Skip to content

Commit

Permalink
Working version URLs. Move rest of stuff into dir
Browse files Browse the repository at this point in the history
  • Loading branch information
ebidel committed Feb 19, 2015
1 parent cb39a21 commit df41b8c
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 173 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
node_modules
bower_components
/components
components
polymer-all
_site
.DS_Store
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ safe: false
#permalink: /news/:year/:month/:day/:title.html

exclude: ["node_modules", "scripts", "sass", "app.yaml", "README.md",
"CONTRIBUTING.md", "Gruntfile.js", "package.json", "config.rb",
"build.py", "polymer-all", "components"]
"CONTRIBUTING.md", "Gruntfile.js", "package.json", "config.rb"]

kramdown:
toc_levels: 2..3
Expand All @@ -23,5 +22,6 @@ kramdown:
project_title: Polymer
project_status: 'Dev preview'
latest_version: 0.5.4
default_version: 0.5 # default version the docs should serve
add_permalinks: true # adds permalinks to heading tags.
load_disqus: true
14 changes: 7 additions & 7 deletions _includes/head.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1">
<meta name="google-site-verification" content="pnjjbQFvjPwaWhEXY6nSyaS9iyghmH-M_yLHBveDX2M">
<meta itemprop="name" content="{{site.project_title}}{% if page.title %} - {{page.title}}{% endif %}">
<meta itemprop="description" content="{% if page.description %}{{page.description}}{% else %}Polymer is a library that uses the latest web technologies to let you create custom HTML elements. Build anything from a button to a complete application as an encapsulated, reusable element that works across desktop and mobile.{% endif %}">

{% if page.snippet_img %}
<meta itemprop="image" content="{{page.snippet_img}}">
{% else %}
<meta itemprop="image" content="http://www.polymer-project.org/images/instacod.png">
<meta itemprop="image" content="https://www.polymer-project.org/images/instacod.png">
{% endif %}

<title>
{% if page.title %}
{{page.title}} -
{{page.title}} -
{% else %}
Welcome - A new type of library for the web, built on top of Web Components
{% endif %} {{site.project_title}}
Expand All @@ -34,12 +34,12 @@
<link rel="stylesheet" href="{{item}}?{{site.time | date: '%Y%m%d'}}" shim-shadowdom>
{% endfor %}

<script src="/webcomponents.min.js?{{site.time | date: '%Y%m%d'}}"></script>
<script src="/{{site.default_version}}/components/webcomponentsjs/webcomponents.min.js?{{site.time | date: '%Y%m%d'}}"></script>
<!-- TODO: remove when https://github.com/Polymer/polymer/issues/391 is fixed -->
<link rel="import" href="/components/polymer/polymer.html">
<link rel="import" href="/{{site.default_version}}/components/polymer/polymer.html">

{% if page.layout == 'home' %}
<link rel="import" href="/elements/homepage_elements.vulcanized.html?{{site.time | date: '%Y%m%d'}}">
<link rel="import" href="/{{site.default_version}}/elements/homepage_elements.vulcanized.html?{{site.time | date: '%Y%m%d'}}">
{% else %}
<link rel="import" href="/elements/common_elements.vulcanized.html?{{site.time | date: '%Y%m%d'}}">
<link rel="import" href="/{{site.default_version}}/elements/common_elements.vulcanized.html?{{site.time | date: '%Y%m%d'}}">
{% endif %}
114 changes: 55 additions & 59 deletions app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,56 +21,57 @@ handlers:
upload: _site/index\.html
secure: always

- url: /build/$
static_files: _site/build/index.html
upload: _site/build/index\.html
# - url: /build/$
# static_files: _site/build/index.html
# upload: _site/build/index\.html

- url: /build/(.*)
script: build.application
# - url: /build/(.*)
# script: build.application

# Short URLs -------------------------------------------------------------------
# backward compatibility
- url: /platform(\.min)?\.js
static_files: components/platform/platform.js
upload: components/platform/platform\.js
# These needs to be in this order and come for the short URL versions.
- url: /(.+)/components/(.*)/webcomponents(\.min)?.js$
static_files: \1/components/\2/webcomponents.min.js
upload: (.+)/components/(.*)/webcomponents(\.min)?.js
http_headers:
Access-Control-Allow-Origin: "*"

- url: /platform(\.min)?\.js.map
static_files: components/platform/platform.js.map
upload: components/platform/platform\.js.\map
- url: /(.+)/components/(.*)/polymer(\.min)?.js$
static_files: \1/components/\2/polymer.min.js
upload: (.+)/components/(.*)/polymer(\.min)?.js
http_headers:
Access-Control-Allow-Origin: "*"

# For webcomponents.js, serve both minified and non-minifed versions
# Workaround for https://github.com/Polymer/docs/issues/823 -- always serve minified
- url: /webcomponents(\.min|)?\.js
static_files: components/webcomponentsjs/webcomponents.min.js
upload: components/webcomponentsjs/webcomponents(\.min|)?.js
- url: /(.+)/components/(.*)
static_files: \1/components/\2
upload: (.+)/components/(.*)
http_headers:
Access-Control-Allow-Origin: "*"

- url: /webcomponents(\.min|)\.js.map
static_files: components/webcomponentsjs/webcomponents\1.js.map
upload: components/webcomponentsjs/webcomponents(\.min)?\.js.\map
# Short URLs -------------------------------------------------------------------
# For webcomponents.js, serve both minified and non-minifed versions
# Workaround for https://github.com/Polymer/docs/issues/823 -- always serve minified

- url: /(.+)/webcomponents(\.min)?.js$
static_files: \1/components/webcomponentsjs/webcomponents.min.js
upload: (.+)/components/webcomponentsjs/webcomponents(\.min)?.js
http_headers:
Access-Control-Allow-Origin: "*"

- url: /polymer(\.min)?\.html
static_files: components/polymer/polymer.html
upload: components/polymer/polymer\.html
- url: /(.+)/polymer.html$
static_files: \1/components/polymer/polymer.html
upload: (.+)/components/polymer/polymer.html
http_headers:
Access-Control-Allow-Origin: "*"

- url: /polymer(\.min)?\.js
static_files: components/polymer/polymer.min.js
upload: components/polymer/polymer\.js
- url: /(.+)/polymer(\.min)?.js$
static_files: \1/components/polymer/polymer.min.js
upload: (.+)/components/polymer/polymer(\.min)?.js
http_headers:
Access-Control-Allow-Origin: "*"

- url: /polymer(\.min)?\.js\.map
static_files: components/polymer/polymer.js.map
upload: components/polymer/polymer\.js\.map
- url: /(.+)/layout.html$
static_files: \1/components/polymer/layout.html
upload: (.+)/components/polymer/layout.html
http_headers:
Access-Control-Allow-Origin: "*"

Expand All @@ -79,9 +80,9 @@ handlers:
# slash will fail to redirect

# /0.5/docs/start/getting-the-code.html
- url: /(.+)?/docs/
- url: /(.+)/docs/
static_files: _site/\1/docs
upload: _site/(.+)?/docs/
upload: _site/(.+)/docs/
http_headers:
Access-Control-Allow-Origin: "*"

Expand All @@ -101,15 +102,15 @@ handlers:
upload: _site/(.*)/index.html
secure: always

- url: /samples
static_dir: samples
http_headers:
Access-Control-Allow-Origin: "*"
# - url: /samples
# static_dir: samples
# http_headers:
# Access-Control-Allow-Origin: "*"

- url: /components
static_dir: components
http_headers:
Access-Control-Allow-Origin: "*"
# - url: /components
# static_dir: components
# http_headers:
# Access-Control-Allow-Origin: "*"

# All other URLs map directly to their path in _site/.
- url: /
Expand All @@ -131,27 +132,22 @@ skip_files:
- ^(.*/)?.*\.bak$
- ^(.*/)?node_modules/.*
- ^(.*/)?third_party/closure/.*
- ^scripts/.*
- ^.*.md|markdown
- ^.*.LICENSE

# few extras to reduce number of files uploaded.
- ^(.*/)?Makefile$
- ^.*.md|markdown
- ^(.*/)?.*\.sublime-project
- ^(.*/)?.*\.sublime-workspace
- ^(.*/)?platform-dev/workbench/.*
- ^(.*/)?(AUTHORS|LICENSE|PATENTS|COPYING|CONTRIBUTING|README)$
- ^(.*/)?projects/(designer|polymer-tutorial|topeka)/components/.*
- ^(.*/)?components/tools/.* # tool is already in /polymer-all
- ^(.*/)?components/firebase-simple-login/firebase-simple-login-(java|objc)/.*
- ^(.*/)?components/firebase-simple-login/lib/.*
- ^(.*/)?components/code-mirror/codemirror-4.0/bin/.*
- ^(.*/)?components/web-component-tester/.*
- ^(.*/)?components/web-animations-(js|next)/test/.*
- ^(.*/)?components/extern-generator/.*
- ^(.*/)?components/polymer-expressions/third_party/.*
- ^(.*/)?Makefile$
- ^(.*/)?codereview.setting
- ^(.*/)?doc_themes/.*
- ^(.*/)?bower_components/.*/manifest.webapp
- ^(.*/)?bower_components/font-awesome/less/.*
- ^(.*/)?bower_components/.*/test/.*

# Jekyll/build dirs
- ^_(data|includes|layouts|plugins)/
- ^sass$
- ^scripts$

- ^(\d.\d(.\d)?)$ # Exclude version dirs. They're in _site/.

# few extras to reduce number of files uploaded.
- ^(.*/)?components/web-component-tester/.*
- ^(.*/)?components/font-awesome/(less|scss)/.*
- ^(.*/)?components/.*/test/.*
80 changes: 0 additions & 80 deletions build.py

This file was deleted.

16 changes: 0 additions & 16 deletions build/index.md

This file was deleted.

16 changes: 8 additions & 8 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ def get_dirs(root='.'):
def get_latest_polymer_version_dir():
current_app_version = os.environ['CURRENT_VERSION_ID'].split('.')[0]

latest_version = memcache.get('latest_version', namespace=current_app_version)
if latest_version is None:
default_version = memcache.get('default_version', namespace=current_app_version)
if default_version is None:
f = open('_config.yml', 'r')
config = yaml.load(f)

latest_version = config.get('latest_version')
memcache.add('latest_version', latest_version, namespace=current_app_version)
default_version = config.get('default_version')
memcache.add('default_version', default_version, namespace=current_app_version)

dirs = get_dirs(root='.')
# ['0.5', '0.6', '1.0.1'] -> max(['05', '06', '101']) -> '101' -> '1.0.1'
latest = '.'.join(max([x.replace('.', '') for x in dirs]))
# dirs = get_dirs(root='.')
# # ['0.5', '0.6', '1.0.1'] -> max(['05', '06', '101']) -> '101' -> '1.0.1'
# latest = '.'.join(max([x.replace('.', '') for x in dirs]))

return latest
return default_version


class VersionHandler(webapp2.RequestHandler):
Expand Down

0 comments on commit df41b8c

Please sign in to comment.