# CHANGES ## Jellyfish 0.6.0 -- 2012-11-02 ### Enhancements for Jellyfish core * Extracted Jellyfish::Controller#call and Jellyfish::Controller#block_call into Jellyfish::Controller::Call so that you can have modules which can override call and block_call. See Jellyfish::Sinatra and Jellyfish::NewRelic for an example. * Now you can use `request` in the controller, which is essentially: `@request ||= Rack::Request.new(env)`. This also means you would need Rack installed and required to use it. Other than this, there's no strict requirement for Rack. ### Enhancements for NewRelic * Added Jellyfish::NewRelic which makes you work easier with NewRelic. Here's an example of how to use it: (extracted from README) ``` ruby require 'jellyfish' class Tank include Jellyfish class MyController < Jellyfish::Controller include Jellyfish::NewRelic end def controller; MyController; end get '/' do "OK\n" end end use Rack::ContentLength use Rack::ContentType, 'text/plain' require 'cgi' # newrelic dev mode needs this and it won't require it itself require 'new_relic/rack/developer_mode' use NewRelic::Rack::DeveloperMode # GET /newrelic to read stats run Tank.new NewRelic::Agent.manual_start(:developer_mode => true) ``` ## Jellyfish 0.5.3 -- 2012-10-26 ### Enhancements for Jellyfish core * Respond an empty string response if the block gives a nil. * Added Jellyfish#log method which allow you to use the same way as Jellyfish log things. * rescue LocalJumpError and give a hint if you're trying to return or break from the block. You should use `next` instead. Or you can simply pass lambda which you can safely `return`. For example: `get '/path', &lambda{ return "body" }` ### Enhancements for Sinatra flavored controller * Introduced `initialize_params` and only initialize them whenever it's not yet set, giving you the ability to initialize params before calling `block_call`, thus you can customize params more easily. An example for making NewRelic work would be like this: ``` ruby class Controller < Api::Controller include NewRelic::Agent::Instrumentation::ControllerInstrumentation def block_call argument, block path = if argument.respond_to?(:regexp) argument.regexp else argument end.to_s[1..-1] name = "#{env['REQUEST_METHOD']} #{path}" initialize_params(argument) # magic category, see: # NewRelic::MetricParser::WebTransaction::Jellyfish perform_action_with_newrelic_trace(:category => 'Controller/Jellyfish', :path => path , :name => name , :request => request , :params => params ){ super } end end module NewRelic::MetricParser::WebTransaction::Jellyfish include NewRelic::MetricParser::WebTransaction::Pattern def is_web_transaction?; true; end def category ; 'Jellyfish'; end end ``` ## Jellyfish 0.5.2 -- 2012-10-20 ### Incompatible changes * `protect` method is removed and inlined, reducing the size of call stack. ### Enhancements for Jellyfish core * `log_error` is now a public method. ### Enhancements for Sinatra flavored controller * Force params encoding to Encoding.default_external ## Jellyfish 0.5.1 -- 2012-10-19 * Removed accidentally added sinatra files. ## Jellyfish 0.5.0 -- 2012-10-18 ### Incompatible changes * Some internal constants are removed. * Renamed `Respond` to `Response`. ### Enhancements * Now Jellyfish would always use the custom error handler to handle the particular exception even if `handle_exceptions` set to false. That is, now setting `handle_exceptions` to false would only disable default error handling. This behavior makes more sense since if you want the exception bubble out then you shouldn't define the custom error handler in the first place. If you define it, you must mean you want to use it. * Eliminated some uninitialized instance variable warnings. * Now you can access the original app via `jellyfish` in the controller. * `Jellyfish::Controller` no longer includes `Jellyfish`, which would remove those `DSL` methods accidentally included in previous version (0.4.0-). ## Jellyfish 0.4.0 -- 2012-10-14 * Now you can define your own custom controller like: ``` ruby require 'jellyfish' class Heater include Jellyfish get '/status' do temperature end def controller; Controller; end class Controller < Jellyfish::Controller def temperature "30\u{2103}\n" end end end use Rack::ContentLength use Rack::ContentType, 'text/plain' run Heater.new ``` * Now it's possible to use a custom matcher instead of regular expression: ``` ruby require 'jellyfish' class Tank include Jellyfish class Matcher def match path path.reverse == 'match/' end end get Matcher.new do |match| "#{match}\n" end end use Rack::ContentLength use Rack::ContentType, 'text/plain' run Tank.new ``` * Added a Sinatra flavor controller ``` ruby require 'jellyfish' class Tank include Jellyfish def controller; Jellyfish::Sinatra; end get %r{^/(?\d+)$} do "Jelly ##{params[:id]}\n" end end use Rack::ContentLength use Rack::ContentType, 'text/plain' run Tank.new ``` ## Jellyfish 0.3.0 -- 2012-10-13 * Birthday!