optimus_prime 4.6.0 → 4.10.0

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: 6002a6846076a2ab40d1c20b4db9a1ac0e4c9f9c
4
- data.tar.gz: ec4a56f8542382076e5078e98ea1b996ec97bd5b
3
+ metadata.gz: 630350e797cbfb3fbc177f9f6c22e02c36bcdbeb
4
+ data.tar.gz: ea1ae51ed3e2ce3eaa6248621d29afa08994e4dc
5
5
  SHA512:
6
- metadata.gz: 987faf196d8675bddda88f8afa986d7559fac01ff4e949aeaae95ffeda84ff8d8124f1ae652e7b64eaa80cbacded161bae7fb429db6e1da0e39f5d2e3fc1f2e6
7
- data.tar.gz: 3d3816981345f13fdc7fea338760fffc0419a6b7968a942b0139e946d8d23595268f169659ce2f2218ae0c3da64bfb53aa61e03ea547e64c3298606eb9ecfd2c
6
+ metadata.gz: ba07bdd25a7f296ff17c3f93417216463b7bae6257ec36f29ac5d6a3640bd0c63b50920be11cf8c9c3c1a7894df71e9579582fcdab1799ffd5fc372ff70e09a4
7
+ data.tar.gz: c460046889e1c4c1e4c043fde980279df8daec8718e68bbd1cf5ab564d6e0bf01d6c9d4f80816499e357d0b16cefa11e7008d0aea1d287a3395dda29f2525ea8
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -24,6 +24,8 @@ to it and get the desired response.
24
24
  ## Default configuration
25
25
  * localhost:7003 -> TEST default endpoint
26
26
  * returns 200 status code for GET,POST
27
+ * Runs on a single thread
28
+ * If multi_threaded is true the default thread pool size is 16
27
29
  * sets content-type to text
28
30
  * wait_for is 3 seconds
29
31
  * Returns empty body when status_code is 404/500
@@ -40,6 +42,17 @@ op = OptimusPrime::Base.new
40
42
  op.prime("path_name", response, options)
41
43
  ```
42
44
 
45
+ multi threaded mode
46
+ ```ruby
47
+ #
48
+ # OptimusPrime::Cannon.fire!(7002, {multi_threaded: true, thread_pool: 50})
49
+ # thread_pool is by default set to 16
50
+ #
51
+ OptimusPrime::Cannon.fire!(7002, {multi_threaded: true})
52
+ op = OptimusPrime::Base.new
53
+ op.prime("path_name", response, options)
54
+ ```
55
+
43
56
  changing port number:
44
57
  ```ruby
45
58
  OptimusPrime::Cannon.fire!(2020)
data/certs/acnalesso.pem CHANGED
@@ -1,22 +1,22 @@
1
1
  -----BEGIN CERTIFICATE-----
2
2
  MIIDnjCCAoagAwIBAgIBATANBgkqhkiG9w0BAQUFADBTMRIwEAYDVQQDDAlhY25h
3
3
  bGVzc28xFTATBgoJkiaJk/IsZAEZFgV5YWhvbzESMBAGCgmSJomT8ixkARkWAmNv
4
- MRIwEAYKCZImiZPyLGQBGRYCdWswHhcNMTUwMTE4MTQyNTE1WhcNMTYwMTE4MTQy
5
- NTE1WjBTMRIwEAYDVQQDDAlhY25hbGVzc28xFTATBgoJkiaJk/IsZAEZFgV5YWhv
4
+ MRIwEAYKCZImiZPyLGQBGRYCdWswHhcNMTUwNjE4MTUyMTUxWhcNMTYwNjE3MTUy
5
+ MTUxWjBTMRIwEAYDVQQDDAlhY25hbGVzc28xFTATBgoJkiaJk/IsZAEZFgV5YWhv
6
6
  bzESMBAGCgmSJomT8ixkARkWAmNvMRIwEAYKCZImiZPyLGQBGRYCdWswggEiMA0G
7
- CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDDcPMePTdtqq16v8sROwnVGbN7dAUr
8
- LCUvqcL6Z5mgu5S15DqnZYs9edyEVsZV/P6kA5xhzQzX/l+HbrlQaQLFADiksQ8w
9
- xpwe2Dk0r9NU2hrg9fhxMRU7yTmf+ryPjgZP+5P/ChEZINHj2dt+hDNFpEepnBlC
10
- PHkc8VLg/OqSrXPFNtp49Y9bpUmearGOy8TwpoGTGoqDJNN3eGzCTMgWN+l6MJQj
11
- Gp8PPh4chTBSqMy9a6KsU4ERQmojGEuogURntRhutQBDVjCp396mkpC6EgsabFb2
12
- ZhMZ1wXbV4AdMPEujw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- xfaQSY/+k+cXJaUpE/aBsIgIzxuVJe98YWDtAgYpmo2jKsPleBAERd2lsSnfV4hj
21
- hAycz5zInHKNXc6zcb6ge0NC
16
+ AQBKdD5moSTDcMUtmMF++RVyCXGOynzdhuwF/w+h99aC0/AZxuOsJUEa0nP3tnon
17
+ ChKnpGwf0M6aJQuRvE+k21KRXO202r3RmXw8R9M4SBb8cZHaIDIqHZGvW6wP2iJ0
18
+ 5KfofwbYUNOpJppk7hhjl5+ASlCU0ved5gHJ1v0PzERurTZHKH631GB+gSL+RDmc
19
+ Q5jbIMvDAerheX+7UGm1Fwfs4nJqn1qlPZvrzGjcKCPFKnvWdbNN8a7P2U78TbvH
20
+ VENeDFfZVO7+QJ1CcexQChPNOenp/1hPs18XXfz7Bx/EOw69PTCudZVqj+xt3gYS
21
+ 9Y/PNWqAWckM1cLwdt/PnWHI
22
22
  -----END CERTIFICATE-----
data/lib/optimus_prime.rb CHANGED
@@ -8,14 +8,15 @@ module OptimusPrime
8
8
 
9
9
  $port = 7002
10
10
 
11
- def self.fire!(port)
11
+ def self.fire!(port, options={})
12
12
  $port = port
13
- self.new.start_server
13
+ self.new(options).start_server
14
14
  end
15
15
 
16
16
  attr_reader :op_port
17
17
 
18
- def initialize
18
+ def initialize(options={})
19
+ @options = options
19
20
  @op_port = $port
20
21
  end
21
22
 
@@ -23,7 +24,7 @@ module OptimusPrime
23
24
 
24
25
  return system("echo '\nOptimus is already priming :)\n\n'") if File.exist?("#{current_path}/tmp/pids/optimus_prime.pid")
25
26
 
26
- unless File.directory?("#{current_path}/tmp/pids")
27
+ unless File.directory?("#{current_path}/tmp/pids")
27
28
  system("echo 'Creating tmp/pid' && mkdir -p #{current_path}/tmp/pids")
28
29
  end
29
30
 
@@ -33,7 +34,11 @@ module OptimusPrime
33
34
  end
34
35
 
35
36
  system("echo '\nStarting Optimus Prime\n'")
36
- puts system("thin start -c #{optimus_prime_path} -p #{op_port} -P #{current_path}/tmp/pids/optimus_prime.pid -l #{current_path}/optimus_prime.log -D -d")
37
+ if @options[:multi_threaded]
38
+ puts system("thin start -c #{optimus_prime_path} -p #{op_port} -P #{current_path}/tmp/pids/optimus_prime.pid -l #{current_path}/optimus_prime.log --threaded -p 7011 --threadpool-size #{@options[:thread_pool] || 16} -d")
39
+ else
40
+ puts system("thin start -c #{optimus_prime_path} -p #{op_port} -P #{current_path}/tmp/pids/optimus_prime.pid -l #{current_path}/optimus_prime.log -D -d")
41
+ end
37
42
 
38
43
  while :starting_server
39
44
  sleep(2) and break if File.exist?("#{current_path}/tmp/pids/optimus_prime.pid")
@@ -1,3 +1,3 @@
1
1
  module OptimusPrime
2
- VERSION = "4.6.0"
2
+ VERSION = "4.10.0"
3
3
  end
data/optimus_prime.log CHANGED
@@ -17818,3 +17818,10 @@ JSON::ParserError - 757: unexpected token at 'status=YES':
17818
17818
  /Users/acnalesso/.rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `eval'
17819
17819
  /Users/acnalesso/.rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `<main>'
17820
17820
  Exiting!
17821
+ Writing PID to /Users/acnalesso/dev/shop/optimus_prime/tmp/pids/optimus_prime.pid
17822
+ Using rack adapter
17823
+ Thin web server (v1.6.3 codename Protein Powder)
17824
+ Debugging ON
17825
+ Maximum connections set to 1024
17826
+ Listening on 0.0.0.0:7003, CTRL+C to stop
17827
+ Exiting!
data/tags CHANGED
@@ -4,26 +4,8 @@
4
4
  !_TAG_PROGRAM_NAME Exuberant Ctags //
5
5
  !_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
6
6
  !_TAG_PROGRAM_VERSION 5.8 //
7
- Base lib/optimus_prime.rb /^ class Base$/;" c class:OptimusPrime
8
- Cannon lib/optimus_prime.rb /^ class Cannon$/;" c class:OptimusPrime
9
- OptimusPrime lib/optimus_prime.rb /^module OptimusPrime$/;" m
10
- OptimusPrime lib/optimus_prime/server.rb /^module OptimusPrime$/;" m
11
7
  OptimusPrime lib/optimus_prime/version.rb /^module OptimusPrime$/;" m
12
- Server lib/optimus_prime/server.rb /^ class Server < ::Sinatra::Base$/;" c class:OptimusPrime
13
- clear! lib/optimus_prime.rb /^ def clear!$/;" f class:OptimusPrime.Base
14
- count lib/optimus_prime.rb /^ def count(path_name)$/;" f class:OptimusPrime.Base
15
- current_path lib/optimus_prime.rb /^ def current_path; `pwd`.chomp; end$/;" f class:OptimusPrime.Cannon
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
18
- get_path lib/optimus_prime/server.rb /^ def get_path$/;" f
19
- initialize lib/optimus_prime.rb /^ def initialize$/;" f class:OptimusPrime.Cannon
20
- initialize lib/optimus_prime.rb /^ def initialize(opts={})$/;" f class:OptimusPrime.Base
21
- last_request_for lib/optimus_prime.rb /^ def last_request_for(path_name)$/;" f class:OptimusPrime.Base
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
24
- prime lib/optimus_prime.rb /^ def prime(path_name, response="", options={})$/;" f class:OptimusPrime.Base
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
28
- start_server lib/optimus_prime.rb /^ def start_server$/;" f class:OptimusPrime.Cannon
29
- wait_until_request lib/optimus_prime.rb /^ def wait_until_request(path_name, &block)$/;" f class:OptimusPrime.Base
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/
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.6.0
4
+ version: 4.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antonio Nalesso
@@ -12,26 +12,26 @@ cert_chain:
12
12
  -----BEGIN CERTIFICATE-----
13
13
  MIIDnjCCAoagAwIBAgIBATANBgkqhkiG9w0BAQUFADBTMRIwEAYDVQQDDAlhY25h
14
14
  bGVzc28xFTATBgoJkiaJk/IsZAEZFgV5YWhvbzESMBAGCgmSJomT8ixkARkWAmNv
15
- MRIwEAYKCZImiZPyLGQBGRYCdWswHhcNMTUwMTE4MTQyNTE1WhcNMTYwMTE4MTQy
16
- NTE1WjBTMRIwEAYDVQQDDAlhY25hbGVzc28xFTATBgoJkiaJk/IsZAEZFgV5YWhv
15
+ MRIwEAYKCZImiZPyLGQBGRYCdWswHhcNMTUwNjE4MTUyMTUxWhcNMTYwNjE3MTUy
16
+ MTUxWjBTMRIwEAYDVQQDDAlhY25hbGVzc28xFTATBgoJkiaJk/IsZAEZFgV5YWhv
17
17
  bzESMBAGCgmSJomT8ixkARkWAmNvMRIwEAYKCZImiZPyLGQBGRYCdWswggEiMA0G
18
- CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDDcPMePTdtqq16v8sROwnVGbN7dAUr
19
- LCUvqcL6Z5mgu5S15DqnZYs9edyEVsZV/P6kA5xhzQzX/l+HbrlQaQLFADiksQ8w
20
- xpwe2Dk0r9NU2hrg9fhxMRU7yTmf+ryPjgZP+5P/ChEZINHj2dt+hDNFpEepnBlC
21
- PHkc8VLg/OqSrXPFNtp49Y9bpUmearGOy8TwpoGTGoqDJNN3eGzCTMgWN+l6MJQj
22
- Gp8PPh4chTBSqMy9a6KsU4ERQmojGEuogURntRhutQBDVjCp396mkpC6EgsabFb2
23
- ZhMZ1wXbV4AdMPEujwMhazAzJepKJqcbdJZJCrtmMbCNCZVq/2/1QFnTAgMBAAGj
24
- fTB7MAkGA1UdEwQCM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- hAycz5zInHKNXc6zcb6ge0NC
27
+ AQBKdD5moSTDcMUtmMF++RVyCXGOynzdhuwF/w+h99aC0/AZxuOsJUEa0nP3tnon
28
+ ChKnpGwf0M6aJQuRvE+k21KRXO202r3RmXw8R9M4SBb8cZHaIDIqHZGvW6wP2iJ0
29
+ 5KfofwbYUNOpJppk7hhjl5+ASlCU0ved5gHJ1v0PzERurTZHKH631GB+gSL+RDmc
30
+ Q5jbIMvDAerheX+7UGm1Fwfs4nJqn1qlPZvrzGjcKCPFKnvWdbNN8a7P2U78TbvH
31
+ VENeDFfZVO7+QJ1CcexQChPNOenp/1hPs18XXfz7Bx/EOw69PTCudZVqj+xt3gYS
32
+ 9Y/PNWqAWckM1cLwdt/PnWHI
33
33
  -----END CERTIFICATE-----
34
- date: 2015-06-11 00:00:00.000000000 Z
34
+ date: 2015-06-18 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
metadata.gz.sig CHANGED
Binary file