sonic-pi-cli 0.0.1

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.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/bin/sonic_pi +18 -0
  3. data/lib/sonic_pi.rb +24 -0
  4. metadata +46 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 83650427588988d44d97af0e5ddbbc95c6e3c610
4
+ data.tar.gz: ce26d97a074a0dec4211462822bbdf48b0c37fa5
5
+ SHA512:
6
+ metadata.gz: f0ece2ce9e8f8b9be9624b3f27d2f23d6fd87b95bb6e75348194629db1be5175a848e930a4059566f2ef2ac11cbf8c3c688c6b261cf09aad818bac2bf5214c5d
7
+ data.tar.gz: 31dd568366b3fcf08452c1fcd1f54b67d403091165828ca54df06c30b804e7e3675b66fe665703207eab44cf03fb76d3e20c3d5fb6f77acb55af3f143279ac08
data/bin/sonic_pi ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'sonic_pi'
4
+
5
+ def stdin
6
+ unless STDIN.tty?
7
+ $stdin.read
8
+ end
9
+ end
10
+
11
+ def args_and_stdin
12
+ [
13
+ ARGV.join(' '),
14
+ stdin,
15
+ ].join("\n")
16
+ end
17
+
18
+ SonicPi.new.run(args_and_stdin)
data/lib/sonic_pi.rb ADDED
@@ -0,0 +1,24 @@
1
+
2
+ require 'rubygems'
3
+ require 'osc-ruby'
4
+
5
+ class SonicPi
6
+ RUN_COMMAND = "/run-code"
7
+ SERVER = 'localhost'
8
+ PORT = 4557
9
+
10
+ def run(command)
11
+ client.send(run_command(command))
12
+ end
13
+
14
+ private
15
+
16
+ def client
17
+ client ||= OSC::Client.new(SERVER, PORT)
18
+ end
19
+
20
+ def run_command(command)
21
+ OSC::Message.new(RUN_COMMAND, "#{command}")
22
+ end
23
+ end
24
+
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sonic-pi-cli
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Nick Johnstone
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-09 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A simple command line interface for Sonic Pi
14
+ email: ncwjohnstone@gmail.com
15
+ executables:
16
+ - sonic_pi
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/sonic_pi.rb
21
+ - bin/sonic_pi
22
+ homepage: http://rubygems.org/gems/sonic-pi-cli
23
+ licenses:
24
+ - MIT
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 2.0.14
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: Sonic Pi CLI
46
+ test_files: []