blackstack_commons 1.1.29 → 1.1.35
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/functions.rb +15 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8162064b7ca165d7dfc2e916e105350788ff8ee
|
4
|
+
data.tar.gz: be908cce3827d4442170fddd947b09bfbb2ca805
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ebe389a3dd4b8acf045956440ee5d5b896a37c1dba36623edef362c8ebc5bbc534c8ca40a7640cbedb97ecfda3abebebb580240f7e64c3c18be1b76960b2428
|
7
|
+
data.tar.gz: a729018e8cd9325575c855ab2e86325ac1d2b71349c962cfb05170ccd75a3ac32306ecfa60234ddbd2b0866731bee285395b386d6c6c1e09308e35ba5fa74da5
|
data/lib/functions.rb
CHANGED
@@ -11,12 +11,15 @@ module BlackStack
|
|
11
11
|
# script is running inside an OCRA temp folder, since the local folder
|
12
12
|
# of the running command is not the filder where the exe file is hosted.
|
13
13
|
#
|
14
|
-
# More information:
|
14
|
+
# More information:
|
15
|
+
# * https://stackoverflow.com/questions/1937743/how-to-get-the-current-working-directorys-absolute-path-from-irb
|
16
|
+
# * https://stackoverflow.com/questions/8577223/ruby-get-the-file-being-executed
|
17
|
+
# * https://stackoverflow.com/questions/7399882/ruby-getting-path-from-pathfilename/7400057
|
15
18
|
#
|
16
|
-
def self.require_in_working_path(filename, show_path_info=false)
|
19
|
+
def self.require_in_working_path(filename, path, show_path_info=false)
|
17
20
|
puts '' if show_path_info
|
18
|
-
|
19
|
-
path = Dir.pwd
|
21
|
+
path = File.expand_path File.dirname(path)
|
22
|
+
#path = Dir.pwd
|
20
23
|
puts "require_in_working_path.path:#{path}:." if show_path_info
|
21
24
|
file = "#{path}/#{filename}"
|
22
25
|
puts "require_in_working_path.file:#{file}:." if show_path_info
|
@@ -532,6 +535,7 @@ module BlackStack
|
|
532
535
|
# max_channels: this method use lockfiles to prevent an excesive number of API calls from each datacenter. There is not allowed more simultaneous calls than max_channels.
|
533
536
|
# TODO: setup max_simultaneus_calls in the configurtion file.
|
534
537
|
def self.call_post(url, params = {}, ssl_verify_mode=BlackStack::Netting::DEFAULT_SSL_VERIFY_MODE, use_lockfile=true)
|
538
|
+
=begin
|
535
539
|
# build the lockfile name
|
536
540
|
x = 0
|
537
541
|
if BlackStack::Netting.max_api_call_channels.to_i > 0
|
@@ -540,9 +544,10 @@ module BlackStack
|
|
540
544
|
# lock the file
|
541
545
|
BlackStack::Netting.lockfiles[x].flock(File::LOCK_EX) if use_lockfile
|
542
546
|
end
|
543
|
-
|
547
|
+
=end
|
544
548
|
begin
|
545
|
-
|
549
|
+
puts
|
550
|
+
puts "call_post:#{url}:."
|
546
551
|
# do the call
|
547
552
|
uri = URI(url)
|
548
553
|
ret = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https', :verify_mode => ssl_verify_mode) do |http|
|
@@ -553,23 +558,23 @@ module BlackStack
|
|
553
558
|
res = http.request req
|
554
559
|
case res
|
555
560
|
when Net::HTTPSuccess then res
|
556
|
-
when Net::HTTPRedirection then BlackStack::Netting::call_post(URI(res['location']), params, BlackStack::Netting::DEFAULT_SSL_VERIFY_MODE, false)
|
561
|
+
when Net::HTTPRedirection then BlackStack::Netting::call_post(URI(res['location']), params, BlackStack::Netting::DEFAULT_SSL_VERIFY_MODE, false) if use_lockfile
|
557
562
|
else
|
558
563
|
res.error!
|
559
564
|
end
|
560
565
|
end
|
561
566
|
|
562
567
|
# release the file
|
563
|
-
BlackStack::Netting.lockfiles[x].flock(File::LOCK_UN) if use_lockfile && BlackStack::Netting.max_api_call_channels.to_i > 0
|
568
|
+
# BlackStack::Netting.lockfiles[x].flock(File::LOCK_UN) if use_lockfile && BlackStack::Netting.max_api_call_channels.to_i > 0
|
564
569
|
rescue => e
|
565
570
|
# release the file
|
566
|
-
BlackStack::Netting.lockfiles[x].flock(File::LOCK_UN) if use_lockfile && BlackStack::Netting.max_api_call_channels.to_i > 0
|
571
|
+
# BlackStack::Netting.lockfiles[x].flock(File::LOCK_UN) if use_lockfile && BlackStack::Netting.max_api_call_channels.to_i > 0
|
567
572
|
|
568
573
|
# elevo la excepcion
|
569
574
|
raise e
|
570
575
|
ensure
|
571
576
|
# release the file
|
572
|
-
BlackStack::Netting.lockfiles[x].flock(File::LOCK_UN) if use_lockfile && BlackStack::Netting.max_api_call_channels.to_i > 0
|
577
|
+
# BlackStack::Netting.lockfiles[x].flock(File::LOCK_UN) if use_lockfile && BlackStack::Netting.max_api_call_channels.to_i > 0
|
573
578
|
end
|
574
579
|
|
575
580
|
# return
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blackstack_commons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.35
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leandro Daniel Sardi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: content_spinning
|