inprovise 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTQ5MmNkZGZjZmJlZjZhNmYxOWE0ZTM3Y2U1MWVjYWQ0ZGM2N2U5Mw==
4
+ MzU2MGE3MGU3MWMzZDIxZTUyYmRjODFmMWUyYWE1NTRmZDZjOTUxMg==
5
5
  data.tar.gz: !binary |-
6
- MjUyY2E2M2M3MWY2OTQwZDY2ZTFhODRhMTM0OWU5ZWFhNTk0Y2MxYQ==
6
+ YjkxODRlNzYzMGE4ODBmNDAwM2E1ZmEwNzUyMmQ0M2UwOWEyYmY4Mg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YTA0MjcyMGE0YWI3OWYxNzQ2MDEwYzBhZjEwMWFhYTY4ZGZjYTNlNzdiZmUy
10
- ZGM0ZGFhNmUyMjAwMjdiMzYyZjY0YjA4YTYzOTNiMDY1OGE4ODdlYWE2YWU5
11
- NTdjOGZlMDRjYmNmOWJjMGRiZjJiN2IwMmQ4YzBjZGExYzZjNDM=
9
+ OGU0OTM0ZWE0NTY1OTQ1MzM0ODhmMGI2MjkxOTQ2ZGNkOTI2MTYzMzQ0ZTVj
10
+ NGY0NTM2MWQ2Mjk2MDVkYmI2NzNhY2JiNzg4Mzk1ZWZkYjEwYTNkOWY1YTRj
11
+ NjkxZmQ5N2Y4ZjQ1MGRiZTMxNjg3YWMzNGE1Yjk5NmM2YzczZGQ=
12
12
  data.tar.gz: !binary |-
13
- MGExZGNlNzFmZGRmMDM4MjU4OTE0NWY2OGEyZDg3Y2M1OGZlZmVhZDYyZjg4
14
- NjVjMGUyZWUzMjBiNGEyOWQ5OTRiMTFiMmQ5YTI0ZGY4NTk5ZjA3NjUzNzEx
15
- MjE1N2RjMTQzM2I0ZWM0MDM2N2VkOGNhNzhiMGRkOTlkZTNlOTk=
13
+ Njc2Y2E0YTczM2Q5NzdjNjQwYjUyOWU1MDg0OTEzN2E4YmVjZDkwMjNjMjlh
14
+ Y2U3ZmNlMzdhODMwYTU3MzYwYzZhZDMyOTZiMTBhMGRlZTdiMjE1MzZjYTll
15
+ Mjc2MDQ2N2Q5MzMxOThhMDQ3MWJkYzE4MjRhNjE2ZTZmNzRkOGM=
data/appveyor.yml ADDED
@@ -0,0 +1,27 @@
1
+ version: "master-{build}"
2
+
3
+ os: Windows Server 2012 R2
4
+ platform:
5
+ - x64
6
+
7
+ environment:
8
+ matrix:
9
+ - ruby_version: "21"
10
+
11
+ branches:
12
+ only:
13
+ - master
14
+
15
+ install:
16
+ - ps: $env:PATH="C:\Ruby$env:ruby_version\bin;$env:PATH"
17
+ - ps: Write-Host $env:PATH
18
+ - ps: ruby --version
19
+ - ps: gem --version
20
+ - ps: gem install bundler --quiet --no-ri --no-rdoc
21
+ - ps: bundler --version
22
+
23
+ build_script:
24
+ - bundle install || bundle install || bundle install
25
+
26
+ test_script:
27
+ - bundle exec rake test
data/bin/rig CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
-
2
+ #!ruby
3
3
  require_relative '../lib/inprovise'
4
4
 
5
5
  exit Inprovise::Cli.run(ARGV)
data/bin/rig.bat ADDED
@@ -0,0 +1,15 @@
1
+ @echo off
2
+ if not "%~f0" == "~f0" goto WinNT
3
+ ruby -Sx "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
4
+ goto endofruby
5
+ :WinNT
6
+ if not exist "%~d0%~p0ruby" goto rubyfrompath
7
+ if exist "%~d0%~p0ruby" "%~d0%~p0ruby" -x "%~dp0\rig" %*
8
+ goto endofruby
9
+ :rubyfrompath
10
+ ruby -x "%~dp0\rig" %*
11
+ goto endofruby
12
+ #!/bin/ruby
13
+ #
14
+ Kernel.system('ruby', '-Sx', File.join(File.dirname(__FILE__), FILE.basename(__FILE__, '.*')), *ARGV)
15
+ :endofruby
@@ -57,8 +57,13 @@ class Inprovise::Logger
57
57
  Thread.exclusive do
58
58
  $stdout.print "#{@node.to_s} [#{@task.bold}] " if @nl
59
59
  $stdout.print msg.sub("\r", "\r".to_eol << "#{@node.to_s} [#{@task.bold}] ")
60
+ @nl = false
60
61
  end
61
- @nl = false
62
+ end
63
+
64
+ def println(msg)
65
+ print(msg)
66
+ Thread.exclusive { $stdout.puts; @nl = true }
62
67
  end
63
68
 
64
69
  def stdout(msg, force=false)
@@ -72,8 +77,7 @@ class Inprovise::Logger
72
77
  def say(msg, color=nil, stream=$stdout)
73
78
  msg.to_s.split("\n").each do |line|
74
79
  out = color ? line.send(color) : line
75
- Thread.exclusive { stream.puts unless @nl; stream.puts "#{@node.to_s} [#{@task.bold}] #{out}" }
76
- @nl = true
80
+ Thread.exclusive { stream.puts unless @nl; stream.puts "#{@node.to_s} [#{@task.bold}] #{out}"; @nl = true }
77
81
  end
78
82
  end
79
83
  end
@@ -9,19 +9,46 @@ Inprovise::Sniffer.define('linux', false) do
9
9
 
10
10
  action('main') do |attrs|
11
11
  attrs[:machine] = run('uname -m').chomp
12
- if remote('/etc/os-release').exists?
13
- trigger 'sniff[linux]:os-release', attrs
14
- elsif remote('/etc/redhat-release').exists?
15
- trigger 'sniff[linux]:redhat-release', attrs
16
- elsif remote('/etc/SuSE-release').exists?
17
- trigger 'sniff[linux]:suse-release', attrs
12
+ if binary_exists?('lsb_release')
13
+ trigger 'sniff[linux]:lsb_release', attrs
14
+ elsif binary_exists?('lsb-release')
15
+ trigger 'sniff[linux]:lsb_release', attrs, 'lsb-release'
16
+ end
17
+ unless attrs[:os_distro]
18
+ if remote('/etc/os-release').exists?
19
+ trigger 'sniff[linux]:os-release', attrs
20
+ elsif remote('/etc/redhat-release').exists?
21
+ trigger 'sniff[linux]:redhat-release', attrs
22
+ elsif remote('/etc/SuSE-release').exists?
23
+ trigger 'sniff[linux]:suse-release', attrs
24
+ elsif remote('/etc/debian-version').exists?
25
+ trigger 'sniff[linux]:debian-version', attrs
26
+ end
18
27
  end
19
28
  attrs[:pkgman] = case attrs[:os_distro]
20
- when 'fedora', 'centos', 'rhel'
21
- binary_exists?('dnf') ? 'dnf' : 'yum'
22
- when /suse/
23
- 'zypper'
24
- end
29
+ when 'fedora', 'centos', 'rhel'
30
+ binary_exists?('dnf') ? 'dnf' : 'yum'
31
+ when 'linuxmint', 'ubuntu', 'debian'
32
+ 'apt'
33
+ when /suse/
34
+ 'zypper'
35
+ end
36
+ end
37
+
38
+ action('lsb_release') do |attrs, bin='lsb_release'|
39
+ if /distributor\s+id:\s+(.*)/i =~ run("#{bin} -i").chomp
40
+ attrs[:os_distro] = case distro = $1
41
+ when /RedHat/i
42
+ 'rhel'
43
+ when /SUSE/i
44
+ run("#{bin} -d").chomp =~ /opensuse/i ? 'opensuse' : 'suse'
45
+ else
46
+ distro.downcase
47
+ end
48
+ if /release:\s+(.*)/i =~ run("#{bin} -r").chomp
49
+ attrs[:os_version] = $1
50
+ end
51
+ end
25
52
  end
26
53
 
27
54
  action('os-release') do |attrs|
@@ -63,6 +90,21 @@ Inprovise::Sniffer.define('linux', false) do
63
90
  end
64
91
  end
65
92
 
93
+ action('suse-release') do |attrs|
94
+ data = remote('/etc/SuSE-release').content.split("\n").collect {|l| l.strip }
95
+ attrs[:os_distro] = data.shift.split(' ').first.downcase
96
+ data.each do |l|
97
+ if data =~ /\AVERSION\s*=\s*(.*)/i
98
+ attrs[:os_version] = $1.strip
99
+ end
100
+ end
101
+ end
102
+
103
+ action('debian-version') do |attrs|
104
+ attrs[:os_distro] = 'debian'
105
+ attrs[:os_version] = remote('/etc/debian-version').content.strip
106
+ end
107
+
66
108
  # :nocov:
67
109
 
68
110
  end
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Inprovise
7
7
 
8
- VERSION = '0.2.5'
8
+ VERSION = '0.2.6'
9
9
 
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inprovise
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Corino
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-04 00:00:00.000000000 Z
11
+ date: 2016-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colored
@@ -85,6 +85,7 @@ email:
85
85
  - mcorino@remedy.nl
86
86
  executables:
87
87
  - rig
88
+ - rig.bat
88
89
  extensions: []
89
90
  extra_rdoc_files: []
90
91
  files:
@@ -95,7 +96,9 @@ files:
95
96
  - LICENSE
96
97
  - README.md
97
98
  - Rakefile.rb
99
+ - appveyor.yml
98
100
  - bin/rig
101
+ - bin/rig.bat
99
102
  - inprovise.gemspec
100
103
  - lib/inprovise.rb
101
104
  - lib/inprovise/channel/ssh.rb