hoe 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +8 -0
- data/Manifest.txt +1 -1
- data/bin/sow +20 -5
- data/lib/hoe.rb +10 -7
- data/template/lib/file_name.rb.erb +1 -0
- data/template/test/{test_file_name.rb.erb → file_name.rb.erb} +2 -1
- data/test/test_hoe.rb +8 -8
- metadata +8 -8
- metadata.gz.sig +2 -1
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
=== 3.3.0 / 2012-11-12
|
2
|
+
|
3
|
+
* 3 minor enhancements:
|
4
|
+
|
5
|
+
* Added Sow#make_sub_modules. (bhenderson)
|
6
|
+
* Hoe.normalize_names now returns test class name separately. (bhenderson)
|
7
|
+
* Sow now generates test and impl files with proper namespacing. (bhenderson)
|
8
|
+
|
1
9
|
=== 3.2.0 / 2012-11-09
|
2
10
|
|
3
11
|
* 3 minor enhancements:
|
data/Manifest.txt
CHANGED
@@ -31,7 +31,7 @@ template/README.txt.erb
|
|
31
31
|
template/Rakefile.erb
|
32
32
|
template/bin/file_name.erb
|
33
33
|
template/lib/file_name.rb.erb
|
34
|
-
template/test/
|
34
|
+
template/test/file_name.rb.erb
|
35
35
|
test/test_hoe.rb
|
36
36
|
test/test_hoe_debug.rb
|
37
37
|
test/test_hoe_gemcutter.rb
|
data/bin/sow
CHANGED
@@ -20,6 +20,16 @@ def check_subdir option
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
def make_sub_modules klass
|
24
|
+
last = nil
|
25
|
+
result = ''
|
26
|
+
klass.split('::')[0..-2].each do |part|
|
27
|
+
last = [last, part].compact.join('::')
|
28
|
+
result << "module #{last}; end\n"
|
29
|
+
end
|
30
|
+
result << "\n" unless result.empty?
|
31
|
+
end
|
32
|
+
|
23
33
|
op = OptionParser.new do |opts|
|
24
34
|
opts.banner = "Usage: sow [options] project_name"
|
25
35
|
|
@@ -79,7 +89,7 @@ project = ARGV.shift
|
|
79
89
|
abort op.to_s unless project
|
80
90
|
abort "Project #{project} seems to exist" if test ?d, project
|
81
91
|
|
82
|
-
_, file_name, klass = Hoe.normalize_names project
|
92
|
+
_, file_name, klass, test_klass = Hoe.normalize_names project
|
83
93
|
|
84
94
|
FileUtils.cp_r template_path, project
|
85
95
|
|
@@ -96,7 +106,7 @@ Dir.chdir project do
|
|
96
106
|
warn "erb: #{path}"
|
97
107
|
|
98
108
|
File.open path, "w" do |io|
|
99
|
-
erb = ERB.new file
|
109
|
+
erb = ERB.new file, nil, '<>'
|
100
110
|
erb.filename = path
|
101
111
|
io.puts erb.result(binding)
|
102
112
|
end
|
@@ -105,12 +115,17 @@ Dir.chdir project do
|
|
105
115
|
paths.grep(/file_name|\.erb$/).each do |file|
|
106
116
|
new_file = file.sub(/file_name/, file_name).sub(/\.erb$/, '')
|
107
117
|
|
108
|
-
|
109
|
-
|
110
|
-
if file =~ /^(bin|test)/ then
|
118
|
+
case file
|
119
|
+
when /^bin/ then
|
111
120
|
dir, *rest = new_file.split File::SEPARATOR
|
112
121
|
|
113
122
|
new_file = File.join dir, rest.join('_')
|
123
|
+
when /^test/ then
|
124
|
+
dir, *rest = new_file.split File::SEPARATOR
|
125
|
+
|
126
|
+
rest.last.sub! /^/, 'test_'
|
127
|
+
|
128
|
+
new_file = File.join dir, *rest
|
114
129
|
end
|
115
130
|
|
116
131
|
FileUtils.mkdir_p File.dirname new_file
|
data/lib/hoe.rb
CHANGED
@@ -91,7 +91,7 @@ class Hoe
|
|
91
91
|
include Rake::DSL if defined?(Rake::DSL)
|
92
92
|
|
93
93
|
# duh
|
94
|
-
VERSION = '3.
|
94
|
+
VERSION = '3.3.0'
|
95
95
|
|
96
96
|
@@plugins = [:clean, :debug, :deps, :flay, :flog, :newb, :package,
|
97
97
|
:publish, :gemcutter, :signing, :test]
|
@@ -327,7 +327,7 @@ class Hoe
|
|
327
327
|
end
|
328
328
|
|
329
329
|
##
|
330
|
-
# Normalize a project name into the project, file, and
|
330
|
+
# Normalize a project name into the project, file, klass and test names that
|
331
331
|
# follow Ruby package naming guidelines.
|
332
332
|
#
|
333
333
|
# Project names are lowercase with _ separating package parts and -
|
@@ -337,14 +337,17 @@ class Hoe
|
|
337
337
|
# extension parts. net-http-persistent becomes net/http/persistent.
|
338
338
|
#
|
339
339
|
# Klass names are CamelCase with :: separating extension parts.
|
340
|
+
#
|
341
|
+
# Test klass names are same as Klass with Test prepended to each part.
|
340
342
|
|
341
343
|
def self.normalize_names project # :nodoc:
|
342
|
-
project
|
343
|
-
klass
|
344
|
-
klass
|
345
|
-
|
344
|
+
project = project.gsub(/([A-Z])/, '_\1').downcase.sub(/^_/, '')
|
345
|
+
klass = project.gsub(/(?:^|_)([a-z])/) { $1.upcase }
|
346
|
+
klass = klass. gsub(/(?:^|-)([a-z])/) { "::#{$1.upcase}" }
|
347
|
+
test_klass = klass. gsub(/(^|::)([A-Z])/) { "#{$1}Test#{$2}" }
|
348
|
+
file_name = project.gsub(/-/, '/')
|
346
349
|
|
347
|
-
return project, file_name, klass
|
350
|
+
return project, file_name, klass, test_klass
|
348
351
|
end
|
349
352
|
|
350
353
|
##
|
data/test/test_hoe.rb
CHANGED
@@ -388,14 +388,14 @@ class TestHoe < MiniTest::Unit::TestCase
|
|
388
388
|
end
|
389
389
|
|
390
390
|
def test_rename
|
391
|
-
# project, file_name, klass = Hoe.normalize_names 'project_name'
|
392
|
-
|
393
|
-
assert_equal %w( word word Word),
|
394
|
-
assert_equal %w( word word Word),
|
395
|
-
assert_equal %w(two_words two_words TwoWords),
|
396
|
-
assert_equal %w(two_words two_words TwoWords),
|
397
|
-
assert_equal %w(two-words two/words Two::Words), Hoe.normalize_names('two-words')
|
398
|
-
assert_equal %w(two_words two_words TwoWords),
|
391
|
+
# project, file_name, klass, test_klass = Hoe.normalize_names 'project_name'
|
392
|
+
|
393
|
+
assert_equal %w( word word Word TestWord), Hoe.normalize_names('word')
|
394
|
+
assert_equal %w( word word Word TestWord), Hoe.normalize_names('Word')
|
395
|
+
assert_equal %w(two_words two_words TwoWords TestTwoWords), Hoe.normalize_names('TwoWords')
|
396
|
+
assert_equal %w(two_words two_words TwoWords TestTwoWords), Hoe.normalize_names('twoWords')
|
397
|
+
assert_equal %w(two-words two/words Two::Words TestTwo::TestWords), Hoe.normalize_names('two-words')
|
398
|
+
assert_equal %w(two_words two_words TwoWords TestTwoWords), Hoe.normalize_names('two_words')
|
399
399
|
end
|
400
400
|
|
401
401
|
def test_nosudo
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hoe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
|
-
-
|
8
|
+
- 3
|
9
9
|
- 0
|
10
|
-
version: 3.
|
10
|
+
version: 3.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Davis
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
FBHgymkyj/AOSqKRIpXPhjC6
|
37
37
|
-----END CERTIFICATE-----
|
38
38
|
|
39
|
-
date: 2012-11-
|
39
|
+
date: 2012-11-13 00:00:00 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
@@ -61,11 +61,11 @@ dependencies:
|
|
61
61
|
requirements:
|
62
62
|
- - ~>
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
hash:
|
64
|
+
hash: 31
|
65
65
|
segments:
|
66
66
|
- 4
|
67
|
-
-
|
68
|
-
version: "4.
|
67
|
+
- 2
|
68
|
+
version: "4.2"
|
69
69
|
type: :development
|
70
70
|
version_requirements: *id002
|
71
71
|
- !ruby/object:Gem::Dependency
|
@@ -138,7 +138,7 @@ files:
|
|
138
138
|
- template/Rakefile.erb
|
139
139
|
- template/bin/file_name.erb
|
140
140
|
- template/lib/file_name.rb.erb
|
141
|
-
- template/test/
|
141
|
+
- template/test/file_name.rb.erb
|
142
142
|
- test/test_hoe.rb
|
143
143
|
- test/test_hoe_debug.rb
|
144
144
|
- test/test_hoe_gemcutter.rb
|
metadata.gz.sig
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
"(r֑���Q��IKnP��=��x��i���p�W�gံ��9�ϴ���J���Y1?�qQ��8��50�3���E���ʥ+T���ա��K���r���A��$���1������r��'2��\կ2�Q� ���[�H�����[�xw���g`
|
2
|
+
��n��$G� }0=C�Y�:�5v-�*/�a��Ka@]�����Er3�ʪ4�WF�-�l!�Ԯ�F�G�����:��}ΘҨf1�5�
|