Typesafe Activator
Typesafe, the folks who make the
play framework have a program called the Typesafe Activator. Activator is a local running Web Application
that runs on your own machine.
The following is a short
tutorial. It will help you install
Activator and begin using it.
I am running the Activator from
a Windows 7 Environment.
Download
Typesafe Activator
Click on "Download Typesafe
Activator"
It will download a zip file. (I downloaded mine on 8/18/2013 and it was
named typesafe-activator-0.3.0.zip)
Unzip the contents and save them to a
folder.
Run
Activator
The Activator includes an activator.bat
file. Double click on it to run it.
Or from the DOS command line run the
following from the directory
>
activator ui
|
From linux or mac run
>
./activator ui
|
The first time I ran the program it
downloaded a lot of files (so it may take more time the first time you run it)
It should open your default browser to the
following local page. Its URL is http://localhost:8888/home
Click on Accept to accept the license.
Now you are at the default page, this is the
Activator UI.
Create
Web App
There are several different Template
programs to choose from. For my first go
at it I selected "Reactive Stocks".
I want to change the default location to a
folder I have on my desktop. Click the
folder to change the location.
Double click On "Desktop"
Then, in my case, select play-testing which
is at C:\Users\patman\Desktop\play-testing
Then click "Select this Folder"
Click Create.
The Activator will create the program.
Your application is ready!
The screen you see now is the App Management
Screen
On the right side you can see the Tutorial
section.
Here you can read the tutorial that came
with the template.
Reading the first page of the tutorial you
will see that the app is running locally at http://localhost:9000/
Open this location in another panel on your
web browser
Issue …..
For some reason mine got stuck trying to
open the page but never actually opened.
To fix this I did the following
From the Activator
Click the Run tab. Then click Stop
After the program stops click on Start
After the app restarted the page loaded fine
for me.
The
Web App
This app looks like some "live"
stock feed with some fake data.
Code
You can read and edit your code from within
Activator.
Clicking the Code menu item will Display the
code.
As an example, clicking on Conf then routes
will open the routes file for this application.
From the Activator web interface you can
edit the files and save them.
I am not going to do that right now I just
wanted to point that out. If you do
edit them and save them the Play framework will automatically recompile the
program.
Open
Project in IntelliJ
I for one prefer to use an IDE when
programming, like IntelliJ.
To open this project in an IDE click on Open
and select your IDE, currently it looks like it supports IntelliJ (which I use)
and Eclipse.
I clicked on IntelliJ to create the needed
files for an IntelliJ project.
You will get the message
"Your app has no IntelliJ
IDEA project files. Generate
them now."
Click
on Generate them now
Messages will scroll by as it generates the
code.
If you are doing this for the first time it
will download some libraries and may take some time.
In my case it took ~ 10 minutes to finish.
When it is done click "import the
project into intelliJ IDEA
You will now see this note telling where the
program is to open in IntelliJ
Open
the project in IntelliJ
Click File
--> Open
Paste the location here and click OK
Click on Project
Here are the program files.
As a quick test open
app --> views --> index.scala.html
Update "Reactive Stocks" to
"Reactive Stocks Test Update"
And save it.
If you look real quick at the Activator web
page you will see that the code is recompiling.
The default behavior of Play is to recompile
if any of its files are updated.
Once the WebApp has been recompiled re-open
the WebApp page.
Reload http://localhost:9000/
You will see that it has been updated with
the new text.
That is enough for a first introduction to
Activator, or at least all I am willing to go into.
Conclusions
Activator seems pretty interesting. I still need to learn the Play Framework so I
can give a better educated opinion on it, but I think I will see myself using
Activator.
References
No comments:
Post a Comment