GithubHelp home page GithubHelp logo

catalystio / grape-raketasks Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vitalinfo/grape-raketasks

0.0 4.0 0.0 17 KB

Rake tasks to ease the development and debugging of Grape APIs.

License: MIT License

Ruby 100.00%

grape-raketasks's Introduction

grape-raketasks

Rake tasks to ease the development and debugging of Grape APIs.

Build Status

Available Tasks

Routes

rake grape_raketasks:routes is like rake routes for your Grape APIs. All routes within every Grape API in your web application will be printed to the terminal, along with parameter requiremements, HTTP verb, the API it belongs to, etc.

Filtering

If you want to see routes belonging to only one API:

Pass an environment variable set to your API name after writing the task. Given the API below, and assuming we only want to see routes belonging to this CatPictures API...

module CatPictures
  class API < Grape::API
    # API stuff
  end
end

I'd execute rake grape_raketasks:routes API=CatPictures::API. Notice how we have to list which constants the API is nested in (if any), separated by a double colon, like in Ruby code.

Installation

1.) Add grape-raketasks to your Gemfile:

# Gemfile
gem 'grape-raketasks'

2.) Install the gem via Bundler:

$ bundle install

or on the command line:

$ gem install grape-raketasks

3.) If your Grape APIs are defined in a Sinatra or Rack web application, you need to write a rake task called :environmentthat loads the application's environment first. This gem's tasks are dependent on it. You could put this in the root of your project directory:

# Rakefile

require 'rake'
require 'bundler'
Bundler.setup
require 'grape-raketasks'
require 'grape-raketasks/tasks'

desc 'load the Sinatra environment.'
task :environment do
  require File.expand_path('your_app_file', File.dirname(__FILE__))
end

Rails applications with mounted Grape APIs don't require an extra step here.

4.) Run rake -T to see all available rake tasks. Tasks with a grape_raketasks namespace should appear somewhere.

5.) Use the tasks! Find bugs or ideas for improvement! Report them here!

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Write specs for your feature
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new pull request

License

See LICENSE

grape-raketasks's People

Contributors

dblock avatar reprah avatar vitalinfo avatar

Watchers

 avatar  avatar  avatar  avatar

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.