volay 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c3642161520ea465b1c2593a913593fd00ce9037
4
- data.tar.gz: 02c6cb3128ff4ac554dd9123d52fc5ee9a1e75e5
2
+ SHA256:
3
+ metadata.gz: '0786e6be35e259e88f2c72bbd57b2b1014ec2e8e0928000c9162a2ca172cb1c0'
4
+ data.tar.gz: a4131cbfad89dfc19a8614c9c5a94313bd544a4c06bbdd89e443b0cd99935317
5
5
  SHA512:
6
- metadata.gz: 03a28e5a4a6b8404ba849b0303f1ca5825e5baae672d6f7295f93b80c8e4e97faad8dd83b9ece29350768e8d0e9b75cb98c7b791fbecb138c6aeb756dd71630c
7
- data.tar.gz: 26a6ba15b4a327bf539c27c53ae5f7d256583645f7fba8935d37afa808a79801818945805baea2be1ebc782685e29e84b26d4eeb24f98e59d8d2c27a414dae55
6
+ metadata.gz: 5e5220cba4ce083166566bcddaf825ddc77e12e78774b2fafc30f9bd6b93aa6778c9accaf18f032122dee0d36976c5a867d82e1ec8107b68530aafaf67da8272
7
+ data.tar.gz: e6c2f0e812fac1c0589ccc53b83229647e7edf36fa1dd0872a055f7a1dcd43cc41af6bad8f9b883b842eaffb6d5e313ba010ed3bcdeb83d0814a18dbf82e10ba
@@ -8,3 +8,13 @@ Metrics/MethodLength:
8
8
  Enabled: false
9
9
  Metrics/PerceivedComplexity:
10
10
  Enabled: false
11
+ Gemspec/RequiredRubyVersion:
12
+ Enabled: false
13
+
14
+ Metrics/BlockLength:
15
+ Exclude:
16
+ - spec/**/*.rb
17
+
18
+ Style/FrozenStringLiteralComment:
19
+ Exclude:
20
+ - lib/volay/cli.rb
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
- # -*- coding: utf-8 -*-
1
+ # frozen_string_literal: true
2
+
2
3
  source 'https://rubygems.org'
3
4
 
4
5
  gemspec
data/README.md CHANGED
@@ -1,12 +1,12 @@
1
- #Volay, the Volume System Tray
1
+ # Volay, the Volume System Tray
2
2
 
3
3
  [![Build Status](https://travis-ci.org/PierreRambaud/volay.svg)](https://travis-ci.org/PierreRambaud/volay)
4
4
 
5
- ##Requirements
5
+ ## Requirements
6
6
 
7
7
  * Ruby 2.0 or newer
8
8
 
9
- ##Installation
9
+ ## Installation
10
10
 
11
11
  From Rubygems:
12
12
 
data/Rakefile CHANGED
@@ -1,4 +1,6 @@
1
1
 
2
+ # frozen_string_literal: true
3
+
2
4
  require 'bundler/gem_tasks'
3
5
  GEMSPEC = Gem::Specification.load('gemirro.gemspec')
4
6
 
@@ -6,4 +8,4 @@ Dir['./task/*.rake'].each do |task|
6
8
  import(task)
7
9
  end
8
10
 
9
- task default: [:rubocop, :spec]
11
+ task default: %i[rubocop spec]
data/bin/volay CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  require File.expand_path('../../lib/volay', __FILE__)
3
5
 
4
6
  # Module volay
@@ -10,7 +12,7 @@ module Volay
10
12
  cli.parse_options
11
13
  Volay::Config.set(:log_level, cli.config[:log_level])
12
14
  Volay::Config.init_config
13
- if [:up, :down, :mute].any? { |k| cli.config.key?(k) }
15
+ if %i[up down mute].any? { |k| cli.config.key?(k) }
14
16
  sound(cli.config)
15
17
  else
16
18
  app
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'gtk3'
2
4
  require 'logger'
3
5
  require 'mixlib/cli'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Volay module
2
4
  module Volay
3
5
  # App class
@@ -19,7 +19,7 @@ module Volay
19
19
  short: '-l LEVEL',
20
20
  long: '--log_level LEVEL',
21
21
  description: 'Set the log level (debug, info, warn, error, fatal)',
22
- in: %w(debug info warn error fatal),
22
+ in: %I[debug info warn error fatal],
23
23
  default: :info,
24
24
  proc: proc { |l| l.to_sym })
25
25
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Volay module
2
4
  module Volay
3
5
  # Config class
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Volay Module
2
4
  module Volay
3
5
  # Mixer not found
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Volay module
2
4
  module Volay
3
5
  # Mixer module
@@ -32,7 +34,7 @@ module Volay
32
34
  { value: current_value,
33
35
  max_value: max_value,
34
36
  percent: current_percent,
35
- muted: current_state == 'on' ? false : true }
37
+ muted: current_state != 'on' }
36
38
  end
37
39
 
38
40
  private
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Volay module
2
4
  module Volay
3
5
  # Mixer module
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Volay module
2
4
  module Volay
3
5
  # Utils class
@@ -26,18 +28,14 @@ module Volay
26
28
  end
27
29
 
28
30
  def status_icon
29
- unless @app.mixer.muted?
30
- case @app.mixer.percent
31
- when 66..100
32
- icon = 'volume-high'
33
- when 33..65
34
- icon = 'volume-medium'
35
- when 0..32
36
- icon = 'volume-low'
37
- end
31
+ return 'volume-muted' if @app.mixer.muted?
32
+ if (66..100).cover?(@app.mixer.percent)
33
+ 'volume-high'
34
+ elsif (33..65).cover?(@app.mixer.percent)
35
+ 'volume-medium'
36
+ else
37
+ 'volume-low'
38
38
  end
39
-
40
- icon.nil? ? 'volume-muted' : icon
41
39
  end
42
40
  end
43
41
  end
@@ -1,4 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Volay module
2
4
  module Volay
3
- VERSION = '1.1.0'.freeze
5
+ VERSION = '1.2.0'
4
6
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'gtk3'
2
4
  require 'mixlib-cli'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Volay module
2
4
  module Volay
3
5
  # Widgets components
@@ -13,7 +15,7 @@ module Volay
13
15
  @app = app
14
16
 
15
17
  methods.each do |name|
16
- next unless name =~ /^on_/
18
+ next unless name.match?(/^on_/)
17
19
  @app.signals_list[name.to_s] = method(name)
18
20
  end
19
21
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Volay module
2
4
  module Volay
3
5
  # Widgets components
@@ -85,18 +87,16 @@ module Volay
85
87
  posx = rectangle.x + rectangle.width
86
88
  posy = rectangle.y
87
89
  end
90
+ elsif rectangle.y + rectangle.height + window_height <=
91
+ monitor.y + monitor.height
92
+ posy = rectangle.y + rectangle.height
88
93
  else
89
- total = rectangle.y + rectangle.height + window_height
90
- if total <= monitor.y + monitor.height
91
- posy = rectangle.y + rectangle.height
92
- else
93
- posy = rectangle.y - window_height
94
- posx = if rectangle.x + window_width <= monitor.x + monitor.width
95
- rectangle.x
96
- else
97
- monitor.x + monitor.width - window_width
98
- end
99
- end
94
+ posy = rectangle.y - window_height
95
+ posx = if rectangle.x + window_width <= monitor.x + monitor.width
96
+ rectangle.x
97
+ else
98
+ monitor.x + monitor.width - window_width
99
+ end
100
100
  end
101
101
 
102
102
  [posx, posy]
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Volay module
2
4
  module Volay
3
5
  # Widgets components
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  $LOAD_PATH << File.expand_path('../lib', __FILE__)
2
4
 
3
5
  require 'simplecov'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'fakefs/spec_helpers'
3
5
  require 'gtk3'
@@ -14,9 +16,6 @@ describe 'Volay::App' do
14
16
  include FakeFS::SpecHelpers
15
17
 
16
18
  context '#events' do
17
- def app_events
18
- end
19
-
20
19
  it 'should return alsa' do
21
20
  allow_any_instance_of(Volay::App).to receive(:initialize_mixer)
22
21
  allow_any_instance_of(Volay::App).to receive(:initialize_ui)
@@ -35,18 +34,18 @@ describe 'Volay::App' do
35
34
  allow_any_instance_of(Volay::App).to receive(:initialize_mixer)
36
35
  allow_any_instance_of(Volay::App).to receive(:initialize_events)
37
36
 
38
- xml = <<-EOF
39
- <?xml version="1.0" encoding="UTF-8"?>
40
- <!-- Generated with glade 3.18.3 -->
41
- <interface>
42
- <requires lib="gtk+" version="3.2"/>
43
- <object class="GtkIconFactory" id="icon_factory">
44
- <sources>
45
- <source stock-id="volume-muted" filename="/glade/icons/volume-muted.png"/>
46
- </sources>
47
- </object>
48
- </interface>
49
- EOF
37
+ xml = <<-XML
38
+ <?xml version="1.0" encoding="UTF-8"?>
39
+ <!-- Generated with glade 3.18.3 -->
40
+ <interface>
41
+ <requires lib="gtk+" version="3.2"/>
42
+ <object class="GtkIconFactory" id="icon_factory">
43
+ <sources>
44
+ <source stock-id="volume-muted" filename="/glade/icons/volume-muted.png"/>
45
+ </sources>
46
+ </object>
47
+ </interface>
48
+ XML
50
49
 
51
50
  File.write('something', xml)
52
51
  app = Volay::App.new('something')
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'logger'
3
5
  require 'volay/config'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'mixlib/shellout'
3
5
  require 'volay/mixer/default'
@@ -38,15 +40,15 @@ describe 'Volay::Mixer::Alsa' do
38
40
  end
39
41
 
40
42
  it 'should raise error when calling current' do
41
- stdout = <<-EOF
42
- Simple mixer control 'Master',0
43
+ stdout = <<-OUTPUT
44
+ Simple mixer control 'Master',0
43
45
  Capabilities: pvolume pswitch pswitch-joined
44
46
  Playback channels: Front Left - Front Right
45
47
  Limits: Playback 0 - 65536
46
48
  Mono:
47
49
  Front Left: Playback 13108 [20%] [off]
48
50
  Front Right: Playback 13108 [20%] [off]
49
- EOF
51
+ OUTPUT
50
52
  stub_shellout('get Master', stdout)
51
53
  expect(mixer.current).to eq(value: 13_107,
52
54
  max_value: 65_536,
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'volay/mixer/default'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'volay/utils'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'volay/widget/volume_control'
3
5
 
@@ -18,7 +20,7 @@ describe 'Volay::Widget::VolumeControl' do
18
20
  volume = double
19
21
  allow(volume).to receive(:value=).and_return(20)
20
22
  allow(app).to receive(:get_object).once.with('volume_adjustement')
21
- .and_return(volume)
23
+ .and_return(volume)
22
24
  allow(app).to receive(:utils).once.and_return(utils)
23
25
  allow(utils).to receive(:update_status_icon).once.and_return(true)
24
26
  allow(app.mixer).to receive(:percent).and_return(20)
@@ -1,4 +1,5 @@
1
- # -*- coding: utf-8 -*-
1
+ # frozen_string_literal: true
2
+
2
3
  desc 'Generates the MANIFEST file'
3
4
  task :manifest do
4
5
  files = `git ls-files`.split("\n").sort
@@ -1,4 +1,5 @@
1
- # -*- coding: utf-8 -*-
1
+ # frozen_string_literal: true
2
+
2
3
  require 'rubocop/rake_task'
3
4
 
4
5
  desc 'Run RuboCop'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rspec/core/rake_task'
2
4
 
3
5
  desc 'Run Rspec tests'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require File.expand_path('../lib/volay/version', __FILE__)
2
4
 
3
5
  Gem::Specification.new do |s|
@@ -12,17 +14,18 @@ Gem::Specification.new do |s|
12
14
  s.executables = ['volay']
13
15
  s.files = File.read(File.expand_path('../MANIFEST', __FILE__)).split("\n")
14
16
 
15
- s.required_ruby_version = '>= 2.0'
17
+ s.required_ruby_version = '> 2.3'
16
18
 
17
- s.add_dependency 'mixlib-cli', '=1.5.0'
18
- s.add_dependency 'mixlib-shellout', '~>2.2'
19
- s.add_dependency 'gtk3', '~>3.0'
19
+ s.add_dependency 'glib2', '~>3.2'
20
+ s.add_dependency 'gtk3', '~>3.2'
21
+ s.add_dependency 'mixlib-cli', '~>1.7'
22
+ s.add_dependency 'mixlib-shellout', '~>2.3'
20
23
 
21
- s.add_development_dependency 'fakefs', '~>0.6'
22
- s.add_development_dependency 'rake', '~>10.5'
23
- s.add_development_dependency 'rack', '~>1.6'
24
- s.add_development_dependency 'rack-test', '~>0.6'
25
- s.add_development_dependency 'rspec', '~>3.4'
26
- s.add_development_dependency 'simplecov', '~>0.11'
27
- s.add_development_dependency 'rubocop', '~>0.35'
24
+ s.add_development_dependency 'fakefs', '~>0.13'
25
+ s.add_development_dependency 'rack', '~>2.0'
26
+ s.add_development_dependency 'rack-test', '~>0.8'
27
+ s.add_development_dependency 'rake', '~>12.0'
28
+ s.add_development_dependency 'rspec', '~>3.7'
29
+ s.add_development_dependency 'rubocop', '~>0.52'
30
+ s.add_development_dependency 'simplecov', '~>0.15'
28
31
  end
metadata CHANGED
@@ -1,155 +1,169 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: volay
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre Rambaud
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-21 00:00:00.000000000 Z
11
+ date: 2018-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: mixlib-cli
14
+ name: glib2
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.5.0
19
+ version: '3.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.5.0
26
+ version: '3.2'
27
27
  - !ruby/object:Gem::Dependency
28
- name: mixlib-shellout
28
+ name: gtk3
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.2'
33
+ version: '3.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.2'
40
+ version: '3.2'
41
41
  - !ruby/object:Gem::Dependency
42
- name: gtk3
42
+ name: mixlib-cli
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.0'
47
+ version: '1.7'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '3.0'
54
+ version: '1.7'
55
55
  - !ruby/object:Gem::Dependency
56
- name: fakefs
56
+ name: mixlib-shellout
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.6'
62
- type: :development
61
+ version: '2.3'
62
+ type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0.6'
68
+ version: '2.3'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rake
70
+ name: fakefs
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '10.5'
75
+ version: '0.13'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '10.5'
82
+ version: '0.13'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rack
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '1.6'
89
+ version: '2.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '1.6'
96
+ version: '2.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rack-test
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0.6'
103
+ version: '0.8'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0.6'
110
+ version: '0.8'
111
111
  - !ruby/object:Gem::Dependency
112
- name: rspec
112
+ name: rake
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '3.4'
117
+ version: '12.0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '3.4'
124
+ version: '12.0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: simplecov
126
+ name: rspec
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '0.11'
131
+ version: '3.7'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '0.11'
138
+ version: '3.7'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rubocop
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '0.35'
145
+ version: '0.52'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '0.35'
152
+ version: '0.52'
153
+ - !ruby/object:Gem::Dependency
154
+ name: simplecov
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '0.15'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '0.15'
153
167
  description: Really simple volume system tray written in ruby.
154
168
  email: pierre.rambaud86@gmail.com
155
169
  executables:
@@ -205,9 +219,9 @@ require_paths:
205
219
  - lib
206
220
  required_ruby_version: !ruby/object:Gem::Requirement
207
221
  requirements:
208
- - - ">="
222
+ - - ">"
209
223
  - !ruby/object:Gem::Version
210
- version: '2.0'
224
+ version: '2.3'
211
225
  required_rubygems_version: !ruby/object:Gem::Requirement
212
226
  requirements:
213
227
  - - ">="
@@ -215,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
229
  version: '0'
216
230
  requirements: []
217
231
  rubyforge_project:
218
- rubygems_version: 2.6.7
232
+ rubygems_version: 2.7.4
219
233
  signing_key:
220
234
  specification_version: 4
221
235
  summary: The Volume system tray