ore-core 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,16 @@
1
+ ### 0.1.1 / 2011-01-19
2
+
3
+ * Require yard ~> 0.6.1.
4
+ * Require rspec ~> 2.4.0.
5
+ * Added common acronyms used in project namespaces to {Ore::Naming}.
6
+ * Added {Ore::Naming#module_of}.
7
+ * Renamed `lib/ore.rb` to `lib/ore-core.rb`.
8
+ * Removed the RubyGems plugin which auto-loaded {Ore::Specification}.
9
+ * Allow multiple dependency versions to be specified as a comma separated
10
+ String.
11
+ * Do not set {Ore::Project#has_rdoc} to `true` since it is deprecated
12
+ and only used by YARD.
13
+
1
14
  ### 0.1.0 / 2010-11-07
2
15
 
3
16
  * Initial release:
@@ -251,7 +251,9 @@ More than one version can be specified for each dependency:
251
251
 
252
252
  dependencies:
253
253
  foo: ~> 0.1.0, >= 0.0.7
254
- bar: 1.2.3, 1.3.1
254
+ bar:
255
+ - 1.2.3
256
+ - 1.3.1
255
257
 
256
258
  ## runtime_dependencies
257
259
 
@@ -263,9 +265,11 @@ The purely runtime-dependencies for a project can be specified like so:
263
265
 
264
266
  More than one version can be specified for each dependency:
265
267
 
266
- dependencies:
268
+ runtime_dependencies:
267
269
  foo: ~> 0.1.0, >= 0.0.7
268
- bar: 1.2.3, 1.3.1
270
+ bar:
271
+ - 1.2.3
272
+ - 1.3.1
269
273
 
270
274
  ## development_dependencies:
271
275
 
@@ -278,7 +282,9 @@ like so:
278
282
 
279
283
  More than one version can be specified for each dependency:
280
284
 
281
- dependencies:
285
+ development_dependencies:
282
286
  foo: ~> 0.1.0, >= 0.0.7
283
- bar: 1.2.3, 1.3.1
287
+ bar:
288
+ - 1.2.3
289
+ - 1.3.1
284
290
 
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
 
4
4
  begin
5
- gem 'rspec', '~> 2.0.0'
5
+ gem 'rspec', '~> 2.4.0'
6
6
  require 'rspec/core/rake_task'
7
7
 
8
8
  RSpec::Core::RakeTask.new
@@ -14,7 +14,7 @@ end
14
14
  task :default => :spec
15
15
 
16
16
  begin
17
- gem 'yard', '~> 0.6.0'
17
+ gem 'yard', '~> 0.6.1'
18
18
  require 'yard'
19
19
 
20
20
  YARD::Rake::YardocTask.new
@@ -1,5 +1,5 @@
1
1
  name: ore-core
2
- version: 0.1.0
2
+ version: 0.1.1
3
3
  summary: Mine raw RubyGems from YAML
4
4
  description:
5
5
  Ore is a simple RubyGem building solution. Ore handles the
@@ -15,4 +15,4 @@ has_yard: true
15
15
 
16
16
  development_dependencies:
17
17
  yard: ~> 0.6.1
18
- rspec: ~> 2.0.0
18
+ rspec: ~> 2.4.0
@@ -1,3 +1,2 @@
1
- require 'ore/config'
2
1
  require 'ore/project'
3
2
  require 'ore/specification'
@@ -30,15 +30,18 @@ module Ore
30
30
  # @param [String] name
31
31
  # The name of the dependency.
32
32
  #
33
- # @param [String, nil] versions
34
- # The version string.
33
+ # @param [String, Array, nil] versions
34
+ # The version(s).
35
35
  #
36
36
  # @return [Dependency]
37
37
  # The parsed dependency.
38
38
  #
39
39
  def self.parse_versions(name,versions)
40
- versions = if versions.kind_of?(String)
40
+ versions = case versions
41
+ when String
41
42
  versions.strip.split(/,\s*/)
43
+ when Array
44
+ versions.map { |v| v.to_s }
42
45
  else
43
46
  []
44
47
  end
@@ -30,10 +30,22 @@ module Ore
30
30
  # Words used in project names, but never in directory names
31
31
  @@ignore_namespaces = %w[ruby java]
32
32
 
33
+ # Common acronyms used in namespaces
34
+ @@namespace_acronyms = %w[
35
+ ffi i18n
36
+ http https ftp smtp imap pop3 ssh ssl tcp udp dns rpc
37
+ url uri www css html xhtml xml xsl json yaml csv
38
+ posix unix bsd
39
+ cpp asm
40
+ ]
41
+
33
42
  # Common project prefixes and namespaces
34
43
  @@common_namespaces = {
35
- 'ffi' => 'FFI',
36
- 'dm' => 'DataMapper'
44
+ 'ar' => 'ActiveRecord',
45
+ 'dm' => 'DataMapper',
46
+ 'js' => 'JavaScript',
47
+ 'msgpack' => 'MsgPack',
48
+ 'github' => 'GitHub'
37
49
  }
38
50
 
39
51
  #
@@ -51,23 +63,48 @@ module Ore
51
63
  end
52
64
  end
53
65
 
66
+ #
67
+ # Guesses the module name for a word within a project name.
68
+ #
69
+ # @param [String] word
70
+ # The word within a project name.
71
+ #
72
+ # @return [String]
73
+ # The module name.
74
+ #
75
+ # @since 0.1.1
76
+ #
77
+ def module_of(word)
78
+ if @@common_namespaces.has_key?(word)
79
+ @@common_namespaces[word]
80
+ elsif @@namespace_acronyms.include?(word)
81
+ word.upcase
82
+ else
83
+ word.capitalize
84
+ end
85
+ end
86
+
54
87
  #
55
88
  # Guesses the module names from a project name.
56
89
  #
90
+ # @param [String] name
91
+ # The name of the project.
92
+ #
57
93
  # @return [Array<String>]
58
94
  # The module names for a project.
59
95
  #
60
96
  def modules_of(name)
61
97
  names_in(name).map do |words|
62
- words.split('_').map { |word|
63
- @@common_namespaces[word] || word.capitalize
64
- }.join
98
+ words.split('_').map { |word| module_of(word) }.join
65
99
  end
66
100
  end
67
101
 
68
102
  #
69
103
  # Guesses the full namespace for a project.
70
104
  #
105
+ # @param [String] name
106
+ # The name of the project.
107
+ #
71
108
  # @return [String]
72
109
  # The full module namespace for a project.
73
110
  #
@@ -93,6 +130,9 @@ module Ore
93
130
  #
94
131
  # Guesses the namespace directories within `lib/` for a project.
95
132
  #
133
+ # @param [String] name
134
+ # The name of the project.
135
+ #
96
136
  # @return [Array<String>]
97
137
  # The namespace directories for the project.
98
138
  #
@@ -103,6 +143,9 @@ module Ore
103
143
  #
104
144
  # Guesses the namespace directory within `lib/` for a project.
105
145
  #
146
+ # @param [String] name
147
+ # The name of the project.
148
+ #
106
149
  # @return [String]
107
150
  # The namespace directory for the project.
108
151
  #
@@ -413,11 +413,9 @@ module Ore
413
413
  gemspec.executables = @executables
414
414
  gemspec.default_executable = @default_executable
415
415
 
416
- gemspec.has_rdoc = if has_yard
417
- 'yard'
418
- elsif has_rdoc
419
- true
420
- end
416
+ if has_yard
417
+ gemspec.has_rdoc = 'yard'
418
+ end
421
419
 
422
420
  gemspec.extra_rdoc_files = @extra_doc_files
423
421
  gemspec.files = @files
@@ -32,5 +32,11 @@ describe Dependency do
32
32
 
33
33
  dep.versions.should == ['~> 1.2.3', '>= 1.4.0']
34
34
  end
35
+
36
+ it "should parse an Array of versions" do
37
+ dep = subject.parse_versions('foo', ['~> 1.2.3', '>= 1.4.0'])
38
+
39
+ dep.versions.should == ['~> 1.2.3', '>= 1.4.0']
40
+ end
35
41
  end
36
42
  end
@@ -1,4 +1,5 @@
1
+ gem 'rspec', '~> 2.4.0'
1
2
  require 'rspec'
2
- require 'ore/specification'
3
+ require 'ore-core'
3
4
 
4
5
  include Ore
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.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-11-07 00:00:00 -07:00
17
+ date: 2011-01-19 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -42,9 +42,9 @@ dependencies:
42
42
  - !ruby/object:Gem::Version
43
43
  segments:
44
44
  - 2
45
+ - 4
45
46
  - 0
46
- - 0
47
- version: 2.0.0
47
+ version: 2.4.0
48
48
  type: :development
49
49
  version_requirements: *id002
50
50
  description: Ore is a simple RubyGem building solution. Ore handles the creation of Gem::Specification objects as well as building '.gem' files. Ore allows the developer to keep all of the project information in a single YAML file.
@@ -68,7 +68,7 @@ files:
68
68
  - README.md
69
69
  - Rakefile
70
70
  - gemspec.yml
71
- - lib/ore.rb
71
+ - lib/ore-core.rb
72
72
  - lib/ore/checks.rb
73
73
  - lib/ore/defaults.rb
74
74
  - lib/ore/dependency.rb
@@ -88,7 +88,6 @@ files:
88
88
  - lib/ore/versions/version.rb
89
89
  - lib/ore/versions/version_constant.rb
90
90
  - lib/ore/versions/version_file.rb
91
- - lib/rubygems_plugin.rb
92
91
  - ore-core.gemspec
93
92
  - spec/dependency_spec.rb
94
93
  - spec/document_file_spec.rb
@@ -1,40 +0,0 @@
1
- module Ore
2
- #
3
- # Provides transparent access to {Ore::Specification}.
4
- #
5
- # @param [Symbol] name
6
- # The constant name.
7
- #
8
- # @return [Object]
9
- # The constant.
10
- #
11
- # @raise [NameError]
12
- # The constant could not be found.
13
- #
14
- def self.const_missing(name)
15
- if name == :Specification
16
- begin
17
- # attempt to load 'ore/specification' from the $LOAD_PATH
18
- require 'ore/specification'
19
- rescue ::LoadError
20
- # find our `lib/` directory
21
- lib_dir = File.expand_path(File.dirname(__FILE__))
22
-
23
- # modify the $LOAD_PATH is 'ore/specification' is not available
24
- $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
25
-
26
- begin
27
- # attempt loading 'ore/specification' again
28
- require 'ore/specification'
29
- rescue ::LoadError
30
- # ore is probably not installed, so raise a NameError
31
- return super(name)
32
- end
33
- end
34
-
35
- return Ore.const_get(name)
36
- end
37
-
38
- super(name)
39
- end
40
- end