cg

Description

cg is A Ruby based HTML "contents generator".

Required RubyGems

  • rack
  • rake
  • jeweler
  • tilt
  • erubis
  • rdiscount

Install

  • RubyGems.org

    $ sudo gem install cg
    
  • GitHub

    $ git clone http://github.com/Tomohiro/cg.git
    $ rake build
    $ sudo rake install
    

Usage

  1. First Step

    $ cg scratch cg.example.com
    
  2. Convert

    $ cd cg.example.com/markdown/
    $ cg convert index.mkd
    

    e.g.

    $ cg convert cg.example.com/markdown/index.mkd
    => cg.example.com/index.html
    
    $ cg convert cg.example.com/markdown/foo+index.mkd
    => cg.example.com/foo/index.html
    
    $ cg convert cg.example.com/markdown/foo-bar+hello.mkd
    => cg.example.com/foo/bar/hello.html
    
  3. All Rebuild

    $ cd cg.example.com
    $ cg rebuild
    
  4. All Rebuild and Packing

    $ cd cg.example.com
    $ cg rebuild packing
    $ tar zxvf public.tar.gz -C /var/www/html/
    
  5. Server

    $ cg server
    

    Access to http://localhost:9292

    $ cg server -h host -p 8080
    

    Access to http://host:8080

    Want to run cg server as a daemon? use nohup.

    $ nohup cg server -h host -p 8080 > &
    

Tips

  1. Template customize

    $ vi templates/html.erb
    
  2. After save hook for Vim

    $ vi .vimrc
    
     autocmd BufWritePost *.mkd :silent !cg convert % > /dev/null
    
  3. After save hook for Emacs

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

Copyright

Copyright (c) 2010 Tomohiro, TAIRA.

Licence

The MIT License. See LICENSE for details.