perus 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/perus/pinger/metrics/screenshot.rb +13 -3
- data/lib/perus/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 599b70600ece749fcd4c4f45ac930f4b795cff09
|
4
|
+
data.tar.gz: ace224657f580232d911a0965426af0696fb5225
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22e9fb25b86654bdc57454173ba6b29cd444bd15c40785551a535feb54178ba394759e418ae39a4758e95e9c0d25b3dc2e5535d33e34996606c5c6ab2c2e6ef9
|
7
|
+
data.tar.gz: 88c08f91f40ac189bfc48932f60bf4e6489ec8a7147da0ae00eee8ff10f7d36fe2afe38baef5a9595aff25430b482813f70302e20c2cd6b4620167742ac27ba5
|
@@ -24,10 +24,19 @@ module Perus::Pinger
|
|
24
24
|
# backticks to avoid thowing an exception on success
|
25
25
|
`sips -z #{height.to_i * percent} #{width.to_i * percent} #{options.path}`
|
26
26
|
else
|
27
|
-
shell("export DISPLAY=:0;
|
27
|
+
shell("export DISPLAY=:0; scrot --silent --thumb #{options.resize.to_i} #{options.path}")
|
28
28
|
end
|
29
29
|
|
30
|
-
|
30
|
+
# scrot produced two files: path.ext and path-thumb.ext
|
31
|
+
@original_path = options.path
|
32
|
+
name_parts = File.basename(options.path).split('.')
|
33
|
+
name_parts[-2] += '-thumb'
|
34
|
+
@thumbnail_path = File.join(
|
35
|
+
File.dirname(options.path),
|
36
|
+
name_parts.join('.')
|
37
|
+
)
|
38
|
+
|
39
|
+
@screenshot_file = File.new(@thumbnail_path)
|
31
40
|
{screenshot: @screenshot_file}
|
32
41
|
end
|
33
42
|
|
@@ -36,7 +45,8 @@ module Perus::Pinger
|
|
36
45
|
@screenshot_file.close
|
37
46
|
end
|
38
47
|
|
39
|
-
File.delete(
|
48
|
+
File.delete(@original_path)
|
49
|
+
File.delete(@thumbnail_path)
|
40
50
|
end
|
41
51
|
end
|
42
52
|
end
|
data/lib/perus/version.rb
CHANGED