ore 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog.md CHANGED
@@ -1,3 +1,10 @@
1
+ ### 0.2.1 / 2010-10-29
2
+
3
+ * Ignore 'ruby' and 'java' from namespace directories returned from
4
+ {Ore::Naming#namespace_dirs_of}.
5
+ * Ignore 'ruby' and 'java' from module names returned from
6
+ {Ore::Naming#modules_of}.
7
+
1
8
  ### 0.2.0 / 2010-10-27
2
9
 
3
10
  * Added {Ore::Project#requirements}.
data/gemspec.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  name: ore
2
- version: 0.2.0
2
+ version: 0.2.1
3
3
  summary: Mine raw RubyGems from YAML
4
4
  description:
5
5
  Ore is a simple RubyGem building solution. Ore handles the
data/lib/ore/naming.rb CHANGED
@@ -27,12 +27,30 @@ module Ore
27
27
  # The directory which contains built packages
28
28
  @@pkg_dir = 'pkg'
29
29
 
30
+ # Words used in project names, but never in directory names
31
+ @@ignore_namespaces = %w[ruby java]
32
+
30
33
  # Common project prefixes and namespaces
31
34
  @@common_namespaces = {
32
35
  'ffi' => 'FFI',
33
36
  'dm' => 'DataMapper'
34
37
  }
35
38
 
39
+ #
40
+ # Splits the project name into individual names.
41
+ #
42
+ # @param [String] name
43
+ # The name to split.
44
+ #
45
+ # @return [Array<String>]
46
+ # The individual names of the project name.
47
+ #
48
+ def names_in(name)
49
+ name.split('-').reject do |word|
50
+ @@ignore_namespaces.include?(word)
51
+ end
52
+ end
53
+
36
54
  #
37
55
  # Guesses the module names from a project name.
38
56
  #
@@ -40,7 +58,7 @@ module Ore
40
58
  # The module names for a project.
41
59
  #
42
60
  def modules_of(name)
43
- name.split('-').map do |words|
61
+ names_in(name).map do |words|
44
62
  words.split('_').map { |word|
45
63
  @@common_namespaces[word] || word.capitalize
46
64
  }.join
@@ -79,7 +97,7 @@ module Ore
79
97
  # The namespace directories for the project.
80
98
  #
81
99
  def namespace_dirs_of(name)
82
- name.split('-').map { |word| underscore(word) }
100
+ names_in(name).map { |word| underscore(word) }
83
101
  end
84
102
 
85
103
  #
data/spec/naming_spec.rb CHANGED
@@ -30,6 +30,10 @@ describe Naming do
30
30
  subject.modules_of('foo-bar').should == ['Foo', 'Bar']
31
31
  end
32
32
 
33
+ it "should filter out obvious names from the module names" do
34
+ subject.modules_of('ruby-foo').should == ['Foo']
35
+ end
36
+
33
37
  it "should recognize common acronyms in project names" do
34
38
  subject.modules_of('ffi-bar').should == ['FFI', 'Bar']
35
39
  end
@@ -42,6 +46,10 @@ describe Naming do
42
46
  subject.namespace_dirs_of('foo-bar').should == ['foo', 'bar']
43
47
  end
44
48
 
49
+ it "should filter out namespaces that are rarely used in directory names" do
50
+ subject.namespace_dirs_of('ruby-foo').should == ['foo']
51
+ end
52
+
45
53
  it "should guess the namespace directory from a project name" do
46
54
  subject.namespace_path_of('foo-bar').should == 'foo/bar'
47
55
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 0
9
- version: 0.2.0
8
+ - 1
9
+ version: 0.2.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Postmodern
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-27 00:00:00 -07:00
17
+ date: 2010-10-29 00:00:00 -07:00
18
18
  default_executable: ore
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency