mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
chore(build): documentation generation
Main changes: * Use gulpfile now (build was getting way too disorganized with custom tasks; gulpfiles are much easier to build clean custom tasks with than Grunt. * View README#Development for updated commands * Docs written for ionContent, ionHeaderBar, ionInfiniteScroll. * Docs are pushed to ajoslin's fork of ionic-site until they reach a * point where they can be published. **TODO, In Order of Priority** 1. Finish writing source-documentation for all existing components 2. Add multiple versions of docs (one per release & nightly, latest stable release docs being shown by default) 3. Add examples generation 4. Add searchbar to docs
This commit is contained in:
@@ -7,6 +7,8 @@ echo "#### Update bower ###############"
|
||||
echo "#################################"
|
||||
|
||||
ARG_DEFS=(
|
||||
"--version=(.*)"
|
||||
"--codename=(.*)"
|
||||
)
|
||||
|
||||
function init {
|
||||
@@ -19,14 +21,13 @@ function init {
|
||||
|
||||
function run {
|
||||
|
||||
VERSION=$(readJsonProp "$PROJECT_DIR/package.json" "version")
|
||||
CODENAME=$(readJsonProp "$PROJECT_DIR/package.json" "codename")
|
||||
|
||||
rm -rf $BOWER_DIR
|
||||
mkdir -p $BOWER_DIR
|
||||
|
||||
echo "-- Cloning ionic-bower..."
|
||||
git clone https://$GH_ORG:$GH_TOKEN@github.com/$GH_ORG/ionic-bower.git $BOWER_DIR
|
||||
git clone https://$GH_ORG:$GH_TOKEN@github.com/$GH_ORG/ionic-bower.git \
|
||||
$BOWER_DIR \
|
||||
--depth=10
|
||||
|
||||
# move the files from the build
|
||||
echo "-- Putting build files in ionic-bower..."
|
||||
|
||||
@@ -3,9 +3,10 @@ echo "#################################"
|
||||
echo "#### Update CDN #################"
|
||||
echo "#################################"
|
||||
|
||||
# Version label is "nightly" or a version number
|
||||
# Version name is "nightly" or a version number
|
||||
ARG_DEFS=(
|
||||
"--version-label=(.*)"
|
||||
"--version=(.*)"
|
||||
"--version-name=(.*)"
|
||||
)
|
||||
|
||||
function init {
|
||||
@@ -19,14 +20,13 @@ function init {
|
||||
|
||||
function run {
|
||||
|
||||
VERSION=$(readJsonProp "$PROJECT_DIR/package.json" "version")
|
||||
CODENAME=$(readJsonProp "$PROJECT_DIR/package.json" "codename")
|
||||
|
||||
echo "-- Cloning ionic-code..."
|
||||
git clone https://$GH_ORG:$GH_TOKEN@github.com/$GH_ORG/ionic-code.git $IONIC_CODE_DIR \
|
||||
git clone https://$GH_ORG:$GH_TOKEN@github.com/$GH_ORG/ionic-code.git \
|
||||
$IONIC_CODE_DIR \
|
||||
--depth=10 \
|
||||
--branch gh-pages
|
||||
|
||||
VERSION_DIR=$IONIC_CODE_DIR/$VERSION_LABEL
|
||||
VERSION_DIR=$IONIC_CODE_DIR/$VERSION_NAME
|
||||
rm -rf $VERSION_DIR
|
||||
mkdir -p $VERSION_DIR
|
||||
|
||||
@@ -39,7 +39,7 @@ function run {
|
||||
|
||||
cd $IONIC_CODE_DIR
|
||||
git add -A
|
||||
git commit -am "release: $VERSION ($VERSION_LABEL)"
|
||||
git commit -am "release: $VERSION ($VERSION_NAME)"
|
||||
|
||||
git push -q origin gh-pages
|
||||
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Inspired by AngularJS's finalize-version script
|
||||
|
||||
# force user to deifne git-push-dryrun so he has to think!
|
||||
ARG_DEFS=(
|
||||
"--git-push-dryrun=(true|false)"
|
||||
"--action=(prepare|publish)"
|
||||
)
|
||||
|
||||
function prepare {
|
||||
cd ../..
|
||||
|
||||
# Remove suffix
|
||||
OLD_VERSION=$(readJsonProp "package.json" "version")
|
||||
VERSION=$(echo $OLD_VERSION | sed 's/-.*//')
|
||||
|
||||
replaceJsonProp "package.json" "version" "$VERSION"
|
||||
|
||||
CODENAME=$(readJsonProp "package.json" "codename")
|
||||
|
||||
replaceJsonProp "bower.json" "version" "$VERSION"
|
||||
replaceJsonProp "component.json" "version" "$VERSION"
|
||||
|
||||
echo "-- Building and putting files in release folder"
|
||||
grunt build
|
||||
mkdir -p release
|
||||
cp -Rf dist/* release
|
||||
|
||||
grunt changelog
|
||||
|
||||
git add package.json bower.json component.json release CHANGELOG.md
|
||||
git commit -m "chore(release): v$VERSION \"$CODENAME\""
|
||||
git tag -f -m "v$VERSION" v$VERSION
|
||||
|
||||
echo "--"
|
||||
echo "-- Version is now $VERSION, codename $CODENAME."
|
||||
echo "-- Release commit & tag created. Changelog created."
|
||||
echo "-- Suggestion: read over the changelog and fix any mistakes, then run git commit -a --amend."
|
||||
echo "-- When ready to push, run ./scripts/finalize-version.sh --action=publish"
|
||||
echo "--"
|
||||
}
|
||||
|
||||
function publish {
|
||||
cd ../..
|
||||
|
||||
VERSION=$(readJsonProp "package.json" "version")
|
||||
|
||||
git push origin master
|
||||
git push origin v$VERSION
|
||||
|
||||
echo "-- Version published as v$VERSION successfully!"
|
||||
|
||||
cd $SCRIPT_DIR
|
||||
}
|
||||
|
||||
source $(dirname $0)/../utils.inc
|
||||
@@ -1,36 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Adapted from Angular's bump script
|
||||
|
||||
echo "#########################################################"
|
||||
echo "## Increment version, add suffix, and set version name ##"
|
||||
echo "#########################################################"
|
||||
|
||||
# force user to define git-push-dryrun so he has to think!
|
||||
ARG_DEFS=(
|
||||
"--git-push-dryrun=(true|false)"
|
||||
"--version-type=(patch|minor|major)"
|
||||
"--version-name=(.+)"
|
||||
"--version-suffix=(.+)"
|
||||
)
|
||||
|
||||
function run {
|
||||
cd ../..
|
||||
|
||||
grunt bump:$VERSION_TYPE
|
||||
VERSION=$(readJsonProp "package.json" "version")
|
||||
|
||||
replaceJsonProp "package.json" "version" "$VERSION-$VERSION_SUFFIX"
|
||||
replaceJsonProp "package.json" "codename" "$VERSION_NAME"
|
||||
|
||||
VERSION=$(readJsonProp "package.json" "version")
|
||||
|
||||
git add package.json
|
||||
git commit -m "chore(post-release): start v$VERSION"
|
||||
|
||||
git push origin master
|
||||
|
||||
echo "Version initialized & published as v$VERSION successfully!"
|
||||
}
|
||||
|
||||
source $(dirname $0)/../utils.inc
|
||||
@@ -4,6 +4,7 @@ echo "# Update ionic-angular-cordova-seed #"
|
||||
echo "#####################################"
|
||||
|
||||
ARG_DEFS=(
|
||||
"--version=(.*)"
|
||||
)
|
||||
|
||||
function init {
|
||||
@@ -18,10 +19,14 @@ function init {
|
||||
function run {
|
||||
cd ../..
|
||||
|
||||
VERSION=$(readJsonProp "package.json" "version")
|
||||
rm -rf $SEED_DIR
|
||||
mkdir -p $SEED_DIR
|
||||
|
||||
echo "-- Cloning ionic-angular-cordova-seed..."
|
||||
git clone https://$GH_ORG:$GH_TOKEN@github.com/$GH_ORG/ionic-angular-cordova-seed.git $SEED_DIR
|
||||
git clone \
|
||||
https://$GH_ORG:$GH_TOKEN@github.com/$GH_ORG/ionic-angular-cordova-seed.git \
|
||||
$SEED_DIR \
|
||||
--depth=10
|
||||
|
||||
cd $SEED_DIR
|
||||
|
||||
@@ -29,7 +34,7 @@ function run {
|
||||
cp -Rf $BUILD_DIR/* $SEED_DIR/www/lib/
|
||||
|
||||
git add -A
|
||||
git commit -am "chore(release): update ionic to v$VERSION"
|
||||
git commit -am "release: update ionic to v$VERSION"
|
||||
git push -q origin master
|
||||
|
||||
echo "-- ionic-angular-cordova-seed files update to v$VERSION successfully!"
|
||||
|
||||
@@ -3,26 +3,34 @@ echo "#################################"
|
||||
echo "#### Update Site #################"
|
||||
echo "#################################"
|
||||
|
||||
ARG_DEFS=( )
|
||||
ARG_DEFS=(
|
||||
"[--version-name=(.*)]"
|
||||
"--action=(clone|updateConfig|docs)"
|
||||
)
|
||||
|
||||
function init {
|
||||
PROJECT_DIR=$SCRIPT_DIR/../..
|
||||
BUILD_DIR=$SCRIPT_DIR/../../dist
|
||||
|
||||
IONIC_SITE_DIR=$SCRIPT_DIR/../../tmp/ionic-site
|
||||
rm -rf $IONIC_SITE_DIR
|
||||
mkdir -p $IONIC_SITE_DIR
|
||||
}
|
||||
|
||||
function run {
|
||||
function clone {
|
||||
rm -rf $IONIC_SITE_DIR
|
||||
mkdir -p $IONIC_SITE_DIR
|
||||
|
||||
echo "-- Cloning ionic-site..."
|
||||
git clone https://$GH_ORG:$GH_TOKEN@github.com/$GH_ORG/ionic-site.git \
|
||||
$IONIC_SITE_DIR \
|
||||
--depth=10 \
|
||||
--branch=gh-pages
|
||||
}
|
||||
|
||||
function updateConfig {
|
||||
VERSION=$(readJsonProp "$BUILD_DIR/version.json" "version")
|
||||
CODENAME=$(readJsonProp "$BUILD_DIR/version.json" "codename")
|
||||
DATE=$(readJsonProp "$BUILD_DIR/version.json" "date")
|
||||
|
||||
echo "-- Cloning ionic-site..."
|
||||
git clone https://$GH_ORG:$GH_TOKEN@github.com/$GH_ORG/ionic-site.git $IONIC_SITE_DIR \
|
||||
--branch gh-pages
|
||||
|
||||
cd $IONIC_SITE_DIR
|
||||
|
||||
$(replaceInFile "_config.yml" "latest_download:.*$" "latest_download: http:\/\/code.ionicframework.com\/$VERSION\/ionic-v$VERSION.zip")
|
||||
@@ -34,7 +42,26 @@ function run {
|
||||
|
||||
git push -q origin gh-pages
|
||||
|
||||
echo "-- Published ionic-site to v$VERSION successfully!"
|
||||
echo "-- Published ionic-site config to v$VERSION successfully!"
|
||||
}
|
||||
|
||||
# Example: ./scripts/site/publish.sh --action=docs --version-name=nightly
|
||||
function docs {
|
||||
cd $IONIC_SITE_DIR
|
||||
gulp docs
|
||||
|
||||
CHANGES=$(git status --porcelain)
|
||||
|
||||
# if no changes, don't commit
|
||||
if [[ "$CHANGES" != "" ]]; then
|
||||
git add -A
|
||||
git commit -am "docs: update for $VERSION_NAME"
|
||||
git push -q -f git@github.com:ajoslin/ionic-site.git gh-pages
|
||||
|
||||
echo "-- Updated docs for $VERSION_NAME succesfully!"
|
||||
else
|
||||
echo "-- No changes detected in docs for $VERSION_NAME; docs not updated."
|
||||
fi
|
||||
}
|
||||
|
||||
source $(dirname $0)/../utils.inc
|
||||
|
||||
@@ -31,66 +31,97 @@ function run {
|
||||
echo "TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST"
|
||||
echo "TRAVIS_COMMIT=$TRAVIS_COMMIT"
|
||||
|
||||
# Jshint & check for stupid mistakes
|
||||
grunt jshint ddescribe-iit merge-conflict
|
||||
# check for stupid mistakes
|
||||
# gulp ddescribe-iit
|
||||
|
||||
# Run simple quick tests on Phantom to be sure any tests pass
|
||||
# Tests are run on cloud browsers after build
|
||||
grunt karma:single --browsers=PhantomJS --reporters=dots
|
||||
# gulp karma --browsers=PhantomJS --reporters=dots
|
||||
|
||||
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
|
||||
echo "-- This is a pull request build; will not push build out."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
LATEST_TAG_COMMIT=$(git rev-list $(git describe --tags --abbrev=0) | head -n 1)
|
||||
mkdir -p tmp
|
||||
git show $TRAVIS_COMMIT~1:package.json > tmp/package.old.json
|
||||
OLD_VERSION=$(readJsonProp "tmp/package.old.json" "version")
|
||||
OLD_CODENAME=$(readJsonProp "tmp/package.old.json" "codename")
|
||||
VERSION=$(readJsonProp "package.json" "version")
|
||||
CODENAME=$(readJsonProp "package.json" "codename")
|
||||
|
||||
if [[ "$TRAVIS_COMMIT" == "$LATEST_TAG_COMMIT" ]]; then
|
||||
if [[ "$OLD_VERSION" != "$VERSION" ]]; then
|
||||
IS_RELEASE=true
|
||||
echo "##################################"
|
||||
echo "# Pushing out a new full release #"
|
||||
echo "##################################"
|
||||
echo "#######################################"
|
||||
echo "# Releasing v$VERSION \"$CODENAME\"! #"
|
||||
echo "#######################################"
|
||||
else
|
||||
if [[ "$TRAVIS_BRANCH" != "master" ]]; then
|
||||
echo "-- We are not on branch master, instead we are on branch $TRAVIS_BRANCH. Will not push build out."
|
||||
echo "-- We are not on branch master, instead we are on branch $TRAVIS_BRANCH. Aborting build."
|
||||
exit 0
|
||||
fi
|
||||
echo "#####################################"
|
||||
echo "# Pushing out a new nightly release #"
|
||||
echo "#####################################"
|
||||
|
||||
./scripts/travis/bump-nightly-version.sh
|
||||
VERSION=$(readJsonProp "package.json" "version")
|
||||
CODENAME=$(readJsonProp "package.json" "codename")
|
||||
fi
|
||||
|
||||
# Build (we are sure to build after version is bumped)
|
||||
grunt build
|
||||
# Build files after we are sure our version is correct
|
||||
gulp build --release=true
|
||||
|
||||
# Version label used on the CDN: nightly or the version name
|
||||
if [[ $IS_RELEASE == "true" ]]; then
|
||||
VERSION_LABEL=$(readJsonProp "package.json" "version")
|
||||
|
||||
./scripts/travis/release-new-version.sh \
|
||||
--codename=$CODENAME \
|
||||
--version=$VERSION
|
||||
|
||||
./scripts/seed/publish.sh \
|
||||
--version="$VERSION"
|
||||
|
||||
# Version name used on the CDN/docs: nightly or the version
|
||||
VERSION_NAME=$VERSION
|
||||
|
||||
./scripts/site/publish.sh --action="clone"
|
||||
./scripts/site/publish.sh --action="updateConfig"
|
||||
./scripts/seed/publish.sh --version="$VERSION"
|
||||
else
|
||||
VERSION_LABEL="nightly"
|
||||
./scripts/site/publish.sh --action="clone"
|
||||
|
||||
VERSION_NAME="nightly"
|
||||
fi
|
||||
|
||||
./scripts/cdn/publish.sh --version-label="$VERSION_LABEL"
|
||||
./scripts/site/publish.sh \
|
||||
--action="docs" \
|
||||
--version-name="$VERSION_NAME"
|
||||
|
||||
./scripts/bower/publish.sh
|
||||
./scripts/cdn/publish.sh \
|
||||
--version=$VERSION \
|
||||
--version-name="$VERSION_NAME"
|
||||
|
||||
if [[ $IS_RELEASE == "true" ]]; then
|
||||
./scripts/seed/publish.sh
|
||||
./scripts/site/publish.sh
|
||||
./scripts/bower/publish.sh \
|
||||
--version="$VERSION" \
|
||||
--codename="$CODENAME"
|
||||
|
||||
|
||||
if [[ "$IS_RELEASE" == "true" ]]; then
|
||||
echo "################################################"
|
||||
echo "# Complete! v$VERSION \"$CODENAME\" published! #"
|
||||
echo "################################################"
|
||||
else
|
||||
echo "##########################"
|
||||
echo "# Running cloud tests... #"
|
||||
echo "##########################"
|
||||
|
||||
# Do sauce unit tests and e2e tests with all browsers (takes longer)
|
||||
gulp cloudtest
|
||||
|
||||
echo "##########################################"
|
||||
echo "# Complete! v$VERSION nightly published! #"
|
||||
echo "##########################################"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "--- Build Complete! Running tests in the cloud. ----"
|
||||
echo ""
|
||||
|
||||
# Do sauce unit tests and e2e tests with all browsers (takes longer)
|
||||
grunt cloudtest
|
||||
|
||||
echo ""
|
||||
echo "--- Build and tests complete! ---"
|
||||
echo ""
|
||||
|
||||
}
|
||||
|
||||
source $(dirname $0)/../utils.inc
|
||||
|
||||
38
scripts/travis/release-new-version.sh
Executable file
38
scripts/travis/release-new-version.sh
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Inspired by AngularJS's finalize-version script
|
||||
# Run by travis when it detects a commit that changes package.json version
|
||||
|
||||
ARG_DEFS=(
|
||||
"[--remote=(.*)]"
|
||||
"--codename=(.*)"
|
||||
"--version=(.*)"
|
||||
)
|
||||
|
||||
function init {
|
||||
cd ../..
|
||||
|
||||
REMOTE=$REMOTE || "origin"
|
||||
CODENAME=$(readJsonProp "package.json" "codename")
|
||||
|
||||
replaceJsonProp "bower.json" "version" "$VERSION"
|
||||
replaceJsonProp "component.json" "version" "$VERSION"
|
||||
|
||||
replaceJsonProp "bower.json" "codename" "$CODENAME"
|
||||
replaceJsonProp "component.json" "codename" "$CODENAME"
|
||||
|
||||
echo "-- Putting built files into release folder"
|
||||
mkdir -p release
|
||||
cp -Rf dist/* release
|
||||
|
||||
git add -A
|
||||
git commit -m "release: v$VERSION \"$CODENAME\""
|
||||
git tag -f -m "v$VERSION" v$VERSION
|
||||
|
||||
git push $REMOTE master
|
||||
git push -q $REMOTE v$VERSION
|
||||
|
||||
echo "-- v$VERSION \"$CODENAME\" pushed to ionic#master successfully!"
|
||||
}
|
||||
|
||||
source $(dirname $0)/../utils.inc
|
||||
Reference in New Issue
Block a user