Project

sails

0.04
No commit activity in last 3 years
No release in over 3 years
Sails, Help you to create Rails style Thrift Server
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0
>= 0.9.0
 Project Readme

Sails

Sails, create Thrift app server like Rails.

Build Status Gem Version

Features

  • Rails style Thrift server;
  • Nonblocking mode;
  • I18n support;

Installation

$ gem install sails
$ sails -h
ENV: development
Commands:
  sails help [COMMAND]  # Describe available commands or one specific command
  sails new APP_NAME    # Create a project
  sails restart         # Restart Thrift server
  sails start           # Start Thrift server
  sails stop            # Stop Thrift server
  sails version         # Show Sails version

Usage

Create new project

$ sails new foo
$ cd foo
$ sails start

Generate Thrift IDL

You can edit Thrift IDL in app_name.thrift, and then generate it to ruby source code.

$ rake generate

Rake tasks

rake client:ping            # client ping test
rake db:create              # Creates the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:create:all to create all databases in the config)
rake db:drop                # Drops the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:drop:all to drop all databases in the config)
rake db:fixtures:load       # Load fixtures into the current environment's database
rake db:migrate             # Migrate the database (options: VERSION=x, VERBOSE=false, SCOPE=blog)
rake db:migrate:create      # Create new migration file
rake db:migrate:status      # Display status of migrations
rake db:rollback            # Rolls the schema back to the previous version (specify steps w/ STEP=n)
rake db:schema:cache:clear  # Clear a db/schema_cache.dump file
rake db:schema:cache:dump   # Create a db/schema_cache.dump file
rake db:schema:dump         # Create a db/schema.rb file that is portable against any DB supported by AR
rake db:schema:load         # Load a schema.rb file into the database
rake db:seed                # Load the seed data from db/seeds.rb
rake db:setup               # Create the database, load the schema, and initialize with the seed data (use db:reset to also drop the database first)
rake db:structure:dump      # Dump the database structure to db/structure.sql
rake db:structure:load      # Recreate the databases from the structure.sql file
rake db:version             # Retrieves the current schema version number
rake generate               # Generate code from thrift IDL file

Client connect to test

You can write test code in lib/tasks/client.rake to test your thrift methods.

And then start sails server, and run rake task to test, for example:

sails s --daemon
rake client:ping

Deploy

$ sails s --daemon
$ ps aux
jason            2408   0.1  0.2  2648176  13532 s003  S    12:14下午   0:00.02 you_sails_app
jason            2407   0.0  0.0  2604916   1016 s003  S    12:14下午   0:00.00 you_sails_app [master]
$ sails restart
$ sails stop

API Documents

http://www.rubydoc.info/github/huacnlee/sails

TODO

  • Reload without restart;
  • Scaffold generator;
  • Multi processes;
  • Default test case templates;
  • Client rake task to test services;
  • Write more framework test cases.