ore-core 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,13 @@
1
+ ### 0.1.3 / 2011-02-12
2
+
3
+ * Added {Ore::Project#emails}.
4
+ * Added {Ore::Project#email}.
5
+ * Added {Ore::Paths#each_path}.
6
+ * Added {Ore::Settings#set_emails!}.
7
+ * Have {Ore::Dependency} inherit from `Gem::Dependency`.
8
+ * DRYed up {Ore::Settings}.
9
+ * Fixed typos in {file:GemspecYML.md}.
10
+
1
11
  ### 0.1.2 / 2011-02-08
2
12
 
3
13
  * Opted into [gem-testers.org](http://gem-testers.org/).
@@ -72,11 +72,11 @@ Multiple licenses can also be listed:
72
72
 
73
73
  The authors of the project can be listed like so:
74
74
 
75
- author: Alice
75
+ authors: Alice
76
76
 
77
77
  If a project has more than one author, each author can be listed:
78
78
 
79
- author:
79
+ authors:
80
80
  - Alice
81
81
  - Eve
82
82
  - Bob
@@ -176,11 +176,11 @@ the `.document` file.
176
176
 
177
177
  The files of the project can be listed like so:
178
178
 
179
- file: lib/**/*.rb
179
+ files: lib/**/*.rb
180
180
 
181
181
  More than one file pattern can be specification:
182
182
 
183
- file:
183
+ files:
184
184
  - lib/**/*.rb
185
185
  - spec/**/*
186
186
  - data/**/*
@@ -244,8 +244,9 @@ The version of RubyGems required by the project can be listed like so:
244
244
 
245
245
  required_rubygems_version: >= 1.3.7
246
246
 
247
- If `required_rubygems_version` is not listed and the project uses Bundler,
248
- Ore will default `required_rubygems_version` to `>= 1.3.6`.
247
+ If `required_rubygems_version` is not listed and the project uses
248
+ [Bundler](http://gembundler.com/), Ore will default `required_rubygems_version`
249
+ to `>= 1.3.6`.
249
250
 
250
251
  ## dependencies
251
252
 
@@ -279,7 +280,7 @@ More than one version can be specified for each dependency:
279
280
  - 1.2.3
280
281
  - 1.3.1
281
282
 
282
- ## development_dependencies:
283
+ ## development_dependencies
283
284
 
284
285
  The purely developmental-dependencies for a project can be specified
285
286
  like so:
@@ -1,5 +1,5 @@
1
1
  name: ore-core
2
- version: 0.1.2
2
+ version: 0.1.3
3
3
  summary: Mine raw RubyGems from YAML
4
4
  description:
5
5
  Ore is a simple RubyGem building solution. Ore handles the
@@ -1,28 +1,10 @@
1
+ require 'rubygems/dependency'
2
+
1
3
  module Ore
2
4
  #
3
5
  # Represents a RubyGem dependency.
4
6
  #
5
- class Dependency
6
-
7
- # The name of the dependency
8
- attr_reader :name
9
-
10
- # The required versions
11
- attr_reader :versions
12
-
13
- #
14
- # Creates a new dependency.
15
- #
16
- # @param [String] name
17
- # The name of the dependency.
18
- #
19
- # @param [Array<String>] versions
20
- # The required versions.
21
- #
22
- def initialize(name,*versions)
23
- @name = name
24
- @versions = versions
25
- end
7
+ class Dependency < Gem::Dependency
26
8
 
27
9
  #
28
10
  # Parses a version string.
@@ -64,5 +46,17 @@ module Ore
64
46
  return parse_versions(name,versions)
65
47
  end
66
48
 
49
+ #
50
+ # The version requirements of the dependency.
51
+ #
52
+ # @return [Array<String>]
53
+ # The version requirement Strings.
54
+ #
55
+ # @since 0.1.3
56
+ #
57
+ def versions
58
+ requirements_list.map { |req| req.to_s }
59
+ end
60
+
67
61
  end
68
62
  end
@@ -142,5 +142,28 @@ module Ore
142
142
  end
143
143
  end
144
144
  end
145
+
146
+ #
147
+ # Iterates over the paths.
148
+ #
149
+ # @param [Array<String>, String] paths
150
+ # The paths or path glob pattern to iterate over.
151
+ #
152
+ # @yield [path]
153
+ # The given block will be passed each individual path.
154
+ #
155
+ # @yieldparam [String] path
156
+ # An individual path.
157
+ #
158
+ # @ since 0.1.3
159
+ #
160
+ def each_path(paths,&block)
161
+ case paths
162
+ when Array
163
+ paths.each(&block)
164
+ else
165
+ glob(paths,&block)
166
+ end
167
+ end
145
168
  end
146
169
  end
@@ -69,8 +69,8 @@ module Ore
69
69
  # The homepage for the project
70
70
  attr_reader :homepage
71
71
 
72
- # The email contact for the project
73
- attr_reader :email
72
+ # The email contacts for the project
73
+ attr_reader :emails
74
74
 
75
75
  # The build date for any project gems
76
76
  attr_reader :date
@@ -179,7 +179,11 @@ module Ore
179
179
  end
180
180
 
181
181
  @homepage = metadata['homepage']
182
- @email = metadata['email']
182
+ @emails = []
183
+
184
+ if metadata['email']
185
+ set_emails! metadata['email']
186
+ end
183
187
 
184
188
  if metadata['date']
185
189
  set_date! metadata['date']
@@ -248,7 +252,7 @@ module Ore
248
252
  end
249
253
 
250
254
  if metadata['post_install_message']
251
- set_post_install_message! metadata['post_install_message']
255
+ @post_install_message = metadata['post_install_message']
252
256
  end
253
257
 
254
258
  @requirements = []
@@ -258,11 +262,11 @@ module Ore
258
262
  end
259
263
 
260
264
  if metadata['required_ruby_version']
261
- set_required_ruby_version! metadata['required_ruby_version']
265
+ @required_ruby_version = metadata['required_ruby_version']
262
266
  end
263
267
 
264
268
  if metadata['required_rubygems_version']
265
- set_required_rubygems_version! metadata['required_rubygems_version']
269
+ @required_rubygems_version = metadata['required_rubygems_version']
266
270
  else
267
271
  infer_required_rubygems_version!
268
272
  end
@@ -339,6 +343,18 @@ module Ore
339
343
  @licenses.first
340
344
  end
341
345
 
346
+ #
347
+ # The primary email address of the project.
348
+ #
349
+ # @return [String, nil]
350
+ # The primary email address for the project.
351
+ #
352
+ # @since 0.1.3
353
+ #
354
+ def email
355
+ @emails.first
356
+ end
357
+
342
358
  #
343
359
  # Determines whether the project prefers using
344
360
  # [RVM](http://rvm.beginrescueend.com/).
@@ -420,7 +436,7 @@ module Ore
420
436
  gemspec.licenses = @licenses
421
437
  gemspec.authors = @authors
422
438
  gemspec.homepage = @homepage
423
- gemspec.email = @email
439
+ gemspec.email = @emails
424
440
  gemspec.date = @date
425
441
 
426
442
  @require_paths.each do |path|
@@ -42,7 +42,8 @@ module Ore
42
42
  # The license(s) of the project.
43
43
  #
44
44
  def set_license!(license)
45
- if license.kind_of?(Array)
45
+ case license
46
+ when Array
46
47
  @licenses += license
47
48
  else
48
49
  @licenses << license
@@ -56,13 +57,31 @@ module Ore
56
57
  # The authors listed in the metadata file.
57
58
  #
58
59
  def set_authors!(authors)
59
- if authors.kind_of?(Array)
60
+ case authors
61
+ when Array
60
62
  @authors += authors
61
63
  else
62
64
  @authors << authors
63
65
  end
64
66
  end
65
67
 
68
+ #
69
+ # Sets the email contacts of the project.
70
+ #
71
+ # @param [Array<String>, String] emails
72
+ # The email addresses listed in the metadata file.
73
+ #
74
+ # @since 0.1.3
75
+ #
76
+ def set_emails!(emails)
77
+ case emails
78
+ when Array
79
+ @emails += emails
80
+ else
81
+ @emails << emails
82
+ end
83
+ end
84
+
66
85
  #
67
86
  # Sets the release date of the project.
68
87
  #
@@ -80,11 +99,7 @@ module Ore
80
99
  # The require-paths or the glob-pattern listed in the metadata file.
81
100
  #
82
101
  def set_require_paths!(paths)
83
- if paths.kind_of?(Array)
84
- paths.each { |path| add_require_path(path) }
85
- else
86
- glob(paths) { |path| add_require_path(path) }
87
- end
102
+ each_path(paths) { |path| add_require_path(path) }
88
103
  end
89
104
 
90
105
  #
@@ -95,11 +110,7 @@ module Ore
95
110
  # file.
96
111
  #
97
112
  def set_executables!(paths)
98
- if paths.kind_of?(Array)
99
- paths.each { |path| add_executable(path) }
100
- else
101
- glob(paths) { |path| add_executable(path) }
102
- end
113
+ each_path(paths) { |path| add_executable(path) }
103
114
  end
104
115
 
105
116
  #
@@ -123,11 +134,7 @@ module Ore
123
134
  # The file paths or the glob-pattern listed in the metadata file.
124
135
  #
125
136
  def set_extra_doc_files!(paths)
126
- if paths.kind_of?(Array)
127
- paths.each { |path| add_extra_doc_file(path) }
128
- else
129
- glob(paths) { |path| add_extra_doc_file(path) }
130
- end
137
+ each_path(paths) { |path| add_extra_doc_file(path) }
131
138
  end
132
139
 
133
140
  #
@@ -137,11 +144,7 @@ module Ore
137
144
  # The files or the glob-pattern listed in the metadata file.
138
145
  #
139
146
  def set_files!(paths)
140
- if paths.kind_of?(Array)
141
- paths.each { |path| add_file(path) }
142
- else
143
- glob(paths) { |path| add_file(path) }
144
- end
147
+ each_path(paths) { |path| add_file(path) }
145
148
  end
146
149
 
147
150
  #
@@ -151,23 +154,7 @@ module Ore
151
154
  # The test-files of the glob-pattern listed in the metadata file.
152
155
  #
153
156
  def set_test_files!(paths)
154
- if paths.kind_of?(Array)
155
- paths.each { |path| add_test_file(path) }
156
- else
157
- glob(paths) { |path| add_test_file(path) }
158
- end
159
- end
160
-
161
- #
162
- # Sets the post-installation message.
163
- #
164
- # @param [String] message
165
- # The post-install message.
166
- #
167
- # @since 0.1.0
168
- #
169
- def set_post_install_message!(message)
170
- @post_install_message = message
157
+ each_path(paths) { |path| add_test_file(path) }
171
158
  end
172
159
 
173
160
  #
@@ -179,33 +166,14 @@ module Ore
179
166
  # @since 0.2.0
180
167
  #
181
168
  def set_requirements!(requirements)
182
- if requirements.kind_of?(Array)
169
+ case requirements
170
+ when Array
183
171
  @requirements += requirements
184
172
  else
185
173
  @requirements << requirements
186
174
  end
187
175
  end
188
176
 
189
- #
190
- # Sets the Ruby version required by the project.
191
- #
192
- # @param [String] version
193
- # The version requirement.
194
- #
195
- def set_required_ruby_version!(version)
196
- @required_ruby_version = version.to_s
197
- end
198
-
199
- #
200
- # Sets the RubyGems version required by the project.
201
- #
202
- # @param [String] version
203
- # The version requirement.
204
- #
205
- def set_required_rubygems_version!(version)
206
- @required_rubygems_version = version.to_s
207
- end
208
-
209
177
  #
210
178
  # Sets the dependencies of the project.
211
179
  #
@@ -9,7 +9,7 @@ describe Dependency do
9
9
  dep = subject.parse('foo')
10
10
 
11
11
  dep.name.should == 'foo'
12
- dep.versions.should be_empty
12
+ dep.versions.should == ['>= 0']
13
13
  end
14
14
 
15
15
  it "should parse a dependency with a version" do
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ore-core
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.2
5
+ version: 0.1.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Postmodern
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-02-08 00:00:00 -08:00
13
+ date: 2011-02-12 00:00:00 -08:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -36,7 +36,8 @@ dependencies:
36
36
  type: :development
37
37
  version_requirements: *id002
38
38
  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.
39
- email: postmodern.mod3@gmail.com
39
+ email:
40
+ - postmodern.mod3@gmail.com
40
41
  executables: []
41
42
 
42
43
  extensions: []