# Getting Started

Setup Smile Dev Environment

# Install Java

ENSURE JAVA 1.8 IS SET

To use the Smile platform, you need JDK 8. Be sure to have the java and javac commands in the current path (you can check this by typing java -version and javac -version at the shell prompt).

> java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)

If Java 8 is not installed, follow thelink to install and SET to Classpath. https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04

Create installs & softwares folder under user home.

> cd    
~> mkdir installs
~> mkdir softwares

Video reference:

# Install Smile

  1. Download install-smile.sh from bitbucket:
    https://bitbucket.org/metastay/repo/downloads/

  2. Copy the downloaded installer install-smile.sh to ~/installs

  3. Grant execute permission to this shell script:

~> cd installs
installs> chmod +x install-smile.sh
  1. Open install-smile.sh file and set eclipse_installed_dir to ./eclipse/jee-oxygen

  2. In install-smile.sh file also set eclipse_dropins_plugins_dir to $eclipse_installed_dir"/Eclipse.app/Contents/Eclipse/dropins"

NOTE

x.x.x -> Download the latest smile version

installs> ./install-smile.sh x.x.x
  1. Set smile in the PATH

For Ubuntu :

gedit .bashrc

For Mac : (* sublime should be installed)

subl .bash_profile
  1. Append the following 2 lines to .bashrc/.bash_profile

For Ubuntu :

export SMILE_HOME="$HOME/installs/smile"
export PATH=$SMILE_HOME/bin:$PATH"

For Mac :

export PATH=~/installs/smile/bin
  1. Reload Terminal (or restart terminal)

For Ubuntu :

. .bashrc

For Mac :

. .bash_profile
  1. Run smile command on Terminal
~>smile
Smile Version - 3.3.8
To create a new project : "smile  new <project-name>"
To create a new lib : "smile  create-lib <lib-name>"
To export lib : "smile  export-lib"
To reset the project : "smile  spile"

Video reference:

# Setup Eclipse

  1. Download eclipse: https://www.eclipse.org/downloads/packages/release/oxygen/3a

  2. choose Eclipse IDE for Java EE Developers

  3. Copy the downloaded installer into softwares folder: ~/installs/softwares

  4. Install Eclipse by clicking on the installer.

  5. Xtext installation:

    • go to “Help” -> “Install New Software”
    • add this url as the site to download the software from: http://download.eclipse.org/modeling/tmf/xtext/updates/composite/releases/
    • once the site content loads, check Xtext -> Xtext Complete SDK and click Next
    • In the next screen choose Xtext Complete SDK and click Next
    • Accept the terms and conditions and proceed
    • restart eclipse.
  6. Installation Complete: With this the eclipse installation is complete.

  7. If Smile is already installed. Copy the plugins from /smile/eclipse/plugins/ to Eclipse/Contents/Eclipse/dropins/plugins/

Video reference:

# Setup Intellij IDEA

Fllowing installation is for Ubuntu, IntelliJ version 2018.3.x. Please Download and install the mentioned version of IntelliJ for your operating system.

  1. Download the above mentioned version of IntelliJ from the following link: https://www.jetbrains.com/idea/download/other.html

  2. Copy the downloaded ideaIC-2018.3.x.tar.gz to ~/installs/softwares

  3. Unzip the ideaIC-2018.3.x.tar.gz

> cd ~/installs/softwares
> softwares> tar -xvf ideaIC-2018.3.x.tar.gz
  1. Open intelliJ

  2. Install Scala plugin:

    • Click on Configure -> Plugins
    • Click on Browse Repositories
    • Search for 'scala' (sort on downloads)
    • Click on install
  3. Install SBT plugin:

    • Click on Configure -> Plugins
    • Click on Browse Repositories
    • Search for 'SBT' (sort on downloads)
    • Click on install
  4. Restart intelliJ and installation is complete

Video reference:

NOTE

The version of intelliJ mentioned in video could be outdated. Please refer the documentation above and download the specified version.

# New Smile Project

  1. Create a folder for your projects
~> mkdir projects
  1. Go inside the projects folder
~> cd projects
  1. To create a new Smile project: create a smile project by projects> smile new <project_name>

TIP

While creating new project project_name must start with Capital.
A new folder with all small letters will be created within which all the project files will be placed.

projects> smile new Mould
projects> cd mould
  1. Run sbt (this takes sometime to download & setup).
projects/mould> sbt
  1. Run smile command run smile command insude sbt shell. Which will setup the project structure.
[Mould] $ smile
  1. Compile: run compile command to ensure no errors.
[Mould] $ compile
  1. Smile project is set.

Video reference:

# Import Project to Eclipse

  1. Open eclipse

  2. Go to File -> Import -> Existing Projects into Workspace

  3. Browse to the new project’s home folder and select the k folder example: ~/projects/mould/k

  4. Click on Finish

  5. Should see the project successfully imported with no errors.

Video reference:

# Import Project to IntelliJ

  1. Open intelliJ

  2. Go to File -> New -> Project from Existing Sources

  3. Choose the build.sbt inside the smile project folder example: ~/projects/mould/build.sbt

  4. Set up Project SDK to java 1.8

  5. Expand the Global SBT settings

  6. Set up SMILE_HOME in VM parameters: -DSMILE_HOME=/home/<user>/installs/smile

  7. click OK

  8. Project should get imported successfully.

Video reference:

# Install and Setup Mongo

  1. Download 3.2.x version from https://www.mongodb.com/download-center/community Choose Linux 64-bit legacy x64 Download : https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.2.22.tgz
cd ~/installs
curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.2.22.tgz
tar -xvf mongodb-linux-x86_64-3.2.22.tgz
mv mongodb-linux-x86_64-3.2.22.tgz mongodb
  1. Create directory for mongo data at ~/db/mongo/data
cd /
mkdir db
cd db
mkdir mongo
cd mongo
mkdir data
cd data
pwd
  1. Create mongodbconfig
cd ~/installs/mongodb/bin
touch mongodbconfig

Paste the below content inside mongodbconfig and save

dbpath = <home_directory>/db/mongo/data
logpath = <home_directory>/db/mongo/mongodb.log
logappend = true
port = 27017
fork = true
#replSet = abc
  1. Create mongostart
cd ~/installs/mongodb/bin
touch mongostart

Paste the below content inside mongostart and save

sudo <home_directory>/installs/mongodb/bin/mongod --config <home_directory>/installs/mongodb/bin/mongodbconfig
  1. Create mongostop
cd ~/installs/mongodb/bin
touch mongostop

Paste the below content inside mongodbconfig and save

#!/bin/bash
pid=`ps -aef | grep mongod | grep config | tr -s " " | cut -f3 -d " "`;
if [ "${pid}" != "" ]; then
sudo kill -2 ${pid};
fi