README.md in teamster-0.3.3 vs README.md in teamster-0.3.4
- old
+ new
@@ -1,69 +1,61 @@
-teamster
-========
+# teamster
A simple bare-bones extensible web portal for individuals or small teams
-Dependencies
-============
+#### Dependencies
To run teamster, there is a few dependencies:
* Only supported in OS X and linux. Not test on Windows. YMMV.
-Install
-=======
+#### Install
Teamster has been packaged into a gem. To install, simply run `gem install teamster`.
-Usage
-=====
+## Usage
* Create a new folder where you want your site to live and navigate into it: `mkdir new-site && cd new-site`
* Initialize teamster and answer some configuration questions: `teamster init`
* Run teamster: `teamster start`
Open a browser and point to http://localhost:9292. A bare teamster page should be shown.
-Running In A "Production" Environment
-=====================================
+## Running In A "Production" Environment
I do not recommended this application be exposed to the wide Internet just yet, but it should be secure enough for an individual or small team to use over their private LAN.
When the `--prod` flag is passed, teamster will not run using rackup, but will utilize the [Puma](http://puma.io/) app server to serve itself. It will create and bind itself to a UNIX socket file and a Puma state file.
-Use With Nginx
---------------
+#### Use With Nginx
Personally, I'm using this in conjunction with the popular [Nginx](http://nginx.org/) web server. To follow these, Nginx must already be installed on your system.
* Run teamster in production mode: `teamster start --prod --socket-file /tmp/teamster.sock --state-file /srv/my-site/app.state`
* In the nginx site configuration file, add the following:
- > upstream app {
- > server unix:///tmp/teamster.sock;
- > }
- >
- > server {
- > server_name my-site.example.com;
- > }
- >
- > location / {
- > proxy_pass http://app;
- > }
- > }
+ upstream app {
+ server unix:///tmp/teamster.sock;
+ }
+ server {
+ server_name my-site.example.com;
+
+ location / {
+ proxy_pass http://app;
+ }
+ }
+
* Restart nginx.
Open a browser and point to http://my-site.example.com. A bare teamster page should be shown.
-Create Modules
-==============
+## Create Modules
To create your custom modules:
* Navigate to the site folder root: `cd /path/to/root/folder/of/my-site`
* Run: `teamster --create-module MODULENAME`.
@@ -72,5 +64,40 @@
* lib/teamster-modules/MODULENAME.rb
* lib/teamster-modules/MODULENAME/views/MODULENAME.erb
In MODULENAME.rb, a class MODULENAME will be created. While it may sub-class from Teamster::Module::Base, it is also a sub-class of Sinatra::Base. When developing it, you can use helper methods and other nifty stuff available from Sinatra. However, do take note of the scoping.
+
+
+#### Helpers Available To Modules
+
+This is a small list of helper methods that can be used in your modules.
+
+* **logged_in?**
+
+This returns `true` or `false`. Useful to check if a user has logged in.
+
+ get '/login_checker' do
+ if logged_in?
+ puts "User has logged in."
+ else
+ puts "You are not logged in."
+ end
+ end
+
+* **login_required**
+
+This halts a route from being run if a user has not yet logged in. Once a user has logged in, the route will be reloaded. The way to use this helper is:
+
+ get '/protected_route' do
+ login_required
+ do_stuff
+ end
+
+* **current_user**
+
+This just returns the username (or canonical name) of the currently logged in user. Since login is not yet implemented, this returns some random string.
+
+ get '/show_name' do
+ login_required
+ puts "Hello, #{current_user}"
+ end