global
def oauth_scaffold_file(file, options)
def oauth_scaffold_file(file, options) transformed_file_name = oauth_transform_string(file, options) transformed_file_content = [] empty_transformer = Scaffolding::Transformer.new("", "") skipping = false File.open(empty_transformer.resolve_template_path(file)).each_line do |line| if line.include?("# 🚅 skip when scaffolding.") next end if line.include?("# 🚅 skip this section when scaffolding.") skipping = true next end if line.include?("# 🚅 stop any skipping we're doing now.") skipping = false next end if skipping next end # remove lines with 'remove in scaffolded files.' unless line.include?("remove in scaffolded files.") # only transform it if it doesn't have the lock emoji. if line.include?("🔒") # remove any comments that start with a lock. line.gsub!(/\s+?#\s+🔒.*/, "") else line = oauth_transform_string(line, options) end transformed_file_content << line end end transformed_file_content = transformed_file_content.join transformed_directory_name = File.dirname(transformed_file_name) unless File.directory?(transformed_directory_name) FileUtils.mkdir_p(transformed_directory_name) end puts "Writing '#{transformed_file_name}'." unless silence_logs? File.write(transformed_file_name, transformed_file_content) end