cutagem 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +13 -0
- data/README +44 -13
- data/Rakefile +2 -2
- data/lib/cutagem.rb +11 -6
- data/templates/command/Rakefile +3 -3
- data/templates/default/Rakefile +3 -3
- metadata +3 -4
- data/CHANGELOG +0 -4
data/ChangeLog
CHANGED
@@ -1,4 +1,17 @@
|
|
1
|
+
2007-10-08 SATOH Hiroh <cho45@lowreal.net>
|
2
|
+
|
3
|
+
* 0.0.3 release
|
4
|
+
* Fix Rakefile for case-sensitive system.
|
5
|
+
* Output more verbosely.
|
6
|
+
|
7
|
+
2007-10-07 SATOH Hiroh <cho45@lowreal.net>
|
8
|
+
|
9
|
+
* 0.0.2 release
|
10
|
+
* use ~/.cutagem/config.yaml as user config.
|
11
|
+
* Rename ChangeLog
|
12
|
+
|
1
13
|
2007-10-07 SATOH Hiroh <cho45@lowreal.net>
|
2
14
|
|
3
15
|
* 0.0.1 release
|
4
16
|
|
17
|
+
|
data/README
CHANGED
@@ -8,13 +8,28 @@ by cho45 <cho45@lowreal.net>
|
|
8
8
|
cutagem (Cut a Gem) is yet another executable for creating gem skelton.
|
9
9
|
|
10
10
|
This is similar in concept to newgem[http://newgem.rubyforge.org/] but
|
11
|
-
more customizable for each
|
11
|
+
more customizable for each user.
|
12
|
+
|
13
|
+
cutagem (Cut a Gem: 宝石のカット) は新しい gem のスケルトンを作るコマンドです。
|
14
|
+
|
15
|
+
newgem[http://newgem.rubyforge.org/] とよく似たものですが、cutagem は
|
16
|
+
各ユーザがカスタマイズしやすいようになっています。
|
12
17
|
|
13
18
|
== Concept
|
14
19
|
|
15
20
|
* User customizable templates.
|
16
21
|
* Not use hoe, etc. Because it makes difficult to customize the created Rakefile.
|
17
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 に書けば済むことを設定として分離したりしません。
|
18
33
|
|
19
34
|
== Installation
|
20
35
|
|
@@ -34,15 +49,25 @@ Most simple sample:
|
|
34
49
|
|
35
50
|
$ cutagem gemname
|
36
51
|
Using Template: .cutagem/templates/default
|
37
|
-
|
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
|
38
56
|
Done.
|
57
|
+
Type any key to edit Rakefile.
|
58
|
+
|
39
59
|
|
40
60
|
When +gemname+ includes hyphens, it's replaced with "/".
|
41
61
|
|
42
62
|
$ cutagem module-test
|
43
63
|
Using Template: .cutagem/templates/default
|
44
|
-
|
45
|
-
|
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
|
+
|
46
71
|
|
47
72
|
$ ls module-test/lib/module/test.rb
|
48
73
|
module-test/lib/module/test.rb
|
@@ -56,8 +81,14 @@ Select templates interactively. (<code>-s</code>, <code>--select</code> option)
|
|
56
81
|
2. default
|
57
82
|
3. command
|
58
83
|
1
|
59
|
-
|
60
|
-
|
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
|
+
|
61
92
|
|
62
93
|
Edit user configuration.
|
63
94
|
|
@@ -71,14 +102,14 @@ Other options:
|
|
71
102
|
Options:
|
72
103
|
-s, --select Select template interactively.
|
73
104
|
-d, --desc Describe this gem.
|
74
|
-
-c, --config Configure user values. Use
|
105
|
+
-c, --config Configure user values. Use $EDITOR
|
75
106
|
--copy-template NAME Copy template to user template dir naming NAME
|
76
107
|
--version Show version string `0.0.2'
|
77
108
|
|
78
109
|
|
79
110
|
== Customization
|
80
111
|
|
81
|
-
+cutagem+ reads ~/.cutagem/
|
112
|
+
+cutagem+ reads ~/.cutagem/templates/* for using it as custom template.
|
82
113
|
Especially "default" template is precedence.
|
83
114
|
|
84
115
|
You can make new template by coping the existing template using '--copy-template NAME' option.
|
@@ -92,13 +123,13 @@ Library installed templates:
|
|
92
123
|
|
93
124
|
User templates:
|
94
125
|
|
95
|
-
* ~/.cutagem/
|
96
|
-
* ~/.cutagem/
|
126
|
+
* ~/.cutagem/templates/default
|
127
|
+
* ~/.cutagem/templates/foobar
|
97
128
|
|
98
129
|
Priority order:
|
99
130
|
|
100
|
-
1. ~/.cutagem/
|
101
|
-
2. ~/.cutagem/
|
131
|
+
1. ~/.cutagem/templates/default
|
132
|
+
2. ~/.cutagem/templates/foobar
|
102
133
|
3. default (system)
|
103
134
|
4. command (system)
|
104
135
|
|
@@ -112,7 +143,7 @@ If you want to check this priority, add <code>-s</code>, <code>--select</code> o
|
|
112
143
|
[gemname]
|
113
144
|
The argument +gemname+.
|
114
145
|
[gempath]
|
115
|
-
The string created by replacing "-" with "/"
|
146
|
+
The string created by replacing "-" with "/" in +gemname+.
|
116
147
|
(ex. gemname is <code>hoge-hoge</code> then, gempath is <code>hoge/hoge</code>)
|
117
148
|
The path is automatically created.
|
118
149
|
|
data/Rakefile
CHANGED
@@ -65,7 +65,7 @@ spec = Gem::Specification.new do |s|
|
|
65
65
|
#s.add_dependency('activesupport', '>=1.3.1')
|
66
66
|
#s.required_ruby_version = '>= 1.8.2'
|
67
67
|
|
68
|
-
s.files = %w(README
|
68
|
+
s.files = %w(README ChangeLog Rakefile) +
|
69
69
|
Dir.glob("{bin,doc,test,lib,templates,generator,extras,website,script}/**/*") +
|
70
70
|
Dir.glob("ext/**/*.{h,c,rb}") +
|
71
71
|
Dir.glob("examples/**/*.rb") +
|
@@ -99,7 +99,7 @@ Rake::RDocTask.new do |rdoc|
|
|
99
99
|
if ENV['DOC_FILES']
|
100
100
|
rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
|
101
101
|
else
|
102
|
-
rdoc.rdoc_files.include('README', '
|
102
|
+
rdoc.rdoc_files.include('README', 'ChangeLog')
|
103
103
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
104
104
|
rdoc.rdoc_files.include('ext/**/*.c')
|
105
105
|
rdoc.rdoc_files.include('bin/**/*')
|
data/lib/cutagem.rb
CHANGED
@@ -6,7 +6,7 @@ require "erb"
|
|
6
6
|
require "yaml"
|
7
7
|
|
8
8
|
class CutAGemCommand
|
9
|
-
VERSION = "0.0.
|
9
|
+
VERSION = "0.0.3"
|
10
10
|
|
11
11
|
include FileUtils
|
12
12
|
def self.run(argv)
|
@@ -31,7 +31,7 @@ class CutAGemCommand
|
|
31
31
|
parser.on("-d", "--desc", "Describe this gem.") do |@description|
|
32
32
|
end
|
33
33
|
|
34
|
-
parser.on("-c", "--config", "Configure user values. Use
|
34
|
+
parser.on("-c", "--config", "Configure user values. Use $EDITOR") do |c|
|
35
35
|
@config.parent.mkpath
|
36
36
|
unless @config.exist?
|
37
37
|
@config.open("w") do |f|
|
@@ -95,18 +95,23 @@ class CutAGemCommand
|
|
95
95
|
config = YAML.load(@config.read)
|
96
96
|
author = config["author"] if config["author"]
|
97
97
|
email = config["email"] if config["email"]
|
98
|
+
puts "~/.cutagem/config.yaml is found. Use it."
|
98
99
|
rescue Errno::ENOENT
|
100
|
+
puts "~/.cutagem/config.yaml is not found. Use default."
|
99
101
|
end
|
100
102
|
|
101
103
|
begin
|
102
104
|
cp_r template, gemdir, :verbose => true
|
103
105
|
Pathname.glob(gemdir + "**/gemname*") do |f|
|
104
|
-
f.
|
106
|
+
new = f.parent + f.basename.to_s.sub(/gemname/, gemname)
|
107
|
+
puts "Rename #{f.relative_path_from(gemdir)} to #{new.relative_path_from(gemdir)}"
|
108
|
+
f.rename(new)
|
105
109
|
end
|
106
110
|
Pathname.glob(gemdir + "**/gempath*") do |f|
|
107
|
-
|
108
|
-
|
109
|
-
|
111
|
+
new = f.parent + f.basename.to_s.sub(/gempath/, gempath)
|
112
|
+
puts "Rename #{f.relative_path_from(gemdir)} to #{new.relative_path_from(gemdir)}"
|
113
|
+
new.parent.mkpath
|
114
|
+
f.rename(new)
|
110
115
|
end
|
111
116
|
Pathname.glob(gemdir + "**/*") do |f|
|
112
117
|
next unless f.file?
|
data/templates/command/Rakefile
CHANGED
@@ -61,7 +61,7 @@ spec = Gem::Specification.new do |s|
|
|
61
61
|
#s.add_dependency('activesupport', '>=1.3.1')
|
62
62
|
#s.required_ruby_version = '>= 1.8.2'
|
63
63
|
|
64
|
-
s.files = %w(README
|
64
|
+
s.files = %w(README ChangeLog Rakefile) +
|
65
65
|
Dir.glob("{bin,doc,test,lib,templates,generator,extras,website,script}/**/*") +
|
66
66
|
Dir.glob("ext/**/*.{h,c,rb}") +
|
67
67
|
Dir.glob("examples/**/*.rb") +
|
@@ -89,12 +89,12 @@ end
|
|
89
89
|
Rake::RDocTask.new do |rdoc|
|
90
90
|
rdoc.rdoc_dir = 'html'
|
91
91
|
rdoc.options += RDOC_OPTS
|
92
|
-
rdoc.template = "
|
92
|
+
rdoc.template = "resh"
|
93
93
|
#rdoc.template = "#{ENV['template']}.rb" if ENV['template']
|
94
94
|
if ENV['DOC_FILES']
|
95
95
|
rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
|
96
96
|
else
|
97
|
-
rdoc.rdoc_files.include('README', '
|
97
|
+
rdoc.rdoc_files.include('README', 'ChangeLog')
|
98
98
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
99
99
|
rdoc.rdoc_files.include('ext/**/*.c')
|
100
100
|
end
|
data/templates/default/Rakefile
CHANGED
@@ -61,7 +61,7 @@ spec = Gem::Specification.new do |s|
|
|
61
61
|
#s.add_dependency('activesupport', '>=1.3.1')
|
62
62
|
#s.required_ruby_version = '>= 1.8.2'
|
63
63
|
|
64
|
-
s.files = %w(README
|
64
|
+
s.files = %w(README ChangeLog Rakefile) +
|
65
65
|
Dir.glob("{bin,doc,test,lib,templates,generator,extras,website,script}/**/*") +
|
66
66
|
Dir.glob("ext/**/*.{h,c,rb}") +
|
67
67
|
Dir.glob("examples/**/*.rb") +
|
@@ -89,12 +89,12 @@ end
|
|
89
89
|
Rake::RDocTask.new do |rdoc|
|
90
90
|
rdoc.rdoc_dir = 'html'
|
91
91
|
rdoc.options += RDOC_OPTS
|
92
|
-
rdoc.template = "
|
92
|
+
rdoc.template = "resh"
|
93
93
|
#rdoc.template = "#{ENV['template']}.rb" if ENV['template']
|
94
94
|
if ENV['DOC_FILES']
|
95
95
|
rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
|
96
96
|
else
|
97
|
-
rdoc.rdoc_files.include('README', '
|
97
|
+
rdoc.rdoc_files.include('README', 'ChangeLog')
|
98
98
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
99
99
|
rdoc.rdoc_files.include('ext/**/*.c')
|
100
100
|
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: cutagem
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2007-10-
|
6
|
+
version: 0.0.3
|
7
|
+
date: 2007-10-08 00:00:00 +09:00
|
8
8
|
summary: More safe eval codes.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -31,7 +31,7 @@ authors:
|
|
31
31
|
- cho45
|
32
32
|
files:
|
33
33
|
- README
|
34
|
-
-
|
34
|
+
- ChangeLog
|
35
35
|
- Rakefile
|
36
36
|
- bin/cutagem
|
37
37
|
- test/cutagem_test.rb
|
@@ -57,7 +57,6 @@ files:
|
|
57
57
|
- templates/default/lib/gempath.rb
|
58
58
|
- templates/default/test/gemname_test.rb
|
59
59
|
- templates/default/test/test_helper.rb
|
60
|
-
- ChangeLog
|
61
60
|
test_files:
|
62
61
|
- test/test_helper.rb
|
63
62
|
rdoc_options:
|
data/CHANGELOG
DELETED