Giter Site home page Giter Site logo

shotgun's Introduction

Shotgun

This is an automatic reloading version of the rackup command that's shipped with Rack. It can be used as an alternative to the complex reloading logic provided by web frameworks or in environments that don't support application reloading.

The shotgun command starts one of Rack's supported servers (e.g., mongrel, thin, webrick) and listens for requests but does not load any part of the actual application. Each time a request is received, it forks, loads the application in the child process, processes the request, and exits the child process. The result is clean, application-wide reloading of all source files and templates on each request.

Usage

Installation:

  gem install shotgun

Starting a server with a rackup file:

  shotgun config.ru

Using Thin and starting on port 6000 instead of 9393 (default):

  shotgun --server=thin --port=6000 config.ru

Running Sinatra apps:

  shotgun hello.rb

See 'shotgun --help' for more advanced usage.

Compatibility

Because of the underlying technique used, Shotgun is only compatible with systems that support fork(2) (probably just MRI on POSIX systems).

Caveats

  • For performance reasons, Shotgun automatically includes middleware to serve static files (similar to Rack::Static). If you rely on Rack serving static assets, then do include Rack::Static yourself.

  • If you use Sinatra, you may need to set the session secret manually.

  • Similar to a Rackup file (config.ru), you can't use require_relative in your preload files (shotgun.rb).

Links

Shotgun

Rack

Sinatra

The reloading system in Ian Bicking's webware framework served as inspiration for the approach taken in Shotgun. Ian lays down the pros and cons of this approach in the following article:

http://ianbicking.org/docs/Webware_reload.html

shotgun's People

Contributors

adammck avatar anatol avatar djanowski avatar edzhelyov avatar jamster avatar josh avatar macournoyer avatar rtomayko avatar schneems 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  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  avatar  avatar  avatar  avatar  avatar

shotgun's Issues

Shotgun requests slow

~/Workspace/bithug (git: master) 1.9.1 โ†’ shotgun --server thin webserver.rb 
== Shotgun starting Rack::Handler::Thin on localhost:9393
>> Thin web server (v1.2.2 codename I Find Your Lack of Sauce Disturbing)
>> Maximum connections set to 1024
>> Listening on localhost:9393, CTRL+C to stop
127.0.0.1 - - [26/Jun/2009 14:36:52] "GET / HTTP/1.1" 200 255 0.0740
127.0.0.1 - - [26/Jun/2009 14:36:59] "GET /favicon.ico HTTP/1.1" 404 420 0.0209
>> Stopping ...
~/Workspace/bithug (git: master) 1.9.1 โ†’ ruby webserver.rb 
== Sinatra/0.10.1 has taken the stage on 4567 for development with backup from Thin
>> Thin web server (v1.2.2 codename I Find Your Lack of Sauce Disturbing)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:4567, CTRL+C to stop
127.0.0.1 - - [26/Jun/2009 14:38:17] "GET / HTTP/1.1" 200 255 0.0035
127.0.0.1 - - [26/Jun/2009 14:38:17] "GET /favicon.ico HTTP/1.1" 404 420 0.0007
>> Stopping ...
== Sinatra has ended his set (crowd applauds)

This is a bit annoying, especially if you have no code changes but a lot of requests.

The way shotgun run

I'm finding out the way Shotgun run.
To shotgun run we have to use Shotgun::Loader.new(env)
It start at step initialize I don't see anything to invoke method call to continue run.
Please help me clearer.
Thanks

Can not run shotgun in cmd.exe on Windows 7 (64bit)

I've just installed gem

C:\Zend\www\sinatra>gem install shotgun
Fetching: shotgun-0.9.gem (100%)
Successfully installed shotgun-0.9
1 gem installed
Installing ri documentation for shotgun-0.9...
Installing RDoc documentation for shotgun-0.9...

And then tried to run shotgun with the following results

C:\Zend\www\sinatra>shotgun param_server.rb

C:/Ruby193/lib/ruby/gems/1.9.1/gems/shotgun-0.9/bin/shotgun:99:in ``': No such file or directory - uname (Errno::ENOENT)
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/shotgun-0.9/bin/shotgun:99:in `block in <top (required)>'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/shotgun-0.9/bin/shotgun:98:in `each'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/shotgun-0.9/bin/shotgun:98:in `find'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/shotgun-0.9/bin/shotgun:98:in `<top (required)>'
    from C:/Ruby193/bin/shotgun:19:in `load'
    from C:/Ruby193/bin/shotgun:19:in `<main>'

the param_server.rb file has only one line

require "rubygems"

Sinatra `enable :lock` doesn't work with Shotgun

Hi,

As I'm using sqlite3 as a dev db, sometimes when I send lots of requests to server at the same time, sqlite3 db file could be locked.
I tried to enable :lock then Sinatra can't deal with many requests parallel, but with Shotgun, it seems that this option doesn't work. Can you help?

Thanks.

Segmentation fault on ruby 1.8.7p301

/.rvm/gems/ruby-1.8.7-p301/gems/rack-1.2.1/lib/rack/file.rb:86: [BUG] Segmentation fault
ruby 1.8.7 (2010-08-16 patchlevel 301) [i686-darwin10.3.0]

Also happens on 1.9.2p0

NameError: uninitialized constant Shotgun::Loader::YAML

I get this error message
NameError: uninitialized constant Shotgun::Loader::YAML
when running shotgun under Ruby1.9.2-p318 or 1.9.2-p320, but not 1.9.3-p362

The error is triggered by this line:

config = YAML::load_file('./.env.yml')

I don't know enough to know whether this is a bug or something I'm doing wrong. Any help appreciated.

EM.next_tick never called

I am using Sinatra running on thin (to publish to an AMQP broker, but that part isn't too important). In my Sinatra method, I have this (in essense):

get "/" do
puts "Sending message"
EventMachine.next_tick do
puts "Doing stuff..."
end
end

If I start Sinatra like this:
ruby site.rb &
then everything works fine and I'd see the "Doing stuff..." message when I call that route. However, if I start it with Shotgun:
shotgun site.rb &
or even:
shotgun -s thin -p 4567 site.rb &

I would see the "Sending message", but not the "Doing stuff...", which leads me to believe that next_tick is not being called when Sinatra is started with Shotgun.

LoadError when requiring 'net/ldap' gem

When using Shotgun to load my Sinatra app ($ shotgun app.rb) I get the following error as I try to load the webpage (no error appears in the console):

Boot Error

Something went wrong while loading config.ru

LoadError: cannot load such file -- net/ldap

/home/<user>/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:229:in `require'
/home/<user>/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:229:in `block in require'
/home/<user>/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:214:in `load_dependency'
/home/<user>/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:229:in `require'
config.ru:4:in `block in inner_app'
/home/<user>/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.2/lib/rack/builder.rb:51:in `instance_eval'
/home/<user>/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.2/lib/rack/builder.rb:51:in `initialize'
config.ru:1:in `new'
config.ru:1:in `inner_app'
/home/<user>/.rvm/gems/ruby-2.0.0-p247/gems/shotgun-0.9/lib/shotgun/loader.rb:112:in `eval'
/home/<user>/.rvm/gems/ruby-2.0.0-p247/gems/shotgun-0.9/lib/shotgun/loader.rb:112:in `inner_app'
/home/<user>/.rvm/gems/ruby-2.0.0-p247/gems/shotgun-0.9/lib/shotgun/loader.rb:102:in `assemble_app'
/home/<user>/.rvm/gems/ruby-2.0.0-p247/gems/shotgun-0.9/lib/shotgun/loader.rb:86:in `proceed_as_child'
/home/<user>/.rvm/gems/ruby-2.0.0-p247/gems/shotgun-0.9/lib/shotgun/loader.rb:31:in `call!'
/home/<user>/.rvm/gems/ruby-2.0.0-p247/gems/shotgun-0.9/lib/shotgun/loader.rb:18:in `call'
/home/<user>/.rvm/gems/ruby-2.0.0-p247/gems/shotgun-0.9/lib/shotgun/favicon.rb:12:in `call'
/home/<user>/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.2/lib/rack/builder.rb:134:in `call'
/home/<user>/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.2/lib/rack/handler/webrick.rb:59:in `service'
/home/<user>/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
/home/<user>/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
/home/<user>/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'

When I load the app via the Ruby command ($ ruby app.rb), everything loads and works properly. This behavior began when I added a line requiring 'net/ldap', which is called out in the error. I've been digging around for about an hour and I can't seem to find any indication why this would happen. Below are the relevant require lines from app.rb:

require 'rubygems'
require 'sinatra'
require 'net/ldap' # gem install net-ldap
Dir.glob('./{models,helpers,controllers}/*.rb').each { |file| require file }

configure do
  set :public_folder, Proc.new { File.join(root, "static") }
  enable :sessions
  set :session_secret, '<secret goes  here>'
end

I have tried both "require 'net-ldap'" and "require 'net/ldap'" and they produce the same results.

abort trap / seg fault on static files (png, jpg, css, js)

i'm getting the following error after several reloads of the same view. this happens in several apps, and doesn't seem to be a problem in production, nor is it a problem with the assets themselves. weird!

::1 - - [05/Nov/2009 14:30:00] "GET /images/success/subheader-arrow-tier2.png HTTP/1.1" 304 - 0.0012
::1 - - [05/Nov/2009 14:30:00] "GET /images/success/subheader-arrow-tier2.png HTTP/1.1" 304 - 0.0385
/opt/local/lib/ruby/gems/1.8/gems/shotgun-0.4/lib/shotgun.rb:33: [BUG] Segmentation fault
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10]

::1 - - [05/Nov/2009 14:30:00] "GET /images/success/summary-shadow-top.png HTTP/1.1" 304 - 0.0014
::1 - - [05/Nov/2009 14:30:00] "GET /images/success/summary-shadow-top.png HTTP/1.1" 304 - 0.0197
Abort trap

Error while running on Windows with jRuby

<script>:1: Cannot run program "uname" (in directory "D:\ruby-exp\sunatra"): CreateProcess error=2, The system cannot find the file specified (IOError) from C:/jruby/lib/ruby/gems/1.8/gems/shotgun-0.6/bin/shotgun:135:in `each' from C:/jruby/lib/ruby/gems/1.8/gems/shotgun-0.6/bin/shotgun:135:in`find' from C:/jruby/lib/ruby/gems/1.8/gems/shotgun-0.6/bin/shotgun:135 from C:/jruby/lib/ruby/gems/1.8/gems/shotgun-0.6/bin/shotgun:19:in `load' from C:\jruby\bin\shotgun:19

shotgun ignores Thin

Since the 0.7 update,

shotgun --server=thin

ignores using Thin and defaults to WEBrick. If I use 0.6, it works correctly so it probably broken in the latest release

I am currently using REE 1.8.7

On stop server I get error in loop reactor

I'm not sure if it is a shotgun specific bug or if it's a platform specific one. I'm using a combination of Rubinius and puma with shotgun to restart on any change. When I stop the server (CTRL + C) I get the following exception/message in the terminal:

Error in reactor loop escaped: Bad file descriptor - select(2) failed (Errno::EBADF)%

Shotgun visits every mapping in config.ru regardless the request

ENV

  ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
  shotgun-0.9.1
  rack-1.6.1
  thin-1.6.3

Simple config.ru

  map '/' do
    p "root"
    run Proc.new {|env| [200, {"Content-Type" => "text/html"}, ["root"]]}
  end

  map "/assets" do
    p "assets"
    run Proc.new {|env| [200, {"Content-Type" => "text/html"}, ["assets"]]}
  end

  map "/admin" do
    p "admin"
    run Proc.new {|env| [200, {"Content-Type" => "text/html"}, ["admin"]]}
  end

Run shotgun server

  $ shotgun

Hit the server:

  $ curl http://localhost:9393/
  root

Server log output

  == Shotgun/Thin on http://127.0.0.1:9393/
  Thin web server (v1.6.3 codename Protein Powder)
  Maximum connections set to 1024
  Listening on 127.0.0.1:9393, CTRL+C to stop
  "root"
  "assets"
  "admin"
  127.0.0.1 - - [15/Jun/2015:18:52:52 +0300] "GET / HTTP/1.1" 200 - 0.0008

This is really nasty when I use shotgun with sinatra and sprockets:
every asset request hits whole application and slow down page loading a lot

Is it by design?

The --browse option doesn't become enable with ruby 1.9

bin/shotgun

browse is not set true under ruby 1.9.

 - opts.on("-O", "--browse", "open browser immediately after starting") { |browse|                                                     
 + opts.on("-O", "--browse", "open browser immediately after starting") { |b|                                                           
     browse = true                                                                                                                      
    } 

Connecting to an app with an IP Address

Shotgun works well when connecting to the app locally from localhost or 127.0.0.1. However, if I try connecting to the app with the ip-address given by my local network (so I can check the app from another computer or my iPhone), I am unable to connect. However, I am able to connect via the same ip-address without using shotgun.

Is there something I can do in order to make my app available past the local computer while using shotgun?

Thanks,

Child processes hang and won't die under Ruby 1.9

Running under Ruby 1.9 w/ webrick, the child processes are hanging pretty much immediately after fork. I think the issue may be that the child processes still have the parent process's accept socket open and so children are getting requests. Needs more research.

LoadError on startup and sinatra request

I am not sure if this is a general error or due to my OSX setup, but when I start a Sinatra app via shotgun, i get the following errors:

rogue% shotgun -d -o 192.168.3.114 -p 4567 lib/server.rb
Exception `LoadError' at /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31 - no such file to load -- Win32API
Exception `LoadError' at /Library/Ruby/Site/1.8/rubygems/custom_require.rb:38 - no such file to load -- Win32API
Exception `LoadError' at /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31 - no such file to load -- mongrel
Exception `LoadError' at /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/gems.rb:7 - no such file to load -- mongrel_experimental
Exception `Gem::LoadError' at /Library/Ruby/Site/1.8/rubygems.rb:779 - RubyGem version error: mongrel_experimental(1.1 not >= 1.1.5)

After that the normal start message is shown:
== Shotgun starting Rack::Handler::Mongrel at http://192.168.3.114:4567

But when I do a request to the sinatra app, I get the following:

Exception `LoadError' at /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31 - no such file to load -- sinatra/base
Exception `LoadError' at /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31 - no such file to load -- tilt
Exception `LoadError' at /Library/Ruby/Site/1.8/rubygems/custom_require.rb:38 - no such file to load -- tilt
Exception `LoadError' at /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31 - no such file to load -- mustache/sinatra
Exception `Sinatra::NotFound' at /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:533 - Sinatra::NotFound
192.168.3.114 - - [04/Jun/2010 23:45:39] "GET / HTTP/1.1" 404 409 0.0074
Exception `LoadError' at /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31 - no such file to load -- sinatra/base
Exception `LoadError' at /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31 - no such file to load -- tilt
Exception `LoadError' at /Library/Ruby/Site/1.8/rubygems/custom_require.rb:38 - no such file to load -- tilt
Exception `LoadError' at /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31 - no such file to load -- mustache/sinatra
Exception `Sinatra::NotFound' at /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:533 - Sinatra::NotFound
192.168.3.114 - - [04/Jun/2010 23:45:39] "GET /favicon.ico HTTP/1.1" 404 420 0.0093

Startup via rackup works and the application is run as expected. So the application in general is fine.

Please tag repository or release tests/specs with the gem

Currently the tests are not shipped with the gem, and there is no way to automatically pick a tarball of the project to have them.

Since I'm trying to package this for Gentoo, it would be much better if we had a way to pick up the tests and run them when installing the package.

Thanks!

Doesn't reach through a VM

When I run a Sinatra app with shotgun, I cannot access it in virtual Windows XP under VMWare. But it does work normally with rackup. Either way I'd go to http://192.168.1.19:port for instance.

If this makes any sense I can help further, please let me know.

Change to load path in 1.9.2

Hi Ryan,

Now that the current directory is not in Ruby's load path running require rackup_file in Shotgun::Loader no longer works.

I've forked and branched your repo and managed to fix the issue (http://github.com/jcf/shotgun/commits/require_relative) but it's clear there is more work to be done to get shotgun's test suite running perfectly under 1.9.2.

If you want to pull the small change that's great as I'll be using it whenever I shotgun a sinatra app.

Thanks,

James

Multiple Requests

Hi, this may be a simple misunderstanding of sinatra and shotgun, but here's what I am seeing:

ROOT
127.0.0.1 - - [07/Dec/2009 21:33:57] "GET / HTTP/1.1" 200 733 0.7421
127.0.0.1 - - [07/Dec/2009 21:33:58] "GET /scripts/tick.js HTTP/1.1" 304 - 0.4458
ROOT
127.0.0.1 - - [07/Dec/2009 21:33:59] "GET / HTTP/1.1" 200 733 0.4516
127.0.0.1 - - [07/Dec/2009 21:34:00] "GET /css/main.css HTTP/1.1" 304 - 0.4813
127.0.0.1 - - [07/Dec/2009 21:34:01] "GET /images/logo.png HTTP/1.1" 304 - 0.5336

I am doing 'puts "ROOT"' in my get '/' do route. Why do I see it twice? Is there something wrong with shotgun or am I just an idiot? I guess both are possible but I think maybe I am doing something wrong.

here is how I am launching shotgun:

$ shotgun --server thin myapp.rb

Thanks in advance!

Doesn't work on macOS High Sierra

Hello,

This gem no longer works on macOS High Sierra.

I noticed it is only compatible with systems that support fork(2) and High Sierra does change how fork() works on syscall level.

WARN TCPServer Error: Address already in use - bind(2)

I've just installed shotgun on Ubuntu and I keep getting the following error:

WARN  TCPServer Error: Address already in use - bind(2)

I've tried using different ports, but still get the same error. Is this a shotgun problem or am I doing something wrong?

cheers,

DAZ

Using rack 1.3.2 and sinatra no logging is visible

ruby app.rb shows me standard Apache log messages, but shotgun app.rb doesn't. The app works fine and reloading works. This happens with Rack 1.3.2 and latest mongrel/webrick. Using [ruby-1.8.7-p352]. Tell me if you can't reproduce and/or need more info.

app.rb as in sinatrarb.com's homepage

does not work well with rack 1.0.1?

my app on sinatra
past work with shotgun.

but after i update rack version from 1.0.0 to 1.0.1,
shotgun does not work well.

$ shotgun
[2009-12-08 23:08:46] INFO  WEBrick 1.3.1
[2009-12-08 23:08:46] INFO  ruby 1.8.7 (2009-06-12) [i686-linux]
== Shotgun starting Rack::Handler::WEBrick on :9393
[2009-12-08 23:08:46] INFO  WEBrick::HTTPServer#start: pid=3467 port=9393

$ netstat -an
tcp        0      0 127.0.0.1:9393              0.0.0.0:*                   LISTEN

only local roopback.

$ ruby myapp.rb
== Sinatra/0.9.4 has taken the stage on 4567 for development with backup from WEBrick
[2009-12-08 23:07:38] INFO  WEBrick 1.3.1
[2009-12-08 23:07:38] INFO  ruby 1.8.7 (2009-06-12) [i686-linux]
[2009-12-08 23:07:38] INFO  WEBrick::HTTPServer#start: pid=3461 port=4567

$ netstat -an
tcp        0      0 0.0.0.0:4567                0.0.0.0:*                   LISTEN

in sinatra's rack, i can access from other ip.

is it shotgun's problem?

my environment
shotgun 0.4
sinatra 0.9.4
rack 1.0.1
ruby 1.8.7 patch174
centos 5.2
on vmware server on windows xp

No output from Rack::CommonLogger

The simplest way I could make it work was by doing this:

cyx@3098530

I know it's a bit hackish though. I tried also experimenting with reopening $stderr / $stdout after forking to the previous values, but unfortunately I couldn't find a way to make it work properly.

Thanks in advance for any help!

Shotgun breaking in Ruby 1.9.2

Hi,

I've been facing an issue with shotgun 0.8 over Ruby 1.9.2. Running a simple Sinatra application using shotgun index.rb I got an error "Boot Error" - complete traceback copied below.
I believe it's due to the fact Ruby 1.9.2 seems not to include current working directory in its import path. Adding the following statement before line 114 in lib/shotgun/loader - where shotgun tries to import index.rb - everything seems to work fine again.

$:.unshift("#{`pwd`}".chomp)

Complete traceback:

Boot Error

Something went wrong while loading index.rb

LoadError: no such file to load -- index.rb

<internal:lib/rubygems/custom_require>:29:in `require'
<internal:lib/rubygems/custom_require>:29:in `require'
/Users/gobr/.rvm/gems/ruby-1.9.2-p0/gems/shotgun-0.8/lib/shotgun/loader.rb:114:in `inner_app'
/Users/gobr/.rvm/gems/ruby-1.9.2-p0/gems/shotgun-0.8/lib/shotgun/loader.rb:102:in `assemble_app'
/Users/gobr/.rvm/gems/ruby-1.9.2-p0/gems/shotgun-0.8/lib/shotgun/loader.rb:86:in `proceed_as_child'
/Users/gobr/.rvm/gems/ruby-1.9.2-p0/gems/shotgun-0.8/lib/shotgun/loader.rb:31:in `call!'
/Users/gobr/.rvm/gems/ruby-1.9.2-p0/gems/shotgun-0.8/lib/shotgun/loader.rb:18:in `call'
/Users/gobr/.rvm/gems/ruby-1.9.2-p0/gems/shotgun-0.8/lib/shotgun/favicon.rb:12:in `call'
/Users/gobr/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/builder.rb:77:in `call'
/Users/gobr/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/content_length.rb:13:in `call'
/Users/gobr/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/handler/webrick.rb:52:in `service'
/Users/gobr/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
/Users/gobr/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/Users/gobr/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'

Thanks due to github.com/rafaelcv for sharing his discoveries on this.

Salute,
Diego 'gobr' Henrique.

shotgun command not found and rack load error

After loading shotgun via the following command, the shotgun command was not found even though the gem loaded OK.

|=|=Wed16==- sudo gem install shotgun
[sudo] password for xxx: 
Successfully installed shotgun-0.6
1 gem installed
Installing ri documentation for shotgun-0.6...
Installing RDoc documentation for shotgun-0.6...
|=|=Wed16==- which shotgun
|=|=Wed16==- 

I grabbed a copy of from the following directory and added it to my personal bin.

copy from =>  /var/lib/gems/1.8/gems/shotgun-0.6/bin

When I ran it I got:

|=|=Wed16==- shotgun -p 4567 pos_server.rb 
/home/mat/bin/shotgun:96:in `require': no such file to load -- rack (LoadError)
      from /home/mat/bin/shotgun:96

Adding a "require 'rubygems'" after that of optparse got it to work finally.

ENV: Ubuntu GNU/Linux, 10.4, ruby 1.8.7 and Mongrel

Shotgun is awesome

My new fav. combo with guard-livereload, it really made my day. Thanks Ryan !

binds to wrong Host (compared to docu)

shotgun -h says
-o, --host HOST listen on HOST (default: 0.0.0.0)

but in the code it's localhost:
# bin/shotgun:14
options = {:Port => 9393, :Host => 'localhost', :AccessLog => [], :Path => '/'}

code should be '0.0.0.0', too

Shotgun Doesn't Respond to SIGTERM

Shotgun does not seem to respond to the SIGTERM process signal, which can make starting and stopping shotgun and real pain, as the common CTRL+C doesn't kill it. Is there any reason for this? If not, is it something that can be fixed in a future version?

Cheers

Unicorn support

Asking for the unicorn server doesn't work. It's pretty new, so don't feel too bad :P

If I get bored in the next little while I'll see about putting it in and sending a pull request.

Shotgun not accepting POST methods in Google Chrome for Mac

Using shotgun to test locally under Google Chrome for Mac, I see that posting a form sends a GET request to the URL specified, rather than POST.

Running the app locally using

$ ruby main.rb

works fine. Not sure if this is a shotgun or rack issue?

unsupported signal SIGQUIT

C:/Ruby192/lib/ruby/gems/1.9.1/gems/shotgun-0.9/bin/shotgun:142:in `trap': unsupported signal SIGQUIT (ArgumentError)
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/shotgun-0.9/bin/shotgun:142:in `block in <top (required)>'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/shotgun-0.9/bin/shotgun:141:in `each'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/shotgun-0.9/bin/shotgun:141:in `<top (required)>'
    from C:/Ruby192/bin/shotgun:19:in `load'
    from C:/Ruby192/bin/shotgun:19:in `<main>'

This is what I get when running shotgun on Win 7 x64.

Provide license information for the software

Can you provide a LICENSE file in root of your project to indicate the license we can use your software under? Pick your license of course, but right now it's hard to know what we're allowed to do with your code.. Thanks.

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.