ore-core 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +9 -2
- data/README.md +5 -5
- data/gemspec.yml +1 -1
- data/lib/ore/dependency.rb +1 -1
- data/lib/ore/project.rb +14 -108
- data/lib/ore/rubygems.rb +132 -0
- data/lib/ore/versions/version.rb +1 -1
- data/spec/dependency_spec.rb +2 -2
- data/spec/helpers/projects/explicit/gemspec.yml +2 -2
- data/spec/projects/project_examples.rb +11 -3
- metadata +5 -5
data/ChangeLog.md
CHANGED
@@ -1,8 +1,15 @@
|
|
1
|
+
### 0.1.5 / 2011-04-08
|
2
|
+
|
3
|
+
* Added {Ore::RubyGems}.
|
4
|
+
* Do not set `default_executable` in {Ore::RubyGems#to_gemspec} on RubyGems
|
5
|
+
>= 1.7.0.
|
6
|
+
* Specs now pass on JRuby 1.6.0 under 1.9 mode.
|
7
|
+
|
1
8
|
### 0.1.4 / 2011-02-25
|
2
9
|
|
3
10
|
* Added `core` to the list of namespaces to ignore.
|
4
11
|
* Bypass the filtering of `Gem::Specification#has_rdoc=` added by RubyGems
|
5
|
-
1.5.x in
|
12
|
+
1.5.x in `Ore::Project#to_gemspec`.
|
6
13
|
|
7
14
|
### 0.1.3 / 2011-02-12
|
8
15
|
|
@@ -64,5 +71,5 @@
|
|
64
71
|
* Added {Ore::Settings}.
|
65
72
|
* Added {Ore::Specification}.
|
66
73
|
* Added {Ore::Project#post_install_message}.
|
67
|
-
* Added
|
74
|
+
* Added `Ore::Settings#set_post_install_message!`.
|
68
75
|
|
data/README.md
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
* [Source](http://github.com/ruby-ore/ore-core)
|
4
4
|
* [Issues](http://github.com/ruby-ore/ore-core/issues)
|
5
|
-
* [Documentation](http://rubydoc.info/gems/ore-core/
|
6
|
-
* [Email](postmodern.mod3 at gmail.com)
|
5
|
+
* [Documentation](http://rubydoc.info/gems/ore-core/frames)
|
6
|
+
* [Email](mailto:postmodern.mod3 at gmail.com)
|
7
7
|
* IRC: irc.freenode.net #ruby-ore
|
8
8
|
|
9
9
|
## Description
|
@@ -50,7 +50,7 @@ project information in a single YAML file.
|
|
50
50
|
The `gemspec.yml` file used to build Ore:
|
51
51
|
|
52
52
|
name: ore-core
|
53
|
-
version: 0.1.
|
53
|
+
version: 0.1.5
|
54
54
|
summary: Mine raw RubyGems from YAML.
|
55
55
|
description:
|
56
56
|
Ore is a simple RubyGem building solution. Ore handles the
|
@@ -65,8 +65,8 @@ The `gemspec.yml` file used to build Ore:
|
|
65
65
|
has_yard: true
|
66
66
|
|
67
67
|
development_dependencies:
|
68
|
-
yard: ~> 0.6
|
69
|
-
rspec: ~> 2.4
|
68
|
+
yard: ~> 0.6
|
69
|
+
rspec: ~> 2.4
|
70
70
|
|
71
71
|
For a complete refrence to the `gemspec.yml` file, please see
|
72
72
|
[GemspecYML Reference](http://rubydoc.info/gems/ore-core/file/GemspecYML.html).
|
data/gemspec.yml
CHANGED
data/lib/ore/dependency.rb
CHANGED
data/lib/ore/project.rb
CHANGED
@@ -5,14 +5,13 @@ require 'ore/paths'
|
|
5
5
|
require 'ore/checks'
|
6
6
|
require 'ore/inferences'
|
7
7
|
require 'ore/settings'
|
8
|
+
require 'ore/rubygems'
|
8
9
|
require 'ore/document_file'
|
9
10
|
|
10
11
|
require 'pathname'
|
11
12
|
require 'yaml'
|
12
13
|
require 'find'
|
13
14
|
require 'fileutils'
|
14
|
-
require 'rubygems/specification'
|
15
|
-
require 'rubygems/builder'
|
16
15
|
|
17
16
|
module Ore
|
18
17
|
#
|
@@ -26,6 +25,7 @@ module Ore
|
|
26
25
|
include Checks
|
27
26
|
include Inferences
|
28
27
|
include Settings
|
28
|
+
include RubyGems
|
29
29
|
|
30
30
|
# The project metadata file
|
31
31
|
@@metadata_file = 'gemspec.yml'
|
@@ -412,118 +412,24 @@ module Ore
|
|
412
412
|
|
413
413
|
alias has_yard? has_yard
|
414
414
|
|
415
|
-
#
|
416
|
-
# Populates a Gem Specification using the metadata of the project.
|
417
|
-
#
|
418
|
-
# @yield [gemspec]
|
419
|
-
# The given block will be passed the populated Gem Specification
|
420
|
-
# object.
|
421
|
-
#
|
422
|
-
# @yieldparam [Gem::Specification] gemspec
|
423
|
-
# The newly created Gem Specification.
|
424
|
-
#
|
425
|
-
# @return [Gem::Specification]
|
426
|
-
# The Gem Specification.
|
427
|
-
#
|
428
|
-
# @see http://rubygems.rubyforge.org/rdoc/Gem/Specification.html
|
429
|
-
#
|
430
|
-
def to_gemspec
|
431
|
-
Gem::Specification.new do |gemspec|
|
432
|
-
gemspec.name = @name.to_s
|
433
|
-
gemspec.version = @version.to_s
|
434
|
-
gemspec.summary = @summary.to_s
|
435
|
-
gemspec.description = @description.to_s
|
436
|
-
gemspec.licenses = @licenses
|
437
|
-
gemspec.authors = @authors
|
438
|
-
gemspec.homepage = @homepage
|
439
|
-
gemspec.email = @emails
|
440
|
-
gemspec.date = @date
|
441
|
-
|
442
|
-
@require_paths.each do |path|
|
443
|
-
unless gemspec.require_paths.include?(path)
|
444
|
-
gemspec.require_paths << path
|
445
|
-
end
|
446
|
-
end
|
447
|
-
|
448
|
-
gemspec.executables = @executables
|
449
|
-
gemspec.default_executable = @default_executable
|
450
|
-
|
451
|
-
# forcibly set the @has_rdoc ivar, as RubyGems 1.5.x disables the
|
452
|
-
# #has_rdoc= writer method.
|
453
|
-
if gemspec.instance_variable_defined?('@has_rdoc')
|
454
|
-
case @documentation
|
455
|
-
when :yard
|
456
|
-
gemspec.instance_variable_set('@has_rdoc','yard')
|
457
|
-
when :rdoc
|
458
|
-
gemspec.instance_variable_set('@has_rdoc',true)
|
459
|
-
when nil
|
460
|
-
gemspec.instance_variable_set('@has_rdoc',false)
|
461
|
-
end
|
462
|
-
end
|
463
|
-
|
464
|
-
gemspec.extra_rdoc_files = @extra_doc_files
|
465
|
-
gemspec.files = @files
|
466
|
-
gemspec.test_files = @test_files
|
467
|
-
gemspec.post_install_message = @post_install_message
|
468
|
-
|
469
|
-
gemspec.requirements = @requirements
|
470
|
-
|
471
|
-
if gemspec.respond_to?(:required_ruby_version=)
|
472
|
-
gemspec.required_ruby_version = @required_ruby_version
|
473
|
-
end
|
474
|
-
|
475
|
-
if gemspec.respond_to?(:required_rubygems_version=)
|
476
|
-
gemspec.required_rubygems_version = @required_rubygems_version
|
477
|
-
end
|
478
|
-
|
479
|
-
@dependencies.each do |dep|
|
480
|
-
gemspec.add_dependency(dep.name,*dep.versions)
|
481
|
-
end
|
482
|
-
|
483
|
-
if gemspec.respond_to?(:add_runtime_dependency)
|
484
|
-
@runtime_dependencies.each do |dep|
|
485
|
-
gemspec.add_runtime_dependency(dep.name,*dep.versions)
|
486
|
-
end
|
487
|
-
else
|
488
|
-
@runtime_dependencies.each do |dep|
|
489
|
-
gemspec.add_dependency(dep.name,*dep.versions)
|
490
|
-
end
|
491
|
-
end
|
492
|
-
|
493
|
-
if gemspec.respond_to?(:add_development_dependency)
|
494
|
-
@development_dependencies.each do |dep|
|
495
|
-
gemspec.add_development_dependency(dep.name,*dep.versions)
|
496
|
-
end
|
497
|
-
else
|
498
|
-
@development_dependencies.each do |dep|
|
499
|
-
gemspec.add_dependency(dep.name,*dep.versions)
|
500
|
-
end
|
501
|
-
end
|
502
|
-
|
503
|
-
# legacy information
|
504
|
-
if gemspec.respond_to?(:rubyforge_project=)
|
505
|
-
gemspec.rubyforge_project = gemspec.name
|
506
|
-
end
|
507
|
-
|
508
|
-
yield gemspec if block_given?
|
509
|
-
end
|
510
|
-
end
|
511
|
-
|
512
415
|
#
|
513
416
|
# Builds a gem for the project.
|
514
417
|
#
|
418
|
+
# @param [Symbol] package
|
419
|
+
# The type of package to build.
|
420
|
+
#
|
515
421
|
# @return [Pathname]
|
516
422
|
# The path to the built gem file within the `pkg/` directory.
|
517
423
|
#
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
424
|
+
# @raise [ArgumentError]
|
425
|
+
# The given package type is not supported.
|
426
|
+
#
|
427
|
+
def build!(package=:gem)
|
428
|
+
if package == :gem
|
429
|
+
to_gem
|
430
|
+
else
|
431
|
+
raise(ArgumentError,"unsupported package type #{package}")
|
432
|
+
end
|
527
433
|
end
|
528
434
|
|
529
435
|
protected
|
data/lib/ore/rubygems.rb
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
require 'ore/paths'
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
|
5
|
+
module Ore
|
6
|
+
module RubyGems
|
7
|
+
include Paths
|
8
|
+
|
9
|
+
#
|
10
|
+
# Populates a Gem Specification using the metadata of the project.
|
11
|
+
#
|
12
|
+
# @yield [gemspec]
|
13
|
+
# The given block will be passed the populated Gem Specification
|
14
|
+
# object.
|
15
|
+
#
|
16
|
+
# @yieldparam [Gem::Specification] gemspec
|
17
|
+
# The newly created Gem Specification.
|
18
|
+
#
|
19
|
+
# @return [Gem::Specification]
|
20
|
+
# The Gem Specification.
|
21
|
+
#
|
22
|
+
# @see http://rubygems.rubyforge.org/rdoc/Gem/Specification.html
|
23
|
+
#
|
24
|
+
# @since 0.1.5
|
25
|
+
#
|
26
|
+
def to_gemspec
|
27
|
+
Gem::Specification.new do |gemspec|
|
28
|
+
gemspec.name = @name.to_s
|
29
|
+
gemspec.version = @version.to_s
|
30
|
+
gemspec.summary = @summary.to_s
|
31
|
+
gemspec.description = @description.to_s
|
32
|
+
gemspec.licenses = @licenses
|
33
|
+
gemspec.authors = @authors
|
34
|
+
gemspec.homepage = @homepage
|
35
|
+
gemspec.email = @emails
|
36
|
+
gemspec.date = @date
|
37
|
+
|
38
|
+
@require_paths.each do |path|
|
39
|
+
unless gemspec.require_paths.include?(path)
|
40
|
+
gemspec.require_paths << path
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
gemspec.executables = @executables
|
45
|
+
|
46
|
+
# default_executable is deprecated in RubyGems 1.7.0 and will be
|
47
|
+
# removed after 2011-10-01.
|
48
|
+
if Gem::VERSION < '1.7.'
|
49
|
+
gemspec.default_executable = @default_executable
|
50
|
+
end
|
51
|
+
|
52
|
+
# forcibly set the @has_rdoc ivar, as RubyGems 1.5.x disables the
|
53
|
+
# #has_rdoc= writer method.
|
54
|
+
if gemspec.instance_variable_defined?('@has_rdoc')
|
55
|
+
case @documentation
|
56
|
+
when :yard
|
57
|
+
gemspec.instance_variable_set('@has_rdoc','yard')
|
58
|
+
when :rdoc
|
59
|
+
gemspec.instance_variable_set('@has_rdoc',true)
|
60
|
+
when nil
|
61
|
+
gemspec.instance_variable_set('@has_rdoc',false)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
gemspec.extra_rdoc_files = @extra_doc_files
|
66
|
+
gemspec.files = @files
|
67
|
+
gemspec.test_files = @test_files
|
68
|
+
gemspec.post_install_message = @post_install_message
|
69
|
+
|
70
|
+
gemspec.requirements = @requirements
|
71
|
+
|
72
|
+
if gemspec.respond_to?(:required_ruby_version=)
|
73
|
+
gemspec.required_ruby_version = @required_ruby_version
|
74
|
+
end
|
75
|
+
|
76
|
+
if gemspec.respond_to?(:required_rubygems_version=)
|
77
|
+
gemspec.required_rubygems_version = @required_rubygems_version
|
78
|
+
end
|
79
|
+
|
80
|
+
@dependencies.each do |dep|
|
81
|
+
gemspec.add_dependency(dep.name,*dep.versions)
|
82
|
+
end
|
83
|
+
|
84
|
+
if gemspec.respond_to?(:add_runtime_dependency)
|
85
|
+
@runtime_dependencies.each do |dep|
|
86
|
+
gemspec.add_runtime_dependency(dep.name,*dep.versions)
|
87
|
+
end
|
88
|
+
else
|
89
|
+
@runtime_dependencies.each do |dep|
|
90
|
+
gemspec.add_dependency(dep.name,*dep.versions)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
if gemspec.respond_to?(:add_development_dependency)
|
95
|
+
@development_dependencies.each do |dep|
|
96
|
+
gemspec.add_development_dependency(dep.name,*dep.versions)
|
97
|
+
end
|
98
|
+
else
|
99
|
+
@development_dependencies.each do |dep|
|
100
|
+
gemspec.add_dependency(dep.name,*dep.versions)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
# legacy information
|
105
|
+
if gemspec.respond_to?(:rubyforge_project=)
|
106
|
+
gemspec.rubyforge_project = gemspec.name
|
107
|
+
end
|
108
|
+
|
109
|
+
yield gemspec if block_given?
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
#
|
114
|
+
# Builds a gem for the project.
|
115
|
+
#
|
116
|
+
# @return [Pathname]
|
117
|
+
# The path to the built gem file within the `pkg/` directory.
|
118
|
+
#
|
119
|
+
# @since 0.1.5
|
120
|
+
#
|
121
|
+
def to_gem
|
122
|
+
pkg_dir = @root.join(@@pkg_dir)
|
123
|
+
FileUtils.mkdir_p(pkg_dir)
|
124
|
+
|
125
|
+
gem_file = Gem::Builder.new(self.to_gemspec).build
|
126
|
+
pkg_path = @root.join(pkg_file)
|
127
|
+
|
128
|
+
FileUtils.mv(gem_file,pkg_path)
|
129
|
+
return pkg_path
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
data/lib/ore/versions/version.rb
CHANGED
data/spec/dependency_spec.rb
CHANGED
@@ -30,13 +30,13 @@ describe Dependency do
|
|
30
30
|
it "should parse multiple versions" do
|
31
31
|
dep = subject.parse_versions('foo', '~> 1.2.3, >= 1.4.0')
|
32
32
|
|
33
|
-
dep.versions.should
|
33
|
+
dep.versions.should =~ ['~> 1.2.3', '>= 1.4.0']
|
34
34
|
end
|
35
35
|
|
36
36
|
it "should parse an Array of versions" do
|
37
37
|
dep = subject.parse_versions('foo', ['~> 1.2.3', '>= 1.4.0'])
|
38
38
|
|
39
|
-
dep.versions.should
|
39
|
+
dep.versions.should =~ ['~> 1.2.3', '>= 1.4.0']
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
@@ -32,9 +32,17 @@ shared_examples_for 'an Ore Project' do
|
|
32
32
|
@project.authors.should_not be_empty
|
33
33
|
end
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
@project.
|
35
|
+
describe "RubyGems" do
|
36
|
+
it "should be able to create a Gem::Specification" do
|
37
|
+
Dir.chdir(@project.root) do
|
38
|
+
@project.to_gemspec.validate.should == true
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should be able to build a .gem package" do
|
43
|
+
Dir.chdir(@project.root) do
|
44
|
+
@project.to_gem.should be_file
|
45
|
+
end
|
38
46
|
end
|
39
47
|
end
|
40
48
|
end
|
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.
|
5
|
+
version: 0.1.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Postmodern
|
@@ -10,8 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
14
|
-
default_executable:
|
13
|
+
date: 2011-04-08 00:00:00 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: rspec
|
@@ -70,6 +69,7 @@ files:
|
|
70
69
|
- lib/ore/naming.rb
|
71
70
|
- lib/ore/paths.rb
|
72
71
|
- lib/ore/project.rb
|
72
|
+
- lib/ore/rubygems.rb
|
73
73
|
- lib/ore/settings.rb
|
74
74
|
- lib/ore/specification.rb
|
75
75
|
- lib/ore/versions.rb
|
@@ -114,7 +114,6 @@ files:
|
|
114
114
|
- spec/spec_helper.rb
|
115
115
|
- spec/versions/version_file_spec.rb
|
116
116
|
- spec/versions/version_spec.rb
|
117
|
-
has_rdoc: yard
|
118
117
|
homepage: http://github.com/ruby-ore/ore-core
|
119
118
|
licenses:
|
120
119
|
- MIT
|
@@ -138,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
137
|
requirements: []
|
139
138
|
|
140
139
|
rubyforge_project: ore-core
|
141
|
-
rubygems_version: 1.
|
140
|
+
rubygems_version: 1.7.2
|
142
141
|
signing_key:
|
143
142
|
specification_version: 3
|
144
143
|
summary: Mine raw RubyGems from YAML
|
@@ -153,3 +152,4 @@ test_files:
|
|
153
152
|
- spec/projects/explicit_project_spec.rb
|
154
153
|
- spec/projects/dm_plugin_project_spec.rb
|
155
154
|
- spec/projects/ffi_binding_project_spec.rb
|
155
|
+
has_rdoc: yard
|