qcmd 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,36 @@
1
+ # using the dnssd library to find running, local QLab instances
2
+
3
+ require 'rubygems'
4
+ require 'dnssd'
5
+
6
+ Thread.abort_on_exception = true
7
+
8
+ def row label, record
9
+ puts "%-12s%s" % [label, record.send(label)]
10
+ end
11
+
12
+ browser = DNSSD.browse '_qlab._udp' do |b|
13
+ DNSSD.resolve b.name, b.type, b.domain do |r|
14
+ puts '*' * 40
15
+ puts "FOUND QLAB:"
16
+
17
+ puts
18
+ puts '-- machine --'
19
+ row :name, b
20
+ row :type, b
21
+ row :domain, b
22
+ row :interface, b
23
+
24
+ puts
25
+ puts '-- resolved domain --'
26
+ row :target, r
27
+ row :port, r
28
+ row :target, r
29
+ puts '*' * 40
30
+ end
31
+ end
32
+
33
+ trap 'INT' do browser.stop; exit end
34
+ trap 'TERM' do browser.stop; exit end
35
+
36
+ sleep
@@ -0,0 +1,14 @@
1
+ require 'qcmd'
2
+
3
+ describe Qcmd::CLI do
4
+ it "should call `start` when initialized" do
5
+ Qcmd::CLI.any_instance.stub(:start) { true }
6
+ Qcmd::CLI.any_instance.should_receive(:start)
7
+ Qcmd::CLI.new
8
+ end
9
+
10
+ it 'should respond to launch' do
11
+ Qcmd::CLI.should_receive :new
12
+ Qcmd::CLI.launch
13
+ end
14
+ end
@@ -0,0 +1,38 @@
1
+ require 'qcmd'
2
+ require 'osc-ruby'
3
+
4
+ describe Qcmd::Commands do
5
+ describe 'cue commands' do
6
+ before do
7
+ Qcmd.context = Qcmd::Context.new
8
+ Qcmd.context.machine = Qcmd::Machine.new('machine', '1.1.1.1', 1000)
9
+ Qcmd.context.workspace_connected = true
10
+ end
11
+
12
+ describe 'cue command always needing reply' do
13
+ before do
14
+ @address = '/workspace/TEST/cue/1/isRunning'
15
+ end
16
+
17
+ describe 'with args' do
18
+ before do
19
+ @message = OSC::Message.new(@address, 123)
20
+ end
21
+
22
+ it 'is detected' do
23
+ Qcmd::Commands.expects_reply?(@message).should eql(true)
24
+ end
25
+ end
26
+
27
+ describe 'without args' do
28
+ before do
29
+ @message = OSC::Message.new(@address, *@args)
30
+ end
31
+
32
+ it 'is detected' do
33
+ Qcmd::Commands.expects_reply?(@message).should eql(true)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,19 @@
1
+ require 'qcmd'
2
+
3
+ describe Qcmd do
4
+ # tests go here
5
+ it "should log debug messages when in verbose mode" do
6
+ Qcmd.should_receive(:log, 'hello')
7
+
8
+ Qcmd.verbose!
9
+ Qcmd.log_level.should eql(:debug)
10
+ Qcmd.debug 'hello'
11
+ end
12
+
13
+ it 'should not log debug messages when not in verbose mode' do
14
+ Qcmd.should_not_receive(:log)
15
+ Qcmd.quiet!
16
+ Qcmd.log_level.should eql(:warning)
17
+ Qcmd.debug 'hello'
18
+ end
19
+ end
@@ -0,0 +1,15 @@
1
+ require 'qcmd'
2
+
3
+ describe Qcmd::QLab do
4
+ it "has a workspace model" do
5
+ ws = Qcmd::QLab::Workspace.new({
6
+ 'displayName' => 'name',
7
+ 'hasPasscode' => false,
8
+ 'uniqueID' => 'id'
9
+ })
10
+
11
+ ws.name.should eql('name')
12
+ ws.passcode?.should eql(false)
13
+ ws.id.should eql('id')
14
+ end
15
+ end
metadata ADDED
@@ -0,0 +1,230 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: qcmd
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Adam Bachman
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-11-16 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: dnssd
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: eventmachine
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :runtime
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: json
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ type: :runtime
62
+ version_requirements: *id003
63
+ - !ruby/object:Gem::Dependency
64
+ name: osc-ruby
65
+ prerelease: false
66
+ requirement: &id004 !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ hash: 3
72
+ segments:
73
+ - 0
74
+ version: "0"
75
+ type: :runtime
76
+ version_requirements: *id004
77
+ - !ruby/object:Gem::Dependency
78
+ name: trollop
79
+ prerelease: false
80
+ requirement: &id005 !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ hash: 3
86
+ segments:
87
+ - 0
88
+ version: "0"
89
+ type: :runtime
90
+ version_requirements: *id005
91
+ - !ruby/object:Gem::Dependency
92
+ name: rspec
93
+ prerelease: false
94
+ requirement: &id006 !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ hash: 3
100
+ segments:
101
+ - 0
102
+ version: "0"
103
+ type: :development
104
+ version_requirements: *id006
105
+ - !ruby/object:Gem::Dependency
106
+ name: cucumber
107
+ prerelease: false
108
+ requirement: &id007 !ruby/object:Gem::Requirement
109
+ none: false
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ hash: 3
114
+ segments:
115
+ - 0
116
+ version: "0"
117
+ type: :development
118
+ version_requirements: *id007
119
+ - !ruby/object:Gem::Dependency
120
+ name: aruba
121
+ prerelease: false
122
+ requirement: &id008 !ruby/object:Gem::Requirement
123
+ none: false
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ hash: 3
128
+ segments:
129
+ - 0
130
+ version: "0"
131
+ type: :development
132
+ version_requirements: *id008
133
+ - !ruby/object:Gem::Dependency
134
+ name: ruby-debug
135
+ prerelease: false
136
+ requirement: &id009 !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ hash: 3
142
+ segments:
143
+ - 0
144
+ version: "0"
145
+ type: :development
146
+ version_requirements: *id009
147
+ description: A simple interactive QLab 3 command line controller
148
+ email:
149
+ - adam.bachman@gmail.com
150
+ executables:
151
+ - qcmd
152
+ extensions: []
153
+
154
+ extra_rdoc_files: []
155
+
156
+ files:
157
+ - .gitignore
158
+ - Gemfile
159
+ - LICENSE.txt
160
+ - README.md
161
+ - Rakefile
162
+ - TODO.md
163
+ - bin/qcmd
164
+ - features/hello.feature
165
+ - features/support/setup.rb
166
+ - lib/qcmd.rb
167
+ - lib/qcmd/cli.rb
168
+ - lib/qcmd/commands.rb
169
+ - lib/qcmd/context.rb
170
+ - lib/qcmd/core_ext/array.rb
171
+ - lib/qcmd/core_ext/osc/message.rb
172
+ - lib/qcmd/handler.rb
173
+ - lib/qcmd/input_completer.rb
174
+ - lib/qcmd/machine.rb
175
+ - lib/qcmd/network.rb
176
+ - lib/qcmd/parser.rb
177
+ - lib/qcmd/plaintext.rb
178
+ - lib/qcmd/qlab.rb
179
+ - lib/qcmd/qlab/cue.rb
180
+ - lib/qcmd/qlab/reply.rb
181
+ - lib/qcmd/qlab/workspace.rb
182
+ - lib/qcmd/server.rb
183
+ - lib/qcmd/version.rb
184
+ - qcmd.gemspec
185
+ - sample/dnssd.rb
186
+ - spec/cli_spec.rb
187
+ - spec/commands_spec.rb
188
+ - spec/qcmd_spec.rb
189
+ - spec/qlab_spec.rb
190
+ has_rdoc: true
191
+ homepage: https://github.com/abachman/qcmd
192
+ licenses: []
193
+
194
+ post_install_message:
195
+ rdoc_options: []
196
+
197
+ require_paths:
198
+ - lib
199
+ required_ruby_version: !ruby/object:Gem::Requirement
200
+ none: false
201
+ requirements:
202
+ - - ">="
203
+ - !ruby/object:Gem::Version
204
+ hash: 3
205
+ segments:
206
+ - 0
207
+ version: "0"
208
+ required_rubygems_version: !ruby/object:Gem::Requirement
209
+ none: false
210
+ requirements:
211
+ - - ">="
212
+ - !ruby/object:Gem::Version
213
+ hash: 3
214
+ segments:
215
+ - 0
216
+ version: "0"
217
+ requirements: []
218
+
219
+ rubyforge_project:
220
+ rubygems_version: 1.6.2
221
+ signing_key:
222
+ specification_version: 3
223
+ summary: QLab 3 console
224
+ test_files:
225
+ - features/hello.feature
226
+ - features/support/setup.rb
227
+ - spec/cli_spec.rb
228
+ - spec/commands_spec.rb
229
+ - spec/qcmd_spec.rb
230
+ - spec/qlab_spec.rb