From ca8b26df7d8ac29ef2cf45fcf6125ca911de0603 Mon Sep 17 00:00:00 2001 From: Alex Cabrera Date: Sun, 27 Oct 2013 15:12:12 -0400 Subject: [PATCH 01/12] use a correct reference for composer requirement --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 42f0d34..a0734c5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ --e git://github.com/marquee/composer.git#egg=composer +-e git+https://github.com/marquee/composer.git#egg=composer Flask==0.9 Flask-Script==0.6.2 From b26703ff9853118afd594d6eee81f1123806c055 Mon Sep 17 00:00:00 2001 From: Alex Cabrera Date: Sun, 27 Oct 2013 15:13:40 -0400 Subject: [PATCH 02/12] Set up Vagrant file for project --- Vagrantfile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Vagrantfile diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..6fab6a9 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,15 @@ +VAGRANTFILE_API_VERSION = "2" + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + config.vm.box = 'raring64' + config.vm.box_url = 'http://cloud-images.ubuntu.com/vagrant/raring/current/raring-server-cloudimg-amd64-vagrant-disk1.box' + + config.vm.network :private_network, ip: '10.10.10.2' + config.vm.synced_folder '.', '/home/vagrant/runtime' + + config.vm.provision :ansible do |ansible| + ansible.inventory_path = 'provisioning/inventory/vagrant' + ansible.playbook = 'provisioning/playbook.yml' + end + +end From 586f933636de99e713595840a78011db22968111 Mon Sep 17 00:00:00 2001 From: Alex Cabrera Date: Sun, 27 Oct 2013 15:13:49 -0400 Subject: [PATCH 03/12] provision using ansible --- provisioning/group_vars/vagrant | 6 ++ provisioning/inventory/vagrant | 2 + provisioning/playbook.yml | 5 ++ provisioning/roles/runtime/tasks/main.yml | 61 +++++++++++++++++++ .../roles/runtime/templates/bash_profile.j2 | 27 ++++++++ 5 files changed, 101 insertions(+) create mode 100644 provisioning/group_vars/vagrant create mode 100644 provisioning/inventory/vagrant create mode 100644 provisioning/playbook.yml create mode 100644 provisioning/roles/runtime/tasks/main.yml create mode 100644 provisioning/roles/runtime/templates/bash_profile.j2 diff --git a/provisioning/group_vars/vagrant b/provisioning/group_vars/vagrant new file mode 100644 index 0000000..cc68602 --- /dev/null +++ b/provisioning/group_vars/vagrant @@ -0,0 +1,6 @@ +--- +ssh_home_dir: /home/vagrant +runtime_dir: /home/vagrant/runtime +runtime_venv_name: runtime +runtime_venv_dir: /home/vagrant/.virtualenvs/runtime + diff --git a/provisioning/inventory/vagrant b/provisioning/inventory/vagrant new file mode 100644 index 0000000..38c0c75 --- /dev/null +++ b/provisioning/inventory/vagrant @@ -0,0 +1,2 @@ +[vagrant] +10.10.10.2 diff --git a/provisioning/playbook.yml b/provisioning/playbook.yml new file mode 100644 index 0000000..43e6db6 --- /dev/null +++ b/provisioning/playbook.yml @@ -0,0 +1,5 @@ +--- +- hosts: vagrant + remote_user: vagrant + roles: + - runtime diff --git a/provisioning/roles/runtime/tasks/main.yml b/provisioning/roles/runtime/tasks/main.yml new file mode 100644 index 0000000..661fb75 --- /dev/null +++ b/provisioning/roles/runtime/tasks/main.yml @@ -0,0 +1,61 @@ +--- +- name: apt | update cache + sudo: yes + apt: update_cache=yes cache_valid_time=3600 + +- name: apt | install git + sudo: yes + apt: pkg=git-core state=latest + +- name: apt | install ruby + sudo: yes + apt: pkg=ruby state=latest + +- name: apt | install rubygems + sudo: yes + apt: pkg=rubygems state=latest + +- name: gem | install sass + sudo: yes + gem: name=sass state=latest + +- name: gem | install compass + sudo: yes + gem: name=compass state=latest + +- name: apt | install nodejs + sudo: yes + apt: pkg=nodejs state=latest + +- name: apt | install npm + sudo: yes + apt: pkg=npm state=latest + +- name: npm | install coffee-script + sudo: yes + npm: name=coffee-script global=yes state=latest + +- name: npm | install node dependencies + sudo: yes + npm: path={{ runtime_dir }} state=latest + +- name: apt | install python + sudo: yes + apt: pkg=python state=latest + +- name: apt | install pip + sudo: yes + apt: pkg=python-pip state=latest + +- name: apt | install virtualenvwrapper + sudo: yes + apt: pkg=virtualenvwrapper state=latest + +- name: pip | install python requirements + pip: chdir={{ runtime_dir }} virtualenv={{ runtime_venv_dir }} requirements=requirements.txt + +- name: bash | update profile + template: src=bash_profile.j2 dest={{ ssh_home_dir }}/.profile + +- name: cake | initialize runtime + command: cake init chdir={{ runtime_dir }} creates=.env diff --git a/provisioning/roles/runtime/templates/bash_profile.j2 b/provisioning/roles/runtime/templates/bash_profile.j2 new file mode 100644 index 0000000..d358107 --- /dev/null +++ b/provisioning/roles/runtime/templates/bash_profile.j2 @@ -0,0 +1,27 @@ +# ~/.profile: executed by the command interpreter for login shells. +# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login +# exists. +# see /usr/share/doc/bash/examples/startup-files for examples. +# the files are located in the bash-doc package. + +# the default umask is set in /etc/profile; for setting the umask +# for ssh logins, install and configure the libpam-umask package. +#umask 022 + +# if running bash +if [ -n "$BASH_VERSION" ]; then + # include .bashrc if it exists + if [ -f "$HOME/.bashrc" ]; then + . "$HOME/.bashrc" + fi +fi + +# set PATH so it includes user's private bin if it exists +if [ -d "$HOME/bin" ] ; then + PATH="$HOME/bin:$PATH" +fi + +# Activate virtualenv and change directories +WORKON_HOME="$HOME/.virtualenvs" +cd {{ runtime_dir }} +workon runtime From 4422dbaffbd5ec29adb5ab437759c26c5df28ac9 Mon Sep 17 00:00:00 2001 From: Alex Cabrera Date: Sun, 27 Oct 2013 15:13:59 -0400 Subject: [PATCH 04/12] docs for vagrant dev environment --- README.md | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/README.md b/README.md index d500996..628929c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,63 @@ # Marquee Runtime +## Getting Started + +The Marquee Runtime comes with it's own development environment that runs on [Vagrant](http://vagrantup.com) and is provisioned by [Ansible](http://ansibleworks.com). Because Ansible support in Vagrant is still under heavy development, we will need to install both [Vagrant](https://github.com/mitchellh/vagrant) and [Ansible](https://github.com/ansible/ansible) from source. + +You'll first want to uninstall any current installations of Vagrant by running through the uninstall package in the [official binaries](http://downloads.vagrantup.com/). + +If you don't have rubygems or bundler installed, you need them. + +``` +→ brew install rubygems +→ gem install bundler +``` + +Then build and install Vagrant + +``` +→ git clone https://github.com/mitchellh/vagrant.git +→ cd vagrant +→ bundle install +→ rake install +``` + +You can install Ansible using pip, but modules are still in heavy flux and keeping different versions of it in virtualenvs is more trouble than it's worth. Just install it from it's pretty stable source, and you'll be fine. Homebrewed it for simplicity. + +``` +# Install from source +→ brew install ansible --HEAD + +# Keep up-to-date +→ brew upgrade ansible --HEAD +``` + +The virtual machine used for the development environment will use private networking and assign itself the IP address `10.10.10.2`. To make your life easier, you should ignore host checking when ssh'ing to it; otherwise, you're going to have to delete lines in `~/.ssh/known_hosts` every time you rebuild the box. + +Add the following to `~/.ssh/config` to save yourself some time: + +``` +Host 10.10.10.2 + StrictHostKeyChecking no + UserKnownHostsFile /dev/null +``` + +You're now good to go. Clone this repository into a *New Project* and then fire up vagrant to get to work. + +``` +→ git clone https://github.com/marquee/runtime.git +→ cd +→ vagrant up +``` + +Vagrant will run through setting up an [Ubuntu Server 13.04 (Raring) Cloud Image](http://cloud-images.ubuntu.com/) virtual machine, install requirements, and set up your development environment. + +You can access the development environment simply by running `vagrant ssh`. Defaults are defined in the [vagrant group_vars](https://github.com/marquee/runtime/tree/master/provisioning/group_vars/vagrant). Highlights below: + +- The runtime located is in your home directory at `/home/vagrant/runtime`. You are logged into this directory when you SSH into the machine. The root directory of the repository on the host machine is synced here, so you can work locally and changes will automatically appear within the development environment and reload watching scripts appropriately. + +- A Python virtual environment named `runtime` is created and into it all dependencies of the application installed. It is activated for you when you log into the virtual machine. + ## Setup From 88949f9088ffb39c8116c31000ba8a9e2fe9b3b4 Mon Sep 17 00:00:00 2001 From: Alex Cabrera Date: Sun, 27 Oct 2013 15:20:45 -0400 Subject: [PATCH 05/12] ignore more stuff --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index b035a5c..fb9c8d3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,9 +2,11 @@ *.swo *.swp *.swo +.cache/* .sass-cache/* .env .DS_Store +.vagrant/* static/* node_modules/* aws_config.json From 43e8b829bf7634d9b702206cf4f99bb373244f4e Mon Sep 17 00:00:00 2001 From: Alex Cabrera Date: Mon, 28 Oct 2013 15:55:37 -0400 Subject: [PATCH 06/12] install latest version of node and npm --- provisioning/roles/runtime/tasks/main.yml | 29 +++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/provisioning/roles/runtime/tasks/main.yml b/provisioning/roles/runtime/tasks/main.yml index 661fb75..44787e9 100644 --- a/provisioning/roles/runtime/tasks/main.yml +++ b/provisioning/roles/runtime/tasks/main.yml @@ -1,4 +1,5 @@ --- + - name: apt | update cache sudo: yes apt: update_cache=yes cache_valid_time=3600 @@ -23,10 +24,38 @@ sudo: yes gem: name=compass state=latest +- name: apt | install python-software-properties + sudo: yes + apt: pkg=python-software-properties state=latest + +- name: apt | install python + sudo: yes + apt: pkg=python state=latest + +- name: apt | install g++ + sudo: yes + apt: pkg=g++ state=latest + +- name: apt | install make + sudo: yes + apt: pkg=make state=latest + +- name: apt | add chris-lea/node.js repository + sudo: yes + apt_repository: repo='ppa:chris-lea/node.js' state=present update_cache=yes + - name: apt | install nodejs sudo: yes apt: pkg=nodejs state=latest +- name: apt | install nodejs-dev + sudo: yes + apt: pkg=nodejs-dev state=latest + +- name: symlink | /usr/bin/nodejs to /usr/bin/node + sudo: yes + file: src=/usr/bin/nodejs dest=/usr/bin/node state=link + - name: apt | install npm sudo: yes apt: pkg=npm state=latest From 5be9f7ed0959a3f0f1a6e10fd9b45f7ac591014c Mon Sep 17 00:00:00 2001 From: Alex Cabrera Date: Mon, 28 Oct 2013 15:56:18 -0400 Subject: [PATCH 07/12] ignore npm debug log --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index fb9c8d3..bd15064 100644 --- a/.gitignore +++ b/.gitignore @@ -9,5 +9,6 @@ .vagrant/* static/* node_modules/* +npm-debug.log aws_config.json .env-development From e9552379f1d4c110e459dc0ff7299138705e9cd7 Mon Sep 17 00:00:00 2001 From: Alex Cabrera Date: Fri, 1 Nov 2013 14:22:04 -0400 Subject: [PATCH 08/12] grammar --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 628929c..139963f 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Then build and install Vagrant → rake install ``` -You can install Ansible using pip, but modules are still in heavy flux and keeping different versions of it in virtualenvs is more trouble than it's worth. Just install it from it's pretty stable source, and you'll be fine. Homebrewed it for simplicity. +You can install Ansible using pip, but modules are still in heavy flux and keeping different versions of it in virtualenvs is more trouble than it's worth. Just install it from source, and you'll be fine. Homebrewed it for simplicity. ``` # Install from source From 3451c376a6500cbf346c2f5264f7239c1778e0da Mon Sep 17 00:00:00 2001 From: Alex Cabrera Date: Fri, 1 Nov 2013 14:23:45 -0400 Subject: [PATCH 09/12] break up new and old readmes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 139963f..53b67e8 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ You can access the development environment simply by running `vagrant ssh`. Defa - A Python virtual environment named `runtime` is created and into it all dependencies of the application installed. It is activated for you when you log into the virtual machine. - +--- ## Setup From 0fd961e4889c6068cb83cea12ac81c3cbe995926 Mon Sep 17 00:00:00 2001 From: Alex Cabrera Date: Tue, 5 Nov 2013 00:40:35 -0500 Subject: [PATCH 10/12] Successfully get node and npm installing --- README.md | 101 ++++++++++------------ provisioning/roles/runtime/tasks/main.yml | 17 +--- 2 files changed, 51 insertions(+), 67 deletions(-) diff --git a/README.md b/README.md index 53b67e8..eed2fa2 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Then build and install Vagrant → rake install ``` -You can install Ansible using pip, but modules are still in heavy flux and keeping different versions of it in virtualenvs is more trouble than it's worth. Just install it from source, and you'll be fine. Homebrewed it for simplicity. +You can install Ansible using pip, but modules are still in heavy flux and keeping different versions of it in virtualenvs is more trouble than it's worth. Just install it from it's pretty stable source, and you'll be fine. Homebrewed it for simplicity. ``` # Install from source @@ -58,63 +58,27 @@ You can access the development environment simply by running `vagrant ssh`. Defa - A Python virtual environment named `runtime` is created and into it all dependencies of the application installed. It is activated for you when you log into the virtual machine. ---- +## Configuration -## Setup +First, make sure the following settings have been configured in your `.env` file: -1. Clone the boilerplate template and install dev dependencies: +- `CONTENT_API_TOKEN` +- `PUBLICATION_NAME` +- `PUBLICATION_SHORT_NAME` - `$ git clone git@github.com:marquee/runtime.git ` - `$ cd ` +If you're going to be deploying this application publicly, you'll also want to hook up your AWS credentials so that static files can be handled by S3. These settings can be found in `.env-development`. - *(If it’s a pre-existing project, clone from the project repo instead.)* +## Running the Runtime -2. Install the various requirements: +Once your `.env` and `.env-development` files are filled out, you'll be able to fire up runtime. To do so, we'll first SSH into the box, then run the `runserver` command. - `$ mkvirtualenv ` - `$ pip install -r requirements.txt` - `$ npm install` - -3. Re-initialize the repo and copy the .env templates: - - `$ cake init` - - *(If this is a pre-existing project, use `init:env` instead.)* - -4. Add additional remotes (if necessary) - - `$ git add remote origin git@git.droptype.com:.git` - `$ git add remote heroku git@heroku.com:.git` - -5. Fill out the environment variables: - - In `.env`: - - * `CONTENT_API_TOKEN` - A read-only ApplicationToken issued by Marquee. - * `PUBLICATION_NAME` - Arbitrary project name - * `PUBLICATION_SHORT_NAME` - The short name, used to prefix the asset uploads - - In `.env-development`: - - * `AWS_ACCESS_KEY_ID` - * `AWS_SECRET_ACCESS_KEY` - - (They are in separate files to keep credentials that have write access - segregated. The `.env` file MUST NOT ever contain API tokens or Access - Keys or whatever that have write privileges.) - - - -## Running the project - -First, make sure you are in the virtualenv: `$ workon ` - -To run the project in debug mode, with the auto reloader, use -`$ python manage.py runserver`. +``` +→ vagrant ssh +# Stuff happens +→ runserver +``` -To run the project as if it is on Heroku, use `$ foreman start`. The project -also supports caching using redis. To use this locally, start redis and set -the `REDIS_URL` in `.env`. +This will make the runtime accessible at [http://10.10.10.2:5000](http://10.10.10.2:5000). @@ -126,10 +90,24 @@ If this is the first time the app is being deployed, you need to set certain environment variables using `$ heroku config:set` They can be set (almost) all at once: - $ heroku config:set CACHE_SOFT_EXPIRY=10 CONTENT_API_TOKEN= CONTENT_API_ROOT=marquee.by/content/ DEBUG=False ENVIRONMENT=production PUBLICATION_NAME="" SECRET_KEY= PUBLICATION_SHORT_NAME= + $ heroku config:set CACHE_SOFT_EXPIRY=10 \ + CONTENT_API_TOKEN= \ + CONTENT_API_ROOT=marquee.by/content/ \ + DEBUG=False ENVIRONMENT=production \ + PUBLICATION_NAME="" \ + SECRET_KEY= \ + PUBLICATION_SHORT_NAME= + +You can also use [this python script](https://gist.github.com/alexcabrera/63b993a604cdb5410ce8) to configure Heroku for you. + +Fire and forget one-liner: + +``` +curl -L http://mrqe.co/1cKkLEV | python +``` -To deploy the code, just `$ git push heroku master`. You’ll also want -to run `$ cake deploy:static` if you made changes to the static assets. +To deploy the code, just `git push heroku master`. You’ll also want +to run `cake deploy:static` if you made changes to the static assets. @@ -218,3 +196,18 @@ characters of a `SHA-1` hash of the asset contents. To refer to a static asset in the templates, use `{{ static_url('filename.jpg') }}`. This will use the appropriate `STATIC_URL`. +## Troubleshooting + +### SSH Error during *Getting Facts* stage of provisioning + +When bringing up the runtime environment with `vagrant up` for the first time, you may see the following message when Ansible attempts to begin provisioning: + +``` +GATHERING FACTS *************************************************************** +fatal: [10.10.10.2] => SSH encountered an unknown error during the +connection. We recommend you re-run the command using -vvvv, which will +enable SSH debugging output to help diagnose the issue +``` + +Sometime its takes a little bit for the SSH server on the Vagrant box to fire up. Simply running `vagrant provision` to start the provisioning process over again should make it go away. + diff --git a/provisioning/roles/runtime/tasks/main.yml b/provisioning/roles/runtime/tasks/main.yml index 44787e9..fcabd30 100644 --- a/provisioning/roles/runtime/tasks/main.yml +++ b/provisioning/roles/runtime/tasks/main.yml @@ -1,8 +1,11 @@ --- +- name: apt | add chris-lea/node.js repository + sudo: yes + apt_repository: repo='ppa:chris-lea/node.js' state=present - name: apt | update cache sudo: yes - apt: update_cache=yes cache_valid_time=3600 + apt: update_cache=yes - name: apt | install git sudo: yes @@ -40,26 +43,14 @@ sudo: yes apt: pkg=make state=latest -- name: apt | add chris-lea/node.js repository - sudo: yes - apt_repository: repo='ppa:chris-lea/node.js' state=present update_cache=yes - - name: apt | install nodejs sudo: yes apt: pkg=nodejs state=latest -- name: apt | install nodejs-dev - sudo: yes - apt: pkg=nodejs-dev state=latest - - name: symlink | /usr/bin/nodejs to /usr/bin/node sudo: yes file: src=/usr/bin/nodejs dest=/usr/bin/node state=link -- name: apt | install npm - sudo: yes - apt: pkg=npm state=latest - - name: npm | install coffee-script sudo: yes npm: name=coffee-script global=yes state=latest From e4e8522927ebb3300e46debfddca3b7840a49a98 Mon Sep 17 00:00:00 2001 From: Alex Cabrera Date: Tue, 5 Nov 2013 01:25:04 -0500 Subject: [PATCH 11/12] add alias for running dev server on 0.0.0.0 --- provisioning/roles/runtime/templates/bash_profile.j2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/provisioning/roles/runtime/templates/bash_profile.j2 b/provisioning/roles/runtime/templates/bash_profile.j2 index d358107..cad06b1 100644 --- a/provisioning/roles/runtime/templates/bash_profile.j2 +++ b/provisioning/roles/runtime/templates/bash_profile.j2 @@ -25,3 +25,6 @@ fi WORKON_HOME="$HOME/.virtualenvs" cd {{ runtime_dir }} workon runtime + +# Useful shortcuts +alias runserver="python manage.py runserver -t 0.0.0.0" From e6b6ff7e84ebe266f616b5dcb1af5727d24724a7 Mon Sep 17 00:00:00 2001 From: Alex Cabrera Date: Tue, 5 Nov 2013 01:25:13 -0500 Subject: [PATCH 12/12] gracefully handle non-critical errors --- Cakefile | 86 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 45 insertions(+), 41 deletions(-) diff --git a/Cakefile b/Cakefile index a3580f8..a283d00 100644 --- a/Cakefile +++ b/Cakefile @@ -261,44 +261,45 @@ doWatch = (options={}, callback) -> doInitEnv = (options={}, callback) -> if fs.existsSync(path.join(PROJECT_ROOT, '.env')) and not options.force - throw new Error('.env exists. Already initialized?') - - crypto.randomBytes 32, (err, secret_key) -> - env_template = """ - CACHE_SOFT_EXPIRY=10 - CONTENT_API_TOKEN= - CONTENT_API_ROOT=marquee.by/content/ - LIB_CDN_ROOT=marquee-cdn.net/ - ASSET_CDN_ROOT=assets.marquee-cdn.net/ - DEBUG=True - ENVIRONMENT=development - PUBLICATION_NAME= - PUBLICATION_SHORT_NAME= - STATIC_URL=/static/ - SECRET_KEY=#{ secret_key.toString('hex') } - """ - env_development_template = """ - AWS_ACCESS_KEY_ID= - AWS_SECRET_ACCESS_KEY= - S3_BUCKET_NAME=cdn.mrqe.co - """ - - operations = 0 - next = -> - operations += 1 - if operations is 2 - callback?() - - fs.writeFile ENV_FILE, env_template, (err) -> - throw err if err? - console.log 'Wrote .env' - next() - - fs.writeFile ENV_DEVELOPMENT_FILE, env_development_template, (err) -> - throw err if err? - console.log 'Wrote .env-development' - next() - + console.log '.env exists. Already initialized?' + else + + crypto.randomBytes 32, (err, secret_key) -> + env_template = """ + CACHE_SOFT_EXPIRY=10 + CONTENT_API_TOKEN= + CONTENT_API_ROOT=marquee.by/content/ + LIB_CDN_ROOT=marquee-cdn.net/ + ASSET_CDN_ROOT=assets.marquee-cdn.net/ + DEBUG=True + ENVIRONMENT=development + PUBLICATION_NAME= + PUBLICATION_SHORT_NAME= + STATIC_URL=/static/ + SECRET_KEY=#{ secret_key.toString('hex') } + """ + env_development_template = """ + AWS_ACCESS_KEY_ID= + AWS_SECRET_ACCESS_KEY= + S3_BUCKET_NAME=cdn.mrqe.co + """ + + operations = 0 + next = -> + operations += 1 + if operations is 2 + callback?() + + fs.writeFile ENV_FILE, env_template, (err) -> + throw err if err? + console.log 'Wrote .env' + next() + + fs.writeFile ENV_DEVELOPMENT_FILE, env_development_template, (err) -> + throw err if err? + console.log 'Wrote .env-development' + next() + doInit = (options={}, callback) -> doInitEnv options, -> @@ -315,9 +316,12 @@ doInit = (options={}, callback) -> next() upstream_command = ['git','remote','rename','origin','upstream'] - executeCommand upstream_command, options, -> - console.log 'upstream remote set' - next() + try + executeCommand upstream_command, options, -> + console.log 'upstream remote set' + next() + catch e + console.log e doFlushStatic = (options={}, callback) ->