rupi 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rupi/camera.rb +26 -0
- data/lib/rupi/sprinkle.rb +71 -0
- data/lib/rupi/version.rb +1 -1
- data/lib/rupi.rb +1 -0
- metadata +10 -3
data/lib/rupi/camera.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
|
3
|
+
module Rupi
|
4
|
+
class Camera
|
5
|
+
CONFIGURATION = {
|
6
|
+
:width => 640,
|
7
|
+
:height => 480,
|
8
|
+
:gain => 80,
|
9
|
+
:brightness => 80,
|
10
|
+
:contrast => 80,
|
11
|
+
:saturation => 80
|
12
|
+
}
|
13
|
+
|
14
|
+
def self.configure(options = {})
|
15
|
+
CONFIGURATION.merge!(options)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.capture(options = {})
|
19
|
+
cfg = CONFIGURATION.merge(options)
|
20
|
+
file = Tempfile.new('snap')
|
21
|
+
command = "uvccapture -S#{cfg[:saturation]} -B#{cfg[:brightness]} -C#{cfg[:contrast]} -G#{cfg[:gain]} -x#{cfg[:width]} -y#{cfg[:height]}"
|
22
|
+
system("#{command} -o#{file.path}")
|
23
|
+
file
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
Sprinkle::Installers::Apt.class_eval do
|
2
|
+
alias_method :install_commands_original, :install_commands
|
3
|
+
|
4
|
+
def install_commands
|
5
|
+
"sudo #{install_commands_original}"
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
RVM_PATH = '/usr/local/rvm'
|
10
|
+
RVM_EXECUTABLE = "#{RVM_PATH}/bin/rvm"
|
11
|
+
|
12
|
+
package :rvm do
|
13
|
+
description 'Ruby Version Manager'
|
14
|
+
|
15
|
+
noop do
|
16
|
+
pre :install, "sudo curl -L get.rvm.io | sudo bash -s stable --path #{RVM_PATH}"
|
17
|
+
end
|
18
|
+
|
19
|
+
verify do
|
20
|
+
has_file RVM_EXECUTABLE
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
package :ruby_dependencies do
|
25
|
+
apt 'build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config'
|
26
|
+
end
|
27
|
+
|
28
|
+
package :ruby do
|
29
|
+
description 'Ruby 1.9.3'
|
30
|
+
version 'ruby-1.9.3-p194'
|
31
|
+
requires :rvm
|
32
|
+
requires :ruby_dependencies
|
33
|
+
|
34
|
+
noop do
|
35
|
+
pre :install, "sudo #{RVM_EXECUTABLE} mount -r https://s3.amazonaws.com/rvm-pi/debian/wheezy_sid/armv6l/ruby-1.9.3-p194.tar.bz2 --verify-downloads 1"
|
36
|
+
# pre :install, "sudo #{RVM_EXECUTABLE} install ruby-1.9.3-p194 --trace"
|
37
|
+
post :install, "#{RVM_EXECUTABLE} use ruby-1.9.3-p194 --default"
|
38
|
+
end
|
39
|
+
|
40
|
+
verify do
|
41
|
+
has_executable "#{RVM_PATH}/rubies/ruby-1.9.3-p194/bin/ruby"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
package :rupi do
|
46
|
+
description 'Rupi'
|
47
|
+
requires :rvm
|
48
|
+
requires :ruby
|
49
|
+
|
50
|
+
apt 'uvccapture'
|
51
|
+
|
52
|
+
noop do
|
53
|
+
pre :install, "#{RVM_PATH}/bin/gem-ruby-1.9.3-p194 install rupi --no-rdoc --no-ri"
|
54
|
+
end
|
55
|
+
|
56
|
+
verify do
|
57
|
+
has_executable "#{RVM_PATH}/gems/ruby-1.9.3-p194/bin/rupi"
|
58
|
+
has_executable 'uvccapture'
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
policy :rupi, :roles => :raspberrypi do
|
63
|
+
requires :rupi
|
64
|
+
end
|
65
|
+
|
66
|
+
deployment do
|
67
|
+
delivery :capistrano do
|
68
|
+
set :user, $user || 'pi'
|
69
|
+
role :raspberrypi, $raspberypis || 'raspberrypi.local', :primary => true
|
70
|
+
end
|
71
|
+
end
|
data/lib/rupi/version.rb
CHANGED
data/lib/rupi.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rupi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: wiringpi
|
@@ -70,7 +70,9 @@ extra_rdoc_files: []
|
|
70
70
|
files:
|
71
71
|
- bin/rupi
|
72
72
|
- bin/rupi_service
|
73
|
+
- lib/rupi/camera.rb
|
73
74
|
- lib/rupi/pin.rb
|
75
|
+
- lib/rupi/sprinkle.rb
|
74
76
|
- lib/rupi/version.rb
|
75
77
|
- lib/rupi.rb
|
76
78
|
- README.md
|
@@ -86,12 +88,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
86
88
|
- - ! '>='
|
87
89
|
- !ruby/object:Gem::Version
|
88
90
|
version: '0'
|
91
|
+
segments:
|
92
|
+
- 0
|
93
|
+
hash: -3759034288693267139
|
89
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
95
|
none: false
|
91
96
|
requirements:
|
92
97
|
- - ! '>='
|
93
98
|
- !ruby/object:Gem::Version
|
94
99
|
version: '0'
|
100
|
+
segments:
|
101
|
+
- 0
|
102
|
+
hash: -3759034288693267139
|
95
103
|
requirements: []
|
96
104
|
rubyforge_project:
|
97
105
|
rubygems_version: 1.8.24
|
@@ -100,4 +108,3 @@ specification_version: 3
|
|
100
108
|
summary: Provides a very natural ruby interface for interacting with GPIO on the Raspberry
|
101
109
|
Pi
|
102
110
|
test_files: []
|
103
|
-
has_rdoc:
|