genki-cutagem 0.0.8.1

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog ADDED
@@ -0,0 +1,38 @@
1
+ 2007-12-07 Keiji Yoshimi <walf443@gmail.com>
2
+ * Add --gem-class option.
3
+ * Fixed typo of default template.
4
+
5
+ 2007-10-11 SATOH Hiroh <cho45@lowreal.net>
6
+
7
+ * 0.0.6 release:
8
+ * Fixed typo of default templates.
9
+
10
+ 2007-10-10 SATOH Hiroh <cho45@lowreal.net>
11
+
12
+ * 0.0.5 release:
13
+ * Fixed default template dependecy.
14
+ * Fixed default template README replacement.
15
+
16
+ 2007-10-09 SATOH Hiroh <cho45@lowreal.net>
17
+
18
+ * 0.0.4 release:
19
+ * Add dependency to Resh (resh).
20
+ * Fixed default template dependeny.
21
+
22
+ 2007-10-08 SATOH Hiroh <cho45@lowreal.net>
23
+
24
+ * 0.0.3 release:
25
+ * Fix Rakefile for case-sensitive system.
26
+ * Output more verbosely.
27
+
28
+ 2007-10-07 SATOH Hiroh <cho45@lowreal.net>
29
+
30
+ * 0.0.2 release:
31
+ * use ~/.cutagem/config.yaml as user config.
32
+ * Rename ChangeLog
33
+
34
+ 2007-10-07 SATOH Hiroh <cho45@lowreal.net>
35
+
36
+ * 0.0.1 release:
37
+
38
+
data/README ADDED
@@ -0,0 +1,177 @@
1
+
2
+ = cutagem - Cut a Gem for creating new beautiful gem.
3
+
4
+ by cho45 <cho45@lowreal.net>
5
+
6
+ == Description
7
+
8
+ cutagem (Cut a Gem) is yet another executable for creating gem skelton.
9
+
10
+ This is similar in concept to newgem[http://newgem.rubyforge.org/] but
11
+ more customizable for each user.
12
+
13
+ cutagem (Cut a Gem: 宝石のカット) は新しい gem のスケルトンを作るコマンドです。
14
+
15
+ newgem[http://newgem.rubyforge.org/] とよく似たものですが、cutagem は
16
+ 各ユーザがカスタマイズしやすいようになっています。
17
+
18
+ == Concept
19
+
20
+ * User customizable templates.
21
+ * Not use hoe, etc. Because it makes difficult to customize the created Rakefile.
22
+ A time like this, copy and paste is better than DRY.
23
+ * Do not use more config file which is written what can be written in Rakefile
24
+ in default template.
25
+
26
+
27
+
28
+ * ユーザ固有のテンプレート
29
+ * hoe とかを使いません。これは生成された Rakefile を更めてその gem 用に
30
+ カスタマイズしたいときにめんどくさくないようにです。
31
+ * このパッケージのテンプレートは、
32
+ Rakefile に書けば済むことを設定として分離したりしません。
33
+
34
+ == Installation
35
+
36
+ === Gem Installation
37
+
38
+ gem install cutagem
39
+
40
+ === Subversion Repository
41
+
42
+ Hosted by CodeRepos[http://coderepos.org/share/browser/lang/ruby/cutagem]
43
+
44
+ svn co http://svn.coderepos.org/share/lang/ruby/cutagem/
45
+
46
+ == Usage
47
+
48
+ Most simple sample:
49
+
50
+ $ cutagem gemname
51
+ Using Template: .cutagem/templates/default
52
+ ~/.cutagem/config.yaml is not found. Use default.
53
+ cp -r /pathto/templates/default /pathto/gemname
54
+ Rename test/gemname_test.rb to test/gemname_test.rb
55
+ Rename lib/gempath.rb to lib/gemname.rb
56
+ Done.
57
+ Type any key to edit Rakefile.
58
+
59
+
60
+ When +gemname+ includes hyphens, it's replaced with "/".
61
+
62
+ $ cutagem module-test
63
+ Using Template: .cutagem/templates/default
64
+ ~/.cutagem/config.yaml is found. Use it.
65
+ cp -r /pathto/templates/default /pathto/module-test
66
+ Rename test/gemname_test.rb to test/module-test_test.rb
67
+ Rename lib/gempath.rb to lib/module/test.rb
68
+ Done.
69
+ Type any key to edit Rakefile.
70
+
71
+
72
+ $ ls module-test/lib/module/test.rb
73
+ module-test/lib/module/test.rb
74
+
75
+
76
+ Select templates interactively. (<code>-s</code>, <code>--select</code> option)
77
+
78
+ $ cutagem -s module-test
79
+ Select template:
80
+ 1. .cutagem/templates/default
81
+ 2. default
82
+ 3. command
83
+ 1
84
+ Using Template: .cutagem/templates/default
85
+ ~/.cutagem/config.yaml is found. Use it.
86
+ cp -r /pathto/templates/default /pathto/module-test
87
+ Rename test/gemname_test.rb to test/module-test_test.rb
88
+ Rename lib/gempath.rb to lib/module/test.rb
89
+ Done.
90
+ Type any key to edit Rakefile.
91
+
92
+
93
+ Edit user configuration.
94
+
95
+ $ cutagem -c
96
+ [Open ~/.cutagem/config.yaml with $EDITOR]
97
+
98
+ Other options:
99
+
100
+ Usage: cutagem [options] gemname
101
+
102
+ Options:
103
+ -s, --select Select template interactively.
104
+ -d, --desc Describe this gem.
105
+ -c, --config Configure user values. Use $EDITOR
106
+ --copy-template NAME Copy template to user template dir naming NAME
107
+ --version Show version string `0.0.2'
108
+
109
+
110
+ == Customization
111
+
112
+ +cutagem+ reads ~/.cutagem/templates/* for using it as custom template.
113
+ Especially "default" template is precedence.
114
+
115
+ You can make new template by coping the existing template using '--copy-template NAME' option.
116
+
117
+ === Priority Example
118
+
119
+ Library installed templates:
120
+
121
+ * default
122
+ * command
123
+
124
+ User templates:
125
+
126
+ * ~/.cutagem/templates/default
127
+ * ~/.cutagem/templates/foobar
128
+
129
+ Priority order:
130
+
131
+ 1. ~/.cutagem/templates/default
132
+ 2. ~/.cutagem/templates/foobar
133
+ 3. default (system)
134
+ 4. command (system)
135
+
136
+ If you want to check this priority, add <code>-s</code>, <code>--select</code> option to +cutagem+.
137
+
138
+
139
+ === Template Spec.
140
+
141
+ ==== File Name Replacement
142
+
143
+ [gemname]
144
+ The argument +gemname+.
145
+ [gempath]
146
+ The string created by replacing "-" with "/" in +gemname+.
147
+ (ex. gemname is <code>hoge-hoge</code> then, gempath is <code>hoge/hoge</code>)
148
+ The path is automatically created.
149
+
150
+ ==== ERB Replacement
151
+
152
+ All files process through ERB.
153
+
154
+ [<%=gemname%>]
155
+ same as filename.
156
+ [<%=gempath%>]
157
+ same as filename.
158
+ [<%=gemclass%>]
159
+ classfied gemname.
160
+ (ex. gemname is <code>hoge-hoge_fuga</code> then, gemclass is <code>Hoge::HogeFuga</code>)
161
+ [<%=author%>]
162
+ ENV["USER"] or ~/.cutagem/config.yaml#author
163
+ [<%=email%>]
164
+ <code>#{ENV["USER"]}@#{ENV["HOST"]}</code> or ~/.cutagem/config.yaml#email
165
+ [<%=description%>]
166
+ <code>-d</code>, <code>--desc</code> option's value
167
+ [<%=config["user_config_value"]%>]
168
+ Replace with ~/.cutagem/config.yaml entry.
169
+
170
+ Of course ERB is Ruby, you can write everything in the bracket.
171
+
172
+ == Copyright
173
+
174
+ Author:: cho45 <cho45@lowreal.net>
175
+ Copyright:: Copyright (c) 2007 cho45 www.lowreal.net
176
+ License:: Ruby's
177
+
data/Rakefile ADDED
@@ -0,0 +1,149 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/clean'
4
+ require 'rake/testtask'
5
+ require 'rake/packagetask'
6
+ require 'rake/gempackagetask'
7
+ require 'rake/rdoctask'
8
+ require 'rake/contrib/rubyforgepublisher'
9
+ require 'fileutils'
10
+ require 'rubyforge'
11
+ include FileUtils
12
+
13
+ AUTHOR = "cho45"
14
+ EMAIL = "cho45@lowreal.net"
15
+ DESCRIPTION = "executable for making new gem skelton."
16
+ RUBYFORGE_PROJECT = "cutagem"
17
+ HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
18
+ BIN_FILES = %w( cutagem )
19
+
20
+ #VERS = File.read("#{File.dirname(__FILE__)}/bin/cutagem")[/VERSION = "(\d\.\d\.\d)"/, 1]
21
+ load "#{File.dirname(__FILE__)}/lib/cutagem.rb"
22
+ VERS = CutAGemCommand::VERSION
23
+
24
+
25
+ NAME = "cutagem"
26
+ REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
27
+ CLEAN.include ['**/.*.sw?', '*.gem', '.config']
28
+ RDOC_OPTS = [
29
+ '--title', "#{NAME} documentation",
30
+ "--charset", "utf-8",
31
+ "--opname", "index.html",
32
+ "--line-numbers",
33
+ "--main", "README",
34
+ "--inline-source",
35
+ ]
36
+
37
+ desc "Packages up #{NAME} gem."
38
+ task :default => [:test]
39
+ task :package => [:clean]
40
+
41
+ Rake::TestTask.new("test") { |t|
42
+ t.libs << "test"
43
+ t.pattern = "test/**/*_test.rb"
44
+ t.verbose = true
45
+ }
46
+
47
+ spec = Gem::Specification.new do |s|
48
+ s.name = NAME
49
+ s.version = VERS
50
+ s.platform = Gem::Platform::RUBY
51
+ s.has_rdoc = true
52
+ s.extra_rdoc_files = ["README", "ChangeLog"]
53
+ s.rdoc_options += RDOC_OPTS + ['--exclude', '^(examples|extras)/']
54
+ s.summary = DESCRIPTION
55
+ s.description = DESCRIPTION
56
+ s.author = AUTHOR
57
+ s.email = EMAIL
58
+ s.homepage = HOMEPATH
59
+ s.executables = BIN_FILES
60
+ s.rubyforge_project = RUBYFORGE_PROJECT
61
+ s.bindir = "bin"
62
+ s.require_path = "lib"
63
+ s.autorequire = ""
64
+ s.test_files = Dir["test/test_*.rb"]
65
+
66
+ s.add_dependency('resh')
67
+ #s.add_dependency('activesupport', '>=1.3.1')
68
+ #s.required_ruby_version = '>= 1.8.2'
69
+
70
+ s.files = %w(README ChangeLog Rakefile) +
71
+ Dir.glob("{bin,doc,test,lib,templates,generator,extras,website,script}/**/*") +
72
+ Dir.glob("ext/**/*.{h,c,rb}") +
73
+ Dir.glob("examples/**/*.rb") +
74
+ Dir.glob("templates/**/*") +
75
+ Dir.glob("tools/*.rb")
76
+
77
+ s.extensions = FileList["ext/**/extconf.rb"].to_a
78
+ end
79
+
80
+ Rake::GemPackageTask.new(spec) do |p|
81
+ p.need_tar = true
82
+ p.gem_spec = spec
83
+ end
84
+
85
+ task :install do
86
+ name = "#{NAME}-#{VERS}.gem"
87
+ sh %{rake package}
88
+ sh %{sudo gem install pkg/#{name}}
89
+ end
90
+
91
+ task :uninstall => [:clean] do
92
+ sh %{sudo gem uninstall #{NAME}}
93
+ end
94
+
95
+
96
+ Rake::RDocTask.new do |rdoc|
97
+ rdoc.rdoc_dir = 'html'
98
+ rdoc.options += RDOC_OPTS
99
+ rdoc.template = "#{ENV["HOME"]}/coderepos/lang/ruby/rdoc/generators/template/html/resh/resh.rb"
100
+ #rdoc.template = "#{ENV['template']}.rb" if ENV['template']
101
+ if ENV['DOC_FILES']
102
+ rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
103
+ else
104
+ rdoc.rdoc_files.include('README', 'ChangeLog')
105
+ rdoc.rdoc_files.include('lib/**/*.rb')
106
+ rdoc.rdoc_files.include('ext/**/*.c')
107
+ rdoc.rdoc_files.include('bin/**/*')
108
+ end
109
+ end
110
+
111
+ desc "Publish to RubyForge"
112
+ task :rubyforge => [:rdoc, :package] do
113
+ Rake::RubyForgePublisher.new(RUBYFORGE_PROJECT, 'cho45').upload
114
+ end
115
+
116
+ desc 'Package and upload the release to rubyforge.'
117
+ task :release => [:clean, :package, :release_local] do |t|
118
+ v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
119
+ abort "Versions don't match #{v} vs #{VERS}" unless v == VERS
120
+ pkg = "pkg/#{NAME}-#{VERS}"
121
+
122
+ rf = RubyForge.new
123
+ puts "Logging in"
124
+ rf.login
125
+
126
+ c = rf.userconfig
127
+ # c["release_notes"] = description if description
128
+ # c["release_changes"] = changes if changes
129
+ c["preformatted"] = true
130
+
131
+ files = [
132
+ "#{pkg}.tgz",
133
+ "#{pkg}.gem"
134
+ ].compact
135
+
136
+ puts "Releasing #{NAME} v. #{VERS}"
137
+ rf.add_release RUBYFORGE_PROJECT, NAME, VERS, *files
138
+ end
139
+
140
+ desc "Package and upload the release to local gem repos."
141
+ task :release_local => [:clean, :package] do |t|
142
+ name = "#{NAME}-#{VERS}.gem"
143
+ sh %{scp pkg/#{name} c:/srv/www/lab.lowreal.net/public/gems/gems}
144
+ end
145
+
146
+ desc 'Update gem spec'
147
+ task :gemspec do
148
+ open("#{NAME}.gemspec", 'w').write spec.to_ruby
149
+ end
data/bin/cutagem ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ # vim:ft=ruby:
3
+
4
+ require "rubygems"
5
+ require "cutagem"
6
+
7
+ CutAGemCommand.new(ARGV).run
data/lib/cutagem.rb ADDED
@@ -0,0 +1,216 @@
1
+
2
+ require "optparse"
3
+ require "pathname"
4
+ require "fileutils"
5
+ require "erb"
6
+ require "yaml"
7
+
8
+ class CutAGemCommand
9
+ VERSION = "0.0.8.1"
10
+
11
+ include FileUtils
12
+ def self.run(argv)
13
+ new(argv.dup).run
14
+ end
15
+
16
+ def initialize(argv)
17
+ @argv = argv
18
+
19
+ @config = Pathname.new(ENV["HOME"]) + ".cutagem/config.yaml"
20
+ @parser = OptionParser.new do |parser|
21
+ parser.banner = <<-EOB.gsub(/^\t+/, "")
22
+ Usage: #$0 [options] gemname
23
+ EOB
24
+
25
+ parser.separator ""
26
+ parser.separator "Options:"
27
+
28
+ parser.on("-s", "--select", "Select template interactively.") do |select|
29
+ @select = select
30
+ end
31
+
32
+ parser.on("-d", "--desc", "Describe this gem.") do |description|
33
+ @description = description
34
+ end
35
+
36
+ parser.on("-c", "--config", "Configure user values. Use $EDITOR") do |c|
37
+ @config.parent.mkpath
38
+ unless @config.exist?
39
+ @config.open("w") do |f|
40
+ f << <<-EOF.gsub(/^\t+/, "")
41
+ author: "#{ENV['USER']}"
42
+ email: "#{ENV['USER']}@#{ENV['HOST']}"
43
+ EOF
44
+ end
45
+ end
46
+ exec(ENV["EDITOR"], @config.to_s)
47
+ end
48
+
49
+ parser.on("--copy-template NAME", "Copy template to user template dir naming NAME") do |name|
50
+ path = Pathname.new(ENV["HOME"]) + ".cutagem/templates" + name
51
+ if path.exist?
52
+ puts "#{path} is already exists."
53
+ exit 1
54
+ end
55
+ template = select_template(true)
56
+ cp_r template, path, :verbose => true
57
+ exit
58
+ end
59
+
60
+ parser.on('--gem-class GEMCLASS', 'Specify your gem class name explicitly') do |gemclass|
61
+ @gemclass = gemclass
62
+ end
63
+
64
+ parser.on("--version", "Show version string `#{VERSION}'") do
65
+ puts VERSION
66
+ exit
67
+ end
68
+ end
69
+ end
70
+
71
+ def run
72
+ @parser.order!(@argv)
73
+ unless @argv.first
74
+ puts "gemname must be required."
75
+ exit 1
76
+ end
77
+
78
+ pwd = Pathname.pwd
79
+
80
+ author = self.author
81
+ email = self.email
82
+ gemname = @argv.shift
83
+ gemid = gemname.gsub("-", "")
84
+ gempath = gemname.gsub("-", "/")
85
+ gemclass = @gemclass ? @gemclass : gempath.split("/").map {|c|
86
+ c.split(/_/).collect {|i| i.capitalize }.join("")
87
+ }.join("::")
88
+ description = @description
89
+
90
+ template = select_template(@select)
91
+
92
+ gemdir = pwd + gemname
93
+
94
+ if gemdir.exist?
95
+ puts "#{gemdir.basename} is already exists."
96
+ exit
97
+ end
98
+
99
+ config = {}
100
+ begin
101
+ config = YAML.load(@config.read)
102
+ author = config["author"] if config["author"]
103
+ email = config["email"] if config["email"]
104
+ puts "~/.cutagem/config.yaml is found. Use it."
105
+ rescue Errno::ENOENT
106
+ puts "~/.cutagem/config.yaml is not found. Use default."
107
+ end
108
+
109
+ begin
110
+ cp_r template, gemdir, :verbose => true
111
+ Pathname.glob(gemdir + "**/gemname*") do |f|
112
+ new = f.parent + f.basename.to_s.sub(/gemname/, gemname)
113
+ puts "Rename #{f.relative_path_from(gemdir)} to #{new.relative_path_from(gemdir)}"
114
+ f.rename(new)
115
+ end
116
+ Pathname.glob(gemdir + "**/gempath*") do |f|
117
+ new = f.parent + f.basename.to_s.sub(/gempath/, gempath)
118
+ puts "Rename #{f.relative_path_from(gemdir)} to #{new.relative_path_from(gemdir)}"
119
+ new.parent.mkpath
120
+ f.rename(new)
121
+ end
122
+ Pathname.glob(gemdir + "**/*") do |f|
123
+ next unless f.file?
124
+ f.open("r+") do |f|
125
+ content = f.read
126
+ f.rewind
127
+ f.puts ERB.new(content).result(binding)
128
+ f.truncate(f.tell)
129
+ end
130
+ end
131
+ rescue
132
+ gemdir.rmtree
133
+ raise
134
+ end
135
+
136
+ puts "Done."
137
+ if ENV["EDITOR"]
138
+ puts "Type any key to edit Rakefile."
139
+ gets
140
+ exec(ENV["EDITOR"], gemdir + "Rakefile")
141
+ end
142
+ end
143
+
144
+ def author
145
+ res = `git-config --global --get user.name 2> /dev/null`
146
+ if $?.success?
147
+ res.strip
148
+ else
149
+ ENV['USER']
150
+ end
151
+ end
152
+
153
+ def email
154
+ res = `git-config --global --get user.email 2> /dev/null`
155
+ if $?.success?
156
+ res.strip
157
+ else
158
+ "#{ENV['USER']}@#{ENV['HOST']}"
159
+ end
160
+ end
161
+
162
+ # Select template from system templates and user templtes.
163
+ # if +select+ is true, select templates interactively.
164
+ def select_template(select)
165
+ @templates = Pathname.new(File.dirname(__FILE__)).realpath + '../templates'
166
+ @user_templates = Pathname.new(ENV["HOME"]).realpath + '.cutagem/templates'
167
+
168
+ templates = []
169
+ u_templates = []
170
+ if @user_templates.exist?
171
+ Pathname.glob(@user_templates + "*").each do |t|
172
+ t = [".cutagem/templates/#{t.basename}", t]
173
+ if t[1].basename.to_s == "default"
174
+ u_templates.unshift(t)
175
+ else
176
+ u_templates << t
177
+ end
178
+ end
179
+ end
180
+ Pathname.glob(@templates + "*").each do |t|
181
+ t = ["#{t.basename}", t]
182
+ if t[1].basename.to_s == "default"
183
+ templates.unshift(t)
184
+ else
185
+ templates << t
186
+ end
187
+ end
188
+ templates = u_templates + templates
189
+
190
+ if select
191
+ puts "Select template:"
192
+ templates.each_with_index do |item,index|
193
+ puts "% 2d. %s" % [index+1, item.first]
194
+ end
195
+ input = gets.chomp
196
+ case input
197
+ when ""
198
+ template = templates.first
199
+ when /^\d+$/
200
+ template = templates[input.to_i-1]
201
+ else
202
+ template = nil
203
+ puts "Canceled"
204
+ exit
205
+ end
206
+ else
207
+ template = templates.first
208
+ end
209
+ unless template
210
+ puts "Not select template."
211
+ exit
212
+ end
213
+ puts "Using Template: %s" % template
214
+ template[1]
215
+ end
216
+ end
@@ -0,0 +1,4 @@
1
+ == 0.0.1 / <%=Time.now.strftime("%Y-%m-%d")%>
2
+
3
+ * initial release
4
+
@@ -0,0 +1,29 @@
1
+
2
+ = <%=gemname%>
3
+
4
+
5
+ == Description
6
+
7
+
8
+ == Installation
9
+
10
+ === Archive Installation
11
+
12
+ rake install
13
+
14
+ === Gem Installation
15
+
16
+ gem install <%=gemid%>
17
+
18
+
19
+ == Features/Problems
20
+
21
+
22
+ == Synopsis
23
+
24
+
25
+ == Copyright
26
+
27
+ Author:: <%=author%> <<%=email%>>
28
+ Copyright:: Copyright (c) <%=Time.now.strftime("%Y")%> <%=author%>
29
+ License::
@@ -0,0 +1,133 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/clean'
4
+ require 'rake/testtask'
5
+ require 'rake/packagetask'
6
+ require 'rake/gempackagetask'
7
+ require 'rake/rdoctask'
8
+ require 'rake/contrib/rubyforgepublisher'
9
+ require 'rake/contrib/sshpublisher'
10
+ require 'fileutils'
11
+ include FileUtils
12
+
13
+ NAME = "<%=gemname%>"
14
+ AUTHOR = "<%=author%>"
15
+ EMAIL = "<%=email%>"
16
+ DESCRIPTION = "<%=description%>"
17
+ RUBYFORGE_PROJECT = "<%=config['meta_project'] || gemid%>"
18
+ HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
19
+ BIN_FILES = %w( <%=gemname%> )
20
+ VERS = "0.0.1"
21
+
22
+
23
+ REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
24
+ CLEAN.include ['**/.*.sw?', '*.gem', '.config']
25
+ RDOC_OPTS = [
26
+ '--title', "#{NAME} documentation",
27
+ "--charset", "utf-8",
28
+ "--opname", "index.html",
29
+ "--line-numbers",
30
+ "--main", "README",
31
+ "--inline-source",
32
+ ]
33
+
34
+ task :default => [:test]
35
+ task :package => [:clean]
36
+
37
+ Rake::TestTask.new("test") do |t|
38
+ t.libs << "test"
39
+ t.pattern = "test/**/*_test.rb"
40
+ t.verbose = true
41
+ end
42
+
43
+ spec = Gem::Specification.new do |s|
44
+ s.name = NAME
45
+ s.version = VERS
46
+ s.platform = Gem::Platform::RUBY
47
+ s.has_rdoc = true
48
+ s.extra_rdoc_files = ["README", "ChangeLog"]
49
+ s.rdoc_options += RDOC_OPTS + ['--exclude', '^(examples|extras)/']
50
+ s.summary = DESCRIPTION
51
+ s.description = DESCRIPTION
52
+ s.author = AUTHOR
53
+ s.email = EMAIL
54
+ s.homepage = HOMEPATH
55
+ s.executables = BIN_FILES
56
+ s.rubyforge_project = RUBYFORGE_PROJECT
57
+ s.bindir = "bin"
58
+ s.require_path = "lib"
59
+ s.autorequire = ""
60
+ s.test_files = Dir["test/*_test.rb"]
61
+
62
+ #s.add_dependency('activesupport', '>=1.3.1')
63
+ #s.required_ruby_version = '>= 1.8.2'
64
+
65
+ s.files = %w(README ChangeLog Rakefile) +
66
+ Dir.glob("{bin,doc,test,lib,templates,generator,extras,website,script}/**/*") +
67
+ Dir.glob("ext/**/*.{h,c,rb}") +
68
+ Dir.glob("examples/**/*.rb") +
69
+ Dir.glob("tools/*.rb")
70
+
71
+ s.extensions = FileList["ext/**/extconf.rb"].to_a
72
+ end
73
+
74
+ Rake::GemPackageTask.new(spec) do |p|
75
+ p.need_tar = true
76
+ p.gem_spec = spec
77
+ end
78
+
79
+ task :install do
80
+ name = "#{NAME}-#{VERS}.gem"
81
+ sh %{rake package}
82
+ sh %{sudo gem install pkg/#{name}}
83
+ end
84
+
85
+ task :uninstall => [:clean] do
86
+ sh %{sudo gem uninstall #{NAME}}
87
+ end
88
+
89
+
90
+ Rake::RDocTask.new do |rdoc|
91
+ rdoc.rdoc_dir = 'html'
92
+ rdoc.options += RDOC_OPTS
93
+ rdoc.template = "resh"
94
+ #rdoc.template = "#{ENV['template']}.rb" if ENV['template']
95
+ if ENV['DOC_FILES']
96
+ rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
97
+ else
98
+ rdoc.rdoc_files.include('README', 'ChangeLog')
99
+ rdoc.rdoc_files.include('lib/**/*.rb')
100
+ rdoc.rdoc_files.include('ext/**/*.c')
101
+ end
102
+ end
103
+
104
+ desc "Publish to RubyForge"
105
+ task :rubyforge => [:rdoc, :package] do
106
+ require 'rubyforge'
107
+ Rake::RubyForgePublisher.new(RUBYFORGE_PROJECT, '<%=ENV['USER']%>').upload
108
+ end
109
+
110
+ desc 'Package and upload the release to rubyforge.'
111
+ task :release => [:clean, :package] do |t|
112
+ v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
113
+ abort "Versions don't match #{v} vs #{VERS}" unless v == VERS
114
+ pkg = "pkg/#{NAME}-#{VERS}"
115
+
116
+ require 'rubyforge'
117
+ rf = RubyForge.new
118
+ puts "Logging in"
119
+ rf.login
120
+
121
+ c = rf.userconfig
122
+ # c["release_notes"] = description if description
123
+ # c["release_changes"] = changes if changes
124
+ c["preformatted"] = true
125
+
126
+ files = [
127
+ "#{pkg}.tgz",
128
+ "#{pkg}.gem"
129
+ ].compact
130
+
131
+ puts "Releasing #{NAME} v. #{VERS}"
132
+ rf.add_release RUBYFORGE_PROJECT, NAME, VERS, *files
133
+ end
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+ # vim:ft=ruby:
3
+
4
+ require "optparse"
5
+ require "pathname"
6
+
7
+ class <%=gemclass.gsub(/::/, "")%>Command
8
+ VERSION = "0.0.1"
9
+
10
+ include FileUtils
11
+ def self.run(argv)
12
+ new(argv.dup).run
13
+ end
14
+
15
+ def initialize(argv)
16
+ @argv = argv
17
+
18
+ @parser = OptionParser.new do |parser|
19
+ parser.banner = <<-EOB.gsub(/^\t+/, "")
20
+ Usage: #$0 [options]
21
+ EOB
22
+
23
+ parser.separator ""
24
+ parser.separator "Options:"
25
+
26
+ parser.on("--version", "Show version string `#{VERSION}'") do
27
+ puts VERSION
28
+ exit
29
+ end
30
+ end
31
+ end
32
+
33
+ def run
34
+ @parser.order!(@argv)
35
+
36
+ # write
37
+ end
38
+ end
@@ -0,0 +1,5 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ require "test/unit"
4
+ class <%=gemclass%>Test < Test::Unit::TestCase
5
+ end
@@ -0,0 +1,3 @@
1
+ require 'test/unit'
2
+ require File.dirname(__FILE__) + '/../lib/<%=gempath%>'
3
+
@@ -0,0 +1,4 @@
1
+ == 0.0.1 / <%=Time.now.strftime("%Y-%m-%d")%>
2
+
3
+ * initial release
4
+
@@ -0,0 +1,29 @@
1
+
2
+ = <%=gemname%>
3
+
4
+
5
+ == Description
6
+
7
+
8
+ == Installation
9
+
10
+ === Archive Installation
11
+
12
+ rake install
13
+
14
+ === Gem Installation
15
+
16
+ gem install <%=gemid%>
17
+
18
+
19
+ == Features/Problems
20
+
21
+
22
+ == Synopsis
23
+
24
+
25
+ == Copyright
26
+
27
+ Author:: <%=author%> <<%=email%>>
28
+ Copyright:: Copyright (c) <%=Time.now.strftime("%Y")%> <%=author%>
29
+ License::
@@ -0,0 +1,142 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/clean'
4
+ require 'rake/testtask'
5
+ require 'rake/packagetask'
6
+ require 'rake/gempackagetask'
7
+ require 'rake/rdoctask'
8
+ require 'rake/contrib/rubyforgepublisher'
9
+ require 'rake/contrib/sshpublisher'
10
+ require 'fileutils'
11
+ include FileUtils
12
+
13
+ NAME = "<%=gemname%>"
14
+ AUTHOR = "<%=author%>"
15
+ EMAIL = "<%=email%>"
16
+ DESCRIPTION = "<%=description%>"
17
+ RUBYFORGE_PROJECT = "<%=config['meta_project'] || gemid%>"
18
+ HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
19
+ BIN_FILES = %w( )
20
+ VERS = "0.0.1"
21
+
22
+ REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
23
+ CLEAN.include ['**/.*.sw?', '*.gem', '.config']
24
+ RDOC_OPTS = [
25
+ '--title', "#{NAME} documentation",
26
+ "--charset", "utf-8",
27
+ "--opname", "index.html",
28
+ "--line-numbers",
29
+ "--main", "README",
30
+ "--inline-source",
31
+ ]
32
+
33
+ task :default => [:test]
34
+ task :package => [:clean]
35
+
36
+ Rake::TestTask.new("test") do |t|
37
+ t.libs << "test"
38
+ t.pattern = "test/**/*_test.rb"
39
+ t.verbose = true
40
+ end
41
+
42
+ spec = Gem::Specification.new do |s|
43
+ s.name = NAME
44
+ s.version = VERS
45
+ s.platform = Gem::Platform::RUBY
46
+ s.has_rdoc = true
47
+ s.extra_rdoc_files = ["README", "ChangeLog"]
48
+ s.rdoc_options += RDOC_OPTS + ['--exclude', '^(examples|extras)/']
49
+ s.summary = DESCRIPTION
50
+ s.description = DESCRIPTION
51
+ s.author = AUTHOR
52
+ s.email = EMAIL
53
+ s.homepage = HOMEPATH
54
+ s.executables = BIN_FILES
55
+ s.rubyforge_project = RUBYFORGE_PROJECT
56
+ s.bindir = "bin"
57
+ s.require_path = "lib"
58
+ s.autorequire = ""
59
+ s.test_files = Dir["test/*_test.rb"]
60
+
61
+ #s.add_dependency('activesupport', '>=1.3.1')
62
+ #s.required_ruby_version = '>= 1.8.2'
63
+
64
+ s.files = %w(README ChangeLog Rakefile) +
65
+ Dir.glob("{bin,doc,test,lib,templates,generator,extras,website,script}/**/*") +
66
+ Dir.glob("ext/**/*.{h,c,rb}") +
67
+ Dir.glob("examples/**/*.rb") +
68
+ Dir.glob("tools/*.rb")
69
+
70
+ s.extensions = FileList["ext/**/extconf.rb"].to_a
71
+ end
72
+
73
+ Rake::GemPackageTask.new(spec) do |p|
74
+ p.need_tar = true
75
+ p.gem_spec = spec
76
+ end
77
+
78
+ task :install do
79
+ name = "#{NAME}-#{VERS}.gem"
80
+ sh %{rake package}
81
+ sh %{sudo gem install pkg/#{name}}
82
+ end
83
+
84
+ task :uninstall => [:clean] do
85
+ sh %{sudo gem uninstall #{NAME}}
86
+ end
87
+
88
+
89
+ Rake::RDocTask.new do |rdoc|
90
+ rdoc.rdoc_dir = 'html'
91
+ rdoc.options += RDOC_OPTS
92
+ rdoc.template = "resh"
93
+ #rdoc.template = "#{ENV['template']}.rb" if ENV['template']
94
+ if ENV['DOC_FILES']
95
+ rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
96
+ else
97
+ rdoc.rdoc_files.include('README', 'ChangeLog')
98
+ rdoc.rdoc_files.include('lib/**/*.rb')
99
+ rdoc.rdoc_files.include('ext/**/*.c')
100
+ end
101
+ end
102
+
103
+ desc "Publish to RubyForge"
104
+ task :rubyforge => [:rdoc, :package] do
105
+ require 'rubyforge'
106
+ Rake::RubyForgePublisher.new(RUBYFORGE_PROJECT, '<%=ENV['USER']%>').upload
107
+ end
108
+
109
+ desc 'Package and upload the release to rubyforge.'
110
+ task :release => [:clean, :package] do |t|
111
+ v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
112
+ abort "Versions don't match #{v} vs #{VERS}" unless v == VERS
113
+ pkg = "pkg/#{NAME}-#{VERS}"
114
+
115
+ require 'rubyforge'
116
+ rf = RubyForge.new.configure
117
+ puts "Logging in"
118
+ rf.login
119
+
120
+ c = rf.userconfig
121
+ # c["release_notes"] = description if description
122
+ # c["release_changes"] = changes if changes
123
+ c["preformatted"] = true
124
+
125
+ files = [
126
+ "#{pkg}.tgz",
127
+ "#{pkg}.gem"
128
+ ].compact
129
+
130
+ puts "Releasing #{NAME} v. #{VERS}"
131
+ rf.add_release RUBYFORGE_PROJECT, NAME, VERS, *files
132
+ end
133
+
134
+ desc 'Show information about the gem.'
135
+ task :debug_gem do
136
+ puts spec.to_ruby
137
+ end
138
+
139
+ desc 'Update gem spec'
140
+ task :gemspec do
141
+ open("#{NAME}.gemspec", 'w').write spec.to_ruby
142
+ end
@@ -0,0 +1,4 @@
1
+
2
+ class <%=gemclass%>
3
+
4
+ end
@@ -0,0 +1,5 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ require "test/unit"
4
+ class <%=gemclass%>Test < Test::Unit::TestCase
5
+ end
@@ -0,0 +1,3 @@
1
+ require 'test/unit'
2
+ require File.dirname(__FILE__) + '/../lib/<%=gempath%>'
3
+
@@ -0,0 +1,8 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ require "test/unit"
4
+ class SafeEvalTest < Test::Unit::TestCase
5
+ def test_t
6
+ assert true
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ require 'test/unit'
2
+ require File.dirname(__FILE__) + '/../lib/cutagem.rb'
3
+
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: genki-cutagem
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.8.1
5
+ platform: ruby
6
+ authors:
7
+ - cho45
8
+ autorequire: ""
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-07-21 00:00:00 -07:00
13
+ default_executable: cutagem
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: resh
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: "0"
23
+ version:
24
+ description: executable for making new gem skelton.
25
+ email: cho45@lowreal.net
26
+ executables:
27
+ - cutagem
28
+ extensions: []
29
+
30
+ extra_rdoc_files:
31
+ - README
32
+ - ChangeLog
33
+ files:
34
+ - README
35
+ - ChangeLog
36
+ - Rakefile
37
+ - bin/cutagem
38
+ - test/cutagem_test.rb
39
+ - test/test_helper.rb
40
+ - lib/cutagem.rb
41
+ - templates/command
42
+ - templates/command/ChangeLog
43
+ - templates/command/README
44
+ - templates/command/Rakefile
45
+ - templates/command/bin
46
+ - templates/command/bin/gemname
47
+ - templates/command/test
48
+ - templates/command/test/gemname_test.rb
49
+ - templates/command/test/test_helper.rb
50
+ - templates/default
51
+ - templates/default/ChangeLog
52
+ - templates/default/README
53
+ - templates/default/lib
54
+ - templates/default/lib/gempath.rb
55
+ - templates/default/test
56
+ - templates/default/test/gemname_test.rb
57
+ - templates/default/test/test_helper.rb
58
+ - templates/default/Rakefile
59
+ has_rdoc: true
60
+ homepage: http://cutagem.rubyforge.org
61
+ post_install_message:
62
+ rdoc_options:
63
+ - --title
64
+ - cutagem documentation
65
+ - --charset
66
+ - utf-8
67
+ - --opname
68
+ - index.html
69
+ - --line-numbers
70
+ - --main
71
+ - README
72
+ - --inline-source
73
+ - --exclude
74
+ - ^(examples|extras)/
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: "0"
82
+ version:
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: "0"
88
+ version:
89
+ requirements: []
90
+
91
+ rubyforge_project: cutagem
92
+ rubygems_version: 1.2.0
93
+ signing_key:
94
+ specification_version: 2
95
+ summary: executable for making new gem skelton.
96
+ test_files:
97
+ - test/test_helper.rb