module Umami::Helper::FileTools
Public Instance Methods
enforce_styling(path = 'spec/umami/')
click to toggle source
Call Rubocop to ensure proper indentation and thus legibility.
# File lib/chef-umami/helpers/filetools.rb, line 30 def enforce_styling(path = 'spec/umami/') puts "Running Rubocop over '#{path}' to enforce styling..." r = RuboCop::CLI.new # Don't output to STDOUT. args = [ '--only', 'Layout/IndentationWidth,Layout/IndentationConsistency', '--auto-correct', '--out', '/dev/null', path ] r.run(args) end
write_file(path = nil, content = '')
click to toggle source
# File lib/chef-umami/helpers/filetools.rb, line 21 def write_file(path = nil, content = '') parent_dir = File.dirname(path) FileUtils.mkdir_p(parent_dir) unless ::File.exist?(parent_dir) f = File.open(path, 'w') # Write with prejudice. f.write(content) f.close end