vigilem-x11-stat 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 366e88e65cb9c9cd73e20b6fdd0fd60b65604adb
4
+ data.tar.gz: 1a55f86b6f513e047e4a2b2e30ce27140b621f5e
5
+ SHA512:
6
+ metadata.gz: 00d94d9c3937c9fde98dcaa4856bae90add709698412faba30d24d5456268da58e14ca15cd3d7d8c2dcb091fa28c5db8340d730a9db242c220e1fff92fbaf757
7
+ data.tar.gz: 80c375a5a4d2e00f31aef1cd5d51de26a6a9d7a568058afb4cd9519943da642a460875de1e864a68fb748e152f88b6868beb787ddeea8a1e769a860e551f653e
@@ -0,0 +1,30 @@
1
+ require 'vigilem/core/stat'
2
+
3
+ module Vigilem
4
+ module X11
5
+ # Stat(us) of X11 and the handler
6
+ # gem associated with it
7
+ class Stat < Core::Stat
8
+
9
+ #
10
+ # @param [String] gem_name, defaults to 'vigilem-x11'
11
+ # @param [Proc] api_check, defaults to Proc.new { !!ENV['DISPLAY'] }
12
+ def initialize(gem_name='vigilem-x11', opts={}, &api_check)
13
+ system_name = 'x11'
14
+ if block_given?
15
+ super(system_name, gem_name, opts, &api_check)
16
+ else
17
+ super(system_name, gem_name, opts) { !!ENV['DISPLAY'] }
18
+ end
19
+ end
20
+
21
+ #
22
+ # @return [Stat]
23
+ def self.default
24
+ @default ||= new
25
+ end
26
+ end
27
+
28
+ end
29
+ end
30
+ Vigilem::X11::Stat.default
@@ -0,0 +1,44 @@
1
+ require 'vigilem/x11/stat'
2
+
3
+ describe Vigilem::X11::Stat do
4
+
5
+
6
+ it 'will have added the default after required' do
7
+ expect(Vigilem::Core::Stat.all).not_to be_empty
8
+ end
9
+
10
+ context 'default contructor,' do
11
+
12
+ describe '#gem_name' do
13
+ it 'defaults to vigilem-x11-stat' do
14
+ expect(subject.gem_name).to eql('vigilem-x11')
15
+ end
16
+ end
17
+
18
+ describe '#api_check?' do
19
+ it 'will return true the DISPLAY env var is available' do
20
+ ENV['DISPLAY'] ||= ':0.0'
21
+ expect(subject.api_check?).to be_truthy
22
+ end
23
+
24
+ it 'will return false the DISPLAY env var is nil' do
25
+ ENV['DISPLAY'] = nil
26
+ expect(subject.api_check?).to be_falsey
27
+ end
28
+ end
29
+
30
+ describe '#available?' do
31
+ it 'will return true as long as api_check? is true' do
32
+ allow(subject).to receive(:api_check?) { true }
33
+ expect(subject.available?).to be_truthy
34
+ end
35
+
36
+ it 'will return false when api_check? is false' do
37
+ allow(subject).to receive(:api_check?) { false }
38
+ expect(subject.available?).to be_falsey
39
+ end
40
+
41
+ end
42
+ end
43
+
44
+ end
metadata ADDED
@@ -0,0 +1,159 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vigilem-x11-stat
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - jtzero
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: vigilem-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: yard
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '3.1'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '3.1'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-given
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: turnip
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: guard-rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description: Stat(us) for whether or not X11 is available
126
+ email:
127
+ - jtzero511@gmail.com
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - lib/vigilem/x11/stat.rb
133
+ - spec/vigilem/x11/stat_spec.rb
134
+ homepage: http://rubygems.org/gems/vigilem-x11-stat
135
+ licenses:
136
+ - MIT
137
+ metadata: {}
138
+ post_install_message:
139
+ rdoc_options: []
140
+ require_paths:
141
+ - lib
142
+ required_ruby_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - '>='
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ required_rubygems_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - '>='
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ requirements: []
153
+ rubyforge_project:
154
+ rubygems_version: 2.4.6
155
+ signing_key:
156
+ specification_version: 4
157
+ summary: Stat(us) for whether or not X11 is available
158
+ test_files:
159
+ - spec/vigilem/x11/stat_spec.rb