@@ -80,7 +80,7 @@ def detect_os
8080 return Specinfra . configuration . os if Specinfra . configuration . os
8181 backend = Specinfra . backend
8282 node = get_working_node
83- if node [ 'platform' ] =~ / windows/
83+ if node [ 'platform' ] . include? ( ' windows' )
8484 return { :family => 'windows' }
8585 end
8686 Specinfra ::Helper ::DetectOs . subclasses . each do |c |
@@ -103,9 +103,9 @@ def get_windows_cmd(meth, *args)
103103 method += "_#{ subaction } " if subaction
104104
105105 common_class = Specinfra ::Command
106- base_class = common_class . const_get ( ' Base' )
107- os_class = common_class . const_get ( ' Windows' )
108- version_class = os_class . const_get ( ' Base' )
106+ base_class = common_class . const_get ( : Base)
107+ os_class = common_class . const_get ( : Windows)
108+ version_class = os_class . const_get ( : Base)
109109 command_class = version_class . const_get ( resource_type . to_camel_case )
110110
111111 command_class = command_class . create
@@ -126,7 +126,7 @@ class Runner
126126 def self . method_missing ( meth , *args )
127127 backend = Specinfra . backend
128128 node = get_working_node
129- if node [ 'platform' ] !~ / windows/
129+ if ! node [ 'platform' ] . include? ( ' windows' )
130130 processor = Specinfra ::Processor
131131 if processor . respond_to? ( meth )
132132 processor . send ( meth , *args )
@@ -144,14 +144,13 @@ def self.method_missing(meth, *args)
144144 end
145145 end
146146
147- private
148147
149148 def self . run ( meth , *args )
150149 backend = Specinfra . backend
151150 cmd = Specinfra . command . get ( meth , *args )
152151 backend = Specinfra . backend
153152 ret = backend . run_command ( cmd )
154- if meth . to_s =~ /^ check/
153+ if meth . to_s . start_with? ( ' check' )
155154 ret . success?
156155 else
157156 ret
@@ -189,7 +188,7 @@ def ssh_exec!(node, command)
189188 {
190189 :exit_status => r . exit_code ,
191190 :stdout => r . stdout ,
192- :stderr => r . stderr
191+ :stderr => r . stderr ,
193192 }
194193 end
195194
@@ -201,7 +200,7 @@ module Specinfra::Backend
201200 class BeakerDispatch < BeakerBase
202201
203202 def dispatch_method ( meth , *args )
204- if get_working_node [ 'platform' ] =~ / windows/
203+ if get_working_node [ 'platform' ] . include? ( ' windows' )
205204 cygwin_backend . send ( meth , *args )
206205 else
207206 exec_backend . send ( meth , *args )
@@ -232,7 +231,7 @@ class BeakerCygwin < BeakerBase
232231 # @param [String] cmd The serverspec command to executed
233232 # @param [Hash] opt No currently supported options
234233 # @return [Hash] Returns a hash containing :exit_status, :stdout and :stderr
235- def run_command ( cmd , opt = { } )
234+ def run_command ( cmd , _opt = { } )
236235 node = get_working_node
237236 script = create_script ( cmd )
238237 #when node is not cygwin rm -rf will fail so lets use native del instead
@@ -269,7 +268,7 @@ class BeakerExec < BeakerBase
269268 # @param [String] cmd The serverspec command to executed
270269 # @param [Hash] opt No currently supported options
271270 # @return [Hash] Returns a hash containing :exit_status, :stdout and :stderr
272- def run_command ( cmd , opt = { } )
271+ def run_command ( cmd , _opt = { } )
273272 node = get_working_node
274273 cmd = build_command ( cmd )
275274 cmd = add_pre_command ( cmd )
0 commit comments