rake-compiler 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt CHANGED
@@ -1,70 +1,73 @@
1
- == 0.4.0 2009-04-03
1
+ === 0.4.1 / 2009-04-09
2
2
 
3
- === Enhancements
3
+ * Enhancements
4
+ * Target specific versions of Ruby when generating binaries.
5
+ This avoids installing a 1.8.x binary gem in 1.9.x and viceversa.
6
+ (Thanks to Aaron Patterson for the patches)
4
7
 
8
+ * Bugfixes
9
+ * No longer raises error if rake-compiler configuration is missing.
10
+ Not all users of a project would have it installed.
11
+ (Thanks to Aaron Patterson for the patch)
12
+
13
+ === 0.4.0 / 2009-04-03
14
+
15
+ * Enhancements
5
16
  * Bended the convention for extension folder.
6
17
  Defining <tt>ext_dir</tt> for custom extension location.
7
18
 
8
- Rake::ExtensionTask.new('my_extension') do |ext|
9
- ext.ext_dir = 'custom/location' # look into custom/location
10
- end # instead of ext/my_extension
19
+ Rake::ExtensionTask.new('my_extension') do |ext|
20
+ ext.ext_dir = 'custom/location' # look into custom/location
21
+ end # instead of ext/my_extension
11
22
 
12
23
  * Better detection of mingw target across Linux/OSX.
13
24
  Exposed it as Rake::ExtensionCompiler
14
-
15
25
  * Display list of available tasks when calling rake-compiler script
16
-
17
26
  * Track Ruby full versioning (x.y.z).
18
27
  This will help the compilation of extensions targetting 1.8.6/7 and 1.9.1
19
28
 
20
- === Bugfixes
21
-
29
+ * Bugfixes
22
30
  * Better output of Rake development tasks (Thanks to Luis Parravicini).
23
31
  * Proper usage of Gem::Platform for native gems (Thanks to Dirkjan Bussink).
24
32
  * Don't use autoload for YAML (present problems with Ruby 1.9.1).
25
33
 
26
- == 0.3.1 / 2009-01-09
27
-
28
- === Enhancements
34
+ === 0.3.1 / 2009-01-09
29
35
 
36
+ * Enhancements
30
37
  * Download cross-ruby source code using HTTP instead of FTP.
31
38
  * Disabled Tcl/Tk extension building on cross-ruby (helps with 1.9).
32
39
 
33
- === Bugfixes
34
-
40
+ * Bugfixes
35
41
  * Workaround bug introduced by lack of Gem::Specification cloning. Fixes DM LH #757.
36
42
  * Use proper binary extension on OSX (reported by Dirkjan Bussink).
37
43
  * Ensure lib/binary task is defined prior clear of requisites.
38
44
 
39
- == 0.3.0 / 2008-12-07
40
-
41
- === New features
45
+ === 0.3.0 / 2008-12-07
42
46
 
47
+ * New features
43
48
  * Let you specify the Ruby version used for cross compilation instead
44
49
  of default one.
45
50
 
46
51
  rake cross compile RUBY_CC_VERSION=1.8
47
52
 
48
- === Enhancements
49
-
53
+ * Enhancements
50
54
  * Properly update rake-compiler configuration when new version is installed.
51
55
  * Automated release process to RubyForge, yay!
52
56
 
53
- === Bugfixes
54
-
57
+ * Bugfixes
55
58
  * Corrected documentation to reflect the available options
56
59
 
57
- == 0.2.1 / 2008-11-30
60
+ === 0.2.1 / 2008-11-30
58
61
 
59
- === New features
62
+ * New features
60
63
 
61
64
  * Allow cross compilation (cross compile) using mingw32 on Linux or OSX.
62
65
  * Allow packaging of gems for Windows on Linux or OSX.
63
66
 
64
- === Enhancements
67
+ * Enhancements
65
68
 
66
69
  * Made generation of extensions safe and target folders per-platform
67
70
 
68
- === Bugfixes
71
+ * Bugfixes
69
72
 
70
73
  * Ensure binaries for the specific platform are copied before packaging.
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- #
4
- # HACK: Lousy API design, sue me. At least works ;-)
5
- #
6
- # Define a series of helpers to aid in search and usage of MinGW (GCC) Compiler
7
- # by gem developer/creators.
8
- #
9
-
10
3
  module Rake
4
+
5
+ #
6
+ # HACK: Lousy API design, sue me. At least works ;-)
7
+ #
8
+ # Define a series of helpers to aid in search and usage of MinGW (GCC) Compiler
9
+ # by gem developer/creators.
10
+ #
11
11
  module ExtensionCompiler
12
12
  # return the host portion from the installed MinGW
13
13
  def self.mingw_host
@@ -188,6 +188,11 @@ module Rake
188
188
  # include the files in the gem specification
189
189
  spec.files += ext_files
190
190
 
191
+ # Make sure that the required ruby version matches the ruby version
192
+ # we've used for cross compiling:
193
+ target_version = RUBY_VERSION =~ /^1.8/ ? '1.8.6' : '1.9.0'
194
+ spec.required_ruby_version = "~> #{target_version}"
195
+
191
196
  # Generate a package for this gem
192
197
  gem_package = Rake::GemPackageTask.new(spec) do |pkg|
193
198
  pkg.need_zip = false
@@ -229,7 +234,8 @@ module Rake
229
234
  tmp_path = "#{@tmp_dir}/#{cross_platform}/#{@name}"
230
235
 
231
236
  unless rbconfig_file = config_file["rbconfig-#{ruby_ver}"] then
232
- fail "no configuration section for specified version of Ruby (rbconfig-#{ruby_ver})"
237
+ warn "no configuration section for specified version of Ruby (rbconfig-#{ruby_ver})"
238
+ return
233
239
  end
234
240
 
235
241
  # define compilation tasks for cross platfrom!
@@ -265,13 +265,16 @@ describe Rake::ExtensionTask do
265
265
  File.stub!(:open).and_yield(mock_fake_rb)
266
266
  end
267
267
 
268
- it 'should not generate an error if no rake-compiler configuration exist' do
268
+ it 'should warn if no rake-compiler configuration exist' do
269
269
  File.should_receive(:exist?).with(@config_file).and_return(false)
270
- lambda {
270
+
271
+ out, err = capture_output do
271
272
  Rake::ExtensionTask.new('extension_one') do |ext|
272
273
  ext.cross_compile = true
273
274
  end
274
- }.should_not raise_error(RuntimeError)
275
+ end
276
+
277
+ err.should match(/rake-compiler must be configured first to enable cross-compilation/)
275
278
  end
276
279
 
277
280
  it 'should parse the config file using YAML' do
@@ -281,15 +284,16 @@ describe Rake::ExtensionTask do
281
284
  end
282
285
  end
283
286
 
284
- it 'should fail if no section of config file defines running version of ruby' do
287
+ it 'should warn if no section of config file defines running version of ruby' do
285
288
  config = mock(Hash)
286
289
  config.should_receive(:[]).with("rbconfig-#{@ruby_ver}").and_return(nil)
287
290
  YAML.stub!(:load_file).and_return(config)
288
- lambda {
291
+ out, err = capture_output do
289
292
  Rake::ExtensionTask.new('extension_one') do |ext|
290
293
  ext.cross_compile = true
291
294
  end
292
- }.should raise_error(RuntimeError, /no configuration section for specified version of Ruby/)
295
+ end
296
+ err.should match(/no configuration section for specified version of Ruby/)
293
297
  end
294
298
 
295
299
  it 'should allow usage of RUBY_CC_VERSION to indicate a different version of ruby' do
data/spec/spec_helper.rb CHANGED
@@ -5,5 +5,9 @@ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
5
5
  require 'rubygems'
6
6
  require 'spec'
7
7
 
8
+ # Console redirection helper
9
+ require File.expand_path(File.join(File.dirname(__FILE__), 'support/capture_output_helper'))
10
+
8
11
  Spec::Runner.configure do |config|
12
+ include CaptureOutputHelper
9
13
  end
@@ -0,0 +1,22 @@
1
+ module CaptureOutputHelper
2
+ def capture_output(&block)
3
+ old_stdout = $stdout
4
+ old_stderr = $stderr
5
+
6
+ stream_out = StringIO.new
7
+ stream_err = StringIO.new
8
+
9
+ begin
10
+ $stdout = stream_out
11
+ $stderr = stream_err
12
+ yield
13
+ ensure
14
+ $stdout = old_stdout
15
+ $stderr = old_stderr
16
+ end
17
+ stream_out.rewind
18
+ stream_err.rewind
19
+
20
+ [stream_out.read, stream_err.read]
21
+ end
22
+ end
data/tasks/gem.rake CHANGED
@@ -3,7 +3,7 @@ require 'rake/gempackagetask'
3
3
  GEM_SPEC = Gem::Specification.new do |s|
4
4
  # basic information
5
5
  s.name = "rake-compiler"
6
- s.version = "0.4.0"
6
+ s.version = "0.4.1"
7
7
  s.platform = Gem::Platform::RUBY
8
8
 
9
9
  # description and details
data/tasks/news.rake CHANGED
@@ -41,7 +41,7 @@ if defined?(RubyForge) then
41
41
  # read changes
42
42
  changes = begin
43
43
  h = File.read("History.txt")
44
- h.split(/^(==.*)/)[1..2].join.strip
44
+ h.split(/^(===+ .*)/)[1..2].join.strip
45
45
  rescue
46
46
  warn "Missing History.txt"
47
47
  ''
data/tasks/rdoc.rake CHANGED
@@ -1,9 +1,15 @@
1
- require 'rake/rdoctask'
1
+ begin
2
+ require 'rdoc/task'
3
+ rescue LoadError
4
+ warn "RDoc 2.4.3+ gem is required, please install it (gem install rdoc)."
5
+ end
2
6
 
3
- DOC = Rake::RDocTask.new(:rdoc) do |rd|
4
- rd.title = 'rake-compiler -- Documentation'
5
- rd.main = 'README.rdoc'
6
- rd.rdoc_dir = 'doc/api'
7
- rd.options << '--main' << 'README.rdoc' << '--title' << 'rake-compiler -- Documentation'
8
- rd.rdoc_files.include %w(README.rdoc LICENSE.txt History.txt lib/**/*.rb)
7
+ if defined?(RDoc) then
8
+ DOC = RDoc::Task.new(:rdoc) do |rd|
9
+ rd.title = 'rake-compiler -- Documentation'
10
+ rd.main = 'README.rdoc'
11
+ rd.rdoc_dir = 'doc/api'
12
+ rd.options << '--line-numbers' << '--main' << 'README.rdoc' << '--title' << 'rake-compiler -- Documentation'
13
+ rd.rdoc_files.include %w(README.rdoc LICENSE.txt History.txt lib/**/*.rb)
14
+ end
9
15
  end
data/tasks/release.rake CHANGED
@@ -36,7 +36,7 @@ if defined?(RubyForge) then
36
36
  # read changes
37
37
  changes = begin
38
38
  h = File.read("History.txt")
39
- h.split(/^(==.*)/)[1..2].join.strip
39
+ h.split(/^(===+ .*)/)[1..2].join.strip
40
40
  rescue
41
41
  warn "Missing History.txt"
42
42
  ''
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake-compiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis Lavena
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-04 00:00:00 -03:00
12
+ date: 2009-04-09 00:00:00 -03:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -53,6 +53,7 @@ files:
53
53
  - lib/rake/extensiontask.rb
54
54
  - spec/lib/rake/extensiontask_spec.rb
55
55
  - spec/spec_helper.rb
56
+ - spec/support/capture_output_helper.rb
56
57
  - tasks/bin/cross-ruby.rake
57
58
  - tasks/common.rake
58
59
  - tasks/cucumber.rake