ambidexter 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/client.rb +2 -2
  3. data/lib/server.rb +6 -6
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6de51a36983d6afa9d7c39c7c6ee97d86466f942
4
- data.tar.gz: 210056cc401d75a69a206556cc818866d2228636
3
+ metadata.gz: 876bc3378a41d7821607b57beed8df253c2f022d
4
+ data.tar.gz: 1cbc4cad843fd7005e9d740b412a0517e617334e
5
5
  SHA512:
6
- metadata.gz: 584c2deaee12dcffcf964c6b53671820d01ab502c98b6000c5c766a37d2f3359f94d8ec8094a2d54dc7bab603ed1b932089985997b2c1191814eed3dd26db4cc
7
- data.tar.gz: 7a07ee3ff38c9d6ced33a7d0c21bec7cdc5566d2adb947fac24c7ddc6c8f5f354034246c76b76496f66aa1099e18047cea1d1700058fb8ab976f95e2a62a7d36
6
+ metadata.gz: 6578138dddbb9da7dbaf748519108efb515ded9c6dfa7cef93a20f4ccc2636d273d9c1571c889b0c88dca81b2ae6a102b95a7be46db57121d9a9ad92de2ebfe2
7
+ data.tar.gz: 51d1c893118fb84052893db44a7394fc38a7c253d0cf98b40be9d2aca7ff5cd302c9b5857f8cce977a044206377da3fe769f975185d24fcb3f3404bcd4036478
@@ -115,7 +115,7 @@ class Client < Application
115
115
  t = Time.now
116
116
  response = Curl.get(@uri + file_name)
117
117
  @req_times << Time.now - t
118
- file = File.open("./files#{file_name}", 'r')
118
+ file = File.open("#{__dir__}/../files#{file_name}", 'r')
119
119
  if response.body == file.read && response.status == '200 OK'
120
120
  print '.'.green
121
121
  else
@@ -127,7 +127,7 @@ class Client < Application
127
127
  response = Curl::Easy.new(@uri + '/file')
128
128
  response.multipart_form_post = true
129
129
  t = Time.now
130
- response.http_post(Curl::PostField.file('uploaded_image', "./files/#{file_name}"))
130
+ response.http_post(Curl::PostField.file('uploaded_image', "#{__dir__}/../files/#{file_name}"))
131
131
  @req_times << Time.now - t
132
132
  if response.status == '200 OK'
133
133
  print '.'.green
@@ -41,11 +41,11 @@ class Server < Application
41
41
  def do_POST(request, response)
42
42
  file_data = request.query["uploaded_image"]
43
43
  random_string = SecureRandom.hex(3)
44
- f = File.open("tmp/#{random_string}_image.jpeg", "wb")
44
+ f = File.open("#{__dir__}/../tmp/#{random_string}_image.jpeg", "wb")
45
45
  f.syswrite file_data
46
46
  f.close
47
- response.status = FileUtils.compare_file("tmp/#{random_string}_image.jpeg", 'files/image.jpeg') ? 200 : 500
48
- FileUtils.rm_rf("tmp/#{random_string}_image.jpeg")
47
+ response.status = FileUtils.compare_file("#{__dir__}/../tmp/#{random_string}_image.jpeg", "#{__dir__}/../files/image.jpeg") ? 200 : 500
48
+ FileUtils.rm_rf("#{__dir__}/../tmp/#{random_string}_image.jpeg")
49
49
  end
50
50
  end
51
51
 
@@ -53,8 +53,8 @@ class Server < Application
53
53
  print "Input Port of servrer: ".green
54
54
  @port = $stdin.gets.chomp
55
55
  @port = '5899' if blank? @port
56
- FileUtils.rm_rf('tmp')
57
- Dir.mkdir('tmp')
56
+ FileUtils.rm_rf("#{__dir__}/../tmp")
57
+ Dir.mkdir("#{__dir__}/../tmp")
58
58
  end
59
59
 
60
60
  def mount
@@ -63,7 +63,7 @@ class Server < Application
63
63
  @server.mount "/lorem", LoremPath
64
64
  @server.mount "/cookie", CookiePath
65
65
  @server.mount "/file", FilePath
66
- @server.mount('/file.txt', WEBrick::HTTPServlet::DefaultFileHandler, './files/file.txt')
66
+ @server.mount('/file.txt', WEBrick::HTTPServlet::DefaultFileHandler, "#{__dir__}/../files/file.txt")
67
67
  end
68
68
 
69
69
  def start
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ambidexter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Cherednichenko