0.1.2 • Published 9 years ago

grunt-sinatra-server v0.1.2

Weekly downloads
1
License
-
Repository
github
Last release
9 years ago

grunt-sinatra-server

Use grunt to control Sinatra's development server, and live-reload with grunt-contrib-watch!

The "sinatra" task

Overview

####sinatra:start (the default sinatra task) Launches the server and leaves it running even when the parent process is no longer running.

####sinatra:stop --or-- sinatra:kill Terminates an already running server.

###Options The sinatra task should be configured with the following options:

NameTypeDefaultDescription
pidFilestring'/tmp/sinatraServer.pid'Path to the pid file. (REQUIRED)
debugbooleanfalseExtra logging output (OPTIONAL)
argsarray[]Additional arguments to add to the sinatra command, supplied as an array of strings. (OPTIONAL)

Getting Started

In the shell...

npm install grunt-sinatra-server

Load it by adding this to Gruntfile.js:

grunt.loadNpmTasks('grunt-sinatra-server');

Then add sinatra to the taskList object passed into grunt.registerTask in Gruntfile.js. (example:)

	grunt.registerTask('default', [
		'concat',
		'uglify',
		'sinatra',
		'watch'
	]);

##Running tests To run the test suite, first invoke the following command within the repo, installing the development dependencies:

$ npm install

Then run the tests:

$ mocha test/test.js

##With grunt-contrib-watch:

You can use this plugin with watch. This is awesome because it enables you to live reload the sinatra server when you make changes to server files (or really, any files that you specify). Here's an example of my watch config:

    watch: {
      sinatra: {
        options: {
          spawn : false, // IMPORTANT. will not work without this setting.
        },
        files: [
          '/bin/hi.rb'
        ],
        tasks: ['sinatra'] 
      }
    },
 
//...
  grunt.registerTask('default', ['sinatra', 'watch']);

The sinatra task knows if watch is running, and on interrupt will kill the sinatra server along with it.

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.1

9 years ago