First of all, install leiningen.
Used mainly for serving the index.html in /.
$ git clone git@github.com:niwibe/sloth.git $ cd sloth $ lein with-profile standalone run 2014-12-11 13:44:21.803:INFO::main: Logging initialized @4524ms 2014-12-11 13:44:22.880:INFO:oejs.Server:main: jetty-9.2.5.v20141112 2014-12-11 13:44:22.904:INFO:oejs.ServerConnector:main: Started ServerConnector@4a59d584{HTTP/1.1}{0.0.0.0:5050} 2014-12-11 13:44:22.905:INFO:oejs.Server:main: Started @5639ms
Used for compiling the frontend application.
$ cd sloth $ lein cljsbuild auto devel Compiling ClojureScript. Compiling "resources/public/js/app.js" from ["src/cljs"]...
You can use normal
build id (instead of devel
) for build with in
:whitespace
optimization instead of :none
. That increases compilation
times but improves page load speed.
You need ruby, nodejs, bundler, gulp and bower installed.
Install ruby and nodejs from your operating system package manager.
Install bundler using gem in a user home directory:
$ gem install --user-install bundler
This installs the binaries that comes in gem’s in location like this: ~/.gem/ruby/2.1.0/bin/, and you should add this path to you PATH variable.
Having ruby and bundler installed, you need install all dependencies for the SASS compiler:
$ bundle install Fetching gem metadata from https://rubygems.org/............. Installing sass 3.4.9 Installing thor 0.19.1 Installing bourbon 4.0.2 Using bundler 1.7.9 Your bundle is complete! It was installed into ./vendor
Install gulp at operating system level:
$ sudo npm install -g gulp bower
And, now, having gulp installed, install all dependencies needed for running gulp:
$ npm install
After having installed all dependencies, execute gulp for compile scss files. Gulp serves the application in localhost’s 9000 port for convenience, so there’s no need to run the backend:
$ gulp
All dependencies and settings for making work browser enabled repl are ready, but disabled by default.
For enable it, uncomment the (ws-repl/connect …)
on
src/cljs/sloth/core.cljs.
And start the browser enabled repl.
$ lein repl nREPL server started on port 57849 on host 127.0.0.1 - nrepl://127.0.0.1:57849 REPL-y 0.3.5, nREPL 0.2.6 Clojure 1.7.0-alpha4 OpenJDK 64-Bit Server VM 1.8.0_25-b18 Docs: (doc function-name-here) (find-doc "part-of-name-here") Source: (source function-name-here) Javadoc: (javadoc java-object-or-class-here) Exit: Control+D or (exit) or (quit) Results: Stored in vars *1, *2, *3, an exception in *e user=> (brepl) << started Weasel server on ws://0.0.0.0:9001 >> Type `:cljs/quit` to stop the ClojureScript REPL nil cljs.user=>
For generating the hiccup equivalent of the HTML template, run the following command:
$ lein hicv 2clj resources/public/sandbox/index.html
The sloth application can run as standalone application in node-webkit environment. For create a node-webkit package, execute:
$ gulp package
That will generate a sloth-x.y.z.nw file in target directory. You can run the application
executing it with nw
:
$ nw target/sloth-0.1.0.nw
This step is only necessary if you want to have local jabber server.
Install ejabberd using your package manager. In case of Archlinux execute as root:
# pacman -S ejabberd
Now, having server installed you have different ways to start it. If you want start a server temporary, you can do it directly with ejabberdctl command:
# For start server ejabberdctl start # For stop server ejabberdctl stop
Server started with ejabberdctl allow interact with them without changing the user.
An other way (recommended) is starting it using the systemd:
systemctl start ejabberd
In this case, if you want interact with server using ejabberdctl command, you should
change to ejabberd user (using su - ejabberd
)
For example, I recommend to setup an empty password for ejabberd user. This will allow you to switch to the ejabberd user without the need to remember another password or using the root user first.
Now, as ejabberd user, create an user in ejabberd server:
ejabberdctl register user localhost password