gratan 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gratan/identifier/auto.rb +17 -4
- data/lib/gratan/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 437c36176e46ac6592882686c864bd6e76dccd48
|
4
|
+
data.tar.gz: d7fb16d23fe5cc5974527f7ba7800032f23da02d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4782fa7623292e29ce8c0d191768f14c0ecc8ded99901ca9320c617311a8a38f1c23578f856afda39ebf4d09f78657b487fff6ff238b1c2957e1f74f28fedc35
|
7
|
+
data.tar.gz: 2465ae129f83796bc2c4ebfc08e8d6efecdb278c1a625549f081d0f0a11513820260d9cfef680517751cc210566a4ff768c79ea977da5dab1a92d9a74926a3b1
|
@@ -1,12 +1,13 @@
|
|
1
1
|
class Gratan::Identifier::Auto
|
2
2
|
def initialize(output, options = {})
|
3
|
+
@output = output
|
3
4
|
@options = options
|
4
5
|
|
5
6
|
unless @options[:dry_run]
|
6
7
|
if output == '-'
|
7
8
|
@output = $stdout
|
8
9
|
else
|
9
|
-
@output =
|
10
|
+
@output = output
|
10
11
|
end
|
11
12
|
end
|
12
13
|
|
@@ -32,9 +33,21 @@ class Gratan::Identifier::Auto
|
|
32
33
|
end
|
33
34
|
|
34
35
|
def puts_password(user, host, password)
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
open_output do |f|
|
37
|
+
f.puts("#{user}@#{host},#{password}")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def open_output
|
42
|
+
return if @options[:dry_run]
|
43
|
+
|
44
|
+
if @output == '-'
|
45
|
+
yield($stdout)
|
46
|
+
$stdout.flush
|
47
|
+
else
|
48
|
+
open(@output, 'a') do |f|
|
49
|
+
yield(f)
|
50
|
+
end
|
38
51
|
end
|
39
52
|
end
|
40
53
|
end
|
data/lib/gratan/version.rb
CHANGED