Giter Site home page Giter Site logo

sails's Introduction

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.

sails's People

Contributors

huacnlee avatar larrylv avatar wuxiaoyi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

sails's Issues

请问这个框架可以和 rails 兼容吗?

我是从 ruby-china 论坛找过来的, 目前我也是 rails 的新手, 正在寻找一种 rails app 集成 thrift 服务的优雅方式,
罗昕的 rails_service 的 ppt 我也看了, 他的框架中有一种 rails_service install 的命令, 是用来专门和 rails 集成的,
请问 sails 是否支持类似的功能?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.