ore-core 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
File without changes
@@ -1,3 +1,25 @@
1
+ ### 0.1.2 / 2011-02-08
2
+
3
+ * Opted into [gem-testers.org](http://gem-testers.org/).
4
+ * Added `rb` to the list of words to ignore in project names.
5
+ * Added common project acronyms to {Ore::Naming}.
6
+ * Added more common project name / namespace mappings:
7
+ * `rubygems` -> `Gem`
8
+ * `ar` -> `ActiveRecord`
9
+ * `dm` -> `DataMapper`
10
+ * `js` -> `JavaScript`
11
+ * `msgpack` -> `MsgPack`
12
+ * `github` -> `GitHub`
13
+ * `rdoc` -> `RDoc`
14
+ * Renamed `Ore::Defaults` to {Ore::Inferences}.
15
+ * Explicitly require `rubygems/specification` and `rubygems/builder`
16
+ to work around a RubyGems 1.5.0 issue.
17
+ * Do not explicitly convert dependency versions into Strings.
18
+ * Default the root directory passed to {Ore::Project#initialize} to the current
19
+ working directory.
20
+ * Fixed typos in the YARD documentation thanks to
21
+ [yard-spellcheck](http://github.com/postmodern/yard-spellcheck).
22
+
1
23
  ### 0.1.1 / 2011-01-19
2
24
 
3
25
  * Require yard ~> 0.6.1.
@@ -22,7 +44,7 @@
22
44
  * Added {Ore::Versions::VersionFile}.
23
45
  * Added {Ore::Project}:
24
46
  * Added {Ore::Checks}.
25
- * Added {Ore::Defaults}.
47
+ * Added `Ore::Defaults`.
26
48
  * Added {Ore::Settings}.
27
49
  * Added {Ore::Specification}.
28
50
  * Added {Ore::Project#post_install_message}.
@@ -87,6 +87,14 @@ The primary email contact for the project can be listed like so:
87
87
 
88
88
  email: alice@example.com
89
89
 
90
+ If a project has more than one email contact, each email address can be
91
+ listed:
92
+
93
+ email:
94
+ - alice@example.com
95
+ - eve@example.com
96
+ - bob@example.com
97
+
90
98
  ## date
91
99
 
92
100
  The publish date of the current version can be listed like so:
@@ -1,5 +1,4 @@
1
-
2
- Copyright (c) 2010 Hal Brodigan
1
+ Copyright (c) 2010-2011 Hal Brodigan
3
2
 
4
3
  Permission is hereby granted, free of charge, to any person obtaining
5
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,23 +1,25 @@
1
- # Ore
1
+ # Ore (Core)
2
2
 
3
3
  * [Source](http://github.com/ruby-ore/ore-core)
4
4
  * [Issues](http://github.com/ruby-ore/ore-core/issues)
5
5
  * [Documentation](http://rubydoc.info/gems/ore-core/file/README.md)
6
+ * [Email](postmodern.mod3 at gmail.com)
6
7
  * IRC: irc.freenode.net #ruby-ore
7
- * Postmodern (postmodern.mod3 at gmail.com)
8
8
 
9
9
  ## Description
10
10
 
11
11
  Ore is a simple RubyGem building solution. Ore handles the creation of
12
- `Gem::Specification` objects as well as building `.gem` files. Ore allows
13
- the developer to keep all of the project information in a single YAML file.
12
+ [Gem::Specification](http://docs.rubygems.org/read/chapter/20) objects as
13
+ well as building `.gem` files. Ore allows the developer to keep all of the
14
+ project information in a single YAML file.
14
15
 
15
16
  ## Features
16
17
 
17
18
  * Stores project information in **one YAML file** (`gemspec.yml`).
18
19
  * **Does not** have dependencies.
19
- * **Does not** impose a development workflow onto the developer. One could
20
- even use Ore with `Jeweler::Tasks`.
20
+ * **Does not** impose a development workflow onto the developer.
21
+ One could even use Ore with
22
+ [Jeweler::Tasks](https://github.com/technicalpickles/jeweler#readme).
21
23
  * **Can** load the project version from:
22
24
  * `VERSION` or `VERSION.yml` files.
23
25
  * `VERSION` constants or `Version` modules defined in a `version.rb` file.
@@ -28,10 +30,17 @@ the developer to keep all of the project information in a single YAML file.
28
30
  # custom logic here
29
31
  end
30
32
  rescue NameError
31
- STDERR.puts "The 'my_project.gemspec' file requires Ore."
32
- STDERR.puts "Run `gem install ore-ore` to install Ore."
33
+ begin
34
+ require 'ore/specification'
35
+ retry
36
+ rescue LoadError
37
+ STDERR.puts "The 'my_project.gemspec' file requires Ore."
38
+ STDERR.puts "Run `gem install ore-core` to install Ore."
39
+ end
33
40
  end
34
41
 
42
+ * **Can** be used with [Bundler](http://gembundler.com).
43
+
35
44
  ## Install
36
45
 
37
46
  $ gem install ore-core
@@ -41,7 +50,7 @@ the developer to keep all of the project information in a single YAML file.
41
50
  The `gemspec.yml` file used to build Ore:
42
51
 
43
52
  name: ore-core
44
- version: 0.1.0
53
+ version: 0.1.2
45
54
  summary: Mine raw RubyGems from YAML.
46
55
  description:
47
56
  Ore is a simple RubyGem building solution. Ore handles the
@@ -57,12 +66,13 @@ The `gemspec.yml` file used to build Ore:
57
66
 
58
67
  development_dependencies:
59
68
  yard: ~> 0.6.1
60
- rspec: ~> 2.0.0
69
+ rspec: ~> 2.4.0
61
70
 
62
71
  For a complete refrence to the `gemspec.yml` file, please see
63
- {file:GemspecYML.md}.
72
+ [GemspecYML Reference](http://rubydoc.info/gems/ore-core/file/GemspecYML.html).
64
73
 
65
74
  ## License
66
75
 
67
- See {file:LICENSE.txt} for license information.
76
+ Copyright (c) 2010-2011 Hal Brodigan
68
77
 
78
+ See {file:LICENSE.txt} for license information.
data/Rakefile CHANGED
@@ -11,6 +11,7 @@ rescue LoadError
11
11
  abort "Please run `gem install rspec` to install RSpec."
12
12
  end
13
13
  end
14
+ task :test => :spec
14
15
  task :default => :spec
15
16
 
16
17
  begin
@@ -1,5 +1,5 @@
1
1
  name: ore-core
2
- version: 0.1.1
2
+ version: 0.1.2
3
3
  summary: Mine raw RubyGems from YAML
4
4
  description:
5
5
  Ore is a simple RubyGem building solution. Ore handles the
@@ -50,10 +50,10 @@ module Ore
50
50
  end
51
51
 
52
52
  #
53
- # Parses a dependencey string.
53
+ # Parses a dependency string.
54
54
  #
55
55
  # @param [String] dependency
56
- # The dependencey string.
56
+ # The dependency string.
57
57
  #
58
58
  # @return [Dependency]
59
59
  # The parsed dependency.
@@ -0,0 +1,215 @@
1
+ require 'ore/naming'
2
+ require 'ore/versions'
3
+
4
+ require 'date'
5
+
6
+ module Ore
7
+ #
8
+ # A mixin for {Project} which provides methods for assigning default
9
+ # values to project attributes.
10
+ #
11
+ module Inferences
12
+ include Naming
13
+
14
+ # The default require-paths
15
+ @@require_paths = [@@lib_dir, @@ext_dir]
16
+
17
+ # The glob to find default executables
18
+ @@executables = "#{@@bin_dir}/*"
19
+
20
+ # The globs to find all testing-files
21
+ @@test_files = [
22
+ "#{@@test_dir}/{**/}*_test.rb",
23
+ "#{@@spec_dir}/{**/}*_spec.rb"
24
+ ]
25
+
26
+ # The files to always exclude
27
+ @@exclude_files = %w[
28
+ .gitignore
29
+ ]
30
+
31
+ protected
32
+
33
+ #
34
+ # Infers the Source Code Management used by the project.
35
+ #
36
+ # @since 0.1.2.
37
+ #
38
+ def infer_scm!
39
+ if @root.join('.git').directory?
40
+ @scm = :git
41
+ else
42
+ @scm = nil
43
+ end
44
+ end
45
+
46
+ #
47
+ # Infers the project files.
48
+ #
49
+ # @since 0.1.2.
50
+ #
51
+ def infer_project_files!
52
+ @project_files = Set[]
53
+
54
+ filter_path = lambda { |path|
55
+ check_readable(path) { |file| @project_files << file }
56
+ }
57
+
58
+ within do
59
+ case @scm
60
+ when :git
61
+ `git ls-files -z`.split("\0").each(&filter_path)
62
+ else
63
+ within { Dir.glob('{**/}*',&filter_path) }
64
+ end
65
+ end
66
+ end
67
+
68
+ #
69
+ # Infers the namespace of the project based on the project name.
70
+ #
71
+ # @since 0.1.2.
72
+ #
73
+ def infer_namespace!
74
+ @namespace_modules = modules_of(@name)
75
+ @namespace = namespace_of(@name)
76
+
77
+ dir = namespace_path_of(@name)
78
+
79
+ @namespace_dir = if lib_directory?(dir)
80
+ dir
81
+ elsif lib_directory?(@name)
82
+ @name
83
+ end
84
+ end
85
+
86
+ #
87
+ # Infers the project name using the directory name of the project.
88
+ #
89
+ # @since 0.1.2.
90
+ #
91
+ def infer_name!
92
+ @name = @root.basename.to_s
93
+ end
94
+
95
+ #
96
+ # Finds and sets the version of the project.
97
+ #
98
+ # @since 0.1.2.
99
+ #
100
+ def infer_version!
101
+ @version = (
102
+ Versions::VersionFile.find(self) ||
103
+ Versions::VersionConstant.find(self)
104
+ )
105
+
106
+ unless @version
107
+ raise(InvalidMetadata,"no version file or constant in #{@root}")
108
+ end
109
+ end
110
+
111
+ #
112
+ # Infers the release date of the project.
113
+ #
114
+ # @since 0.1.2.
115
+ #
116
+ def infer_date!
117
+ @date = Date.today
118
+ end
119
+
120
+ #
121
+ # Infers the require-paths of the project.
122
+ #
123
+ # @since 0.1.2.
124
+ #
125
+ def infer_require_paths!
126
+ @@require_paths.each do |name|
127
+ @require_paths << name if @root.join(name).directory?
128
+ end
129
+ end
130
+
131
+ #
132
+ # Infers the executables of the project.
133
+ #
134
+ # @since 0.1.2.
135
+ #
136
+ def infer_executables!
137
+ glob(@@executables) do |path|
138
+ check_executable(path) { |exe| @executables << File.basename(exe) }
139
+ end
140
+ end
141
+
142
+ #
143
+ # Infers the default executable of the project.
144
+ #
145
+ # @since 0.1.2.
146
+ #
147
+ def infer_default_executable!
148
+ @default_executable = if @executables.include?(@name)
149
+ @name
150
+ else
151
+ @executables.first
152
+ end
153
+ end
154
+
155
+ #
156
+ # Infers documentation of the project.
157
+ #
158
+ # @since 0.1.2.
159
+ #
160
+ def infer_documentation!
161
+ if file?('.yardopts')
162
+ @documentation = :yard
163
+ else
164
+ @documentation = :rdoc
165
+ end
166
+ end
167
+
168
+ #
169
+ # Infers the extra documentation files of the project.
170
+ #
171
+ # @since 0.1.2.
172
+ #
173
+ def infer_extra_doc_files!
174
+ glob('README.*') { |path| add_extra_doc_file(path) }
175
+
176
+ if @document
177
+ @document.each_extra_file { |path| add_extra_doc_file(path) }
178
+ end
179
+ end
180
+
181
+ #
182
+ # Infers the files of the project.
183
+ #
184
+ # @since 0.1.2.
185
+ #
186
+ def infer_files!
187
+ @project_files.each do |file|
188
+ @files << file unless @@exclude_files.include?(file)
189
+ end
190
+ end
191
+
192
+ #
193
+ # Infers the test-files of the project.
194
+ #
195
+ # @since 0.1.2.
196
+ #
197
+ def infer_test_files!
198
+ @@test_files.each do |pattern|
199
+ glob(pattern) { |path| add_test_file(path) }
200
+ end
201
+ end
202
+
203
+ #
204
+ # Infers the required version of RubyGems to `>= 1.3.6`, if the
205
+ # project uses Bundler.
206
+ #
207
+ # @since 0.1.2.
208
+ #
209
+ def infer_required_rubygems_version!
210
+ if bundler?
211
+ @required_rubygems_version = '>= 1.3.6'
212
+ end
213
+ end
214
+ end
215
+ end
@@ -28,11 +28,11 @@ module Ore
28
28
  @@pkg_dir = 'pkg'
29
29
 
30
30
  # Words used in project names, but never in directory names
31
- @@ignore_namespaces = %w[ruby java]
31
+ @@ignore_namespaces = %w[ruby rb java]
32
32
 
33
33
  # Common acronyms used in namespaces
34
34
  @@namespace_acronyms = %w[
35
- ffi i18n
35
+ ffi yard i18n
36
36
  http https ftp smtp imap pop3 ssh ssl tcp udp dns rpc
37
37
  url uri www css html xhtml xml xsl json yaml csv
38
38
  posix unix bsd
@@ -41,11 +41,13 @@ module Ore
41
41
 
42
42
  # Common project prefixes and namespaces
43
43
  @@common_namespaces = {
44
+ 'rubygems' => 'Gem',
44
45
  'ar' => 'ActiveRecord',
45
46
  'dm' => 'DataMapper',
46
47
  'js' => 'JavaScript',
47
48
  'msgpack' => 'MsgPack',
48
- 'github' => 'GitHub'
49
+ 'github' => 'GitHub',
50
+ 'rdoc' => 'RDoc'
49
51
  }
50
52
 
51
53
  #
@@ -3,7 +3,7 @@ require 'ore/exceptions/invalid_metadata'
3
3
  require 'ore/naming'
4
4
  require 'ore/paths'
5
5
  require 'ore/checks'
6
- require 'ore/defaults'
6
+ require 'ore/inferences'
7
7
  require 'ore/settings'
8
8
  require 'ore/document_file'
9
9
 
@@ -11,10 +11,12 @@ require 'pathname'
11
11
  require 'yaml'
12
12
  require 'find'
13
13
  require 'fileutils'
14
+ require 'rubygems/specification'
15
+ require 'rubygems/builder'
14
16
 
15
17
  module Ore
16
18
  #
17
- # Combinds the metadata from the `gemspec.yml` file and the inferred
19
+ # Combines the metadata from the `gemspec.yml` file and the inferred
18
20
  # information from the project directory.
19
21
  #
20
22
  class Project
@@ -22,7 +24,7 @@ module Ore
22
24
  include Naming
23
25
  include Paths
24
26
  include Checks
25
- include Defaults
27
+ include Inferences
26
28
  include Settings
27
29
 
28
30
  # The project metadata file
@@ -40,7 +42,7 @@ module Ore
40
42
  # The fully-qualified namespace of the project
41
43
  attr_reader :namespace
42
44
 
43
- # The infered namespace modules of the project
45
+ # The inferred namespace modules of the project
44
46
  attr_reader :namespace_modules
45
47
 
46
48
  # The directory contain the project code.
@@ -124,7 +126,7 @@ module Ore
124
126
  # @param [String] root
125
127
  # The root directory of the project.
126
128
  #
127
- def initialize(root)
129
+ def initialize(root=Dir.pwd)
128
130
  @root = Pathname.new(root).expand_path
129
131
 
130
132
  unless @root.directory?
@@ -149,7 +151,7 @@ module Ore
149
151
  if metadata['name']
150
152
  @name = metadata['name'].to_s
151
153
  else
152
- default_name!
154
+ infer_name!
153
155
  end
154
156
 
155
157
  # infer the namespace from the project name
@@ -158,7 +160,7 @@ module Ore
158
160
  if metadata['version']
159
161
  set_version! metadata['version']
160
162
  else
161
- default_version!
163
+ infer_version!
162
164
  end
163
165
 
164
166
  @summary = (metadata['summary'] || metadata['description'])
@@ -182,7 +184,7 @@ module Ore
182
184
  if metadata['date']
183
185
  set_date! metadata['date']
184
186
  else
185
- default_date!
187
+ infer_date!
186
188
  end
187
189
 
188
190
  @document = DocumentFile.find(self)
@@ -192,7 +194,7 @@ module Ore
192
194
  if metadata['require_paths']
193
195
  set_require_paths! metadata['require_paths']
194
196
  else
195
- default_require_paths!
197
+ infer_require_paths!
196
198
  end
197
199
 
198
200
  @executables = []
@@ -200,7 +202,7 @@ module Ore
200
202
  if metadata['executables']
201
203
  set_executables! metadata['executables']
202
204
  else
203
- default_executables!
205
+ infer_executables!
204
206
  end
205
207
 
206
208
  @default_executable = nil
@@ -208,7 +210,7 @@ module Ore
208
210
  if metadata['default_executable']
209
211
  set_default_executable! metadata['default_executable']
210
212
  else
211
- default_executable!
213
+ infer_default_executable!
212
214
  end
213
215
 
214
216
  if metadata['has_yard']
@@ -218,7 +220,7 @@ module Ore
218
220
  :rdoc
219
221
  end
220
222
  else
221
- default_documentation!
223
+ infer_documentation!
222
224
  end
223
225
 
224
226
  @extra_doc_files = []
@@ -226,7 +228,7 @@ module Ore
226
228
  if metadata['extra_doc_files']
227
229
  set_extra_doc_files! metadata['extra_doc_files']
228
230
  else
229
- default_extra_doc_files!
231
+ infer_extra_doc_files!
230
232
  end
231
233
 
232
234
  @files = []
@@ -234,7 +236,7 @@ module Ore
234
236
  if metadata['files']
235
237
  set_files! metadata['files']
236
238
  else
237
- default_files!
239
+ infer_files!
238
240
  end
239
241
 
240
242
  @test_files = []
@@ -242,7 +244,7 @@ module Ore
242
244
  if metadata['test_files']
243
245
  set_test_files! metadata['test_files']
244
246
  else
245
- default_test_files!
247
+ infer_test_files!
246
248
  end
247
249
 
248
250
  if metadata['post_install_message']
@@ -262,7 +264,7 @@ module Ore
262
264
  if metadata['required_rubygems_version']
263
265
  set_required_rubygems_version! metadata['required_rubygems_version']
264
266
  else
265
- default_required_rubygems_version!
267
+ infer_required_rubygems_version!
266
268
  end
267
269
 
268
270
  @dependencies = []
@@ -337,6 +339,19 @@ module Ore
337
339
  @licenses.first
338
340
  end
339
341
 
342
+ #
343
+ # Determines whether the project prefers using
344
+ # [RVM](http://rvm.beginrescueend.com/).
345
+ #
346
+ # @return [Boolean]
347
+ # Specifies whether the project prefers being developed under RVM.
348
+ #
349
+ # @since 0.1.2
350
+ #
351
+ def rvm?
352
+ file?('.rvmrc')
353
+ end
354
+
340
355
  #
341
356
  # Determines whether the project uses Bundler.
342
357
  #
@@ -367,6 +382,8 @@ module Ore
367
382
  @documentation == :rdoc
368
383
  end
369
384
 
385
+ alias has_rdoc? has_rdoc
386
+
370
387
  #
371
388
  # Determines if the project contains YARD documentation.
372
389
  #
@@ -377,6 +394,8 @@ module Ore
377
394
  @documentation == :yard
378
395
  end
379
396
 
397
+ alias has_yard? has_yard
398
+
380
399
  #
381
400
  # Populates a Gem Specification using the metadata of the project.
382
401
  #
@@ -494,53 +513,6 @@ module Ore
494
513
  messages.each { |mesg| STDERR.puts("WARNING: #{mesg}") }
495
514
  end
496
515
 
497
- #
498
- # Infers the Source Code Management used by the project.
499
- #
500
- def infer_scm!
501
- if @root.join('.git').directory?
502
- @scm = :git
503
- else
504
- @scm = nil
505
- end
506
- end
507
-
508
- #
509
- # Infers the project files.
510
- #
511
- def infer_project_files!
512
- @project_files = Set[]
513
-
514
- filter_path = lambda { |path|
515
- check_readable(path) { |file| @project_files << file }
516
- }
517
-
518
- within do
519
- case @scm
520
- when :git
521
- `git ls-files -z`.split("\0").each(&filter_path)
522
- else
523
- within { Dir.glob('{**/}*',&filter_path) }
524
- end
525
- end
526
- end
527
-
528
- #
529
- # Infers the namespace of the project based on the project name.
530
- #
531
- def infer_namespace!
532
- @namespace_modules = modules_of(@name)
533
- @namespace = namespace_of(@name)
534
-
535
- dir = namespace_path_of(@name)
536
-
537
- @namespace_dir = if lib_directory?(dir)
538
- dir
539
- elsif lib_directory?(@name)
540
- @name
541
- end
542
- end
543
-
544
516
  #
545
517
  # Adds a require-path to the project.
546
518
  #
@@ -210,7 +210,7 @@ module Ore
210
210
  # Sets the dependencies of the project.
211
211
  #
212
212
  # @param [Hash{String => String}] dependencies
213
- # The dependencey names and versions listed in the metadata file.
213
+ # The dependency names and versions listed in the metadata file.
214
214
  #
215
215
  # @raise [InvalidMetadata]
216
216
  # The dependencies must be a `Hash`.
@@ -221,8 +221,6 @@ module Ore
221
221
  end
222
222
 
223
223
  dependencies.each do |name,versions|
224
- versions = versions.to_s
225
-
226
224
  @dependencies << Dependency.parse_versions(name,versions)
227
225
  end
228
226
  end
@@ -231,7 +229,7 @@ module Ore
231
229
  # Sets the runtime-dependencies of the project.
232
230
  #
233
231
  # @param [Hash{String => String}] dependencies
234
- # The runtime-dependencey names and versions listed in the metadata
232
+ # The runtime-dependency names and versions listed in the metadata
235
233
  # file.
236
234
  #
237
235
  # @raise [InvalidMetadata]
@@ -243,8 +241,6 @@ module Ore
243
241
  end
244
242
 
245
243
  dependencies.each do |name,versions|
246
- versions = versions.to_s
247
-
248
244
  @runtime_dependencies << Dependency.parse_versions(name,versions)
249
245
  end
250
246
  end
@@ -253,7 +249,7 @@ module Ore
253
249
  # Sets the development-dependencies of the project.
254
250
  #
255
251
  # @param [Hash{String => String}] dependencies
256
- # The development-dependencey names and versions listed in the
252
+ # The development-dependency names and versions listed in the
257
253
  # metadata file.
258
254
  #
259
255
  # @raise [InvalidMetadata]
@@ -265,8 +261,6 @@ module Ore
265
261
  end
266
262
 
267
263
  dependencies.each do |name,versions|
268
- versions = versions.to_s
269
-
270
264
  @development_dependencies << Dependency.parse_versions(name,versions)
271
265
  end
272
266
  end
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ore-core
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 1
8
- - 1
9
- version: 0.1.1
4
+ prerelease:
5
+ version: 0.1.2
10
6
  platform: ruby
11
7
  authors:
12
8
  - Postmodern
@@ -14,7 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2011-01-19 00:00:00 -08:00
13
+ date: 2011-02-08 00:00:00 -08:00
18
14
  default_executable:
19
15
  dependencies:
20
16
  - !ruby/object:Gem::Dependency
@@ -25,10 +21,6 @@ dependencies:
25
21
  requirements:
26
22
  - - ~>
27
23
  - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
- - 6
31
- - 1
32
24
  version: 0.6.1
33
25
  type: :development
34
26
  version_requirements: *id001
@@ -40,10 +32,6 @@ dependencies:
40
32
  requirements:
41
33
  - - ~>
42
34
  - !ruby/object:Gem::Version
43
- segments:
44
- - 2
45
- - 4
46
- - 0
47
35
  version: 2.4.0
48
36
  type: :development
49
37
  version_requirements: *id002
@@ -60,6 +48,7 @@ extra_rdoc_files:
60
48
  - LICENSE.txt
61
49
  files:
62
50
  - .document
51
+ - .gemtest
63
52
  - .rspec
64
53
  - .yardopts
65
54
  - ChangeLog.md
@@ -70,13 +59,13 @@ files:
70
59
  - gemspec.yml
71
60
  - lib/ore-core.rb
72
61
  - lib/ore/checks.rb
73
- - lib/ore/defaults.rb
74
62
  - lib/ore/dependency.rb
75
63
  - lib/ore/document_file.rb
76
64
  - lib/ore/exceptions.rb
77
65
  - lib/ore/exceptions/exception.rb
78
66
  - lib/ore/exceptions/invalid_metadata.rb
79
67
  - lib/ore/exceptions/project_not_found.rb
68
+ - lib/ore/inferences.rb
80
69
  - lib/ore/naming.rb
81
70
  - lib/ore/paths.rb
82
71
  - lib/ore/project.rb
@@ -138,21 +127,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
138
127
  requirements:
139
128
  - - ">="
140
129
  - !ruby/object:Gem::Version
141
- segments:
142
- - 0
143
130
  version: "0"
144
131
  required_rubygems_version: !ruby/object:Gem::Requirement
145
132
  none: false
146
133
  requirements:
147
134
  - - ">="
148
135
  - !ruby/object:Gem::Version
149
- segments:
150
- - 0
151
136
  version: "0"
152
137
  requirements: []
153
138
 
154
139
  rubyforge_project: ore-core
155
- rubygems_version: 1.3.7
140
+ rubygems_version: 1.5.0
156
141
  signing_key:
157
142
  specification_version: 3
158
143
  summary: Mine raw RubyGems from YAML
@@ -1,140 +0,0 @@
1
- require 'ore/naming'
2
- require 'ore/versions'
3
-
4
- require 'date'
5
-
6
- module Ore
7
- #
8
- # A mixin for {Project} which provides methods for assigning default
9
- # values to project attributes.
10
- #
11
- module Defaults
12
- include Naming
13
-
14
- # The default require-paths
15
- @@require_paths = [@@lib_dir, @@ext_dir]
16
-
17
- # The glob to find default executables
18
- @@executables = "#{@@bin_dir}/*"
19
-
20
- # The globs to find all testing-files
21
- @@test_files = [
22
- "#{@@test_dir}/{**/}*_test.rb",
23
- "#{@@spec_dir}/{**/}*_spec.rb"
24
- ]
25
-
26
- # The files to always exclude
27
- @@exclude_files = %w[
28
- .gitignore
29
- ]
30
-
31
- protected
32
-
33
- #
34
- # Sets the project name using the directory name of the project.
35
- #
36
- def default_name!
37
- @name = @root.basename.to_s
38
- end
39
-
40
- #
41
- # Finds and sets the version of the project.
42
- #
43
- def default_version!
44
- @version = (
45
- Versions::VersionFile.find(self) ||
46
- Versions::VersionConstant.find(self)
47
- )
48
-
49
- unless @version
50
- raise(InvalidMetadata,"no version file or constant in #{@root}")
51
- end
52
- end
53
-
54
- #
55
- # Sets the release date of the project.
56
- #
57
- def default_date!
58
- @date = Date.today
59
- end
60
-
61
- #
62
- # Sets the require-paths of the project.
63
- #
64
- def default_require_paths!
65
- @@require_paths.each do |name|
66
- @require_paths << name if @root.join(name).directory?
67
- end
68
- end
69
-
70
- #
71
- # Sets the executables of the project.
72
- #
73
- def default_executables!
74
- glob(@@executables) do |path|
75
- check_executable(path) { |exe| @executables << File.basename(exe) }
76
- end
77
- end
78
-
79
- #
80
- # sets the default executable of the project.
81
- #
82
- def default_executable!
83
- @default_executable = if @executables.include?(@name)
84
- @name
85
- else
86
- @executables.first
87
- end
88
- end
89
-
90
- #
91
- # Sets the default documentation of the project.
92
- #
93
- def default_documentation!
94
- if file?('.yardopts')
95
- @documentation = :yard
96
- else
97
- @documentation = :rdoc
98
- end
99
- end
100
-
101
- #
102
- # Sets the extra documentation files of the project.
103
- #
104
- def default_extra_doc_files!
105
- glob('README.*') { |path| add_extra_doc_file(path) }
106
-
107
- if @document
108
- @document.each_extra_file { |path| add_extra_doc_file(path) }
109
- end
110
- end
111
-
112
- #
113
- # Sets the files of the project.
114
- #
115
- def default_files!
116
- @project_files.each do |file|
117
- @files << file unless @@exclude_files.include?(file)
118
- end
119
- end
120
-
121
- #
122
- # Sets the test-files of the project.
123
- #
124
- def default_test_files!
125
- @@test_files.each do |pattern|
126
- glob(pattern) { |path| add_test_file(path) }
127
- end
128
- end
129
-
130
- #
131
- # Defaults the required version of RubyGems to `>= 1.3.6`, if the
132
- # project uses Bundler.
133
- #
134
- def default_required_rubygems_version!
135
- if bundler?
136
- @required_rubygems_version = '>= 1.3.6'
137
- end
138
- end
139
- end
140
- end