fest 1.3.10 → 1.3.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/changelog.org +2 -0
- data/config/custom.yml +20 -0
- data/fest.gemspec +1 -1
- data/lib/fest.rb +6 -4
- data/spec/fest_spec.rb +1 -1
- data/spec/params/custom_spec.rb +1 -1
- data/spec/volume_spec.rb +71 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13c8f0457755e90a69e4acd44415155d28156b54
|
4
|
+
data.tar.gz: 0d24042c2900cfbe268da9345e73009613726cf4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 321c86e13f3d28a0400fa3654e4b5b67cafc6be9e23163a91671d2b27ca4b22ba95f786247840004657b6e878138024613d4c638e3a9209a30031aa5454193df
|
7
|
+
data.tar.gz: 6d9beffb87ecae15ab3c5ade7a7379cd6c64a9cddf4a379a57e5d1ed2430f4166d666ecc3f004cdef553c134dc3d572ba3d23bf81091f02f8fe3563a77646af2
|
data/README.md
CHANGED
data/changelog.org
CHANGED
data/config/custom.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
path:
|
3
|
+
'/tmp'
|
4
|
+
current_volume:
|
5
|
+
- "`amixer | grep -o '[0-9]*' | sed '5 ! d' `.to_i"
|
6
|
+
index:
|
7
|
+
- "index = `ls -r #{@path} | grep -o '[0-9]*' | sed '1 ! d'`.to_i"
|
8
|
+
- "index > 0 ? index += 1 : index = 1"
|
9
|
+
min_volume:
|
10
|
+
20
|
11
|
+
max_volume:
|
12
|
+
60
|
13
|
+
step:
|
14
|
+
4
|
15
|
+
language:
|
16
|
+
'cmu_us_slt_arctic_hts'
|
17
|
+
backlight:
|
18
|
+
nil
|
19
|
+
conditions:
|
20
|
+
{}
|
data/fest.gemspec
CHANGED
data/lib/fest.rb
CHANGED
@@ -11,10 +11,12 @@ class Fest
|
|
11
11
|
include Volume
|
12
12
|
|
13
13
|
def say(string)
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
unless string.nil? || string.empty?
|
15
|
+
check_conditions
|
16
|
+
make_wav(string)
|
17
|
+
expect_if_paplay_now
|
18
|
+
play_wav
|
19
|
+
end
|
18
20
|
end
|
19
21
|
|
20
22
|
def initialize(params = {})
|
data/spec/fest_spec.rb
CHANGED
data/spec/params/custom_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require_relative '../spec_helper'
|
|
2
2
|
|
3
3
|
describe Fest do
|
4
4
|
describe '#initialize' do
|
5
|
-
params = YAML.load_file("#{GEM_ROOT}/config/
|
5
|
+
params = YAML.load_file("#{GEM_ROOT}/config/custom.yml")
|
6
6
|
let(:loader) { described_class.new(params) }
|
7
7
|
|
8
8
|
params.each do |key, value|
|
data/spec/volume_spec.rb
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
RSpec.describe Fest do
|
5
|
+
describe '::Volume' do
|
6
|
+
before(:each) do
|
7
|
+
@fest = Fest.new
|
8
|
+
params = YAML.load_file("#{GEM_ROOT}/config/default.yml")
|
9
|
+
@step = params['step']
|
10
|
+
@current_volume = eval(params['current_volume'].join('; '))
|
11
|
+
@max_volume = params['max_volume']
|
12
|
+
@min_volume = params['min_volume']
|
13
|
+
end
|
14
|
+
|
15
|
+
it '.include? Volume' do
|
16
|
+
expect(@fest.class.included_modules.include?(Volume)).to be_truthy
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'current volume eq volume?' do
|
20
|
+
vol = `amixer | grep -o '[0-9]*' | sed "5 ! d"`.to_i
|
21
|
+
expect(@current_volume).to eq(vol)
|
22
|
+
end
|
23
|
+
|
24
|
+
it '#inputs' do
|
25
|
+
inputs =
|
26
|
+
`pactl list sink-inputs | grep '№' | grep -o '[0-9]*'`.split("\n")
|
27
|
+
expect(@fest.sink_inputs).to match_array(inputs)
|
28
|
+
end
|
29
|
+
|
30
|
+
it '#check_optimal_volume' do
|
31
|
+
vol = @current_volume - @current_volume / 10 * @step
|
32
|
+
expect(@fest.check_optimal_volume).to eq(vol)
|
33
|
+
end
|
34
|
+
|
35
|
+
it '#optimize_volume' do
|
36
|
+
if @current_volume > @max_volume
|
37
|
+
expect(@fest.optimize_volume).to be < @current_volume
|
38
|
+
elsif @current_volume < @min_volume
|
39
|
+
expect(@fest.optimize_volume).to be > @current_volume
|
40
|
+
else
|
41
|
+
expect(@fest.optimize_volume).to eq(@current_volume)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
it '#change_volume down' do
|
46
|
+
@fest.sink_inputs
|
47
|
+
@fest.change_volume(
|
48
|
+
@current_volume,
|
49
|
+
@fest.check_optimal_volume,
|
50
|
+
@step
|
51
|
+
)
|
52
|
+
|
53
|
+
current_volume = `amixer | grep -o '[0-9]*' | sed "5 ! d"`.to_i
|
54
|
+
vol = current_volume - current_volume / 10 * @step
|
55
|
+
expect(@fest.check_optimal_volume).to eq(vol)
|
56
|
+
end
|
57
|
+
|
58
|
+
it '#change_volume up' do
|
59
|
+
@fest.sink_inputs
|
60
|
+
@fest.change_volume(
|
61
|
+
@fest.check_optimal_volume,
|
62
|
+
@current_volume,
|
63
|
+
@step
|
64
|
+
)
|
65
|
+
|
66
|
+
current_volume = `amixer | grep -o '[0-9]*' | sed "5 ! d"`.to_i
|
67
|
+
vol = `amixer | grep -o '[0-9]*' | sed "5 ! d"`.to_i
|
68
|
+
expect(current_volume).to eq(vol)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexsey Ermolaev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -55,6 +55,7 @@ files:
|
|
55
55
|
- Rakefile
|
56
56
|
- changelog.org
|
57
57
|
- config/conditions.yml
|
58
|
+
- config/custom.yml
|
58
59
|
- config/default.yml
|
59
60
|
- fest.gemspec
|
60
61
|
- lib/fest.rb
|
@@ -63,6 +64,7 @@ files:
|
|
63
64
|
- spec/params/custom_spec.rb
|
64
65
|
- spec/params/default_spec.rb
|
65
66
|
- spec/spec_helper.rb
|
67
|
+
- spec/volume_spec.rb
|
66
68
|
homepage: https://github.com/AfsmNGhr/fest
|
67
69
|
licenses:
|
68
70
|
- MIT
|
@@ -97,3 +99,4 @@ test_files:
|
|
97
99
|
- spec/params/custom_spec.rb
|
98
100
|
- spec/params/default_spec.rb
|
99
101
|
- spec/spec_helper.rb
|
102
|
+
- spec/volume_spec.rb
|