Compare commits
37 Commits
master
...
ember-cli-
Author | SHA1 | Date | |
---|---|---|---|
![]() |
db209f50b5 | ||
![]() |
6b53f583fd | ||
![]() |
1aeb2f9016 | ||
![]() |
2dff78b0ea | ||
![]() |
00be9c26bb | ||
![]() |
1c59f0cf51 | ||
![]() |
364fe16cfe | ||
![]() |
c2600f27c5 | ||
![]() |
e788de0acb | ||
![]() |
3ca1c216f5 | ||
![]() |
ab9f89f42b | ||
![]() |
f9b1b7601e | ||
![]() |
dfb80470f6 | ||
![]() |
84ac5f2abf | ||
![]() |
067a19a264 | ||
![]() |
7ed9b4357b | ||
![]() |
a9bd47502d | ||
![]() |
0403884224 | ||
![]() |
45f90c5ed2 | ||
![]() |
ef73b927e8 | ||
![]() |
34444246fd | ||
![]() |
f8ccf9d8d8 | ||
![]() |
4e1b2cd140 | ||
![]() |
0887bf9cde | ||
![]() |
770e708552 | ||
![]() |
02e653576a | ||
![]() |
d8446a596c | ||
![]() |
ce413fb8fc | ||
![]() |
fb0e7e16f4 | ||
![]() |
a672891b7e | ||
![]() |
8028b694e6 | ||
![]() |
6325fa2e8d | ||
![]() |
167bd114c5 | ||
![]() |
95da771778 | ||
![]() |
b921ab5191 | ||
![]() |
1a84955bd0 | ||
![]() |
2b878d8628 |
|
@ -1,2 +1 @@
|
|||
https://github.com/heroku/heroku-buildpack-ruby.git
|
||||
https://github.com/travis-ci/travis-web-ember-cli-buildpack.git
|
||||
|
|
33
.travis.yml
33
.travis.yml
|
@ -4,15 +4,15 @@ node_js: stable
|
|||
|
||||
env:
|
||||
- EMBER_VERSION=default
|
||||
- EMBER_VERSION=release
|
||||
- EMBER_VERSION=beta
|
||||
- EMBER_VERSION=canary
|
||||
# - EMBER_VERSION=release
|
||||
# - EMBER_VERSION=beta
|
||||
# - EMBER_VERSION=canary
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- env: EMBER_VERSION=release
|
||||
- env: EMBER_VERSION=beta
|
||||
- env: EMBER_VERSION=canary
|
||||
# - env: EMBER_VERSION=release
|
||||
# - env: EMBER_VERSION=beta
|
||||
# - env: EMBER_VERSION=canary
|
||||
|
||||
fast_finish: true
|
||||
|
||||
|
@ -46,21 +46,6 @@ notifications:
|
|||
campfire:
|
||||
secure: "JJezWGD9KJY/LC2aznI3Zyohy31VTIhcTKX7RWR4C/C8YKbW9kZv3xV6Vn11\nSHxJTeZo6st2Bpv6tjlWZ+HCR09kyCNavIChedla3+oHOiuL0D4gSo+gkTNW\nUKYZz9mcQUd9RoQpTeyxvdvX+l7z62/7JwFA7txHOqxbTS8jrjc="
|
||||
|
||||
before_deploy:
|
||||
- ASSETS_HOST=https://s3.amazonaws.com/travis-error-pages ember build --env production
|
||||
# delete some of the stuff that's useless for maintenance page
|
||||
- rm -fr dist/assets/*.js dist/images/emoji dist/index.html dist/images/sponsors
|
||||
- cp dist/maintenance.html dist/index.html
|
||||
|
||||
deploy:
|
||||
provider: s3
|
||||
access_key_id: $MAINTENANCE_S3_ACCESS_KEY_ID
|
||||
secret_access_key: $MAINTENANCE_S3_SECRET_ACCESS_KEY
|
||||
bucket: travis-error-pages
|
||||
skip_cleanup: true
|
||||
acl: public_read
|
||||
local_dir: dist
|
||||
region: us-east-1
|
||||
on:
|
||||
branch: master
|
||||
condition: "$EMBER_VERSION = default"
|
||||
# FIXME this needs refinement, obvs
|
||||
after_success:
|
||||
- "test $EMBER_VERSION == 'default' && test $TRAVIS_PULL_REQUEST && ember deploy pull-request --verbose"
|
||||
|
|
1
Gemfile
1
Gemfile
|
@ -8,6 +8,7 @@ gem 'rack-protection', '~> 1.3'
|
|||
gem 'rack-mobile-detect'
|
||||
gem 'sinatra'
|
||||
gem 'hashr'
|
||||
gem 'redis'
|
||||
|
||||
group :development, :test do
|
||||
gem 'rake'
|
||||
|
|
|
@ -28,6 +28,7 @@ GEM
|
|||
rack-test (0.6.2)
|
||||
rack (>= 1.0)
|
||||
rake (10.1.1)
|
||||
redis (3.2.2)
|
||||
rspec (2.99.0)
|
||||
rspec-core (~> 2.99.0)
|
||||
rspec-expectations (~> 2.99.0)
|
||||
|
@ -61,10 +62,11 @@ DEPENDENCIES
|
|||
rack-protection (~> 1.3)
|
||||
rack-ssl (~> 1.3)
|
||||
rake
|
||||
redis
|
||||
rspec (~> 2.11)
|
||||
sinatra
|
||||
sinatra-contrib
|
||||
travis-web!
|
||||
|
||||
BUNDLED WITH
|
||||
1.10.1
|
||||
1.11.2
|
||||
|
|
74
config/deploy.js
Normal file
74
config/deploy.js
Normal file
|
@ -0,0 +1,74 @@
|
|||
var VALID_DEPLOY_TARGETS = [ //update these to match what you call your deployment targets
|
||||
'dev',
|
||||
'qa',
|
||||
'pull-request'
|
||||
];
|
||||
|
||||
module.exports = function(deployTarget) {
|
||||
var ENV = {
|
||||
build: {},
|
||||
redis: {
|
||||
allowOverwrite: true,
|
||||
keyPrefix: 'travis:index'
|
||||
},
|
||||
s3: {
|
||||
bucket: 'travis-web-production-next',
|
||||
region: 'eu-west-1'
|
||||
}
|
||||
};
|
||||
if (VALID_DEPLOY_TARGETS.indexOf(deployTarget) === -1) {
|
||||
throw new Error('Invalid deployTarget ' + deployTarget);
|
||||
}
|
||||
|
||||
if (deployTarget === 'dev') {
|
||||
ENV.build.environment = 'development';
|
||||
ENV.redis.url = process.env.REDIS_URL;
|
||||
ENV.plugins = ['build', 'redis']; // only care about deploying index.html into redis in dev
|
||||
}
|
||||
|
||||
if (deployTarget === 'qa' || deployTarget === 'pull-request') {
|
||||
ENV.build.environment = 'production';
|
||||
ENV.s3.accessKeyId = process.env.AWS_KEY;
|
||||
ENV.s3.secretAccessKey = process.env.AWS_SECRET;
|
||||
}
|
||||
|
||||
if (deployTarget === 'qa') {
|
||||
ENV.redis.url = process.env.QA_REDIS_URL;
|
||||
}
|
||||
|
||||
if (deployTarget === 'pull-request') {
|
||||
ENV.redis.url = process.env.REDIS_URL;
|
||||
|
||||
ENV.github = {
|
||||
token: process.env.GITHUB_TOKEN,
|
||||
userOrOrganization: 'travis-ci',
|
||||
repo: 'travis-web',
|
||||
publicURL: 'https://travis-web-production-next.herokuapp.com/?index_key={{versionSha}}',
|
||||
// FIXME is there an environment variable for this?
|
||||
commitUser: 'backspace',
|
||||
commitSha: process.env.TRAVIS_COMMIT
|
||||
};
|
||||
}
|
||||
|
||||
return ENV;
|
||||
|
||||
/* Note: a synchronous return is shown above, but ember-cli-deploy
|
||||
* does support returning a promise, in case you need to get any of
|
||||
* your configuration asynchronously. e.g.
|
||||
*
|
||||
* var Promise = require('ember-cli/lib/ext/promise');
|
||||
* return new Promise(function(resolve, reject){
|
||||
* var exec = require('child_process').exec;
|
||||
* var command = 'heroku config:get REDISTOGO_URL --app my-app-' + deployTarget;
|
||||
* exec(command, function (error, stdout, stderr) {
|
||||
* ENV.redis.url = stdout.replace(/\n/, '').replace(/\/\/redistogo:/, '//:');
|
||||
* if (error) {
|
||||
* reject(error);
|
||||
* } else {
|
||||
* resolve(ENV);
|
||||
* }
|
||||
* });
|
||||
* });
|
||||
*
|
||||
*/
|
||||
}
|
|
@ -6,20 +6,17 @@ module.exports = function(defaults) {
|
|||
var fingerprint,
|
||||
assetsHost;
|
||||
|
||||
// FIXME: this should not have dev hardcoded
|
||||
var s3Bucket = require('./config/deploy')('dev').s3.bucket;
|
||||
|
||||
if (process.env.DISABLE_FINGERPRINTS) {
|
||||
fingerprint = false;
|
||||
} else {
|
||||
fingerprint = {
|
||||
exclude: ['images/emoji'],
|
||||
extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map', 'svg']
|
||||
extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map', 'svg'],
|
||||
prepend: '//' + s3Bucket + '.s3.amazonaws.com/',
|
||||
};
|
||||
|
||||
if (assetsHost = process.env.ASSETS_HOST) {
|
||||
if (assetsHost.substr(-1) !== '/') {
|
||||
assetsHost = assetsHost + '/'
|
||||
}
|
||||
fingerprint.prepend = assetsHost
|
||||
}
|
||||
}
|
||||
|
||||
var app = new EmberApp({
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
"ember-cli-autoprefixer": "^0.5.0",
|
||||
"ember-cli-babel": "^5.1.6",
|
||||
"ember-cli-dependency-checker": "^1.2.0",
|
||||
"ember-cli-deploy": "0.6.0",
|
||||
"ember-cli-deploy-github": "0.3.0",
|
||||
"ember-cli-deploy-lightning-pack": "0.6.1",
|
||||
"ember-cli-deprecation-workflow": "0.1.6",
|
||||
"ember-cli-document-title": "0.2.0",
|
||||
"ember-cli-htmlbars": "^1.0.3",
|
||||
|
|
|
@ -5,6 +5,7 @@ require 'delegate'
|
|||
require 'time'
|
||||
require 'json'
|
||||
require 'travis/utils/deep_merge'
|
||||
require 'redis'
|
||||
|
||||
class Travis::Web::App
|
||||
autoload :AltVersions, 'travis/web/app/alt_versions'
|
||||
|
@ -61,11 +62,21 @@ class Travis::Web::App
|
|||
end
|
||||
|
||||
def call(env)
|
||||
name = env['travis.alt'] || :default
|
||||
routers[name] ||= create_router(alt: name)
|
||||
route = routers[name].call(env)
|
||||
route[1]["Date"] = Time.now.httpdate
|
||||
route
|
||||
# name = env['travis.alt'] || :default
|
||||
# routers[name] ||= create_router(alt: name)
|
||||
# route = routers[name].call(env)
|
||||
# puts "routers"
|
||||
# puts routers.inspect
|
||||
# puts "env:"
|
||||
# puts env
|
||||
# puts "name: #{name}"
|
||||
# puts "route!"
|
||||
# puts route.inspect
|
||||
# route[1]["Date"] = Time.now.httpdate
|
||||
# route
|
||||
|
||||
req = Rack::Request.new(env)
|
||||
response_for("index.html", {params: req.params, host: req.host})
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -82,7 +93,7 @@ class Travis::Web::App
|
|||
end
|
||||
|
||||
def response_for(file, options = {})
|
||||
content = File.read(file)
|
||||
content = content_for(file, options)
|
||||
if fingerprinted?(file)
|
||||
headers = {
|
||||
'Content-Length' => content.bytesize.to_s,
|
||||
|
@ -111,6 +122,20 @@ class Travis::Web::App
|
|||
[ 200, headers, [content] ]
|
||||
end
|
||||
|
||||
def content_for(file, options)
|
||||
if index?(file)
|
||||
redis = Redis.new
|
||||
project = 'travis'
|
||||
|
||||
host = options[:host]
|
||||
|
||||
index_key = host.split('.')[0] || redis.get("#{project}:index:current")
|
||||
redis.get("#{project}:index:#{index_key}")
|
||||
else
|
||||
content = File.read(file)
|
||||
end
|
||||
end
|
||||
|
||||
def each_file
|
||||
Dir.glob(File.join(root, '**/*')) { |file| yield file if File.file?(file) }
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user