rupi 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rupi/camera.rb +12 -3
- data/lib/rupi/capistrano.rb +27 -7
- data/lib/rupi/version.rb +1 -1
- data/templates/Capfile.erb +1 -1
- data/templates/Gemfile +0 -1
- metadata +4 -5
- data/lib/rupi/sprinkle.rb +0 -73
data/lib/rupi/camera.rb
CHANGED
@@ -17,10 +17,19 @@ module Rupi
|
|
17
17
|
|
18
18
|
def self.capture(options = {})
|
19
19
|
cfg = CONFIGURATION.merge(options)
|
20
|
-
|
20
|
+
|
21
|
+
path = options[:path]
|
22
|
+
|
23
|
+
if path.nil?
|
24
|
+
file = Tempfile.new('snap')
|
25
|
+
path = file.path
|
26
|
+
end
|
27
|
+
|
21
28
|
command = "uvccapture -S#{cfg[:saturation]} -B#{cfg[:brightness]} -C#{cfg[:contrast]} -G#{cfg[:gain]} -x#{cfg[:width]} -y#{cfg[:height]}"
|
22
|
-
|
23
|
-
|
29
|
+
|
30
|
+
system("#{command} -o#{path}")
|
31
|
+
|
32
|
+
file || File.new(path)
|
24
33
|
end
|
25
34
|
end
|
26
35
|
end
|
data/lib/rupi/capistrano.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
require 'bundler/setup'
|
2
|
-
require 'sprinkle'
|
3
2
|
|
4
3
|
Capistrano::Configuration.instance(:must_exist).load do
|
5
4
|
|
5
|
+
set :default_shell, "bash -l"
|
6
|
+
|
6
7
|
namespace :deploy do
|
7
8
|
desc 'prepare your raspberry pi for deployment'
|
8
9
|
task :setup do
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
Sprinkle::Script.sprinkle(File.read(sprinkle_path), sprinkle_path)
|
10
|
+
setup_rvm
|
11
|
+
setup_ruby
|
12
|
+
setup_rupi
|
13
13
|
|
14
14
|
run "mkdir -p #{deploy_to}"
|
15
15
|
|
@@ -18,8 +18,28 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
18
18
|
setup_service
|
19
19
|
end
|
20
20
|
|
21
|
+
task :setup_rvm do
|
22
|
+
run "test -f ~/.rvm/bin/rvm || curl -L get.rvm.io | bash -s stable", :shell => 'sh'
|
23
|
+
end
|
24
|
+
|
25
|
+
task :setup_ruby_dependencies do
|
26
|
+
run 'sudo apt-get -y install 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'
|
27
|
+
end
|
28
|
+
|
29
|
+
task :setup_ruby do
|
30
|
+
setup_ruby_dependencies
|
31
|
+
put "install: --no-rdoc --no-ri\nupdate: --no-rdoc --no-ri\n", ".gemrc", :via => :scp
|
32
|
+
run "rvm mount -r https://s3.amazonaws.com/rvm-pi/debian/wheezy_sid/armv6l/#{Rupi::RUBY_VERSION}.tar.bz2 --verify-downloads 1"
|
33
|
+
run "rvm use #{Rupi::RUBY_VERSION} --default"
|
34
|
+
end
|
35
|
+
|
36
|
+
task :setup_rupi do
|
37
|
+
run 'sudo apt-get -y install uvccapture'
|
38
|
+
run 'gem install rupi'
|
39
|
+
end
|
40
|
+
|
21
41
|
task :setup_service do
|
22
|
-
run "
|
42
|
+
run "rupi_service install #{deploy_to}/app.rb"
|
23
43
|
end
|
24
44
|
|
25
45
|
desc 'deploy the app'
|
@@ -45,7 +65,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
45
65
|
end
|
46
66
|
|
47
67
|
task :bundle do
|
48
|
-
run "
|
68
|
+
run "cd #{deploy_to} && bundle check || bundle install"
|
49
69
|
end
|
50
70
|
end
|
51
71
|
|
data/lib/rupi/version.rb
CHANGED
data/templates/Capfile.erb
CHANGED
data/templates/Gemfile
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.4.
|
4
|
+
version: 0.4.5
|
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-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: wiringpi
|
@@ -90,7 +90,6 @@ files:
|
|
90
90
|
- lib/rupi/capistrano.rb
|
91
91
|
- lib/rupi/generator.rb
|
92
92
|
- lib/rupi/pin.rb
|
93
|
-
- lib/rupi/sprinkle.rb
|
94
93
|
- lib/rupi/version.rb
|
95
94
|
- lib/rupi.rb
|
96
95
|
- templates/app.rb
|
@@ -111,7 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
111
110
|
version: '0'
|
112
111
|
segments:
|
113
112
|
- 0
|
114
|
-
hash:
|
113
|
+
hash: -402449666898579362
|
115
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
115
|
none: false
|
117
116
|
requirements:
|
@@ -120,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
119
|
version: '0'
|
121
120
|
segments:
|
122
121
|
- 0
|
123
|
-
hash:
|
122
|
+
hash: -402449666898579362
|
124
123
|
requirements: []
|
125
124
|
rubyforge_project:
|
126
125
|
rubygems_version: 1.8.24
|
data/lib/rupi/sprinkle.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
require 'rupi/version'
|
2
|
-
|
3
|
-
Sprinkle::Installers::Apt.class_eval do
|
4
|
-
alias_method :install_commands_original, :install_commands
|
5
|
-
|
6
|
-
def install_commands
|
7
|
-
"sudo #{install_commands_original}"
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
RVM_PATH = '/usr/local/rvm'
|
12
|
-
RVM_EXECUTABLE = "#{RVM_PATH}/bin/rvm"
|
13
|
-
|
14
|
-
package :rvm do
|
15
|
-
description 'Ruby Version Manager'
|
16
|
-
|
17
|
-
noop do
|
18
|
-
pre :install, "sudo curl -L get.rvm.io | sudo bash -s stable --path #{RVM_PATH}"
|
19
|
-
end
|
20
|
-
|
21
|
-
verify do
|
22
|
-
has_file RVM_EXECUTABLE
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
package :ruby_dependencies do
|
27
|
-
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'
|
28
|
-
end
|
29
|
-
|
30
|
-
package :ruby do
|
31
|
-
description Rupi::RUBY_VERSION
|
32
|
-
version Rupi::RUBY_VERSION
|
33
|
-
requires :rvm
|
34
|
-
requires :ruby_dependencies
|
35
|
-
|
36
|
-
noop do
|
37
|
-
pre :install, "sudo #{RVM_EXECUTABLE} mount -r https://s3.amazonaws.com/rvm-pi/debian/wheezy_sid/armv6l/#{Rupi::RUBY_VERSION}.tar.bz2 --verify-downloads 1"
|
38
|
-
# pre :install, "sudo #{RVM_EXECUTABLE} install #{Rupi::RUBY_VERSION} --trace"
|
39
|
-
post :install, "#{RVM_EXECUTABLE} use #{Rupi::RUBY_VERSION} --default"
|
40
|
-
end
|
41
|
-
|
42
|
-
verify do
|
43
|
-
has_executable "#{RVM_PATH}/rubies/#{Rupi::RUBY_VERSION}/bin/ruby"
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
package :rupi do
|
48
|
-
description 'Rupi'
|
49
|
-
requires :rvm
|
50
|
-
requires :ruby
|
51
|
-
|
52
|
-
apt 'uvccapture'
|
53
|
-
|
54
|
-
noop do
|
55
|
-
pre :install, "#{RVM_PATH}/bin/gem-#{Rupi::RUBY_VERSION} install rupi --no-rdoc --no-ri"
|
56
|
-
end
|
57
|
-
|
58
|
-
verify do
|
59
|
-
has_executable "#{RVM_PATH}/gems/#{Rupi::RUBY_VERSION}/bin/rupi"
|
60
|
-
has_executable 'uvccapture'
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
policy :rupi, :roles => :raspberrypi do
|
65
|
-
requires :rupi
|
66
|
-
end
|
67
|
-
|
68
|
-
deployment do
|
69
|
-
delivery :capistrano do
|
70
|
-
set :user, $user || 'pi'
|
71
|
-
role :raspberrypi, $raspberypis || 'raspberrypi.local', :primary => true
|
72
|
-
end
|
73
|
-
end
|