rake-compiler 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,352 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ require 'rake/extensiontask'
4
+ require 'rbconfig'
5
+
6
+ describe Rake::ExtensionTask do
7
+ describe '#new' do
8
+ describe '(basic)' do
9
+ it 'should raise an error if no name is provided' do
10
+ lambda {
11
+ Rake::ExtensionTask.new
12
+ }.should raise_error(RuntimeError, /Extension name must be provided/)
13
+ end
14
+
15
+ it 'should allow string as extension name assignation' do
16
+ ext = Rake::ExtensionTask.new('extension_one')
17
+ ext.name.should == 'extension_one'
18
+ end
19
+
20
+ it 'should allow string as extension name using block assignation' do
21
+ ext = Rake::ExtensionTask.new do |ext|
22
+ ext.name = 'extension_two'
23
+ end
24
+ ext.name.should == 'extension_two'
25
+ end
26
+
27
+ it 'should return itself for the block' do
28
+ from_block = nil
29
+ from_lasgn = Rake::ExtensionTask.new('extension_three') do |ext|
30
+ from_block = ext
31
+ end
32
+ from_block.should == from_lasgn
33
+ end
34
+
35
+ it 'should accept a gem specification as parameter' do
36
+ spec = mock_gem_spec
37
+ ext = Rake::ExtensionTask.new('extension_three', spec)
38
+ ext.gem_spec.should == spec
39
+ end
40
+
41
+ it 'should allow gem specification be defined using block assignation' do
42
+ spec = mock_gem_spec
43
+ ext = Rake::ExtensionTask.new('extension_four') do |ext|
44
+ ext.gem_spec = spec
45
+ end
46
+ ext.gem_spec.should == spec
47
+ end
48
+
49
+ it 'should allow forcing of platform' do
50
+ ext = Rake::ExtensionTask.new('weird_extension') do |ext|
51
+ ext.platform = 'universal-foo-bar-10.5'
52
+ end
53
+ ext.platform.should == 'universal-foo-bar-10.5'
54
+ end
55
+ end
56
+ end
57
+
58
+ describe '(defaults)' do
59
+ before :each do
60
+ @ext = Rake::ExtensionTask.new('extension_one')
61
+ end
62
+
63
+ it 'should look for extconf script' do
64
+ @ext.config_script.should == 'extconf.rb'
65
+ end
66
+
67
+ it 'should dump intermediate files to tmp/' do
68
+ @ext.tmp_dir.should == 'tmp'
69
+ end
70
+
71
+ it 'should look for extension inside ext/' do
72
+ @ext.ext_dir.should == 'ext'
73
+ end
74
+
75
+ it 'should copy build extension into lib/' do
76
+ @ext.lib_dir.should == 'lib'
77
+ end
78
+
79
+ it 'should look for C files pattern (.c)' do
80
+ @ext.source_pattern.should == "*.c"
81
+ end
82
+
83
+ it 'should have no configuration options preset to delegate' do
84
+ @ext.config_options.should be_empty
85
+ end
86
+
87
+ it 'should default to current platform' do
88
+ @ext.platform.should == RUBY_PLATFORM
89
+ end
90
+
91
+ it 'should default to no cross compilation' do
92
+ @ext.cross_compile.should be_false
93
+ end
94
+
95
+ it 'should have no configuration options for cross compilation' do
96
+ @ext.cross_config_options.should be_empty
97
+ end
98
+
99
+ it "should have cross platform defined to 'i386-mingw32'" do
100
+ @ext.cross_platform.should == 'i386-mingw32'
101
+ end
102
+ end
103
+
104
+ describe '(tasks)' do
105
+ before :each do
106
+ Rake.application.clear
107
+ CLEAN.clear
108
+ CLOBBER.clear
109
+ end
110
+
111
+ describe '(one extension)' do
112
+ before :each do
113
+ Rake::FileList.stub!(:[]).and_return(["ext/extension_one/source.c"])
114
+ @ext = Rake::ExtensionTask.new('extension_one')
115
+ @ext_bin = ext_bin('extension_one')
116
+ @platform = RUBY_PLATFORM
117
+ end
118
+
119
+ describe 'compile' do
120
+ it 'should define as task' do
121
+ Rake::Task.task_defined?('compile').should be_true
122
+ end
123
+
124
+ it "should depend on 'compile:{platform}'" do
125
+ Rake::Task['compile'].prerequisites.should include("compile:#{@platform}")
126
+ end
127
+ end
128
+
129
+ describe 'compile:extension_one' do
130
+ it 'should define as task' do
131
+ Rake::Task.task_defined?('compile:extension_one').should be_true
132
+ end
133
+
134
+ it "should depend on 'compile:extension_one:{platform}'" do
135
+ Rake::Task['compile:extension_one'].prerequisites.should include("compile:extension_one:#{@platform}")
136
+ end
137
+ end
138
+
139
+ describe 'lib/extension_one.{so,bundle}' do
140
+ it 'should define as task' do
141
+ Rake::Task.task_defined?("lib/#{@ext_bin}").should be_true
142
+ end
143
+
144
+ it "should depend on 'copy:extension_one:{platform}'" do
145
+ Rake::Task["lib/#{@ext_bin}"].prerequisites.should include("copy:extension_one:#{@platform}")
146
+ end
147
+ end
148
+
149
+ describe 'tmp/{platform}/extension_one/extension_one.{so,bundle}' do
150
+ it 'should define as task' do
151
+ Rake::Task.task_defined?("tmp/#{@platform}/extension_one/#{@ext_bin}").should be_true
152
+ end
153
+
154
+ it "should depend on 'tmp/{platform}/extension_one/Makefile'" do
155
+ Rake::Task["tmp/#{@platform}/extension_one/#{@ext_bin}"].prerequisites.should include("tmp/#{@platform}/extension_one/Makefile")
156
+ end
157
+
158
+ it "should depend on 'ext/extension_one/source.c'" do
159
+ Rake::Task["tmp/#{@platform}/extension_one/#{@ext_bin}"].prerequisites.should include("ext/extension_one/source.c")
160
+ end
161
+
162
+ it "should not depend on 'ext/extension_one/source.h'" do
163
+ Rake::Task["tmp/#{@platform}/extension_one/#{@ext_bin}"].prerequisites.should_not include("ext/extension_one/source.h")
164
+ end
165
+ end
166
+
167
+ describe 'tmp/{platform}/extension_one/Makefile' do
168
+ it 'should define as task' do
169
+ Rake::Task.task_defined?("tmp/#{@platform}/extension_one/Makefile").should be_true
170
+ end
171
+
172
+ it "should depend on 'tmp/{platform}/extension_one'" do
173
+ Rake::Task["tmp/#{@platform}/extension_one/Makefile"].prerequisites.should include("tmp/#{@platform}/extension_one")
174
+ end
175
+
176
+ it "should depend on 'ext/extension_one/extconf.rb'" do
177
+ Rake::Task["tmp/#{@platform}/extension_one/Makefile"].prerequisites.should include("ext/extension_one/extconf.rb")
178
+ end
179
+ end
180
+
181
+ describe 'clean' do
182
+ it "should include 'tmp/{platform}/extension_one' in the pattern" do
183
+ CLEAN.should include("tmp/#{@platform}/extension_one")
184
+ end
185
+ end
186
+
187
+ describe 'clobber' do
188
+ it "should include 'lib/extension_one.{so,bundle}'" do
189
+ CLOBBER.should include("lib/#{@ext_bin}")
190
+ end
191
+
192
+ it "should include 'tmp'" do
193
+ CLOBBER.should include('tmp')
194
+ end
195
+ end
196
+ end
197
+
198
+ describe '(native tasks)' do
199
+ before :each do
200
+ Rake::FileList.stub!(:[]).and_return(["ext/extension_one/source.c"])
201
+ @spec = mock_gem_spec
202
+ @ext_bin = ext_bin('extension_one')
203
+ @platform = RUBY_PLATFORM
204
+ end
205
+
206
+ describe 'native' do
207
+ before :each do
208
+ @spec.stub!(:platform=).and_return('ruby')
209
+ end
210
+
211
+ it 'should define a task for building the supplied gem' do
212
+ Rake::ExtensionTask.new('extension_one', @spec)
213
+ Rake::Task.task_defined?('native:my_gem').should be_true
214
+ end
215
+
216
+ it 'should define as task for pure ruby gems' do
217
+ Rake::Task.task_defined?('native').should be_false
218
+ Rake::ExtensionTask.new('extension_one', @spec)
219
+ Rake::Task.task_defined?('native').should be_true
220
+ end
221
+
222
+ it 'should not define a task for already native gems' do
223
+ @spec.stub!(:platform).and_return('current')
224
+ Rake::ExtensionTask.new('extension_one', @spec)
225
+ Rake::Task.task_defined?('native').should be_false
226
+ end
227
+
228
+ it 'should depend on platform specific native tasks' do
229
+ Rake::ExtensionTask.new('extension_one', @spec)
230
+ Rake::Task["native"].prerequisites.should include("native:#{@platform}")
231
+ end
232
+
233
+ describe 'native:my_gem:{platform}' do
234
+ it 'should depend on binary extension' do
235
+ Rake::ExtensionTask.new('extension_one', @spec)
236
+ Rake::Task["native:my_gem:#{@platform}"].prerequisites.should include("tmp/#{@platform}/extension_one/#{@ext_bin}")
237
+ end
238
+ end
239
+ end
240
+ end
241
+
242
+ describe '(cross platform tasks)' do
243
+ before :each do
244
+ File.stub!(:exist?).and_return(true)
245
+ YAML.stub!(:load_file).and_return(mock_config_yml)
246
+ Rake::FileList.stub!(:[]).and_return(["ext/extension_one/source.c"])
247
+ @spec = mock_gem_spec
248
+ @config_file = File.expand_path("~/.rake-compiler/config.yml")
249
+ @major_ver = RUBY_VERSION.match(/(\d+.\d+)/)[1]
250
+ @config_path = mock_config_yml["rbconfig-#{@major_ver}"]
251
+ end
252
+
253
+ it 'should not generate an error if no rake-compiler configuration exist' do
254
+ File.should_receive(:exist?).with(@config_file).and_return(false)
255
+ lambda {
256
+ Rake::ExtensionTask.new('extension_one') do |ext|
257
+ ext.cross_compile = true
258
+ end
259
+ }.should_not raise_error(RuntimeError)
260
+ end
261
+
262
+ it 'should parse the config file using YAML' do
263
+ YAML.should_receive(:load_file).with(@config_file).and_return(mock_config_yml)
264
+ Rake::ExtensionTask.new('extension_one') do |ext|
265
+ ext.cross_compile = true
266
+ end
267
+ end
268
+
269
+ it 'should fail if no section of config file defines running version of ruby' do
270
+ config = mock(Hash)
271
+ config.should_receive(:[]).with("rbconfig-#{@major_ver}").and_return(nil)
272
+ YAML.stub!(:load_file).and_return(config)
273
+ lambda {
274
+ Rake::ExtensionTask.new('extension_one') do |ext|
275
+ ext.cross_compile = true
276
+ end
277
+ }.should raise_error(RuntimeError, /no configuration section for this version of Ruby/)
278
+ end
279
+
280
+ it 'should allow usage of RUBY_CC_VERSION to indicate a different version of ruby' do
281
+ config = mock(Hash)
282
+ config.should_receive(:[]).with("rbconfig-2.0").and_return('/path/to/ruby/2.0/rbconfig.rb')
283
+ YAML.stub!(:load_file).and_return(config)
284
+ begin
285
+ ENV['RUBY_CC_VERSION'] = '2.0'
286
+ Rake::ExtensionTask.new('extension_one') do |ext|
287
+ ext.cross_compile = true
288
+ end
289
+ ensure
290
+ ENV.delete('RUBY_CC_VERSION')
291
+ end
292
+ end
293
+
294
+ describe "(cross for 'universal-unknown' platform)" do
295
+ before :each do
296
+ @ext = Rake::ExtensionTask.new('extension_one', @spec) do |ext|
297
+ ext.cross_compile = true
298
+ ext.cross_platform = 'universal-unknown'
299
+ end
300
+ end
301
+
302
+ describe 'rbconfig' do
303
+ it 'should chain rbconfig tasks to Makefile generation' do
304
+ Rake::Task['tmp/universal-unknown/extension_one/Makefile'].prerequisites.should include('tmp/universal-unknown/extension_one/rbconfig.rb')
305
+ end
306
+
307
+ it 'should take rbconfig from rake-compiler configuration' do
308
+ Rake::Task['tmp/universal-unknown/extension_one/rbconfig.rb'].prerequisites.should include(@config_path)
309
+ end
310
+ end
311
+
312
+ describe 'compile:universal-unknown' do
313
+ it "should be defined" do
314
+ Rake::Task.task_defined?('compile:universal-unknown').should be_true
315
+ end
316
+
317
+ it "should depend on 'compile:extension_one:universal-unknown'" do
318
+ Rake::Task['compile:universal-unknown'].prerequisites.should include('compile:extension_one:universal-unknown')
319
+ end
320
+ end
321
+
322
+ describe 'native:universal-unknown' do
323
+ it "should be defined" do
324
+ Rake::Task.task_defined?('native:universal-unknown').should be_true
325
+ end
326
+
327
+ it "should depend on 'native:my_gem:universal-unknown'" do
328
+ Rake::Task['native:universal-unknown'].prerequisites.should include('native:my_gem:universal-unknown')
329
+ end
330
+ end
331
+ end
332
+ end
333
+ end
334
+
335
+ private
336
+ def ext_bin(extension_name)
337
+ "#{extension_name}.#{RbConfig::CONFIG['DLEXT']}"
338
+ end
339
+
340
+ def mock_gem_spec(stubs = {})
341
+ mock(Gem::Specification,
342
+ { :name => 'my_gem', :platform => 'ruby' }.merge(stubs)
343
+ )
344
+ end
345
+
346
+ def mock_config_yml
347
+ {
348
+ 'rbconfig-1.8' => '/some/path/version/1.8/to/rbconfig.rb',
349
+ 'rbconfig-1.9' => '/some/path/version/1.9/to/rbconfig.rb'
350
+ }
351
+ end
352
+ end
@@ -0,0 +1,9 @@
1
+ # add lib directory to the search path
2
+ libdir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
4
+
5
+ require 'rubygems'
6
+ require 'spec'
7
+
8
+ Spec::Runner.configure do |config|
9
+ end
@@ -0,0 +1,159 @@
1
+ #--
2
+ # Cross-compile ruby, using Rake
3
+ #
4
+ # This source code is released under the MIT License.
5
+ # See LICENSE file for details
6
+ #++
7
+
8
+ #
9
+ # This code is inspired and based on notes from the following sites:
10
+ #
11
+ # http://tenderlovemaking.com/2008/11/21/cross-compiling-ruby-gems-for-win32/
12
+ # http://github.com/jbarnette/johnson/tree/master/cross-compile.txt
13
+ # http://eigenclass.org/hiki/cross+compiling+rcovrt
14
+ #
15
+ # This recipe only cleanup the dependency chain and automate it.
16
+ # Also opens the door to usage different ruby versions
17
+ # for cross-compilation.
18
+ #
19
+
20
+ require 'rake'
21
+ require 'rake/clean'
22
+ require 'yaml'
23
+
24
+ USER_HOME = File.expand_path("~/.rake-compiler")
25
+ RUBY_CC_VERSION = "ruby-#{ENV['VERSION'] || '1.8.6-p287'}"
26
+
27
+ # grab the major "1.8" or "1.9" part of the version number
28
+ MAJOR = RUBY_CC_VERSION.match(/.*-(\d.\d).\d/)[1]
29
+
30
+ # define a location where sources will be stored
31
+ directory "#{USER_HOME}/sources/#{RUBY_CC_VERSION}"
32
+ directory "#{USER_HOME}/builds/#{RUBY_CC_VERSION}"
33
+
34
+ # clean intermediate files and folders
35
+ CLEAN.include("#{USER_HOME}/sources/#{RUBY_CC_VERSION}")
36
+ CLEAN.include("#{USER_HOME}/builds/#{RUBY_CC_VERSION}")
37
+
38
+ # remove the final products and sources
39
+ CLOBBER.include("#{USER_HOME}/sources")
40
+ CLOBBER.include("#{USER_HOME}/builds")
41
+ CLOBBER.include("#{USER_HOME}/ruby/#{RUBY_CC_VERSION}")
42
+ CLOBBER.include("#{USER_HOME}/config.yml")
43
+
44
+ # ruby source file should be stored there
45
+ file "#{USER_HOME}/sources/#{RUBY_CC_VERSION}.tar.gz" => ["#{USER_HOME}/sources"] do |t|
46
+ # download the source file using wget or curl
47
+ chdir File.dirname(t.name) do
48
+ url = "ftp://ftp.ruby-lang.org/pub/ruby/#{MAJOR}/#{File.basename(t.name)}"
49
+ sh "wget #{url} || curl -O #{url}"
50
+ end
51
+ end
52
+
53
+ # Extract the sources
54
+ file "#{USER_HOME}/sources/#{RUBY_CC_VERSION}" => ["#{USER_HOME}/sources/#{RUBY_CC_VERSION}.tar.gz"] do |t|
55
+ chdir File.dirname(t.name) do
56
+ t.prerequisites.each { |f| sh "tar xfz #{File.basename(f)}" }
57
+ end
58
+ end
59
+
60
+ # backup makefile.in
61
+ file "#{USER_HOME}/sources/#{RUBY_CC_VERSION}/Makefile.in.bak" => ["#{USER_HOME}/sources/#{RUBY_CC_VERSION}"] do |t|
62
+ cp "#{USER_HOME}/sources/#{RUBY_CC_VERSION}/Makefile.in", t.name
63
+ end
64
+
65
+ # correct the makefiles
66
+ file "#{USER_HOME}/sources/#{RUBY_CC_VERSION}/Makefile.in" => ["#{USER_HOME}/sources/#{RUBY_CC_VERSION}/Makefile.in.bak"] do |t|
67
+ content = File.open(t.name, 'rb') { |f| f.read }
68
+
69
+ out = ""
70
+
71
+ content.each_line do |line|
72
+ if line =~ /^\s*ALT_SEPARATOR =/
73
+ out << "\t\t ALT_SEPARATOR = \"\\\\\\\\\"; \\\n"
74
+ else
75
+ out << line
76
+ end
77
+ end
78
+
79
+ when_writing("Patching Makefile.in") {
80
+ File.open(t.name, 'wb') { |f| f.write(out) }
81
+ }
82
+ end
83
+
84
+ task :mingw32 do
85
+ unless File.exist?('/usr/bin/i586-mingw32msvc-gcc') then
86
+ warn "You need to install mingw32 cross compile functionality to be able to continue."
87
+ warn "Please refer to your distro documentation about installation."
88
+ fail
89
+ end
90
+ end
91
+
92
+ task :environment do
93
+ ENV['ac_cv_func_getpgrp_void'] = 'no'
94
+ ENV['ac_cv_func_setpgrp_void'] = 'yes'
95
+ ENV['rb_cv_negative_time_t'] = 'no'
96
+ ENV['ac_cv_func_memcmp_working'] = 'yes'
97
+ ENV['rb_cv_binary_elf' ] = 'no'
98
+ end
99
+
100
+ # generate the makefile in a clean build location
101
+ file "#{USER_HOME}/builds/#{RUBY_CC_VERSION}/Makefile" => ["#{USER_HOME}/builds/#{RUBY_CC_VERSION}",
102
+ "#{USER_HOME}/sources/#{RUBY_CC_VERSION}/Makefile.in"] do |t|
103
+
104
+ # set the configure options
105
+ options = [
106
+ '--host=i586-mingw32msvc',
107
+ '--target=i386-mingw32',
108
+ '--build=i686-linux',
109
+ '--enable-shared'
110
+ ]
111
+
112
+ chdir File.dirname(t.name) do
113
+ prefix = File.expand_path("../../ruby/#{RUBY_CC_VERSION}")
114
+ options << "--prefix=#{prefix}"
115
+ sh File.expand_path("../../sources/#{RUBY_CC_VERSION}/configure"), *options
116
+ end
117
+ end
118
+
119
+ # make
120
+ file "#{USER_HOME}/builds/#{RUBY_CC_VERSION}/ruby.exe" => ["#{USER_HOME}/builds/#{RUBY_CC_VERSION}/Makefile"] do |t|
121
+ chdir File.dirname(t.prerequisites.first) do
122
+ sh "make"
123
+ end
124
+ end
125
+
126
+ # make install
127
+ file "#{USER_HOME}/ruby/#{RUBY_CC_VERSION}/bin/ruby.exe" => ["#{USER_HOME}/builds/#{RUBY_CC_VERSION}/ruby.exe"] do |t|
128
+ chdir File.dirname(t.prerequisites.first) do
129
+ sh "make install"
130
+ end
131
+ end
132
+
133
+ # rbconfig.rb location
134
+ file "#{USER_HOME}/ruby/#{RUBY_CC_VERSION}/lib/ruby/#{MAJOR}/i386-mingw32/rbconfig.rb" => ["#{USER_HOME}/ruby/#{RUBY_CC_VERSION}/bin/ruby.exe"]
135
+
136
+ file :update_config => ["#{USER_HOME}/ruby/#{RUBY_CC_VERSION}/lib/ruby/#{MAJOR}/i386-mingw32/rbconfig.rb"] do |t|
137
+ config_file = "#{USER_HOME}/config.yml"
138
+ if File.exist?(config_file) then
139
+ puts "Updating #{t.name}"
140
+ config = YAML.load_file(config_file)
141
+ else
142
+ puts "Generating #{t.name}"
143
+ config = {}
144
+ end
145
+
146
+ config["rbconfig-#{MAJOR}"] = File.expand_path(t.prerequisites.first)
147
+
148
+ when_writing("Saving changes into #{config_file}") {
149
+ File.open(config_file, 'w') do |f|
150
+ f.puts config.to_yaml
151
+ end
152
+ }
153
+ end
154
+
155
+ task :default do
156
+ end
157
+
158
+ desc "Build #{RUBY_CC_VERSION} suitable for cross-platform development."
159
+ task 'cross-ruby' => [:mingw32, :environment, :update_config]
data/tasks/common.rake ADDED
@@ -0,0 +1,13 @@
1
+ require 'rake/clean'
2
+
3
+ # common pattern cleanup
4
+ CLEAN.include('tmp')
5
+
6
+ # set default task
7
+ task :default => [:spec, :features]
8
+
9
+ # make packing depend on success of running specs and features
10
+ task :package => [:spec, :features]
11
+
12
+ # make the release re-generate the gemspec if required
13
+ task :release => [:gemspec]
@@ -0,0 +1,14 @@
1
+ begin
2
+ gem 'cucumber', '~> 0.1.8'
3
+ require 'cucumber/rake/task'
4
+ rescue Exception
5
+ nil
6
+ end
7
+
8
+ if defined?(Cucumber)
9
+ Cucumber::Rake::Task.new do |t|
10
+ t.cucumber_opts = "--format pretty --no-source"
11
+ end
12
+ else
13
+ warn "Cucumber gem is required, please install it. (gem install cucumber)"
14
+ end
data/tasks/gem.rake ADDED
@@ -0,0 +1,59 @@
1
+ require 'rake/gempackagetask'
2
+
3
+ GEM_SPEC = Gem::Specification.new do |s|
4
+ # basic information
5
+ s.name = "rake-compiler"
6
+ s.version = "0.3.0"
7
+ s.platform = Gem::Platform::RUBY
8
+
9
+ # description and details
10
+ s.summary = 'Rake-based Ruby C Extension task generator.'
11
+ s.description = <<-EOF
12
+ Provide a standard and simplified way to build and package
13
+ Ruby C extensions using Rake as glue.
14
+ EOF
15
+
16
+ # dependencies
17
+ s.add_dependency 'rake', '>= 0.8.3', '< 0.9'
18
+
19
+ # development dependencies
20
+ #s.add_development_dependency 'rspec', '~> 1.1.9'
21
+ #s.add_development_dependency 'rcov', '~> 0.8.1'
22
+ #s.add_development_dependency 'cucumber', '~> 0.1.8'
23
+
24
+ # components, files and paths
25
+ s.files = FileList["features/**/*.{feature,rb}", "bin/rake-compiler",
26
+ "lib/**/*.rb", "spec/**/*.rb", "tasks/**/*.rake",
27
+ "Rakefile", "*.{rdoc,txt,yml}"]
28
+
29
+ s.executables = ['rake-compiler']
30
+
31
+ s.require_path = 'lib'
32
+
33
+ # documentation
34
+ s.has_rdoc = true
35
+ s.rdoc_options << '--main' << 'README.rdoc' << '--title' << 'rake-compiler -- Documentation'
36
+
37
+ s.extra_rdoc_files = %w(README.rdoc LICENSE.txt History.txt)
38
+
39
+ # project information
40
+ s.homepage = 'http://github.com/luislavena/rake-compiler'
41
+ s.rubyforge_project = 'rake-compiler'
42
+
43
+ # author and contributors
44
+ s.author = 'Luis Lavena'
45
+ s.email = 'luislavena@gmail.com'
46
+ end
47
+
48
+ gem_package = Rake::GemPackageTask.new(GEM_SPEC) do |pkg|
49
+ pkg.need_tar = false
50
+ pkg.need_zip = false
51
+ end
52
+
53
+ file 'rake-compiler.gemspec' => ['Rakefile', 'tasks/gem.rake'] do |t|
54
+ puts "Generating #{t.name}"
55
+ File.open(t.name, 'w') { |f| f.puts GEM_SPEC.to_yaml }
56
+ end
57
+
58
+ desc "Generate or update the standalone gemspec file for the project"
59
+ task :gemspec => ['rake-compiler.gemspec']
data/tasks/rdoc.rake ADDED
@@ -0,0 +1,9 @@
1
+ require 'rake/rdoctask'
2
+
3
+ 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)
9
+ end