Sha256: 679269b26e9654cef53ce095c51f90c44f428dbf344a5ca06184c9a7ee98888d

Contents?: true

Size: 1.57 KB

Versions: 3

Compression:

Stored size: 1.57 KB

Contents

class Jekyll::BlogGenerator < Rails::Generators::NamedBase
    source_root File.expand_path('../templates', __FILE__)

    def copy_config_file
        copy_file 'config/jekyll/_config.yml.tt', 'config/jekyll/_config.yml'
        copy_file 'config/jekyll/atom.xml.tt', 'config/jekyll/atom.xml'
        copy_file 'config/jekyll/index.html.tt', 'config/jekyll/index.html'
        copy_file 'config/jekyll/_layouts/default.html.tt', 'config/jekyll/_layouts/default.html'
        copy_file 'config/jekyll/_layouts/page.html.tt', 'config/jekyll/_layouts/page.html'
        copy_file 'config/jekyll/_layouts/post.html.tt', 'config/jekyll/_layouts/post.html'
        copy_file 'config/jekyll/_posts/2012-04-25-a-test-post.markdown.tt', 'config/jekyll/_posts/2012-04-25-a-test-post.markdown'
        copy_file 'config/jekyll/css/screen.css', 'config/jekyll/css/screen.css'
        copy_file 'config/jekyll/css/syntax.css', 'config/jekyll/css/syntax.css'
    end

    def create_blog source = 'config/jekyll', destination = 'public/blog'
        options = {
            'source' => source,
            'destination' => destination
        }
        source_dir = 'config/jekyll'
        options = Jekyll.configuration(options)
        site = Jekyll::Site.new(options)
        
        begin
          site.process
        rescue Jekyll::FatalException => e
          puts
          puts "ERROR: YOUR SITE COULD NOT BE BUILT:"
          puts "------------------------------------"
          puts e.message
          exit(1)
        end
        puts "Successfully generated site: #{source} -> #{destination}"
    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bloggy-0.0.7 lib/generators/jekyll/blog/blog_generator.rb
bloggy-0.0.4 lib/generators/jekyll/blog/blog_generator.rb
bloggy-0.0.3 lib/generators/jekyll/blog/blog_generator.rb