go_easy_btn 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/bin/go_easy_btn CHANGED
@@ -6,7 +6,7 @@
6
6
  Mac: go_easy_btn <cmd> /dev/tty.usbmodem12341
7
7
  =end
8
8
 
9
- require File.expand_path('../lib/big_ass_button', File.dirname(__FILE__))
9
+ require 'go_easy_btn'
10
10
 
11
11
  btn = BigAssButton.new :cmd => ARGV[0], :dev => (ARGV[1] || '/dev/tty.usbmodem12341')
12
- btn.make_it_easy
12
+ btn.make_it_easy
@@ -15,27 +15,11 @@ class BigAssButton
15
15
  end
16
16
 
17
17
  def make_it_easy
18
- puts "Making It Easy™\n\n"
18
+ puts "Making It Easy\n\n"
19
19
  SerialPort.open @device, @port do |port|
20
20
  begin
21
21
  while data = port.readline
22
- if data.strip == BTN_COMMAND
23
- puts border
24
-
25
- Alerter.alert 'I am going to make this easy.'
26
- puts "Executing: #{@cmd}"
27
-
28
- success = system @cmd
29
-
30
- msg = success ? "That was easy!" : "Error: #{$?}"
31
- Alerter.alert msg
32
- puts msg
33
-
34
- puts border
35
- @count += 1
36
-
37
- puts stats
38
- end
22
+ run_command if data.strip == BTN_COMMAND
39
23
  end
40
24
  rescue Interrupt, EOFError
41
25
  puts "\rgoing bye bye now"
@@ -44,6 +28,29 @@ class BigAssButton
44
28
  end
45
29
  end
46
30
 
31
+ protected
32
+
33
+ def run_command
34
+ puts border
35
+
36
+ Alerter.alert 'I am going to make this easy.'
37
+ puts "Executing: #{@cmd}"
38
+
39
+ success = system @cmd
40
+
41
+ msg = if success
42
+ @count += 1
43
+ "That was easy!"
44
+ else
45
+ "Error: #{$?}"
46
+ end
47
+
48
+ Alerter.alert msg
49
+ puts msg
50
+ puts border
51
+ puts stats
52
+ end
53
+
47
54
  private
48
55
 
49
56
  def stats(verbose = false)
@@ -58,4 +65,4 @@ class BigAssButton
58
65
  def border
59
66
  '*'*80
60
67
  end
61
- end
68
+ end
metadata CHANGED
@@ -1,80 +1,67 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: go_easy_btn
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 2
9
- version: 0.0.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Josh Nussbaum, Diego Salazar
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2012-11-29 00:00:00 -05:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-11-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: serialport
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
- version: "0"
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
30
22
  type: :runtime
31
- version_requirements: *id001
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
32
30
  description: Hook up easy button via USB serial port and trigger shell commands
33
- email:
31
+ email:
34
32
  - joshnuss@gmail.com
35
33
  - diego@pixelheadstudio.com
36
- executables: []
37
-
34
+ executables:
35
+ - go_easy_btn
38
36
  extensions: []
39
-
40
37
  extra_rdoc_files: []
41
-
42
- files:
43
- - lib/big_ass_button.rb
38
+ files:
39
+ - lib/go_easy_btn.rb
44
40
  - lib/alerter.rb
45
41
  - bin/go_easy_btn
46
- has_rdoc: true
47
42
  homepage: https://github.com/joshnuss/easy-button
48
43
  licenses: []
49
-
50
44
  post_install_message:
51
45
  rdoc_options: []
52
-
53
- require_paths:
46
+ require_paths:
54
47
  - lib
55
- - bin
56
- required_ruby_version: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- segments:
61
- - 1
62
- - 8
63
- - 7
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
64
53
  version: 1.8.7
65
- required_rubygems_version: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- segments:
70
- - 0
71
- version: "0"
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ! '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
72
60
  requirements: []
73
-
74
61
  rubyforge_project:
75
- rubygems_version: 1.3.6
62
+ rubygems_version: 1.8.24
76
63
  signing_key:
77
64
  specification_version: 3
78
65
  summary: Make things Easy!
79
66
  test_files: []
80
-
67
+ has_rdoc: false