Skip to content

Commit

Permalink
Replace tabs with 4 white-spaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
lehni committed Aug 16, 2014
1 parent 687199e commit 48cb05a
Show file tree
Hide file tree
Showing 230 changed files with 37,135 additions and 37,133 deletions.
64 changes: 32 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ For OSX see <http://madebyhoundstooth.com/blog/install-node-with-homebrew-on-os-

For Linux see <http://nodejs.org/download/> to locate 32-bit and 64-bit nodejs binaries as well as sources. It is recommended that you download directly from the nodejs site; the version available via many OS-supplied package managers is out-of-date and doesn't work with many of the packages paper uses. NPM is now included with the nodejs distribution. Once nodejs (with npm) has been installed you can install bower using the following command:

npm install -g bower
npm install -g bower

With Bower installed, simply type this command in your project folder:

bower install paper
bower install paper

Upon execution, you will find a `paper` folder inside the project's `bower_components` folder. For more information on Bower and to learn about its features for dependence tracking, see <http://bower.io/>.

Expand All @@ -42,113 +42,113 @@ You can also use NPM to install Paper.js for Node.js. But before doing so, you n

The easiest way to install Cairo is install Homebrew <http://mxcl.github.io/homebrew/> then issue the command:

brew install cairo
brew install cairo

Note that currently there is an issue on OSX with Cairo. If the above causes errors, the following will most likely fix it:

PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig/ npm install paper
PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig/ npm install paper

Also, whenever you would like to update the modules, you will need to execute:

PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig/ npm update
PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig/ npm update

**Installing Cairo on Debian/Ubuntu Linux:**

sudo apt-get install libcairo2-dev
sudo apt-get install libcairo2-dev

You might also need these additional packages if you don't usually build from c++ sources:

sudo apt-get install build-essential libssl-dev libjpeg8-dev libgif-dev
sudo apt-get install build-essential libssl-dev libjpeg8-dev libgif-dev

**After Cairo has been installed:**

You should now be able to install the Paper.js module from NPM:

npm install paper
npm install paper

## Development

**Get the source (for building):**

git clone --recursive git://github.com/paperjs/paper.js.git
git clone --recursive git://github.com/paperjs/paper.js.git

**Get the source (for contributing):**

If you want to contribute to the project you will have to [make a fork](http://help.github.com/forking/). Then do this:

git clone --recursive [email protected]:yourusername/paper.js.git
cd paper.js
git remote add upstream git://github.com/paperjs/paper.js.git
git clone --recursive [email protected]:yourusername/paper.js.git
cd paper.js
git remote add upstream git://github.com/paperjs/paper.js.git

### Refreshing Your Clone

To fetch changes from origin (your fork), run

git fetch origin
git fetch origin

If you are working with a fork and would like to fetch from upstream, run

git fetch upstream
git fetch upstream

To update the `jsdoc-toolkit` submodule inside the `build` folder, used to generate the documentation, run

git submodule update --init
git submodule update --init

### Building the Library

Paper.js has a couple of dependencies as Bower and NPM modules. See <http://madebyhoundstooth.com/blog/install-node-with-homebrew-on-os-x/> for a tutorial explaining how to install Node.js, NPM and Bower on OSX.

In order to be able to build Paper.js, after checking out the repository, paper has dependencies that need to be installed. Install them by issuing the following commands from the paper.js directory:

npm install
bower install
npm install
bower install

You might find that the npm command fails attempting to fetch packages needed for dependencies due to using https (the default protocol to access the npm registry). If that is the case you can switch to using http for registry access with the following command:

npm config set registry http://registry.npmjs.org/
npm config set registry http://registry.npmjs.org/

Next you need to create minified versions of some of these dependencies. This is handled by the `minify-components.sh` script inside the `build` folder:

cd build
./minify-components.sh
cd build
./minify-components.sh

The Paper.js sources are distributed across many separate files, organised in subfolders inside the `src` folder. To compile them all into one distributable file, you can run the `build.sh` script inside the `build` folder:

cd build
./build.sh
cd build
./build.sh

You will then find the built library inside the `dist` folder, named `paper.js`.

`build.sh` offer two modes:

commented Preprocessed but still formated and commented
stripped Formated but without comments (default)
commented Preprocessed but still formated and commented
stripped Formated but without comments (default)

In order to minify the resulting built versions, you can run the `minify.sh` script:

cd build
./minify.sh
cd build
./minify.sh

### Building the Documentation

Similarly to building the library, you can run `docs.sh` inside the `build` folder to build the documentation.

cd build
./docs.sh
cd build
./docs.sh

Your docs will then be located at `dist/docs`.

### Editing and Running Code during Development

As a handy alternative to building the library after each change to try it out in your scripts, there is a helper script `src/load.js` that loads the library directly from all the separate source files in the `src` folder. The shell script `load.sh` in the `build` folder produces a `paper.js` library in `dist` that does nothing else than loading the source files through `src/load.js`. This means you can switch between loading from sources and loading a built library simply by running `build.sh` or `load.sh` inside the `build` folder.

cd build
./load.sh
cd build
./load.sh

And to go back to a built library

cd build
./build.sh
cd build
./build.sh

Note that your PaperScripts examples do not need to change, they can keep loading `dist/paper-full.js`, which will always do the right thing. Note also that `src/load.js` handles both browsers and Node.js, through the handy PrePro JS preprocessing library <http://github.com/lehni/prepro.js>.

Expand Down
14 changes: 7 additions & 7 deletions build/build.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,30 @@
# build.sh MODE
#
# MODE:
# commented Preprocessed, still formated and commented
# stripped Preprocessed, formated but without comments
# commented Preprocessed, still formated and commented
# stripped Preprocessed, formated but without comments

if [ $# -eq 0 ]
then
MODE="stripped"
MODE="stripped"
else
MODE=$1
MODE=$1
fi

# Create the dist folder if it does not exist yet.
if [ ! -d ../dist/ ]
then
mkdir ../dist/
mkdir ../dist/
fi

if [ -f ../dist/paper-full.js ]
then
rm ../dist/paper-full.js
rm ../dist/paper-full.js
fi

if [ -f ../dist/paper-node.js ]
then
rm ../dist/paper-node.js
rm ../dist/paper-node.js
fi

./preprocess.sh $MODE ../src/paper.js "-i '../src/constants.js'" ../dist/paper-full.js
Expand Down
Empty file modified build/dist.sh
100755 → 100644
Empty file.
12 changes: 6 additions & 6 deletions build/docs.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
# Generate documentation
#
# MODE:
# docs Generates the JS API docs - Default
# serverdocs Generates the website templates for the online JS API docs
# docs Generates the JS API docs - Default
# serverdocs Generates the website templates for the online JS API docs

if [ $# -eq 0 ]
then
MODE="docs"
MODE="docs"
else
MODE=$1
MODE=$1
fi

cd jsdoc-toolkit
Expand All @@ -29,6 +29,6 @@ cd ..

if [ $MODE = "docs" ]
then
# Build paper.js library for documentation
./preprocess.sh stripped ../src/paper.js "-o '{ \"browser\": true }' -i '../src/constants.js'" ../dist/docs/assets/js/paper.js
# Build paper.js library for documentation
./preprocess.sh stripped ../src/paper.js "-o '{ \"browser\": true }' -i '../src/constants.js'" ../dist/docs/assets/js/paper.js
fi
4 changes: 2 additions & 2 deletions build/load.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

if [ -f ../dist/paper-full.js ]
then
rm ../dist/paper-full.js
rm ../dist/paper-full.js
fi

if [ -f ../dist/paper-node.js ]
then
rm ../dist/paper-node.js
rm ../dist/paper-node.js
fi

ln -s ../src/load.js ../dist/paper-full.js
Expand Down
Empty file modified build/minify-components.sh
100755 → 100644
Empty file.
Empty file modified build/minify.sh
100755 → 100644
Empty file.
20 changes: 10 additions & 10 deletions build/preprocess.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@
# preprocess.sh MODE SOURCE ARGUMENTS DESTINATION
#
# MODE:
# commented Preprocessed, still formated and commented
# stripped Preprocessed, formated but without comments
# commented Preprocessed, still formated and commented
# stripped Preprocessed, formated but without comments

# Get the date from the git log:
DATE=$(git log -1 --pretty=format:%ad)
# Load __options from options.js and convert it to escaped JSON, to be passed on
# to prepro:
OPTIONS=$(printf '%q' $(node -e "
eval(require('fs').readFileSync('../src/options.js', 'utf8'));
process.stdout.write(JSON.stringify(__options));
eval(require('fs').readFileSync('../src/options.js', 'utf8'));
process.stdout.write(JSON.stringify(__options));
"))
# Build the prepo.js command out of it, passing on version and date as defines:
COMMAND="../node_modules/.bin/prepro -o $OPTIONS -o '{ \"date\": \"$DATE\" }' $3 $2"

case $1 in
commented)
eval $COMMAND > $4
;;
stripped)
eval "$COMMAND -c" > $4
;;
commented)
eval $COMMAND > $4
;;
stripped)
eval "$COMMAND -c" > $4
;;
esac
12 changes: 6 additions & 6 deletions build/publish.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@

# Extract the paper.js version from options.js:
VERSION=$(printf '%q' $(node -e "
eval(require('fs').readFileSync('../src/options.js', 'utf8'));
process.stdout.write(__options.version);
eval(require('fs').readFileSync('../src/options.js', 'utf8'));
process.stdout.write(__options.version);
"))

# Helper function that updates paper.js vesion in JSON files
function update_version()
{
node -e "
var data = require('$1');
data.version = '$VERSION';
require('fs').writeFile('$1',
JSON.stringify(data, null, ' ') + require('os').EOL);
var data = require('$1');
data.version = '$VERSION';
require('fs').writeFile('$1',
JSON.stringify(data, null, ' ') + require('os').EOL);
"
}

Expand Down
Empty file modified build/typescript.sh
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion build/zip.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ cp -r $BASE/dist/docs .
# Erase the old Zip file
if [ -f $BASE/dist/paperjs.zip ]
then
rm $BASE/dist/paperjs.zip
rm $BASE/dist/paperjs.zip
fi
# Zip the whole thing
zip -9 -r $BASE/dist/paperjs.zip * LICENSE.txt -x "*/.DS_Store"
Expand Down
Loading

0 comments on commit 48cb05a

Please sign in to comment.