class RuGPost::Project

Public Class Methods

add_repo(args=[],ops={}) click to toggle source
# File lib/rugpost/project.rb, line 10
def Project.add_repo(args=[],ops={})
        raise "Must supply repo name" unless args.size == 1
        raise "Site repo already exists" if File.exist?(args[0])
        # create repository structure
        puts "Adding new site repository: #{args[0]}..."
        repo = args[0]
        Dir.mkdir(repo)
        Dir.mkdir(repo/'drafts')
        Dir.mkdir(repo/'published')
        Dir.mkdir(repo/'published/source')
        Dir.mkdir(repo/'published/output')
end
config(args=[],ops={}) click to toggle source
# File lib/rugpost/project.rb, line 23
def Project.config(args=[],ops={})
        # load configuration as hash
        config = YAML.load_file( CONFIG )
        # set key
        config.merge!(ops)
        # hash to config
        File.open( CONFIG,'w' ) {|f| f.write( config.to_yaml )}
end
init(args=[],ops={}) click to toggle source
# File lib/rugpost/project.rb, line 4
def Project.init(args=[],ops={})
        puts "Initializing RuGPost project under current directory..."
        File.open( CONFIG, 'w' ) { |f| f.write("---\n:gmail: notset") }
        File.open( TEMPLATE, 'w' ) {|f| f.write(template_meta + "---\n" + template_body)}
end