This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >>>>> Environment <<<<<< | |
| TORQUEBOX_HOME: C:\dev\torquebox\torquebox-2.x | |
| JRUBY_HOME: C:\dev\torquebox\torquebox-2.x\jruby | |
| JBOSS_HOME: C:\dev\torquebox\torquebox-2.x\jboss | |
| >>>>> Ruby <<<<<< | |
| Version: 1.9.2 | |
| Platform: java | |
| >>>>> TorqueBox Server <<<<<< |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @responder.respond do |r| | |
| r.do_something | |
| @responder.bad_request! # using @responder in it's own block, is this frowned upon? | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| req = Request.new(params) | |
| req.validate_params_as do |conditions| | |
| conditions[:scriptingtimingid] = :numeric | |
| conditions[:script_name] = :string | |
| conditions[:completed_on] = :time | |
| end | |
| req.validate? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| C:\dev\torquebox\backstage>echo %JRUBY_OPTS% | |
| --1.9 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Warden::Manager.before_failure do |env, opts| | |
| # Sinatra/Padrino is very sensitive to the request method and | |
| # since authentication could fail on any type of method, we need | |
| # to set it for the failure app so it is routed to the correct block. | |
| env['REQUEST_METHOD'] = "POST" | |
| end | |
| Warden::Strategies.add(:basic_http) do | |
| def valid? | |
| # Check if valid and store an instance var |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Ciaran-Archers-MacBook-Pro:roman-numerals carcher$ jasmine-node spec --coffee | |
| F | |
| Failures: | |
| 1) TestClass should be created | |
| Message: | |
| TypeError: object is not a function | |
| Stacktrace: | |
| TypeError: object is not a function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # create queue | |
| Padrino.after_load do | |
| # | |
| # Create message queues | |
| ## | |
| TorqueBox::Messaging::Queue.start '/queues/metrics/scripttiming' | |
| p '/queues/metrics/scripttiming queue started in Padrino.' | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ScriptTimingMsgProcessor < TorqueBox::Messaging::MessageProcessor | |
| p "ScriptTimingMsgProcessor class loaded" | |
| def on_message(body) | |
| # The body will be of whatever type was published by the Producer | |
| # the entire JMS message is available as a member variable called message() | |
| p 'ScriptTimingMsgProcessor::on_message() called with ' + body.to_s | |
| end | |
| def on_error(exception) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # code | |
| queue = TorqueBox::Messaging::Queue.new('/queues/metrics/script_timing') | |
| p params | |
| p params.class | |
| queue.publish params | |
| # output | |
| 08:35:06,177 INFO [stdout] (http--127.0.0.1-8080-1) {"scriptname"=>"test", "server"=>"1"} | |
| 08:35:06,178 INFO [stdout] (http--127.0.0.1-8080-1) Hash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Grid | |
| attr_accessor :values | |
| def initialize(dimension) | |
| @values = [] | |
| (1..dimension).each do |i| | |
| @values << (1..dimension).map{ ('A'..'Z').to_a[rand(26)] } | |
| end | |
| end |