Sha256: b5ed87c1e2e4734eda74a7326de0f59dd6055fcd6f3785902826da0326861f87

Contents?: true

Size: 601 Bytes

Versions: 1

Compression:

Stored size: 601 Bytes

Contents

module Klipp

  class Configuration
    @@auto_create_dirs = false # set by the gem's binary

    def self.auto_create_dirs
      @@auto_create_dirs
    end

    def self.auto_create_dirs= auto_create_dirs
      @@auto_create_dirs = auto_create_dirs
    end

    def self.auto_create(dir)
      if auto_create_dirs && File.directory?(File.dirname dir) && !File.exists?(dir)
        Dir.mkdir dir
      end
      dir
    end

    def self.root_dir
      auto_create File.join(Dir.home, '.klipp')
    end

    def self.templates_dir
      auto_create File.join(root_dir, 'templates')
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
klipp-0.0.1 lib/klipp/configuration.rb