public
Description: Very customable gem skelton generator (Ruby)
Homepage: http://cutagem.rubyforge.org/
Clone URL: git://github.com/cho45/cutagem.git
hotchpotch (author)
Wed Jul 09 02:46:00 -0700 2008
commit  554e96ebb428844c97dc09a21040bf819fc5770e
tree    f108e3370f75a059b671bc2b9fbd38acdfdaad6a
parent  c32fa0bcb0a587f74234f764fafd89b092d0bf56
name age message
file ChangeLog Thu Dec 06 15:41:56 -0800 2007 lang/ruby/cutagem/templates/command/Rakefile, l... [walf443]
file README Wed Jan 09 10:35:53 -0800 2008 lang/ruby/cutagem/README: Fix doc bug. gi... [cho45]
file Rakefile Mon Oct 08 14:41:31 -0700 2007 /lang/ruby/cutagem/Rakefile, /lang/ruby/cutagem... [cho45]
directory bin/ Fri Oct 05 23:51:15 -0700 2007 lang/ruby/cutagem/Rakefile, lang/ruby/cutagem/l... [cho45]
directory lib/ Wed Jul 09 02:46:00 -0700 2008 author/email を git-config --global な conf から取得、... [hotchpotch]
directory templates/ Tue May 20 03:27:19 -0700 2008 add debug_gem task that like hoe tasks [Yuichi Tateno]
directory test/ Sat Oct 06 19:00:23 -0700 2007 lang/ruby/cutagem/test/test_helper.rb, lang/rub... [cho45]
README
= cutagem - Cut a Gem for creating new beautiful gem.

by cho45 <cho45@lowreal.net>

== Description

cutagem (Cut a Gem) is yet another executable for creating gem skelton.

This is similar in concept to newgem[http://newgem.rubyforge.org/] but
more customizable for each user.

cutagem (Cut a Gem: 宝石のカット) は新しい gem のスケルトンを作るコマンドです。

newgem[http://newgem.rubyforge.org/] とよく似たものですが、cutagem は
各ユーザがカスタマイズしやすいようになっています。

== Concept

* User customizable templates.
* Not use hoe, etc. Because it makes difficult to customize the created Rakefile.
  A time like this, copy and paste is better than DRY.
* Do not use more config file which is written what can be written in Rakefile
  in default template.

   

* ユーザ固有のテンプレート
* hoe とかを使いません。これは生成された Rakefile を更めてその gem 用に
  カスタマイズしたいときにめんどくさくないようにです。
* このパッケージのテンプレートは、
  Rakefile に書けば済むことを設定として分離したりしません。

== Installation

=== Gem Installation

  gem install cutagem

=== Subversion Repository

Hosted by CodeRepos[http://coderepos.org/share/browser/lang/ruby/cutagem]

  svn co http://svn.coderepos.org/share/lang/ruby/cutagem/

== Usage

Most simple sample:

  $ cutagem gemname
  Using Template: .cutagem/templates/default
  ~/.cutagem/config.yaml is not found. Use default.
  cp -r /pathto/templates/default /pathto/gemname
  Rename test/gemname_test.rb to test/gemname_test.rb
  Rename lib/gempath.rb to lib/gemname.rb
  Done.
  Type any key to edit Rakefile.
  

When +gemname+ includes hyphens, it's replaced with "/".

  $ cutagem module-test
  Using Template: .cutagem/templates/default
  ~/.cutagem/config.yaml is found. Use it.
  cp -r /pathto/templates/default /pathto/module-test
  Rename test/gemname_test.rb to test/module-test_test.rb
  Rename lib/gempath.rb to lib/module/test.rb
  Done.
  Type any key to edit Rakefile.


  $ ls module-test/lib/module/test.rb
  module-test/lib/module/test.rb


Select templates interactively. (<code>-s</code>, <code>--select</code> option)

  $ cutagem -s module-test
  Select template:
   1. .cutagem/templates/default
   2. default
   3. command
  1
  Using Template: .cutagem/templates/default
  ~/.cutagem/config.yaml is found. Use it.
  cp -r /pathto/templates/default /pathto/module-test
  Rename test/gemname_test.rb to test/module-test_test.rb
  Rename lib/gempath.rb to lib/module/test.rb
  Done.
  Type any key to edit Rakefile.


Edit user configuration.

  $ cutagem -c
  [Open ~/.cutagem/config.yaml with $EDITOR]

Other options:

  Usage: cutagem [options] gemname
  
  Options:
  -s, --select                     Select template interactively.
  -d, --desc                       Describe this gem.
  -c, --config                     Configure user values. Use $EDITOR
      --copy-template NAME         Copy template to user template dir naming NAME
      --version                    Show version string `0.0.2'


== Customization

+cutagem+ reads ~/.cutagem/templates/* for using it as custom template.
Especially "default" template is precedence.

You can make new template by coping the existing template using '--copy-template NAME' option.

=== Priority Example

Library installed templates:

* default
* command

User templates:

* ~/.cutagem/templates/default
* ~/.cutagem/templates/foobar

Priority order:

1. ~/.cutagem/templates/default
2. ~/.cutagem/templates/foobar
3. default (system)
4. command (system)

If you want to check this priority, add <code>-s</code>, <code>--select</code> option to +cutagem+.


=== Template Spec.

==== File Name Replacement

[gemname]
  The argument +gemname+.
[gempath]
  The string created by replacing "-" with "/" in +gemname+.
  (ex. gemname is <code>hoge-hoge</code> then, gempath is <code>hoge/hoge</code>)
  The path is automatically created.

==== ERB Replacement

All files process through ERB.

[<%=gemname%>]
  same as filename.
[<%=gempath%>]
  same as filename.
[<%=gemclass%>]
  classfied gemname.
  (ex. gemname is <code>hoge-hoge_fuga</code> then, gemclass is <code>Hoge::HogeFuga</code>)
[<%=author%>]
  ENV["USER"] or ~/.cutagem/config.yaml#author
[<%=email%>]
  <code>#{ENV["USER"]}@#{ENV["HOST"]}</code> or ~/.cutagem/config.yaml#email
[<%=description%>]
  <code>-d</code>, <code>--desc</code> option's value
[<%=config["user_config_value"]%>]
  Replace with ~/.cutagem/config.yaml entry.

Of course ERB is Ruby, you can write everything in the bracket.

== Copyright

Author::    cho45 <cho45@lowreal.net>
Copyright:: Copyright (c) 2007 cho45 www.lowreal.net
License::   Ruby's