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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 630350e797cbfb3fbc177f9f6c22e02c36bcdbeb
4
- data.tar.gz: ea1ae51ed3e2ce3eaa6248621d29afa08994e4dc
3
+ metadata.gz: 102ae689ec68dd6de7e144886d7fb28b51d3bace
4
+ data.tar.gz: 1e6ea8e6248a90178dc348f8e3cae787a988b018
5
5
  SHA512:
6
- metadata.gz: ba07bdd25a7f296ff17c3f93417216463b7bae6257ec36f29ac5d6a3640bd0c63b50920be11cf8c9c3c1a7894df71e9579582fcdab1799ffd5fc372ff70e09a4
7
- data.tar.gz: c460046889e1c4c1e4c043fde980279df8daec8718e68bbd1cf5ab564d6e0bf01d6c9d4f80816499e357d0b16cefa11e7008d0aea1d287a3395dda29f2525ea8
6
+ metadata.gz: 5721cd0d7cdb4bf19fb0129f8abba4149c8352a3d128a8d1aee56ae743693ce8fadace7c6ca653f7fbb870a493ef87d4f3aeb2c4bc2fe1413187e726836296b1
7
+ data.tar.gz: 3ed60d2aacbc87ac33ec0709710433c9aca7e9d5e63ab4f1fa44126aa63e947c5f43834d9d3fc0c6816f26a43280585771a7815da399b95626386a8f3bf7be0b
checksums.yaml.gz.sig CHANGED
Binary file
data/Gemfile CHANGED
@@ -5,4 +5,4 @@ gemspec
5
5
 
6
6
  gem "sinatra"
7
7
  gem "pry"
8
- gem "puma"
8
+ gem "thin"
data/config.ru CHANGED
@@ -1,4 +1,7 @@
1
1
  $LOAD_PATH.unshift __dir__
2
2
  require "lib/optimus_prime"
3
3
 
4
+ puts "Running config.ru now"
5
+ use OptimusPrime::Wait
6
+ use OptimusPrime::NormaliseUniqueURL
4
7
  run OptimusPrime::Server
@@ -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: 200, requested_with: false, sleep: false, persisted: false }
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>
@@ -1,3 +1,3 @@
1
1
  module OptimusPrime
2
- VERSION = "4.10.0"
2
+ VERSION = "4.10.1"
3
3
  end
@@ -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</h3>
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 ]
@@ -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", "~> 1.6"
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
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+
3
+ echo "Starting optimus prime"
4
+ echo $ENV
5
+ echo $VCAP_APP_PORT
6
+ ENV=$ENV thin start -R config.ru -p $VCAP_APP_PORT --threaded --threadpool-size 16 -e $ENV
7
+ echo "OP has been started"
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.0
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-06-18 00:00:00.000000000 Z
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: '1.6'
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: '1.6'
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