Sha256: 64053cf073a40fe6d5339ad17a72ff11eb45ad85b57e8daa87068e1c86b50567

Contents?: true

Size: 853 Bytes

Versions: 6

Compression:

Stored size: 853 Bytes

Contents

module Shutter
  class Files
    include Shutter::Content
    
    class << self
      include Shutter::Content
      def create(dir, overwrite=false, except=[])
        CONFIG_FILES.each do |name|
          file = "#{dir}/#{name}"
          if !File.exists?(file) || overwrite || except.include?(name)
            File.open(file, 'w') do |f| 
              f.write(const_get(name.upcase.gsub(/\./, "_")))
            end
          end
        end
      end

      def create_config_dir(config_path)
        # Check to see if the path to the config files exist
        unless File.directory?(config_path)
          begin
            Dir.mkdir(config_path)
          rescue Errno::ENOENT
            raise "Could not create the configuration directory.  Check to see if the parent directory exists."
          end
        end
      end
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
shutter-0.2.5 lib/shutter/files.rb
shutter-0.2.4 lib/shutter/files.rb
shutter-0.2.3 lib/shutter/files.rb
shutter-0.2.2 lib/shutter/files.rb
shutter-0.2.0 lib/shutter/files.rb
shutter-0.1.0 lib/shutter/files.rb