perus 0.1.10 → 0.1.11

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a4c31e7e80547a4efe91311c2f149e943eb52ea4
4
- data.tar.gz: 676cbbb27a25a6a2778e540cb9c9641ee0c07601
3
+ metadata.gz: 599b70600ece749fcd4c4f45ac930f4b795cff09
4
+ data.tar.gz: ace224657f580232d911a0965426af0696fb5225
5
5
  SHA512:
6
- metadata.gz: d5926cc09e9a6267fc6b00d6a6449791c464431a55446624dd56a51ba8b35f5cf1e56e38202bf53d712fa31806dc9ba329e43f8193e7b71195f08f9713d167d8
7
- data.tar.gz: 3dfd536f991cf0f7b125901fea602361b667027a6a1e36ff76353798ae5e2e4abe3204480a933f7ce6fba7159c83ddfe3dd818b383c629ef579c0420e49f83e0
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; import -window root -resize #{options.resize} #{options.path}")
27
+ shell("export DISPLAY=:0; scrot --silent --thumb #{options.resize.to_i} #{options.path}")
28
28
  end
29
29
 
30
- @screenshot_file = File.new(options.path)
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(options.path)
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
@@ -1,3 +1,3 @@
1
1
  module Perus
2
- VERSION = "0.1.10"
2
+ VERSION = "0.1.11"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: perus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Will Cannings