hoe 1.8.2 → 1.8.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/History.txt +7 -0
  2. data/bin/sow +4 -9
  3. data/lib/hoe.rb +9 -1
  4. data/test/test_hoe.rb +11 -0
  5. metadata +4 -4
@@ -1,3 +1,10 @@
1
+ === 1.8.3 / 2009-01-20:
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * Refactored sow's naming code to Hoe.normalize_names and wrote some
6
+ tests to flush out inconsistencies.
7
+
1
8
  === 1.8.2 / 2008-10-24:
2
9
 
3
10
  * 1 minor enhancement:
data/bin/sow CHANGED
@@ -3,6 +3,9 @@
3
3
  $t ||= false
4
4
  $d ||= false
5
5
 
6
+ require 'rubygems'
7
+ require 'hoe'
8
+
6
9
  if defined? $h then
7
10
  puts "usage: #{File.dirname($0)} [-d|-t] project"
8
11
  puts " -t = add project to subdir under 'trunk'"
@@ -20,15 +23,7 @@ abort "You must supply a project name on the commandline" unless project
20
23
  abort "Project #{project} seems to exist" if test ?d, project
21
24
  puts "creating project #{project}"
22
25
 
23
- case project
24
- when /_/ then
25
- file_name = project
26
- project = project.capitalize.gsub(/_([a-z])/) {$1.upcase}
27
- klass = project
28
- else
29
- file_name = project.gsub(/([A-Z])/, '_\1').downcase.sub(/^_/, '')
30
- klass = project.capitalize.gsub(/_([a-z])/) {$1.upcase}
31
- end
26
+ project, file_name, klass = Hoe.normalize_names project
32
27
 
33
28
  Dir.mkdir project
34
29
  Dir.chdir project do
data/lib/hoe.rb CHANGED
@@ -124,7 +124,7 @@ end
124
124
  #
125
125
 
126
126
  class Hoe
127
- VERSION = '1.8.2'
127
+ VERSION = '1.8.3'
128
128
  GEMURL = URI.parse 'http://gems.rubyforge.org' # for namespace :deps below
129
129
 
130
130
  ruby_prefix = Config::CONFIG['prefix']
@@ -333,6 +333,14 @@ class Hoe
333
333
  Hoe::RUBY_FLAGS.sub!(/-I/, "-I#{dirs.join(s)}#{s}")
334
334
  end
335
335
 
336
+ def self.normalize_names project
337
+ project = project.tr('-', '_').gsub(/([A-Z])/, '_\1').downcase.sub(/^_/, '')
338
+ klass = project.gsub(/(?:^|_)([a-z])/) { $1.upcase }
339
+ file_name = project
340
+
341
+ return project, file_name, klass
342
+ end
343
+
336
344
  def normalize_deps deps
337
345
  Array(deps).map { |o| String === o ? [o] : o }
338
346
  end
@@ -94,4 +94,15 @@ class TestHoe < Test::Unit::TestCase
94
94
  assert_equal :development, dep.type
95
95
  assert_equal ">= #{Hoe::VERSION}", dep.version_requirements.to_s
96
96
  end
97
+
98
+ def test_rename
99
+ # project, file_name, klass = Hoe.normalize_names 'project_name'
100
+
101
+ assert_equal %w( word word Word), Hoe.normalize_names('word')
102
+ assert_equal %w( word word Word), Hoe.normalize_names('Word')
103
+ assert_equal %w(two_words two_words TwoWords), Hoe.normalize_names('TwoWords')
104
+ assert_equal %w(two_words two_words TwoWords), Hoe.normalize_names('twoWords')
105
+ assert_equal %w(two_words two_words TwoWords), Hoe.normalize_names('two-words')
106
+ assert_equal %w(two_words two_words TwoWords), Hoe.normalize_names('two_words')
107
+ end
97
108
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hoe
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.2
4
+ version: 1.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-24 00:00:00 -07:00
12
+ date: 2009-01-20 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 1.0.1
23
+ version: 1.0.2
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  requirements: []
75
75
 
76
76
  rubyforge_project: seattlerb
77
- rubygems_version: 1.3.0
77
+ rubygems_version: 1.3.1
78
78
  signing_key:
79
79
  specification_version: 2
80
80
  summary: Hoe is a simple rake/rubygems helper for project Rakefiles