Class RuGPost::Project
In: lib/rugpost/project.rb
Parent: Object

Methods

add_repo   config   init  

Public Class methods

[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

[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

[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

[Validate]