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
2 changes: 1 addition & 1 deletion .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ rules:
no-else-return: 2
no-inner-declarations: 2
no-lonely-if: 2
no-magic-numbers: [2, {ignore: [-1, 0, 1]}]
# no-magic-numbers: [2, {ignore: [-1, 0, 1]}]
no-shadow: 2
no-unneeded-ternary: 2
no-unused-expressions: 2
Expand Down
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
*.pyc
*.pyo
.DS_Store
.git*
.hg*
.idea
.vscode
*.pyc
*.pyo
bower_components
main/index.yaml
main/lib
Expand All @@ -12,4 +13,7 @@ main/static/dev
main/static/ext
main/static/min
node_modules
npm-debug.log
package-lock.json
temp/
yarn-error.log
Empty file added .prettierignore
Empty file.
6 changes: 3 additions & 3 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ trailingComma: all
useTabs: false

overrides:
- files: "*.json"
options:
printWidth: 200
- files: '*.json'
options:
printWidth: 200
49 changes: 49 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
language: node_js

node_js:
- '8'

python:
- '2.7'

sudo: required

cache:
pip: true
yarn: true
directories:
- '$HOME/google-cloud-sdk/'
- node_modules

notifications:
- email: false

env:
# Make sure gcloud command is on our PATH and the App Engine SDK is in the Python path
- PATH=$PATH:${HOME}/google-cloud-sdk/bin CLOUDSDK_CORE_DISABLE_PROMPTS=1

before_install:
- python -V
# Travis defaults to python 2.7.6 we need at least 2.7.9
# askubuntu suggests using a PPA repository
- sudo add-apt-repository -y ppa:jonathonf/python-2.7
- sudo apt-get update
- sudo apt-get install -y python2.7
# Check if gcloud doesn't exist or if there is gcloud update, in which case delete the current installation
- if ! command -v gcloud || gcloud version 2>&1 | grep -F update; then rm -rf $HOME/google-cloud-sdk; sudo rm -rf /usr/lib/google-cloud-sdk; else echo "Keeping cached Google Cloud SDK"; fi
# Check if Google Cloud SDK is installed and if not remove remnants and install it
- if [ ! -d "$HOME/google-cloud-sdk/" ] ; then sudo rm -rf /usr/lib/google-cloud-sdk; export CLOUDSDK_CORE_DISABLE_PROMPTS=1; curl https://sdk.cloud.google.com | bash; fi
# Check if Google Cloud SDK is installed *properly* and if not remove remnants and install it
- if [ ! -f "$HOME/google-cloud-sdk/path.bash.inc" ]; then ls -al $HOME/google-cloud-sdk; rm -rf $HOME/google-cloud-sdk; sudo rm -rf /usr/lib/google-cloud-sdk; export CLOUDSDK_CORE_DISABLE_PROMPTS=1; curl https://sdk.cloud.google.com | bash; fi
# Add gcloud to $PATH or give some diagnostic info
- source $HOME/google-cloud-sdk/path.bash.inc || ls -al $HOME/google-cloud-sdk
- gcloud version
- gcloud components install app-engine-python
- python -V

before_script:
- yarn global add gulp-cli

script:
- yarn test
- gulp deploy --dryrun
52 changes: 26 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ The latest version is always accessible from [http://upload.gae-init.appspot.com

## Requirements

* [Google App Engine SDK for Python][]
* [Node.js][], [pip][], [virtualenv][]
* [macOS][] or [Linux][] or [Windows][]
- [Google App Engine SDK for Python][]
- [Node.js][], [Yarn][], [pip][], [virtualenv][]
- [macOS][] or [Linux][] or [Windows][]

Make sure you have all of the above or refer to the docs on how to [install the requirements](http://docs.gae-init.appspot.com/requirement/).

## Running the Development Environment

```bash
$ cd /path/to/project-name
$ gulp
cd /path/to/project-name
gulp
```

To test it visit `http://localhost:3000` in your browser.
Expand All @@ -30,56 +30,55 @@ To test it visit `http://localhost:3000` in your browser.
For a complete list of commands:

```bash
$ gulp help
gulp help
```

## Initializing or Resetting the project

```bash
$ cd /path/to/project-name
$ npm install
$ gulp
cd /path/to/project-name
yarn
gulp
```

If something goes wrong you can always do:

```bash
$ gulp reset
$ npm install
$ gulp
gulp reset
yarn
gulp
```

---

To install [Gulp][] as a global package:

```bash
$ npm install -g gulp
yarn global add gulp-cli
```

## Deploying on Google App Engine

```bash
$ gulp deploy
$ gulp deploy --project=foo
$ gulp deploy --project=foo --version=bar
$ gulp deploy --project=foo --version=bar --no-promote
gulp deploy
gulp deploy --project=foo
gulp deploy --project=foo --version=bar
gulp deploy --project=foo --version=bar --no-promote
```

## Tech Stack

* [Google App Engine][], [NDB][]
* [Jinja2][], [Flask][], [Flask-RESTful][], [Flask-WTF][]
* [CoffeeScript][], [Less][]
* [Bootstrap][], [Font Awesome][], [Social Buttons][]
* [jQuery][], [Moment.js][]
* [OpenID][] sign in (Google, Facebook, Twitter and more)
* [Python 2.7][], [pip][], [virtualenv][]
* [Gulp][], [Bower][]
- [Google App Engine][], [NDB][]
- [Jinja2][], [Flask][], [Flask-RESTful][], [Flask-WTF][]
- [Less][]
- [Bootstrap][], [Font Awesome][], [Social Buttons][]
- [jQuery][], [Moment.js][]
- [OpenID][] sign in (Google, Facebook, Twitter and more)
- [Python 2.7][], [pip][], [virtualenv][]
- [Gulp][], [Bower][]

[bootstrap]: http://getbootstrap.com/
[bower]: http://bower.io/
[coffeescript]: http://coffeescript.org/
[documentation]: http://docs.gae-init.appspot.com
[feature list]: http://docs.gae-init.appspot.com/features/
[flask-restful]: https://flask-restful.readthedocs.org
Expand All @@ -105,3 +104,4 @@ $ gulp deploy --project=foo --version=bar --no-promote
[tutorial]: http://docs.gae-init.appspot.com/tutorial/
[virtualenv]: http://www.virtualenv.org/
[windows]: http://windows.microsoft.com/
[yarn]: https://yarnpkg.com/
2 changes: 1 addition & 1 deletion bin/requirements_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ gcloud components install app-engine-python
sudo apt-get install nodejs

# Gulp.js
sudo npm install -g gulp
npm install --global gulp-cli

# Python related
curl https://bootstrap.pypa.io/get-pip.py | sudo python
Expand Down
2 changes: 1 addition & 1 deletion bin/requirements_osx_brew.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ gcloud components install app-engine-python
brew install node

# Gulp.js
npm install -g gulp
npm install --global gulp-cli

# Python related
curl https://bootstrap.pypa.io/get-pip.py | python
Expand Down
2 changes: 1 addition & 1 deletion bin/requirements_osx_port.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ gcloud components install app-engine-python
sudo port install nodejs

# Gulp.js
npm install -g gulp
npm install --global gulp-cli

# Python related
curl https://bootstrap.pypa.io/get-pip.py | python
Expand Down
2 changes: 1 addition & 1 deletion bin/test_hello_world.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
cd ~
git clone https://github.com/gae-init/gae-init.git hello-world
cd hello-world
npm install
yarn
gulp
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"bootstrap": "3.3.7",
"font-awesome": "4.7.0",
"jquery": "3.3.1",
"moment": "2.20.1"
"moment": "2.22.2"
},
"name": "gae-init",
"overrides": {
Expand Down
35 changes: 21 additions & 14 deletions gulp/tasks/build.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,28 @@ gulp.task 'rebuild',
$.sequence 'reset', 'build'


gulp.task 'deploy', 'Deploy project to Google App Engine.', ['build'], ->
options = yargs process.argv, configuration:
'boolean-negation': false
'camel-case-expansion': false
delete options['_']
options_str = ''
for k of options
if options[k] == true
options[k] = ''
options_str += " #{if k.length > 1 then '-' else ''}-#{k} #{options[k]}"
gulp.task 'deploy',
'Deploy project to Google App Engine. Available options:', ['build'], ->
options = yargs process.argv, configuration:
'boolean-negation': false
'camel-case-expansion': false
delete options['_']
options_str = ''
dryrun = ''
for k of options
if k == 'dryrun'
dryrun = 'echo DRYRUN - would run: '
else
if options[k] == true
options[k] = ''
options_str += " #{if k.length > 1 then '-' else ''}-#{k} #{options[k]}"

gulp.src('run.py').pipe $.start [{
match: /run.py$/
cmd: "gcloud app deploy main/*.yaml#{options_str}"
}]
gulp.src('run.py').pipe $.start [{
match: /run.py$/
cmd: "#{dryrun}gcloud app deploy main/*.yaml#{options_str}"
}]
, options:
'dryrun': 'run all preparations but do not actually deploy'


gulp.task 'run',
Expand Down
2 changes: 1 addition & 1 deletion gulp/tasks/clean.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ gulp.task 'clean:venv', false, ->


gulp.task 'reset',
'Complete reset of project. Run "npm install" after this procedure.',
'Complete reset of project. Run "yarn install" after this procedure.',
['clean', 'clean:dev', 'clean:min', 'clean:venv'], ->
del paths.dep.bower_components
del paths.dep.node_modules
Expand Down
7 changes: 4 additions & 3 deletions gulp/tasks/dep.coffee
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
fs = require 'fs'
gulp = require('gulp-help') require 'gulp'
yarn = require('gulp-yarn')
main_bower_files = require 'main-bower-files'
$ = require('gulp-load-plugins')()
paths = require '../paths'


gulp.task 'npm', false, ->
gulp.src 'package.json'
gulp.task 'yarn', false, ->
gulp.src ['./package.json', './yarn.lock']
.pipe $.plumber()
.pipe $.start()
.pipe yarn()


gulp.task 'bower', false, ->
Expand Down
2 changes: 1 addition & 1 deletion gulp/tasks/script.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ gulp.task 'script', false, ->
.pipe $.plumber errorHandler: util.onError
.pipe $.if is_coffee, $.coffee()
.pipe $.concat 'script.js'
.pipe $.babel presets: ['es2015']
.pipe $.babel presets: ['@babel/env']
.pipe uglify()
.pipe $.size {title: 'Minified scripts'}
.pipe gulp.dest "#{paths.static.min}/script"
Expand Down
2 changes: 1 addition & 1 deletion gulp/tasks/watch.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ gulp.task 'watch', false, ->
$.watch 'requirements.txt', ->
$.sequence('pip')()
$.watch 'package.json', ->
$.sequence('npm')()
$.sequence('yarn')()
$.watch 'bower.json', ->
$.sequence('ext_watch_rebuild')()
$.watch 'gulp/config.coffee', ->
Expand Down
4 changes: 2 additions & 2 deletions magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
###############################################################################
# Options
###############################################################################
MAGIC_URL = 'http://magic.gae-init.appspot.com'
MAGIC_URL = 'https://magic-dot-gae-init.appspot.com'

PARSER = argparse.ArgumentParser(description='Visit %s for more.' % MAGIC_URL)
PARSER.add_argument(
Expand All @@ -22,7 +22,7 @@
)
PARSER.add_argument(
'-r', '--remote', dest='remote_url', action='store', default=MAGIC_URL,
help="set the remote URL if it's not http://magic.gae-init.appspot.com",
help="set the remote URL if it's not https://magic-dot-gae-init.appspot.com",
)
ARGS = PARSER.parse_args()

Expand Down
Loading