uoregon-multissh 0.3.3 → 0.3.4

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cli.rb +27 -20
  3. data/uoregon-multissh.gemspec +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d284c7f4d29ba2c2472e6f4d7c842105a2336af8c6f4c32a6031d09b2e561efa
4
- data.tar.gz: 856f4c7bfd5d3243933c10ebe93b5cd5d6e6094e3141e27ff6db51b4bf764aa2
3
+ metadata.gz: '097fb0d438ad8612a245a114c4a0a0ea83ca4ef4ba805991bc89ac5d07214947'
4
+ data.tar.gz: 0b962624d18475092a037a59c34d8680d0c7ed799c4441ebaee692723c5afcc8
5
5
  SHA512:
6
- metadata.gz: 6457ecbc9c7808e8a1bbaf8dc6838fe18da88c7b410f4a7a7477b0bb7b68db938347687d2bec6120db6f2a2b7420cfa30394bc0f59b5d93639e0fa011fc8c27e
7
- data.tar.gz: '05725282dc0715f76e083bf93cee7b2cf13cac7b3d3193f1510c51e13ddc90317cf6f26a2085276e3237796019d21856ee5a52b7b3f4c32875d56197c6716d16'
6
+ metadata.gz: da3a07426ac6106e01434cd93a7bb8bb62523ea2d9cc6d22578de9c9a35bbcb8b7b630a6a22409c6ca5bbe291200f82504443f2baf6ef32e0fc76f9503cd8a2b
7
+ data.tar.gz: 97a9c74220b38105b4bba788b7deef67fc5803b12285c11f850b0af8f0e741504ca7e6f48332164307df8039552ebacbb205d65e3e26624ac374276006b5d00e
data/lib/cli.rb CHANGED
@@ -35,6 +35,7 @@ class Cli
35
35
  @pkey_password = @options[:pkey_password]
36
36
 
37
37
  @debug = true if @options[:debug]
38
+ @util = Util.new(@debug)
38
39
  @regenerate = true if @options[:regenerate_config]
39
40
  @disable_sudo = true if @options[:disable_sudo]
40
41
 
@@ -67,20 +68,23 @@ class Cli
67
68
  # If '@' is used, return a list of nodes from a file
68
69
  # Otherwise return a list of nodes parsed from comma-separated input from cli
69
70
  #
71
+ @util.dbg("nodes: #{nodes}")
70
72
  if nodes.start_with?('@')
71
73
  node_list = []
72
74
  file_path = nodes[1..-1]
73
75
  expanded_file_path = File.expand_path(file_path)
74
- if File.exists? expanded_file_path
75
- File.open(expanded_file_path, 'r') do |f|
76
- f.each_line do |line|
77
- line.chomp!.strip!
78
- unless line.start_with?('#') || line.empty?
79
- node_list.append(line)
80
- end#unless
81
- end#f.each_line
82
- end#File.open
83
- end#File.exists?
76
+ @util.dbg("nodes_file: #{expanded_file_path}")
77
+ raise "File not found" unless File.exists?(expanded_file_path)
78
+
79
+ File.open(expanded_file_path, 'r') do |f|
80
+ f.each_line do |line|
81
+ line.chomp!.strip!
82
+ unless line.start_with?('#') || line.empty?
83
+ node_list << line
84
+ end
85
+ end
86
+ end
87
+
84
88
  return node_list
85
89
  else
86
90
  return nodes.split(',').map(&:strip)
@@ -93,20 +97,23 @@ class Cli
93
97
  # If '@' is used, return a command string from a file
94
98
  # Otherwise return specified command
95
99
  #
100
+ @util.dbg("command: #{command}")
96
101
  if command.start_with?('@')
97
102
  command_list = []
98
103
  file_path = command[1..-1]
99
104
  expanded_file_path = File.expand_path(file_path)
100
- if File.exists? expanded_file_path
101
- File.open(expanded_file_path, 'r') do |f|
102
- f.each_line do |line|
103
- line.chomp!.strip!
104
- unless line.start_with?('#') || line.empty?
105
- command_list.append(line)
106
- end#unless
107
- end#f.each_line
108
- end#File.open
109
- end#File.exists?
105
+ @util.dbg("command_file: #{expanded_file_path}")
106
+ raise "File not found" unless File.exists?(expanded_file_path)
107
+
108
+ File.open(expanded_file_path, 'r') do |f|
109
+ f.each_line do |line|
110
+ line.chomp!.strip!
111
+ unless line.start_with?('#') || line.empty?
112
+ command_list << line
113
+ end
114
+ end
115
+ end
116
+
110
117
  command_list.map! do |command|
111
118
  command = format_command(command, @disable_sudo)
112
119
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'uoregon-multissh'
3
- spec.version = '0.3.3'
3
+ spec.version = '0.3.4'
4
4
  spec.date = '2019-05-14'
5
5
  spec.summary = "Do all the things everywhere at the same time"
6
6
  spec.description = "Quickly run multiple commands on many boxes at the same time"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uoregon-multissh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas Crownover