itamae-plugin-recipe-raspberry_pi 0.1.0 → 0.1.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.
- checksums.yaml +4 -4
- data/.rubocop.yml +12 -0
- data/Gemfile +2 -0
- data/README.md +6 -1
- data/Rakefile +5 -3
- data/bin/console +3 -3
- data/itamae-plugin-recipe-raspberry_pi.gemspec +5 -4
- data/lib/ext/itamae.rb +18 -0
- data/lib/itamae/plugin/recipe/raspberry_pi.rb +30 -0
- data/lib/itamae/plugin/recipe/raspberry_pi/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 097336b025e217bc736518c1d155ac1fdab0dd41
|
4
|
+
data.tar.gz: 4b856c365aec46ffd94fe1fab4866b183dc0668b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68b1824d3ed781b140e6bb1b49a0eaa16305c0d6194f4d45950250a43d486b9813ef8742c5fcfa6cfda80a2d6727fdc47bdda64968ea48d8c85edd2ee1b4b3c7
|
7
|
+
data.tar.gz: 5e4f85cbcb4fa61df680663c74f43d629369d8031bd83552fb9e9a31d30f6de05647bbaaf3dc27f516174b540712f0e8d0c04ae28c7e72d18cb4dfe614d1f287
|
data/.rubocop.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
Itamae::Plugin::Recipe::RaspberryPi
|
2
2
|
========
|
3
3
|
|
4
|
+
[](http://badge.fury.io/rb/itamae-plugin-recipe-raspberry_pi)
|
5
|
+
|
4
6
|
Itamae plugin for Setup RaspberryPi.
|
5
7
|
|
6
8
|
Installation
|
@@ -20,7 +22,8 @@ Or install it yourself as:
|
|
20
22
|
|
21
23
|
$ gem install itamae-plugin-recipe-raspberry_pi
|
22
24
|
|
23
|
-
|
25
|
+
Usage
|
26
|
+
--------
|
24
27
|
|
25
28
|
Include your recipe.
|
26
29
|
|
@@ -28,3 +31,5 @@ Include your recipe.
|
|
28
31
|
include_recipe 'raspberry_pi'
|
29
32
|
```
|
30
33
|
|
34
|
+
|
35
|
+
|
data/Rakefile
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'rubocop/rake_task'
|
3
4
|
|
4
5
|
RSpec::Core::RakeTask.new(:spec)
|
6
|
+
RuboCop::RakeTask.new
|
5
7
|
|
6
|
-
task :
|
8
|
+
task default: %i(spec rubocop)
|
data/bin/console
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'itamae/plugin/recipe/raspberry_pi'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +10,5 @@ require "itamae/plugin/recipe/raspberry_pi"
|
|
10
10
|
# require "pry"
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'irb'
|
14
14
|
IRB.start
|
@@ -11,9 +11,11 @@ Gem::Specification.new do |spec|
|
|
11
11
|
|
12
12
|
spec.summary = 'Raspberry Pi installer with itemae'
|
13
13
|
spec.description = 'Raspberry Pi installer with itemae.'
|
14
|
-
spec.homepage = ''
|
14
|
+
spec.homepage = 'https://github.com/tk-hamaguchi/itamae-plugin-recipe-raspberry_pi'
|
15
15
|
|
16
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f|
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
}
|
17
19
|
spec.bindir = 'exe'
|
18
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
21
|
spec.require_paths = ['lib']
|
@@ -21,6 +23,5 @@ Gem::Specification.new do |spec|
|
|
21
23
|
spec.add_development_dependency 'bundler', '~> 1.10'
|
22
24
|
spec.add_development_dependency 'rake', '~> 10.0'
|
23
25
|
spec.add_development_dependency 'rspec'
|
24
|
-
spec.add_runtime_dependency
|
25
|
-
|
26
|
+
spec.add_runtime_dependency 'itamae', '~> 1.4.1'
|
26
27
|
end
|
data/lib/ext/itamae.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
module Itamae
|
2
|
+
class Node
|
3
|
+
attr_reader :backend
|
4
|
+
end
|
5
|
+
module Backend
|
6
|
+
class Ssh
|
7
|
+
def host
|
8
|
+
@options['host']
|
9
|
+
end
|
10
|
+
|
11
|
+
def clear
|
12
|
+
@backend.get_config(:ssh).close
|
13
|
+
@backend.set_config(:ssh, nil)
|
14
|
+
@backend.set_config(:scp, nil)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'ext/itamae'
|
2
|
+
|
1
3
|
execute 'update package list' do
|
2
4
|
user 'root'
|
3
5
|
command 'apt-get update -y'
|
@@ -75,3 +77,31 @@ execute 'reboot' do
|
|
75
77
|
user 'root'
|
76
78
|
command 'reboot'
|
77
79
|
end
|
80
|
+
|
81
|
+
local_ruby_block 'waiting reboot' do
|
82
|
+
block do
|
83
|
+
if (node.backend.class == Itamae::Backend::Ssh)
|
84
|
+
flag = false
|
85
|
+
loop do
|
86
|
+
ping = "ping -c 1 -t 1 #{node.backend.host}"
|
87
|
+
status = `#{ping} 2>&1 >/dev/null && echo $?`.strip
|
88
|
+
if status == '' && flag
|
89
|
+
elsif status == ''
|
90
|
+
Itamae::Logger.info 'rebooting...'
|
91
|
+
flag = true
|
92
|
+
elsif status == '0' && flag
|
93
|
+
break
|
94
|
+
end
|
95
|
+
sleep 1
|
96
|
+
end
|
97
|
+
Itamae::Logger.info 'rebooted.'
|
98
|
+
Itamae::Logger.info 'reconnect ssh session..'
|
99
|
+
node.backend.clear
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
directory '/tmp/itamae_tmp' do
|
105
|
+
mode '777'
|
106
|
+
action :create
|
107
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: itamae-plugin-recipe-raspberry_pi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takahiro HAMAGUCHI
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -75,6 +75,7 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- ".gitignore"
|
77
77
|
- ".rspec"
|
78
|
+
- ".rubocop.yml"
|
78
79
|
- ".ruby-gemset"
|
79
80
|
- ".ruby-version"
|
80
81
|
- ".travis.yml"
|
@@ -84,9 +85,10 @@ files:
|
|
84
85
|
- bin/console
|
85
86
|
- bin/setup
|
86
87
|
- itamae-plugin-recipe-raspberry_pi.gemspec
|
88
|
+
- lib/ext/itamae.rb
|
87
89
|
- lib/itamae/plugin/recipe/raspberry_pi.rb
|
88
90
|
- lib/itamae/plugin/recipe/raspberry_pi/version.rb
|
89
|
-
homepage:
|
91
|
+
homepage: https://github.com/tk-hamaguchi/itamae-plugin-recipe-raspberry_pi
|
90
92
|
licenses: []
|
91
93
|
metadata: {}
|
92
94
|
post_install_message:
|