jimmy_jukebox 0.6.7 → 0.6.8

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.
@@ -8,28 +8,30 @@ module JimmyJukebox
8
8
  class NoNewSongException < Exception; end
9
9
  class NoCurrentSongException < Exception; end
10
10
  class NoPreviousSongException < Exception; end
11
- class NotRunningXWindowsException < Exception; end
12
11
 
13
12
  attr_accessor :current_song, :continuous_play, :songs_played, :initial_dpms_state
14
13
  attr_writer :user_config, :next_song, :playing
15
14
 
16
15
  def dpms_state
17
- raise NotRunningXWindowsException unless JimmyJukebox::RUNNING_X_WINDOWS
18
- xsettings = `xset q`
19
- xsettings.match(/DPMS is (.*)/)[1]
16
+ if JimmyJukebox::RUNNING_X_WINDOWS
17
+ xsettings = `xset q`
18
+ xsettings.match(/DPMS is (.*)/)[1]
19
+ end
20
20
  end
21
21
 
22
22
  def restore_dpms_state
23
- raise NotRunningXWindowsException unless JimmyJukebox::RUNNING_X_WINDOWS
24
- puts "*** Restoring DPMS state to 'Enabled' ***"
25
- `xset +dpms` if initial_dpms_state == 'Enabled'
23
+ if JimmyJukebox::RUNNING_X_WINDOWS
24
+ puts "*** Restoring DPMS state to 'Enabled' ***"
25
+ `xset +dpms` if initial_dpms_state == 'Enabled'
26
+ end
26
27
  end
27
28
 
28
29
  def disable_monitor_powerdown
29
- raise NotRunningXWindowsException unless JimmyJukebox::RUNNING_X_WINDOWS
30
- self.initial_dpms_state = dpms_state
31
- puts "*** Disabling DPMS. Will re-enable DPMS on shutdown ***" if initial_dpms_state == 'Enabled'
32
- `xset -dpms` #`; xset s off`
30
+ if JimmyJukebox::RUNNING_X_WINDOWS
31
+ self.initial_dpms_state = dpms_state
32
+ puts "*** Disabling DPMS. Will re-enable DPMS on shutdown ***" if initial_dpms_state == 'Enabled'
33
+ `xset -dpms` #`; xset s off`
34
+ end
33
35
  end
34
36
 
35
37
  def initialize(new_user_config = UserConfig.new, continuous_play = true)
@@ -20,9 +20,11 @@ module JimmyJukebox
20
20
  end
21
21
  end
22
22
 
23
+ HOST_OS = RbConfig::CONFIG['host_os']
24
+ RUNNING_OSX = HOST_OS =~ /darwin/i || HOST_OS =~ /mac os/i
23
25
  RUNNING_JRUBY = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby') || RUBY_PLATFORM == 'java'
24
- RUNNING_LINUX = RbConfig::CONFIG['host_os'] =~ /linux/i
25
- RUNNING_X_WINDOWS = running_x_windows
26
+ RUNNING_LINUX = HOST_OS =~ /linux/i
27
+ RUNNING_X_WINDOWS = !RUNNING_OSX && running_x_windows
26
28
 
27
29
  class UserConfig
28
30
 
@@ -1,4 +1,4 @@
1
1
  module JimmyJukebox
2
- VERSION = '0.6.7'
3
- DATE = '2013-10-20'
2
+ VERSION = '0.6.8'
3
+ DATE = '2013-10-21'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jimmy_jukebox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.7
4
+ version: 0.6.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-20 00:00:00.000000000 Z
12
+ date: 2013-10-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec