class KnapsackPro::Config::TempFiles

Constants

TEMP_DIRECTORY_PATH

relative to the directory where you run knapsack_pro gem (user’s project)

Public Class Methods

create_gitignore_file!() click to toggle source
# File lib/knapsack_pro/config/temp_files.rb, line 35
def self.create_gitignore_file!
  File.open(gitignore_file_path, 'w+') do |f|
    f.write(gitignore_file_content)
  end
end
create_temp_directory!() click to toggle source
# File lib/knapsack_pro/config/temp_files.rb, line 18
def self.create_temp_directory!
  FileUtils.mkdir_p(TEMP_DIRECTORY_PATH)
end
ensure_temp_directory_exists!() click to toggle source
# File lib/knapsack_pro/config/temp_files.rb, line 9
def self.ensure_temp_directory_exists!
  unless File.exist?(gitignore_file_path)
    create_temp_directory!
    create_gitignore_file!
  end
end
gitignore_file_content() click to toggle source
# File lib/knapsack_pro/config/temp_files.rb, line 26
      def self.gitignore_file_content
        <<~GITIGNORE
        # This directory is used by knapsack_pro gem for storing temporary files during tests runtime.
        # Ignore all files, and do not commit this directory into your repository.
        # Learn more at https://knapsackpro.com
        *
        GITIGNORE
      end
gitignore_file_path() click to toggle source
# File lib/knapsack_pro/config/temp_files.rb, line 22
def self.gitignore_file_path
  File.join(TEMP_DIRECTORY_PATH, '.gitignore')
end