fest 1.3.10 → 1.3.11

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 162120a716861b8e7afe36ae975895af52eee799
4
- data.tar.gz: ce28d4db581b858d5165640155388073edcbaa82
3
+ metadata.gz: 13c8f0457755e90a69e4acd44415155d28156b54
4
+ data.tar.gz: 0d24042c2900cfbe268da9345e73009613726cf4
5
5
  SHA512:
6
- metadata.gz: 34fed53a50413d0484681508ba00d25f8c1c00283f21fbeb2abff3c06a062c35585971647bb6efc0b181b751309d0c0b99d650809a9550c8e36cbbc9a0b36b2c
7
- data.tar.gz: aab8528a178264dff0bb486670e8bc208ce90ac9e201d23cd149d6fdcfa758232e4e74bf06a93c8b5eaaf9347ae7fea786cb933a5e0e067f3f292d84307faad0
6
+ metadata.gz: 321c86e13f3d28a0400fa3654e4b5b67cafc6be9e23163a91671d2b27ca4b22ba95f786247840004657b6e878138024613d4c638e3a9209a30031aa5454193df
7
+ data.tar.gz: 6d9beffb87ecae15ab3c5ade7a7379cd6c64a9cddf4a379a57e5d1ed2430f4166d666ecc3f004cdef553c134dc3d572ba3d23bf81091f02f8fe3563a77646af2
data/README.md CHANGED
@@ -34,7 +34,7 @@ require 'fest'
34
34
  @fest.say("Пример")
35
35
  # => Say "Пример"
36
36
 
37
- @fest = Fest.new({'language' => "cmu_us_slt_arctic_hts"})
37
+ @fest = Fest.new(YAML.load_file('../config/custom.yml'))
38
38
  @fest.say("This is an example")
39
39
  # => Say "This is an example"
40
40
 
@@ -1,3 +1,5 @@
1
+ ** Чт 01 окт 2015 18:40:50
2
+ - unless if string nil or empty?
1
3
  ** 1.3.10 (2015-28-09 Пн)
2
4
  - initialize with params for yml file
3
5
  - check conditions @params['conditions'] or conditions.yml
@@ -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
+ {}
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'fest'
3
- gem.version = '1.3.10'
3
+ gem.version = '1.3.11'
4
4
  gem.authors = 'Alexsey Ermolaev'
5
5
  gem.email = 'afay.zangetsu@gmail.com'
6
6
  gem.homepage = 'https://github.com/AfsmNGhr/fest'
@@ -11,10 +11,12 @@ class Fest
11
11
  include Volume
12
12
 
13
13
  def say(string)
14
- check_conditions
15
- make_wav(string)
16
- expect_if_paplay_now
17
- play_wav
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 = {})
@@ -11,7 +11,7 @@ RSpec.describe Fest do
11
11
 
12
12
  context '#say' do
13
13
  it 'check successfull say' do
14
- @fest.say('Начинаю тъэ+с т+ирова ние')
14
+ @fest.say('Произвожу проверку функ циона+ла')
15
15
  expect($?.success?).to be_truthy
16
16
  end
17
17
  end
@@ -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/default.yml")
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|
@@ -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.10
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-09-28 00:00:00.000000000 Z
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