go_easy_btn 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/go_easy_btn +17 -6
  2. data/lib/go_easy_btn.rb +3 -4
  3. metadata +2 -2
data/bin/go_easy_btn CHANGED
@@ -1,12 +1,23 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- =begin
4
- Example Usage:
5
- Linux: go_easy_btn <cmd> /dev/ttyUSB0
6
- Mac: go_easy_btn <cmd> /dev/tty.usbmodem12341
7
- =end
3
+ def usage
4
+ <<-USAGE
5
+ Usage:
6
+
7
+ go_easy_btn <cmd> <device> <baud>"
8
+
9
+ Example:
10
+ go_easy_btn "say 'Im a shell script called from $(pwd)'" /dev/tty.usbmodem12341 115200
11
+
12
+ USAGE
13
+ end
14
+
15
+ if ARGV[0].nil? || ARGV[0] == ''
16
+ puts usage
17
+ exit false
18
+ end
8
19
 
9
20
  require 'go_easy_btn'
10
21
 
11
- btn = BigAssButton.new :cmd => ARGV[0], :dev => (ARGV[1] || '/dev/tty.usbmodem12341')
22
+ btn = GoEasyButton.new :cmd => ARGV[0], :dev => (ARGV[1] || '/dev/tty.usbmodem12341'), :baud => ARGV[2]
12
23
  btn.make_it_easy
data/lib/go_easy_btn.rb CHANGED
@@ -1,16 +1,15 @@
1
1
  require 'rubygems'
2
2
  require 'serialport'
3
- require File.expand_path('alerter', File.dirname(__FILE__))
3
+ require 'alerter'
4
4
 
5
- class BigAssButton
5
+ class GoEasyButton
6
6
  BTN_COMMAND = 'PRESSED'
7
7
 
8
8
  def initialize(options = {})
9
9
  raise 'not found serial port has been' unless File.exists? options[:dev]
10
- raise ':cmd must be something!' if options[:cmd].nil? || options[:cmd] == ''
11
10
  @cmd = options[:cmd]
12
11
  @device = options[:dev]
13
- @port = options[:port] || 115200
12
+ @port = options[:baud] || 115200
14
13
  @count = 0
15
14
  @start_time = Time.now
16
15
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 4
9
- version: 0.0.4
8
+ - 5
9
+ version: 0.0.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Josh Nussbaum, Diego Salazar