Sha256: c182cc6b6ffa6151995cb6aba586cc2429a6cd5a4ca6b2d0736a5ca30a72f1e6

Contents?: true

Size: 1.39 KB

Versions: 1

Compression:

Stored size: 1.39 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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gumdrop-0.6.0 lib/gumdrop.rb