Skip to content

Getting started version 0.11 and earlier

Hannes Hirzel edited this page Apr 9, 2014 · 2 revisions

The following 'Get started' text is outdated. It might though still contain some information which is not easily available elsewhere. The new Getting started.

To get started hacking on Amber you can take any of these routes, desribed in short here and explained in more depth later:

  • Try it out in the browser, without installing anything by visiting http://www.amber-lang.net and clicking on the "Class browser" button to play around with the IDE. Note that you will not be able to save any code you write and refreshing the page will also revert any changes you have made.
  • You are going to develop in-browser application (this is most common use of Amber) and use bower for dependency management. You need to install node.js, npm, bower, amber cli tools via npm; initialize your project as bower package; and install amber as a bower dependency of your project. The Amber development server is accessible via ./bower_components/amber/bin/amber serve. You will be able to start Amber server, launch browser with IDE and save code.
  • You are going to develop node.js server-side application and use npm for dependency management. You need to install node.js, npm, bower, amber cli tools via npm; initialize your project as npm package; and install amber as an npm dependency of your project. A few Amber scripts including Amber server will be added to node_modules/.bin/. You will be able to start Amber server, launch browser with IDE and save code.
  • You do not want manage dependencies via npm nor bower. You can then download an Amber zipball and node.js and integrate Amber by hand. You will be able to start Amber server, launch browser with IDE and save code.
  • Amber Core Developer Mode (do this if you want to contribute to Amber itself): install Git first and get a proper clone from http://github.com/amber-smalltalk/amber instead of a zip/tarball. It requires installing Git first, which is left as an "exercise to the reader" (although being quite simple) :) Do not forget to get the dependencies: see below.

Downloading Amber

Releases

Unpack wherever you like, but we would advise you to rename the directory that is unpacked to something slightly shorter, e.g. "amber". With Amber 0.12.0 we refrained from managing the dependencies ourselves and use bower instead. So please continue below with Getting dependencies :)

Installing Node.js

Node (for short) is simply the V8 Javascript VM from Google Chrome hooked together with some hardcore C++ libraries for doing "evented I/O". Basically, it's Javascript for the server - on async steroids. Amber runs fine in Node and we use it for several Amber tools, like amberc or the Amber server (see below). There are also several Amber-Node example to look at if you want to play with running Amber programs server-side. In short - you really want to install Nodejs. :)

  • Installing Node on Linux can be done using your package tool of choice (apt-get install nodejs for example) or any other way described at the download page.
  • Installing Node on Mac OS X or Windows is probably done best by using the installers at download from Nodejs.org.

Installing npm

npm stands for 'node package manager' and is needed to load dependencies for the node projects. Amber uses node-based projects for housekeeping, so npm is required to be present.

Depending on your platform, npm can be installed alongside with node (ie Windows). If it is not (ie CentOS), you can install it using your OS's package tool.

Getting dependencies

Amber depends on a few of web libraries to work. These dependencies are managed using bower, a package manager for web libraries. If you do not have bower installed, install it with npm install -g bower.

If you got Amber itself from bower, bower dependencies are already installed with it. If not, you should run bower install inside the Amber directory.

At this point you can double click the index.html file in the Amber directory to get the IDE up. However, you will not be able to save code. So please continue below :)

To be able to use Amber development tools (simple Amber development server, amberc compiler, or run grunt tasks), you must also install development dependencies. If you got Amber itself from npm, development dependencies are already installed. Otherwise, run npm install in the Amber directory.

Starting the Amber server

Nicolas has written a minimal webDAV server that is the easiest way to get up and running Amber with the ability to save code. This little server is written in... Amber! And it runs on top of Node. So to start it up serving your brand new directory tree of sweet Amber you do:

cd amber      (or whatever you called the directory you unpackaged)
./bin/amber serve  (in windows you type `bin\amber serve` instead)

It should say Starting file server on http://127.0.0.1:4000. If it does, hooray! That means both Node and Amber are good. On Windows you might get a question about opening that port in the local firewall - yep, do it!

Firing up Amber

The Amber IDE is written in... Amber. It uses JQuery and runs right in your browser as a ... well, a web page. We could open it up just using a file url - but the reason we performed the previous steps is so that we can load the IDE web page from a server that can handle PUTs (webDAV) of source code. According to web security Amber can only do PUT back to the same server it was loaded from. Thus we instead want to open it through our little server now listening on port 4000:

http://localhost:4000/index.html

Clicking the above link should get your Amber running. (If it isn't, check your network setting to make sure that requests to localhost aren't being forwarded to your proxy server.)

To verify that you can indeed commit - just select a Package in the browser, like say "Examples" and press "Commit package" button. If all goes well nothing happens :). So in order to really know if it worked we can check the modified date on the files amber/st/Examples.st and amber/js/Examples.js - they should be brand new.

NOTE: We can use any webDAV server and Apache2 has been used earlier and works fine. But the Amber server is smaller and simpler to start.

Now, finally, you can proceed to Writing my first app

Clone this wiki locally