Class: Jekyll::BlogGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Jekyll::BlogGenerator
- Defined in:
- lib/generators/jekyll/blog/blog_generator.rb
Instance Method Summary collapse
- #copy_config_file ⇒ Object
- #create_blog(source = 'config/jekyll', destination = File.join('public',"#{name}")) ⇒ Object
Instance Method Details
#copy_config_file ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/generators/jekyll/blog/blog_generator.rb', line 5 def copy_config_file template 'config/jekyll/_config.yml.tt', 'config/jekyll/_config.yml' copy_file 'config/jekyll/atom.xml.tt', 'config/jekyll/atom.xml' template 'config/jekyll/index.html.tt', 'config/jekyll/index.html' template 'config/jekyll/_layouts/default.html.tt', 'config/jekyll/_layouts/default.html' template 'config/jekyll/_layouts/post.html.tt', 'config/jekyll/_layouts/post.html' copy_file 'config/jekyll/_layouts/page.html.tt', 'config/jekyll/_layouts/page.html' copy_file 'config/jekyll/_posts/2014-01-11-a-test-post.markdown.tt', 'config/jekyll/_posts/2014-01-11-a-test-post.markdown' copy_file 'config/jekyll/css/screen.css.tt', 'config/jekyll/css/screen.css' copy_file 'config/jekyll/css/syntax.css.tt', 'config/jekyll/css/syntax.css' copy_file 'tasks/new_post.rake.tt', 'lib/tasks/new_post.rake' copy_file 'tasks/gen.rake.tt', 'lib/tasks/gen.rake' end |
#create_blog(source = 'config/jekyll', destination = File.join('public',"#{name}")) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/generators/jekyll/blog/blog_generator.rb', line 19 def create_blog source = 'config/jekyll', destination = File.join('public',"#{name}") = { 'source' => source, 'destination' => destination } source_dir = 'config/jekyll' = Jekyll.configuration() site = Jekyll::Site.new() begin site.process rescue Jekyll::FatalException => e puts puts "ERROR: YOUR SITE COULD NOT BE BUILT:" puts "------------------------------------" puts e. exit(1) end puts "Successfully generated site: #{source} -> #{destination}" end |