seriamp 0.1.14 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.1
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,106 @@ 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'
69
+ - !ruby/object:Gem::Dependency
70
+ name: faraday
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2.7'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.7'
83
+ - !ruby/object:Gem::Dependency
84
+ name: sinatra
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rack-test
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '2.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '2.0'
27
111
  description: Library for controlling Yamaha A/V receivers and Sonance Sonamp amplifiers
28
112
  via the serial port
29
113
  email:
30
114
  - code@olegp.name
31
115
  executables:
116
+ - integra
32
117
  - sonamp
118
+ - sonamp-auto-power
33
119
  - sonamp-web
34
120
  - yamaha
35
121
  - yamaha-web
@@ -37,21 +123,36 @@ extensions: []
37
123
  extra_rdoc_files: []
38
124
  files:
39
125
  - ".gitignore"
126
+ - Gemfile
127
+ - Gemfile.lock
40
128
  - LICENSE
41
129
  - README.md
130
+ - bin/integra
42
131
  - bin/sonamp
132
+ - bin/sonamp-auto-power
43
133
  - bin/sonamp-web
44
134
  - bin/yamaha
45
135
  - bin/yamaha-web
46
136
  - lib/seriamp.rb
137
+ - lib/seriamp/all.rb
138
+ - lib/seriamp/backend.rb
47
139
  - lib/seriamp/backend/ffi.rb
48
140
  - lib/seriamp/backend/serial_port.rb
49
141
  - lib/seriamp/detect.rb
50
142
  - lib/seriamp/error.rb
143
+ - lib/seriamp/faraday_facade.rb
144
+ - lib/seriamp/integra.rb
145
+ - lib/seriamp/integra/client.rb
146
+ - lib/seriamp/integra/cmd.rb
147
+ - lib/seriamp/integra/executor.rb
148
+ - lib/seriamp/integra/protocol/constants.rb
149
+ - lib/seriamp/integra/protocol/methods.rb
51
150
  - lib/seriamp/sonamp.rb
52
151
  - lib/seriamp/sonamp/app.rb
152
+ - lib/seriamp/sonamp/auto_power.rb
53
153
  - lib/seriamp/sonamp/client.rb
54
154
  - lib/seriamp/sonamp/cmd.rb
155
+ - lib/seriamp/sonamp/executor.rb
55
156
  - lib/seriamp/utils.rb
56
157
  - lib/seriamp/version.rb
57
158
  - lib/seriamp/yamaha.rb
@@ -62,6 +163,13 @@ files:
62
163
  - lib/seriamp/yamaha/protocol/constants.rb
63
164
  - lib/seriamp/yamaha/protocol/methods.rb
64
165
  - seriamp.gemspec
166
+ - spec/sonamp/app_spec.rb
167
+ - spec/sonamp/client_spec.rb
168
+ - spec/sonamp/cmd_spec.rb
169
+ - spec/spec_helper.rb
170
+ - spec/yamaha/app_spec.rb
171
+ - spec/yamaha/client_spec.rb
172
+ - spec/yamaha/cmd_spec.rb
65
173
  homepage: https://github.com/p/seriamp
66
174
  licenses:
67
175
  - BSD-2-Clause
@@ -85,4 +193,11 @@ rubygems_version: 3.3.15
85
193
  signing_key:
86
194
  specification_version: 4
87
195
  summary: Serial control for amplifiers & A/V receivers
88
- test_files: []
196
+ test_files:
197
+ - spec/sonamp/app_spec.rb
198
+ - spec/sonamp/client_spec.rb
199
+ - spec/sonamp/cmd_spec.rb
200
+ - spec/spec_helper.rb
201
+ - spec/yamaha/app_spec.rb
202
+ - spec/yamaha/client_spec.rb
203
+ - spec/yamaha/cmd_spec.rb