11# -----------------------------------------------------------------------------
2- #
3- # MySQL2 Spatial ActiveRecord Adapter Rakefile
4- #
2+ #
3+ # Generic Gem Rakefile
4+ #
55# -----------------------------------------------------------------------------
6- # Copyright 2010 Daniel Azuma
7- #
6+ # Copyright 2010-2012 Daniel Azuma
7+ #
88# All rights reserved.
9- #
9+ #
1010# Redistribution and use in source and binary forms, with or without
1111# modification, are permitted provided that the following conditions are met:
12- #
12+ #
1313# * Redistributions of source code must retain the above copyright notice,
1414# this list of conditions and the following disclaimer.
1515# * Redistributions in binary form must reproduce the above copyright notice,
1818# * Neither the name of the copyright holder, nor the names of any other
1919# contributors to this software, may be used to endorse or promote products
2020# derived from this software without specific prior written permission.
21- #
21+ #
2222# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2323# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2424# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3434;
3535
3636
37- RAKEFILE_CONFIG = {
38- :product_visible_name => 'MySQL2 Spatial ActiveRecord Adapter' ,
39- }
37+ # Load config if present
38+
39+ config_path_ = ::File . expand_path ( 'rakefile_config.rb' , ::File . dirname ( __FILE__ ) )
40+ load ( config_path_ ) if ::File . exists? ( config_path_ )
41+ RAKEFILE_CONFIG = { } unless defined? ( ::RAKEFILE_CONFIG )
4042
4143
4244# Gemspec
@@ -45,12 +47,11 @@ require 'rubygems'
4547gemspec_ = eval ( ::File . read ( ::Dir . glob ( '*.gemspec' ) . first ) )
4648release_gemspec_ = eval ( ::File . read ( ::Dir . glob ( '*.gemspec' ) . first ) )
4749release_gemspec_ . version = gemspec_ . version . to_s . sub ( /\. build\d +$/ , '' )
48- RAKEFILE_CONFIG = { } unless defined? ( ::RAKEFILE_CONFIG )
4950
5051
5152# Platform info
5253
53- dlext_ = ::Config ::CONFIG [ 'DLEXT' ]
54+ dlext_ = ::RbConfig ::CONFIG [ 'DLEXT' ]
5455
5556platform_ =
5657 case ::RUBY_DESCRIPTION
147148clean_files_ = [ doc_directory_ , pkg_directory_ , tmp_directory_ ] +
148149 ::Dir . glob ( 'ext/**/Makefile*' ) +
149150 ::Dir . glob ( 'ext/**/*.{o,class,log,dSYM}' ) +
150- ::Dir . glob ( "**/*.{#{ dlext_ } ,rbc,jar}" ) +
151+ ::Dir . glob ( "**/*.{bundle,so,dll ,rbc,jar}" ) +
151152 ( ::RAKEFILE_CONFIG [ :extra_clean_files ] || [ ] )
152- task :clean do
153+ task :clean do
153154 clean_files_ . each { |path_ | rm_rf path_ }
154155end
155156
@@ -184,13 +185,15 @@ end
184185
185186# Gem release tasks
186187
187- task :build_gem do
188+ task :build_other
189+
190+ task :build_gem => :build_other do
188191 ::Gem ::Builder . new ( gemspec_ ) . build
189192 mkdir_p ( pkg_directory_ )
190193 mv "#{ gemspec_ . name } -#{ gemspec_ . version } .gem" , "#{ pkg_directory_ } /"
191194end
192195
193- task :build_release do
196+ task :build_release => :build_other do
194197 ::Gem ::Builder . new ( release_gemspec_ ) . build
195198 mkdir_p ( pkg_directory_ )
196199 mv "#{ release_gemspec_ . name } -#{ release_gemspec_ . version } .gem" , "#{ pkg_directory_ } /"
205208
206209# Unit test task
207210
208- task :test => :build_ext do
211+ task :test => [ :build_ext , :build_other ] do
209212 $:. unshift ( ::File . expand_path ( 'lib' , ::File . dirname ( __FILE__ ) ) )
210213 if ::ENV [ 'TESTCASE' ]
211214 test_files_ = ::Dir . glob ( "test/#{ ::ENV [ 'TESTCASE' ] } .rb" )
0 commit comments