Sha256: c98f9a9a20f17b5b3a2adc41c2941effb82b382f005b2c1dae2e371071fea582

Contents?: true

Size: 821 Bytes

Versions: 3

Compression:

Stored size: 821 Bytes

Contents

module Wtf
  class Core
      
    def current_path
      Dir.pwd
    end

    def has_documentation?
      File.exist?(wtf_file)
    end

    alias :is_documented? :has_documentation?

    def wtf_file
      current_path + '/.wtf'
    end

    def clean
      if is_documented?
        File.delete(wtf_file)
        true
      else
        puts not_documented
        nil
      end
    end

    def not_documented
      "This folder is not documented yet. Add a documentation by running: \n\n wtf doc -c 'a description of the folder'"
    end

    def write(data)
      File.open(wtf_file, 'w') {|f| f.write(data) }
    end

    def content
      if is_documented?
        data = File.read(wtf_file)
        data
      else
        puts not_documented
      end
    end

    alias :read_documentation :content

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wtf-doc-0.1.5 lib/wtf/core.rb
wtf-doc-0.1.4 lib/wtf/core.rb
wtf-doc-0.1.3 lib/wtf/core.rb