- Notifications
You must be signed in to change notification settings - Fork74
An opinionated toolkit for writing excellent APIs in Ruby.
License
interagent/pliny
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Pliny helps Ruby developers write and maintain excellent APIs.
It bundles the best patterns, libraries and practices we've seen after writing a lot of APIs.
Install gem:
$ gem install pliny
And initialize your new API app:
$ pliny-new myapp$cd myapp&& bin/setup
Pliny bundlesgenerators to help you get started:
$ bundleexec pliny-generate model artistcreated model file ./lib/models/artist.rbcreated migration ./db/migrate/1408995997_create_artists.rbcreatedtest ./spec/models/artist_spec.rb$ bundleexec pliny-generate mediator artists/creatorcreated mediator file ./lib/mediators/artists/creator.rbcreatedtest ./spec/mediators/artists/creator_spec.rb$ bundleexec pliny-generate endpoint artistscreated endpoint file ./lib/endpoints/artists.rbadd the following to lib/routes.rb: mount Endpoints::Artistscreatedtest ./spec/endpoints/artists_spec.rbcreatedtest ./spec/acceptance/artists_spec.rb$ bundleexec pliny-generate migration fix_somethingcreated migration ./db/migrate/1395873228_fix_something.rb$ bundleexec pliny-generate schema artistscreated schema file ./schema/schemata/artist.yamlrebuilt ./schema/schema.json
To test your application:
$ bundleexec rake
Or to run a single test suite:
$ bundleexec rspec spec/acceptance/artists_spec.rb
$ bundleexec pliny-generate
Commands: pliny-generate endpoint NAME # Generates an endpoint pliny-generate help [COMMAND] # Describe available commands or one specific command pliny-generate mediator NAME # Generates a mediator pliny-generate migration NAME # Generates a migration pliny-generate model NAME # Generates a model pliny-generate scaffold NAME # Generates a scaffold of endpoint, model, schema and serializer pliny-generate schema NAME # Generates a schema pliny-generate serializer NAME # Generates a serializer
Pliny adds common Rake tasks to help maintain your app:
rake db:create# Create the databaserake db:drop# Drop the databaserake db:migrate# Run database migrationsrake db:rollback# Rollback last database migrationrake db:schema:dump# Dump the database schemarake db:schema:load# Load the database schemarake db:schema:merge# Merges migrations into schema and removes themrake db:seed# Seed the database with datarake db:setup# Setup the databaserake schema# Rebuild schema.json
And provides the following commands:
$ foreman start# Starts server$ foreman run bin/console# IRB/Pry console$ foreman run bin/run'puts "hello world"'# Run automated code
(hint: don't forgetforeman run
in development)
Usepliny-update
to update the Pliny app in the current directory.
This not only bumps the version dependency, but also applies any changes that happened in the template app (for instance: new initializer, tweaks in the base endpoint, etc).
Run tests:
$ bundle install$ createdb pliny-gem-test$ rake
Created by Brandur Leach and Pedro Belo.
MIT licensed.
About
An opinionated toolkit for writing excellent APIs in Ruby.
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.