seriamp 0.1.14 → 0.2.0

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.
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Seriamp::Yamaha::App do
6
+ include Rack::Test::Methods
7
+
8
+ describe '#initialize' do
9
+ it 'works' do
10
+ described_class.new
11
+ end
12
+ end
13
+
14
+ let(:app) do
15
+ described_class.tap do |app|
16
+ app.client = client
17
+ end
18
+ end
19
+
20
+ let(:client_cls) { Seriamp::Yamaha::Client }
21
+ let(:client) { double('yamaha client') }
22
+
23
+ describe 'get /power' do
24
+ end
25
+
26
+ describe 'put /main/power' do
27
+ it 'works' do
28
+ client.should receive(:with_device).and_yield
29
+ client.should receive(:set_main_power).with(true)
30
+
31
+ put '/main/power', 'true'
32
+
33
+ last_response.status.should == 204
34
+ last_response.body.should == ''
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Seriamp::Yamaha::Client do
6
+ describe '#initialize' do
7
+ it 'works' do
8
+ described_class.new
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,82 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Seriamp::Yamaha::Cmd do
6
+ let(:client_cls) { Seriamp::Yamaha::Client }
7
+
8
+ describe '#initialize' do
9
+ it 'works' do
10
+ described_class.new
11
+ end
12
+ end
13
+
14
+ let(:args) { [] }
15
+ let(:stdin_c) { '' }
16
+ let(:stdin) { StringIO.new(stdin_c) }
17
+ let (:cmd) { described_class.new(args, stdin) }
18
+
19
+ describe '#run' do
20
+ describe 'no command' do
21
+ it 'reads stdin' do
22
+ stdin.should receive(:each_line)
23
+ cmd.run
24
+ end
25
+ end
26
+
27
+ let(:client) { double('client') }
28
+
29
+ describe '!status' do
30
+ let(:args) { %w(status) }
31
+
32
+ it 'works' do
33
+ client.should_receive(:last_status)
34
+ client_cls.should receive(:new).and_return(client)
35
+ cmd.run
36
+ end
37
+ end
38
+
39
+ describe 'bulk commands' do
40
+ describe '!status' do
41
+ let(:stdin_c) { 'status' }
42
+
43
+ it 'works' do
44
+ client.should_receive(:last_status)
45
+ client_cls.should receive(:new).and_return(client)
46
+ cmd.run
47
+ end
48
+ end
49
+
50
+ describe 'dash syntax' do
51
+ let(:stdin_c) { "pure-direct on" }
52
+
53
+ it 'works' do
54
+ client.should_receive(:set_pure_direct).with(true)
55
+ client_cls.should receive(:new).and_return(client)
56
+ cmd.run
57
+ end
58
+ end
59
+
60
+ describe 'underscore syntax' do
61
+ let(:stdin_c) { "pure_direct on" }
62
+
63
+ it 'works' do
64
+ client.should_receive(:set_pure_direct).with(true)
65
+ client_cls.should receive(:new).and_return(client)
66
+ cmd.run
67
+ end
68
+ end
69
+
70
+ describe 'two commands' do
71
+ let(:stdin_c) { "status\npure-direct on" }
72
+
73
+ it 'works' do
74
+ client.should_receive(:last_status)
75
+ client.should_receive(:set_pure_direct).with(true)
76
+ client_cls.should receive(:new).and_return(client)
77
+ cmd.run
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seriamp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Pudeyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-30 00:00:00.000000000 Z
11
+ date: 2023-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: serialport
@@ -16,20 +16,64 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '1.3'
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.0'
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec-core
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.12'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.12'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec-expectations
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.12'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.12'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-mocks
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.12'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.12'
27
69
  description: Library for controlling Yamaha A/V receivers and Sonance Sonamp amplifiers
28
70
  via the serial port
29
71
  email:
30
72
  - code@olegp.name
31
73
  executables:
74
+ - integra
32
75
  - sonamp
76
+ - sonamp-auto-power
33
77
  - sonamp-web
34
78
  - yamaha
35
79
  - yamaha-web
@@ -37,21 +81,36 @@ extensions: []
37
81
  extra_rdoc_files: []
38
82
  files:
39
83
  - ".gitignore"
84
+ - Gemfile
85
+ - Gemfile.lock
40
86
  - LICENSE
41
87
  - README.md
88
+ - bin/integra
42
89
  - bin/sonamp
90
+ - bin/sonamp-auto-power
43
91
  - bin/sonamp-web
44
92
  - bin/yamaha
45
93
  - bin/yamaha-web
46
94
  - lib/seriamp.rb
95
+ - lib/seriamp/all.rb
96
+ - lib/seriamp/backend.rb
47
97
  - lib/seriamp/backend/ffi.rb
48
98
  - lib/seriamp/backend/serial_port.rb
49
99
  - lib/seriamp/detect.rb
50
100
  - lib/seriamp/error.rb
101
+ - lib/seriamp/faraday_facade.rb
102
+ - lib/seriamp/integra.rb
103
+ - lib/seriamp/integra/client.rb
104
+ - lib/seriamp/integra/cmd.rb
105
+ - lib/seriamp/integra/executor.rb
106
+ - lib/seriamp/integra/protocol/constants.rb
107
+ - lib/seriamp/integra/protocol/methods.rb
51
108
  - lib/seriamp/sonamp.rb
52
109
  - lib/seriamp/sonamp/app.rb
110
+ - lib/seriamp/sonamp/auto_power.rb
53
111
  - lib/seriamp/sonamp/client.rb
54
112
  - lib/seriamp/sonamp/cmd.rb
113
+ - lib/seriamp/sonamp/executor.rb
55
114
  - lib/seriamp/utils.rb
56
115
  - lib/seriamp/version.rb
57
116
  - lib/seriamp/yamaha.rb
@@ -62,6 +121,13 @@ files:
62
121
  - lib/seriamp/yamaha/protocol/constants.rb
63
122
  - lib/seriamp/yamaha/protocol/methods.rb
64
123
  - seriamp.gemspec
124
+ - spec/sonamp/app_spec.rb
125
+ - spec/sonamp/client_spec.rb
126
+ - spec/sonamp/cmd_spec.rb
127
+ - spec/spec_helper.rb
128
+ - spec/yamaha/app_spec.rb
129
+ - spec/yamaha/client_spec.rb
130
+ - spec/yamaha/cmd_spec.rb
65
131
  homepage: https://github.com/p/seriamp
66
132
  licenses:
67
133
  - BSD-2-Clause
@@ -85,4 +151,11 @@ rubygems_version: 3.3.15
85
151
  signing_key:
86
152
  specification_version: 4
87
153
  summary: Serial control for amplifiers & A/V receivers
88
- test_files: []
154
+ test_files:
155
+ - spec/sonamp/app_spec.rb
156
+ - spec/sonamp/client_spec.rb
157
+ - spec/sonamp/cmd_spec.rb
158
+ - spec/spec_helper.rb
159
+ - spec/yamaha/app_spec.rb
160
+ - spec/yamaha/client_spec.rb
161
+ - spec/yamaha/cmd_spec.rb