The readme contains the following steps for initial setup:
- Clone the git repository
cd lab
cp config/config.sample.yml config/config.yml
make everything
- open another new terminal and run
bin/rackup config.ru
- open http://localhost:9292
- (optional) open a new terminal and run
bin/guard
- (optional)
cp -vn script/post-commit .git/hooks/
Use git to create a local clone of the Lab repository. If you aren't familiar with git, you should read one of the tutorials on it.
If you have commit access to the repository use this form:
git clone [email protected]:concord-consortium/lab.git
Alternatively if you don’t have commit access use this form:
git clone git://github.com/concord-consortium/lab.git
Open a shell and change to the lab/
directory. The first time you cd
into the lab/
directory
RVM will switch to using ruby-2.0.0-p247
based on the .ruby-version
file in the repository.
Additionally the .ruby-gemset
tells RVM to install the gems in a gemset named lab
. So together
these files tell RVM to store and load gems from the ruby-2.0.0-p247@lab
gemset.
If you don't have ruby-2.0.0-p247
already installed rvm will display the command you need to
run to install it. Run this command if required.
If you do end up having to install a new version of Ruby with RVM change out of and back into the lab directory after the RVM install of Ruby is complete:
cd ..; cd lab
Copy the sample project configuration file to config/config.yml
You can examine it and edit it if you want: project configuration documentation
This will download and install all the dependencies and build the whole project for the first time.
When make everything
is run on a freshly cloned repository it performs the following tasks:
-
Install the runtime dependencies as git submodules into the
vendor/
directory:git submodule update --init --recursive
-
Install the development dependencies that use nodejs and are managed by npm:
npm install
You can see the list of dependencies to be installed in the file
package.json
. In additionvendor/d3
andvendor/science.js
are manually installed intonode_modules/
. -
Install the additional RubyGems used for development: haml, sass, guard ...
bundle install --binstubs
This creates the
bin/
directory and populates it with command-line executables for running the specific versions of the RubyGems installed for development. -
Generates the
public
directory: -
Generates the Java resources in the
public/jnlp
directory:
You should now be able to open the file: public/index.html
in a browser however most things won't work correctly.
This is because of the limitation of the file
protocol in browsers. Continue on to see about setting up the server.
Startup the Rack-based Lab server for local development. This is simple rack application that mainly just serves the files in public. It does contain 2 dynamic extensions:
- an embedded Jnlp service which handles serving jar and jnlp files in an optimized way
- a shutterbug service so you can take snapshots locally
Alternatively you can use python -m SimpleHTTPServer
to run a python server. Currently it won't handle the applets
and jnlps correctly and it won't support snapshots, but you might not need those features.
6. open http://localhost:9292
Now that the files in public are built and a server is running you can view the Lab site locally.
Start watching the src/
and test/
directories with Guard and when files are
changed automatically generate the JavaScript Lab modules, the examples, and run the tests.
Now any change you make in src/examples/
will generate the corresponding content in public/examples/
.
In addition changes in src/lab/
generate the associated Lab modules in lab/
and copy these modules
to public/lab/
. In addition any change in either the src/lab/
or test/
directories will run the
tests and display the results in the console window where bin/guard
is running.
This is optional because you can also just manually run make
after making changes.
Add a git post-commit hook. After every commit src/lab/lab.version.js
should be updated to include recent
version and build information for Lab's distribution. This is done with a git post-commit hook.
There is a pre built one in script/post-commit
which you can copy:
cp -vn script/post-commit .git/hooks/
If you already have a post-commit file the above command will tell you. So instead add the following line to
your existing post-commit
:
(cd $GIT_DIR/.. && ./script/update-git-commit-and-branch.rb)
This is optional because having updated version information is only needed if you are submitting benchmarks from your local machine. These benchmarks include the commit information, so it is best to have it updated.