fusuma-plugin-appmatcher 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fusuma/plugin/appmatcher/version.rb +1 -1
- data/lib/fusuma/plugin/appmatcher.rb +23 -4
- data/spec/fusuma/plugin/appmatcher_spec.rb +33 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e83ab4ed022583573d314044dd916c8e997d7c8ded16d6e5e92dd47977eb68f
|
4
|
+
data.tar.gz: b25d958c8220d36c21ff0dae24fbf8e083feef7ca4d5317401de5926480b64af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47204d64d8ea6999328d00a6e4eb4d36823e91aaff66a8f6afcaef5bc09c6e5a471da0c09b2cbc72093c8246eaa7446e12bb84d89f986ca937e7aa8667f13720
|
7
|
+
data.tar.gz: d738fcde80baaa9cd61869caeb26667d04c8a1951956d0f2b0e274696e4c5b8bf57881a00ff2157e4275284fac1c53e4383b834ce931d3d6f1c3fd0a4a626276
|
@@ -13,11 +13,30 @@ module Fusuma
|
|
13
13
|
|
14
14
|
# @return [Class]
|
15
15
|
def backend_klass
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
case xdg_session_type
|
17
|
+
when /x11/
|
18
|
+
return X11
|
19
|
+
when /wayland/
|
20
|
+
return Gnome if xdg_current_desktop =~ /GNOME/
|
20
21
|
end
|
22
|
+
MultiLogger.error(
|
23
|
+
<<~ERROR
|
24
|
+
appmatcher doesn't support
|
25
|
+
XDG_CURRENT_DESKTOP: '#{xdg_current_desktop}'
|
26
|
+
XDG_SESSION_TYPE: '#{xdg_session_type}'"
|
27
|
+
ERROR
|
28
|
+
)
|
29
|
+
exit 1
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def xdg_session_type
|
35
|
+
ENV.fetch('XDG_SESSION_TYPE', '')
|
36
|
+
end
|
37
|
+
|
38
|
+
def xdg_current_desktop
|
39
|
+
ENV.fetch('XDG_CURRENT_DESKTOP', '')
|
21
40
|
end
|
22
41
|
end
|
23
42
|
end
|
@@ -2,8 +2,38 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
module Fusuma
|
6
|
+
module Plugin
|
7
|
+
RSpec.describe Appmatcher do
|
8
|
+
it 'has a version number' do
|
9
|
+
expect(Appmatcher::VERSION).not_to be nil
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '#backend_klass' do
|
13
|
+
context 'when XDG_CURRENT_DESKTOP is UNKNOWN' do
|
14
|
+
before { allow(Appmatcher).to receive(:xdg_current_desktop).and_return('UNKNOWN') }
|
15
|
+
it { expect { Appmatcher.backend_klass }.to raise_error }
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'when XDG_SESSION_TYPE is x11' do
|
19
|
+
before { allow(Appmatcher).to receive(:xdg_session_type).and_return('x11') }
|
20
|
+
it { expect(Appmatcher.backend_klass).to eq Appmatcher::X11 }
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'when XDG_SESSION_TYPE is wayland' do
|
24
|
+
before { allow(Appmatcher).to receive(:xdg_session_type).and_return('wayland') }
|
25
|
+
|
26
|
+
context 'when XDG_CURRENT_DESKTOP is ubuntu:GNOME' do
|
27
|
+
before { allow(Appmatcher).to receive(:xdg_current_desktop).and_return('ubuntu:GNOME') }
|
28
|
+
it { expect(Appmatcher.backend_klass).to eq Appmatcher::Gnome }
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'when XDG_CURRENT_DESKTOP is UNKNOWN' do
|
32
|
+
before { allow(Appmatcher).to receive(:xdg_current_desktop).and_return('UNKNOWN') }
|
33
|
+
it { expect { Appmatcher.backend_klass }.to raise_error }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
8
38
|
end
|
9
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fusuma-plugin-appmatcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iberianpig
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rexml
|