itamae-plugin-recipe-raspberry_pi 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6454ec6438d3918fbcdd05b1af63ac01a5efea7
4
- data.tar.gz: 7b29ca0a554c59ff045048cefd263be76f338164
3
+ metadata.gz: 097336b025e217bc736518c1d155ac1fdab0dd41
4
+ data.tar.gz: 4b856c365aec46ffd94fe1fab4866b183dc0668b
5
5
  SHA512:
6
- metadata.gz: 164af91e155e62e557dea808393b8b68cd79eb5363ce3e7ed3efde85db68d6e8c28c2f4acdfa03fbd35360265b2e18fcbc55cc4cc008d3a9df1acd998881247d
7
- data.tar.gz: ce1e37fe09cc8aa52dc4a25b3a7d09c2d29792a5b5573967e190b1a962b81aa84190116ba177190a5041a2f7fcc2c97159e7d8c84229316d6757ec48c13fab1d
6
+ metadata.gz: 68b1824d3ed781b140e6bb1b49a0eaa16305c0d6194f4d45950250a43d486b9813ef8742c5fcfa6cfda80a2d6727fdc47bdda64968ea48d8c85edd2ee1b4b3c7
7
+ data.tar.gz: 5e4f85cbcb4fa61df680663c74f43d629369d8031bd83552fb9e9a31d30f6de05647bbaaf3dc27f516174b540712f0e8d0c04ae28c7e72d18cb4dfe614d1f287
@@ -0,0 +1,12 @@
1
+ Metrics/LineLength:
2
+ Max: 100
3
+
4
+ Style/Documentation:
5
+ Enabled: false
6
+
7
+ AsciiComments:
8
+ Enabled: false
9
+
10
+ Encoding:
11
+ Enabled: false
12
+
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ gem 'rubocop'
4
+
3
5
  # Specify your gem's dependencies in itamae-plugin-recipe-raspberry_pi.gemspec
4
6
  gemspec
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  Itamae::Plugin::Recipe::RaspberryPi
2
2
  ========
3
3
 
4
+ [![Gem Version](https://badge.fury.io/rb/itamae-plugin-recipe-raspberry_pi.svg)](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
- ## Usage
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 "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
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 :default => :spec
8
+ task default: %i(spec rubocop)
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "itamae/plugin/recipe/raspberry_pi"
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 "irb"
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| f.match(%r{^(test|spec|features)/}) }
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 'itamae', '~> 1.4.1'
25
-
26
+ spec.add_runtime_dependency 'itamae', '~> 1.4.1'
26
27
  end
@@ -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
@@ -2,7 +2,7 @@ module Itamae
2
2
  module Plugin
3
3
  module Recipe
4
4
  module RaspberryPi
5
- VERSION = "0.1.0"
5
+ VERSION = '0.1.1'
6
6
  end
7
7
  end
8
8
  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.0
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-26 00:00:00.000000000 Z
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: