File: path_helpers.rb

package info (click to toggle)
ruby-buff-ignore 1.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 164 kB
  • sloc: ruby: 183; makefile: 3
file content (29 lines) | stat: -rw-r--r-- 650 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require 'fileutils'
require 'pathname'

module Buff::Ignore
  module RSpec
    module PathHelpers
      # The tmp path where testing support/workspaces are
      #
      # @return [Pathname]
      def tmp_path
        @_tmp_path ||= app_root.join('tmp').expand_path
      end

      private
        # The "root" of berkshelf
        #
        # @return [Pathname]
        def app_root
          @_app_root ||= Pathname.new(File.expand_path('../../..', __FILE__))
        end

        # Clean the temporary directories
        def clean_tmp_path!
          FileUtils.rm_rf(tmp_path)
          FileUtils.mkdir_p(tmp_path)
        end
    end
  end
end