Sha256: 3a029f1c2847c622f5844d7c77a951650e7b902f0c701a52f9c47a6ca1f7c727

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

# coding: utf-8

require 'tilt'
require 'fileutils'
require 'active_support/all'

module Gumdrop

  autoload :Context, "gumdrop/context"
  autoload :Content, "gumdrop/content"
  autoload :DataManager, "gumdrop/data_manager"
  autoload :Generator, "gumdrop/generator"
  autoload :HashObject, "gumdrop/hash_object"
  autoload :Pager, "gumdrop/data_manager"
  autoload :Server, "gumdrop/server"
  # autoload :Site, "gumdrop/site"
  autoload :VERSION, "gumdrop/version"
  autoload :ViewHelpers, "gumdrop/view_helpers"
  
  class << self

    def run(opts={})
      site_file= Gumdrop.fetch_site_file
      unless site_file.nil?
        site= Site.new site_file, opts

        site.build
        
        puts "Done."
      else
        puts "Not in a valid Gumdrop site directory."
      end
    end

    def in_site_folder?(filename="Gumdrop")
      !fetch_site_file(filename).nil?
    end

    def fetch_site_file(filename="Gumdrop")
      here= Dir.pwd
      found= File.file? File.join( here, filename )
      while !found and File.directory?(here) and File.dirname(here).length > 3
        here= File.expand_path File.join(here, '../')
        found= File.file? File.join( here, filename )
      end
      if found
        File.expand_path File.join(here, filename)
      else
        nil
      end
    end

    def site_dirname(filename="Gumdrop")
      File.dirname( fetch_site_file( filename ) )
    end

  end
  
end

require 'gumdrop/site'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gumdrop-0.6.1 lib/gumdrop.rb