optimus_prime 4.10.0 → 4.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/Gemfile +1 -1
- data/config.ru +3 -0
- data/lib/optimus_prime/server.rb +3 -1
- data/lib/optimus_prime/version.rb +1 -1
- data/lib/optimus_prime/views/add.erb +5 -1
- data/lib/optimus_prime.rb +49 -0
- data/manifest.yml +15 -0
- data/npm-debug.log +19 -0
- data/optimus_prime.gemspec +1 -1
- data/start.sh +7 -0
- data/tags +0 -4
- data.tar.gz.sig +0 -0
- metadata +9 -6
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 102ae689ec68dd6de7e144886d7fb28b51d3bace
|
4
|
+
data.tar.gz: 1e6ea8e6248a90178dc348f8e3cae787a988b018
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5721cd0d7cdb4bf19fb0129f8abba4149c8352a3d128a8d1aee56ae743693ce8fadace7c6ca653f7fbb870a493ef87d4f3aeb2c4bc2fe1413187e726836296b1
|
7
|
+
data.tar.gz: 3ed60d2aacbc87ac33ec0709710433c9aca7e9d5e63ab4f1fa44126aa63e947c5f43834d9d3fc0c6816f26a43280585771a7815da399b95626386a8f3bf7be0b
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/Gemfile
CHANGED
data/config.ru
CHANGED
data/lib/optimus_prime/server.rb
CHANGED
@@ -107,6 +107,7 @@ module OptimusPrime
|
|
107
107
|
end
|
108
108
|
|
109
109
|
get "/get/*" do
|
110
|
+
|
110
111
|
path = get_path
|
111
112
|
response = responses[path]
|
112
113
|
|
@@ -152,8 +153,9 @@ module OptimusPrime
|
|
152
153
|
post "/add" do
|
153
154
|
body = params[:body]
|
154
155
|
path = params[:path]
|
156
|
+
status = params[:status] || 200
|
155
157
|
content_type = params[:content_type]
|
156
|
-
responses[path] = { content_type: (content_type || :html), body: body, status_code:
|
158
|
+
responses[path] = { content_type: (content_type || :html), body: body, status_code: status, requested_with: false, sleep: false, persisted: false }
|
157
159
|
requests[path] = { count: 0, last_request: nil }
|
158
160
|
<<-HTML
|
159
161
|
<h1>Done!</h1>
|
@@ -41,7 +41,7 @@
|
|
41
41
|
<form method=post action="/add">
|
42
42
|
<h1>Mega Mock</h1>
|
43
43
|
<h2>Feat: The master plan.</h2>
|
44
|
-
<h3>The only primer your will ever need
|
44
|
+
<h3>The only primer your will ever need.</h3>
|
45
45
|
<label>
|
46
46
|
Path:<br><input type=text name=path>
|
47
47
|
</label>
|
@@ -53,6 +53,10 @@
|
|
53
53
|
<option value="text/html">text/html</option>
|
54
54
|
</select>
|
55
55
|
<br><br>
|
56
|
+
<label>
|
57
|
+
Response code:<br><input type=text name=status value=200>
|
58
|
+
</label>
|
59
|
+
<br><br>
|
56
60
|
<label>
|
57
61
|
Body:<br><textarea name=body></textarea>
|
58
62
|
</label>
|
data/lib/optimus_prime.rb
CHANGED
@@ -3,6 +3,55 @@ require "optimus_prime/server"
|
|
3
3
|
|
4
4
|
module OptimusPrime
|
5
5
|
|
6
|
+
class NormaliseUniqueURL
|
7
|
+
def initialize(app)
|
8
|
+
@app = app
|
9
|
+
end
|
10
|
+
|
11
|
+
def call(env)
|
12
|
+
|
13
|
+
if match = env["QUERY_STRING"].match(/_OpID=(\d){13}-(\d){5}(.*)?/)
|
14
|
+
|
15
|
+
if path_to_be_prepended = match[match.size - 1]
|
16
|
+
timestamps = env["QUERY_STRING"].match(/[_OpID=](\d){13}-(\d){5}/)
|
17
|
+
|
18
|
+
path_to_be_prepended.insert(0, '/') unless path_to_be_prepended.start_with?('/')
|
19
|
+
|
20
|
+
env["PATH_INFO"] = env["PATH_INFO"] << path_to_be_prepended
|
21
|
+
env["REQUEST_PATH"] = env["PATH_INFO"].clone
|
22
|
+
env["QUERY_STRING"] = "_OpID#{timestamps}"
|
23
|
+
env["REQUEST_URI"] = "#{env["PATH_INFO"]}?#{env["QUERY_STRING"]}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
require 'pry'
|
29
|
+
binding.pry
|
30
|
+
|
31
|
+
|
32
|
+
puts env["PATH_INFO"]
|
33
|
+
|
34
|
+
@app.call(env)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
class Wait
|
40
|
+
def initialize(app)
|
41
|
+
@app = app
|
42
|
+
end
|
43
|
+
|
44
|
+
def call(env)
|
45
|
+
|
46
|
+
if match = env["PATH_INFO"].match(/\/wait\/(\d+)/)
|
47
|
+
ttw = match.string.split("/").last.to_i
|
48
|
+
sleep(ttw)
|
49
|
+
return [200, {}, ["Inactive for: #{ttw}"]]
|
50
|
+
end
|
51
|
+
|
52
|
+
@app.call(env)
|
53
|
+
end
|
54
|
+
end
|
6
55
|
|
7
56
|
class Cannon
|
8
57
|
|
data/manifest.yml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
applications:
|
3
|
+
".":
|
4
|
+
name: optimus-prime
|
5
|
+
framework:
|
6
|
+
name: standalone
|
7
|
+
info:
|
8
|
+
mem: 64M
|
9
|
+
description: Standalone Application
|
10
|
+
exec:
|
11
|
+
runtime: ruby21
|
12
|
+
command: bash start.sh
|
13
|
+
url: optimus-prime.nimbus-03.cg.bskyb.com
|
14
|
+
mem: '512'
|
15
|
+
instances: 1
|
data/npm-debug.log
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
0 info it worked if it ends with ok
|
2
|
+
1 verbose cli [ 'node', '/usr/local/bin/npm', 'run', 'test-single-run' ]
|
3
|
+
2 info using npm@2.10.1
|
4
|
+
3 info using node@v0.12.4
|
5
|
+
4 verbose node symlink /usr/local/bin/node
|
6
|
+
5 verbose stack Error: ENOENT, open '/Users/acnalesso/dev/shop/optimus_prime/package.json'
|
7
|
+
5 verbose stack at Error (native)
|
8
|
+
6 verbose cwd /Users/acnalesso/dev/shop/optimus_prime
|
9
|
+
7 error Darwin 13.4.0
|
10
|
+
8 error argv "node" "/usr/local/bin/npm" "run" "test-single-run"
|
11
|
+
9 error node v0.12.4
|
12
|
+
10 error npm v2.10.1
|
13
|
+
11 error path /Users/acnalesso/dev/shop/optimus_prime/package.json
|
14
|
+
12 error code ENOENT
|
15
|
+
13 error errno -2
|
16
|
+
14 error enoent ENOENT, open '/Users/acnalesso/dev/shop/optimus_prime/package.json'
|
17
|
+
14 error enoent This is most likely not a problem with npm itself
|
18
|
+
14 error enoent and is related to npm not being able to find a file.
|
19
|
+
15 verbose exit [ -2, true ]
|
data/optimus_prime.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_development_dependency "bundler"
|
21
|
+
spec.add_development_dependency "bundler"
|
22
22
|
spec.add_development_dependency "rake"
|
23
23
|
spec.add_development_dependency "rspec"
|
24
24
|
|
data/start.sh
ADDED
data/tags
CHANGED
@@ -5,7 +5,3 @@
|
|
5
5
|
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
|
6
6
|
!_TAG_PROGRAM_VERSION 5.8 //
|
7
7
|
OptimusPrime lib/optimus_prime/version.rb /^module OptimusPrime$/;" m
|
8
|
-
get lib/optimus_prime.rb /^ ::Faraday.get("http:\/\/localhost:#{op_port}/
|
9
|
-
prime lib/optimus_prime.rb /^ def prime(path_name, response="", options={})$/
|
10
|
-
sleep lib/optimus_prime.rb /^ sleep(0.1)$/
|
11
|
-
system lib/optimus_prime.rb /^ return system("echo '\\nOptimus is already p/
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: optimus_prime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.10.
|
4
|
+
version: 4.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Antonio Nalesso
|
@@ -31,22 +31,22 @@ cert_chain:
|
|
31
31
|
VENeDFfZVO7+QJ1CcexQChPNOenp/1hPs18XXfz7Bx/EOw69PTCudZVqj+xt3gYS
|
32
32
|
9Y/PNWqAWckM1cLwdt/PnWHI
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2015-
|
34
|
+
date: 2015-08-07 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
38
38
|
requirement: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- - "
|
40
|
+
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '
|
42
|
+
version: '0'
|
43
43
|
type: :development
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - "
|
47
|
+
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '
|
49
|
+
version: '0'
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
51
|
name: rake
|
52
52
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,10 +137,13 @@ files:
|
|
137
137
|
- lib/optimus_prime/server.rb
|
138
138
|
- lib/optimus_prime/version.rb
|
139
139
|
- lib/optimus_prime/views/add.erb
|
140
|
+
- manifest.yml
|
141
|
+
- npm-debug.log
|
140
142
|
- optimus_prime.gemspec
|
141
143
|
- optimus_prime.log
|
142
144
|
- spec/lib/optimus_prime_spec.rb
|
143
145
|
- spec/spec_helper.rb
|
146
|
+
- start.sh
|
144
147
|
- tags
|
145
148
|
homepage: ''
|
146
149
|
licenses:
|
metadata.gz.sig
CHANGED
Binary file
|