Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ cache:
bundler: true
directories:
- node_modules
- "$HOME/google-cloud-sdk/"

before_install:
- nvm install 4.6.0
Expand All @@ -28,6 +29,19 @@ install:
- npm install
- cd ember-app && npm install && cd ..

before_script:
# Install gcloud if it doesnt exist
- echo "Installing gcloud..."
- if [ ! -d "$HOME/google-cloud-sdk/bin" ]; then rm -rf $HOME/google-cloud-sdk; curl https://sdk.cloud.google.com | bash -y; fi
# Add gcloud to $PATH
- source $HOME/google-cloud-sdk/path.bash.inc
- gcloud version
# Authorize gcloud
- echo $GCLOUD_KEY | base64 --decode > gcloud.p12
- gcloud auth activate-service-account $GCLOUD_EMAIL --key-file gcloud.p12

script:
- bundle exec rake
- cd ember-app && ./node_modules/.bin/ember test && cd ..
- bundle exec rake assets:precompile
- bundle exec rake cdn:push
1 change: 1 addition & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@

# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'
config.action_controller.asset_host = ENV['CDN_HOST'] if ENV['CDN_HOST'].present?

# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
Expand Down
4 changes: 2 additions & 2 deletions lib/tasks/ember-cli.rake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require "ember-cli-rails"
namespace "heroku-ember-cli" do
namespace "ember-cli" do
task compile: :environment do
EmberCLI.configure do |c|
c.app :app, path: Rails.root.join('ember-app')
Expand All @@ -21,4 +21,4 @@ namespace "heroku-ember-cli" do
end
end

task "assets:precompile" => "heroku-ember-cli:compile"
task "assets:precompile" => "ember-cli:compile"
8 changes: 8 additions & 0 deletions lib/tasks/push-to-cdn.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace "cdn" do
task push: :environment do
assets_dir = "#{Rails.root}/public/assets"
`gsutil -m rm gs://huboard-web/staging/assets/**`
`gsutil -m cp -r #{assets_dir} gs://huboard-web/staging`
`gsutil -m acl -R ch -u AllUsers:R gs://huboard-web/staging/assets`
end
end