class Fastlane::Helper::NpmHelper
Public Class Methods
find_root_dir(dir = Dir.pwd)
click to toggle source
# File lib/fastlane/plugin/npm/helper/npm_helper.rb, line 8 def self.find_root_dir(dir = Dir.pwd) return dir if File.file?(File.join(dir, 'package.json')) parent_dir = File.expand_path("..", dir) return nil unless parent_dir != '/' find_root_dir parent_dir end
update_file_content(file_name:, search:, replace:)
click to toggle source
# File lib/fastlane/plugin/npm/helper/npm_helper.rb, line 17 def self.update_file_content(file_name:, search:, replace:) text = File.read(file_name) new_contents = text.gsub(search, replace) # To write changes to the file, use: File.open(file_name, "w") {|file| file.puts new_contents } end