pebble_commander 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 (3) hide show
  1. checksums.yaml +7 -0
  2. data/bin/pebble_commander +42 -0
  3. metadata +46 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 77164641a94b2ae158d014c03b9181e0a4f8bd4c
4
+ data.tar.gz: 7c1f49438ce35e5fcb409e534cb1236f125601f3
5
+ SHA512:
6
+ metadata.gz: dfd29d2cdb5da286f663cd4b32229b6a49cb8a675c84b90151e7f4faa30f3ea9566fc2eaaab2adbb2b2fea7ac06ba9c4940e59ef599cec0513d30e5b3975d30f
7
+ data.tar.gz: 80c65dae9e5a92d08203fd425cbd93fc127dfdd2f25c2bd20f8dc8d9947f1d1409c356e361b4845db628349c867e87c179ebc1857ed2a3ecebf051d37c703c04
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pebble'
4
+
5
+ TITLE = "Pebble Commander"
6
+
7
+ def send_result(watch, result)
8
+ if result
9
+ watch.notification_sms(TITLE "Success!")
10
+ else
11
+ watch.notification_sms(TITLE, "Failure...")
12
+ end
13
+ end
14
+
15
+ def run_command(watch, command)
16
+ watch.notification_sms(TITLE, "Running:\n '#{command.chomp}'")
17
+ result = system(command)
18
+ send_result(watch, result)
19
+ end
20
+
21
+ watch = Pebble::Watch.autodetect
22
+ watch.connect
23
+
24
+ watch.notification_sms(TITLE, "Welcome to #{TITLE}!")
25
+
26
+ commands = []
27
+ File.open(".pebble-commands").each_line { |line| commands << line }
28
+ watch.set_nowplaying_metadata(commands[0], commands[2], commands[1])
29
+
30
+ watch.on_event(:media_control) do |event|
31
+ case event.button
32
+ when :previous
33
+ run_command(watch, commands[0])
34
+ when :playpause
35
+ run_command(watch, commands[1])
36
+ when :next
37
+ run_command(watch, commands[2])
38
+ end
39
+ end
40
+
41
+ watch.listen_for_events
42
+
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pebble_commander
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Callum Stott
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-11-14 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - callum@seadowg.com
16
+ executables:
17
+ - pebble_commander
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - bin/pebble_commander
22
+ homepage: http://github.com/seadowg/pebble_commander
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.3
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: Execute arbritary commands with the Pebble Watch
46
+ test_files: []