ruby - How do I make my rack app a gem? -
i have nice litte .ru file can run rackup want able publish as gem. assume can move lib directory , add gemspec else need can run run after installing gem?
gemspec+correct directory structure+(most importantly) placing script launch app(with run, probably) bin/ directory.
a little more details on gem binaries here
update
an example requested. have made gem called agent depends on sinatra(it depends on rack). has definition of agent::server:
module agent   # code goes here...   class server <  ::sinatra::base      '/sync'         [200, "yahoo!"]     end   end   i created file called test following contents:
#!/usr/bin/env ruby  require "rubygems" require "agent"  rack::handler::webrick.run(   agent::server.new,   :port => 9000 )   then, if run chmod 0755 test , ./test after that, can go http://localhost:900/sync , see yahoo!.
Comments
Post a Comment