Sha256: 8217fc320349a494fd591f3b387a49246125a1be8cfc99b6843a79b9210cd936

Contents?: true

Size: 654 Bytes

Versions: 12

Compression:

Stored size: 654 Bytes

Contents

require 'securerandom'

module Papa
  module Helper
    class Path
      TMP_PATH = '/tmp/'
      VI_PREFIX = 'papa-vi-'
      SANDBOX_PREFIX = 'papa-sandbox-'

      def self.generate_vi_file_path
        File.join(TMP_PATH, VI_PREFIX + uuid_gen + '.txt')
      end

      def self.generate_sandbox_path(type, options = {})
        path =
          if options.has_key?('override_path_prefix')
            options[:override_path_prefix] + '-' + type
          else
            SANDBOX_PREFIX + type + '-' +  uuid_gen
          end
        File.join(TMP_PATH, path)
      end

      def self.uuid_gen
        SecureRandom.uuid
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
papa-1.2.0 lib/papa/helper/path.rb
papa-1.1.0 lib/papa/helper/path.rb
papa-1.0.0 lib/papa/helper/path.rb
papa-0.7.2 lib/papa/helper/path.rb
papa-0.7.1 lib/papa/helper/path.rb
papa-0.7.0 lib/papa/helper/path.rb
papa-0.6.2 lib/papa/helper/path.rb
papa-0.6.1 lib/papa/helper/path.rb
papa-0.6.0 lib/papa/helper/path.rb
papa-0.5.0 lib/papa/helper/path.rb
papa-0.4.1 lib/papa/helper/path.rb
papa-0.4.0 lib/papa/helper/path.rb