Class: KnapsackPro::Config::TempFiles
- Inherits:
-
Object
- Object
- KnapsackPro::Config::TempFiles
- Defined in:
- lib/knapsack_pro/config/temp_files.rb
Constant Summary collapse
- TEMP_DIRECTORY_PATH =
relative to the directory where you run knapsack_pro gem (user’s project)
'.knapsack_pro'
Class Method Summary collapse
- .create_gitignore_file! ⇒ Object
- .create_temp_directory! ⇒ Object
- .ensure_temp_directory_exists! ⇒ Object
- .gitignore_file_content ⇒ Object
- .gitignore_file_path ⇒ Object
Class Method Details
.create_gitignore_file! ⇒ Object
35 36 37 38 39 |
# 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! ⇒ Object
18 19 20 |
# 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! ⇒ Object
9 10 11 12 13 14 |
# 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 ⇒ Object
26 27 28 29 30 31 32 33 |
# 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 ⇒ Object
22 23 24 |
# File 'lib/knapsack_pro/config/temp_files.rb', line 22 def self.gitignore_file_path File.join(TEMP_DIRECTORY_PATH, '.gitignore') end |