optimus_prime 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b21594444427e0d8f033659808f7694b71d51f08
4
- data.tar.gz: 79b3ada0c5c81ecac3c502a3e5c5763f035009b9
3
+ metadata.gz: aeeeb6e0390633d397bf2414b79738dad8219afe
4
+ data.tar.gz: 703d840d45f6b5e4bfbd57365067cd5f92622782
5
5
  SHA512:
6
- metadata.gz: ca99401cb0c9100ed66e20997871600d97b52258cbf3f53ef3ce0500863864e74da3cb7492011a624c90e6b48a42c6788bc4a52bf504e575100ed97c616ee145
7
- data.tar.gz: 6609b0f517db910e86d21674de883fe94183050bcc9f9f09925dbd8ebb584edf6bc08a097b0f2bd198ebb3503a9b814f4533526c569e71f8909456f6d4b7ce8b
6
+ metadata.gz: df43c44bb81e9dbe5b8fcfcbb8e1a135a9e5cc6bc9472a7ed0efef3be980d7a36aa763036b253747e4e9dec15136e5a2cd518c0aeb4ee21610c568e235763441
7
+ data.tar.gz: 8d6186e74005e0121e5428145184acba4aebbe6a44e62d65e53780193fca41b38857c2f8319612236e1b4899725e1162b9588e26c1a0c61578720b6454485887
@@ -5,10 +5,10 @@ require "json"
5
5
  module OptimusPrime
6
6
 
7
7
  class Server < ::Sinatra::Base
8
- before do
9
- content_type :json
8
+ after do
10
9
  headers 'Access-Control-Allow-Origin' => '*',
11
- 'Access-Control-Allow-Methods' => ['OPTIONS', 'GET', 'POST']
10
+ 'Access-Control-Allow-Headers' => env['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'],
11
+ 'Access-Control-Allow-Methods' => ['OPTIONS', 'GET', 'POST', 'PATCH']
12
12
  end
13
13
 
14
14
  set :public_folder, __dir__ + "/server/public"
@@ -19,6 +19,9 @@ module OptimusPrime
19
19
  @@requests ||= {}
20
20
  @@not_primed ||= {}
21
21
 
22
+ options "/*" do
23
+ end
24
+
22
25
  patch "/get/*" do
23
26
  path = get_path
24
27
  response = responses[path]
@@ -1,3 +1,3 @@
1
1
  module OptimusPrime
2
- VERSION = "4.0.0"
2
+ VERSION = "4.0.1"
3
3
  end
data/optimus_prime.log CHANGED
@@ -12409,3 +12409,133 @@ Thin web server (v1.6.2 codename Doc Brown)
12409
12409
  Debugging ON
12410
12410
  Maximum connections set to 1024
12411
12411
  Listening on 0.0.0.0:7003, CTRL+C to stop
12412
+ Writing PID to /Users/mars/dev/optimus_prime/tmp/pids/optimus_prime.pid
12413
+ Using rack adapter
12414
+ Thin web server (v1.6.3 codename Protein Powder)
12415
+ Debugging ON
12416
+ Maximum connections set to 1024
12417
+ Listening on 0.0.0.0:7003, CTRL+C to stop
12418
+ JSON::ParserError - 757: unexpected token at 'status=YES':
12419
+ /Users/mars/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/json/common.rb:155:in `parse'
12420
+ /Users/mars/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/json/common.rb:155:in `parse'
12421
+ /Users/mars/dev/optimus_prime/lib/optimus_prime/server.rb:174:in `parse_request'
12422
+ /Users/mars/dev/optimus_prime/lib/optimus_prime/server.rb:89:in `block in <class:Server>'
12423
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1603:in `call'
12424
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1603:in `block in compile!'
12425
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `[]'
12426
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `block (3 levels) in route!'
12427
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:985:in `route_eval'
12428
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `block (2 levels) in route!'
12429
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1006:in `block in process_route'
12430
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1004:in `catch'
12431
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1004:in `process_route'
12432
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:964:in `block in route!'
12433
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:963:in `each'
12434
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:963:in `route!'
12435
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1076:in `block in dispatch!'
12436
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `block in invoke'
12437
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `catch'
12438
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `invoke'
12439
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1073:in `dispatch!'
12440
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:898:in `block in call!'
12441
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `block in invoke'
12442
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `catch'
12443
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `invoke'
12444
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:898:in `call!'
12445
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:886:in `call'
12446
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
12447
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in `call'
12448
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in `call'
12449
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
12450
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
12451
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in `call'
12452
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/rack-1.5.2/lib/rack/nulllogger.rb:9:in `call'
12453
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/rack-1.5.2/lib/rack/head.rb:11:in `call'
12454
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:180:in `call'
12455
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:2014:in `call'
12456
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1478:in `block in call'
12457
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1788:in `synchronize'
12458
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1478:in `call'
12459
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/connection.rb:86:in `block in pre_process'
12460
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/connection.rb:84:in `catch'
12461
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/connection.rb:84:in `pre_process'
12462
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/connection.rb:53:in `process'
12463
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/connection.rb:39:in `receive_data'
12464
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine'
12465
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'
12466
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/backends/base.rb:73:in `start'
12467
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/server.rb:162:in `start'
12468
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/controllers/controller.rb:87:in `start'
12469
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/runner.rb:200:in `run_command'
12470
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/runner.rb:156:in `run!'
12471
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/bin/thin:6:in `<top (required)>'
12472
+ /Users/mars/.rvm/gems/ruby-2.1.1/bin/thin:23:in `load'
12473
+ /Users/mars/.rvm/gems/ruby-2.1.1/bin/thin:23:in `<main>'
12474
+ /Users/mars/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
12475
+ /Users/mars/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'
12476
+ Exiting!
12477
+ Writing PID to /Users/mars/dev/optimus_prime/tmp/pids/optimus_prime.pid
12478
+ Using rack adapter
12479
+ Thin web server (v1.6.3 codename Protein Powder)
12480
+ Debugging ON
12481
+ Maximum connections set to 1024
12482
+ Listening on 0.0.0.0:7003, CTRL+C to stop
12483
+ JSON::ParserError - 757: unexpected token at 'status=YES':
12484
+ /Users/mars/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/json/common.rb:155:in `parse'
12485
+ /Users/mars/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/json/common.rb:155:in `parse'
12486
+ /Users/mars/dev/optimus_prime/lib/optimus_prime/server.rb:173:in `parse_request'
12487
+ /Users/mars/dev/optimus_prime/lib/optimus_prime/server.rb:88:in `block in <class:Server>'
12488
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1603:in `call'
12489
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1603:in `block in compile!'
12490
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `[]'
12491
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `block (3 levels) in route!'
12492
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:985:in `route_eval'
12493
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `block (2 levels) in route!'
12494
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1006:in `block in process_route'
12495
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1004:in `catch'
12496
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1004:in `process_route'
12497
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:964:in `block in route!'
12498
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:963:in `each'
12499
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:963:in `route!'
12500
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1076:in `block in dispatch!'
12501
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `block in invoke'
12502
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `catch'
12503
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `invoke'
12504
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1073:in `dispatch!'
12505
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:898:in `block in call!'
12506
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `block in invoke'
12507
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `catch'
12508
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `invoke'
12509
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:898:in `call!'
12510
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:886:in `call'
12511
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
12512
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in `call'
12513
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in `call'
12514
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
12515
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
12516
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in `call'
12517
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/rack-1.5.2/lib/rack/nulllogger.rb:9:in `call'
12518
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/rack-1.5.2/lib/rack/head.rb:11:in `call'
12519
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:180:in `call'
12520
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:2014:in `call'
12521
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1478:in `block in call'
12522
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1788:in `synchronize'
12523
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1478:in `call'
12524
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/connection.rb:86:in `block in pre_process'
12525
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/connection.rb:84:in `catch'
12526
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/connection.rb:84:in `pre_process'
12527
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/connection.rb:53:in `process'
12528
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/connection.rb:39:in `receive_data'
12529
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine'
12530
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'
12531
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/backends/base.rb:73:in `start'
12532
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/server.rb:162:in `start'
12533
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/controllers/controller.rb:87:in `start'
12534
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/runner.rb:200:in `run_command'
12535
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/runner.rb:156:in `run!'
12536
+ /Users/mars/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/bin/thin:6:in `<top (required)>'
12537
+ /Users/mars/.rvm/gems/ruby-2.1.1/bin/thin:23:in `load'
12538
+ /Users/mars/.rvm/gems/ruby-2.1.1/bin/thin:23:in `<main>'
12539
+ /Users/mars/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
12540
+ /Users/mars/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'
12541
+ Exiting!
data/tags CHANGED
@@ -14,15 +14,16 @@ clear! lib/optimus_prime.rb /^ def clear!$/;" f class:OptimusPrime.Base
14
14
  count lib/optimus_prime.rb /^ def count(path_name)$/;" f class:OptimusPrime.Base
15
15
  current_path lib/optimus_prime.rb /^ def current_path; `pwd`.chomp; end$/;" f class:OptimusPrime.Cannon
16
16
  fire lib/optimus_prime.rb /^ def self.fire!(port)$/;" F class:OptimusPrime.Cannon
17
- get_boolean lib/optimus_prime/server.rb /^ def get_boolean(boolean)$/;" f
17
+ get_boolean lib/optimus_prime/server.rb /^ def get_boolean(boolean)$/;" f
18
18
  get_path lib/optimus_prime/server.rb /^ def get_path$/;" f
19
19
  initialize lib/optimus_prime.rb /^ def initialize$/;" f class:OptimusPrime.Cannon
20
20
  initialize lib/optimus_prime.rb /^ def initialize(opts={})$/;" f class:OptimusPrime.Base
21
21
  last_request_for lib/optimus_prime.rb /^ def last_request_for(path_name)$/;" f class:OptimusPrime.Base
22
22
  optimus_prime_path lib/optimus_prime.rb /^ def optimus_prime_path$/;" f class:OptimusPrime.Cannon
23
+ parse_request lib/optimus_prime/server.rb /^ def parse_request(content_type)$/;" f
23
24
  prime lib/optimus_prime.rb /^ def prime(path_name, response="", options={})$/;" f class:OptimusPrime.Base
24
- record_request lib/optimus_prime/server.rb /^ def record_request(path)$/;" f
25
- requests lib/optimus_prime/server.rb /^ def requests$/;" f
26
- responses lib/optimus_prime/server.rb /^ def responses$/;" f
25
+ record_request lib/optimus_prime/server.rb /^ def record_request(path, body)$/;" f
26
+ requests lib/optimus_prime/server.rb /^ def requests$/;" f
27
+ responses lib/optimus_prime/server.rb /^ def responses$/;" f
27
28
  start_server lib/optimus_prime.rb /^ def start_server$/;" f class:OptimusPrime.Cannon
28
29
  wait_until_request lib/optimus_prime.rb /^ def wait_until_request(path_name, &block)$/;" f class:OptimusPrime.Base
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optimus_prime
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antonio Nalesso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-20 00:00:00.000000000 Z
11
+ date: 2014-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler