Skip to content
Browse files

Move prawn and rails unit test runs into Rakefile. Add simple git sup…

…port methods to Rake. Move some more config info into default properties
  • Loading branch information...
1 parent 7557120 commit c595c02d289cfec491eecd56a4c5697f3ecb9f6c @enebo enebo committed Feb 11, 2010
Showing with 54 additions and 94 deletions.
  1. +22 −0 Rakefile
  2. +12 −94 build.xml
  3. +4 −0 default.build.properties
  4. +16 −0 rakelib/git.rake
View
22 Rakefile
@@ -37,3 +37,25 @@ task :gen do
system 'jar -uf lib/jruby.jar -C src_gen .'
end
+task :fetch_latest_rails_repo do
+ unless git_repo_exists? RAILS_DIR
+ git_shallow_clone('rails', RAILS_GIT_REPO, RAILS_DIR)
+ else
+ git_pull('rails', RAILS_DIR)
+ end
+end
+
+task :fetch_latest_prawn_repo do
+ unless git_repo_exists? PRAWN_DIR
+ git_shallow_clone('prawn', PRAWN_GIT_REPO, PRAWN_DIR) do
+ `git checkout #{PRAWN_STABLE_VERSION}`
+ `git submodule init`
+ `git submodule update`
+ end
+ else
+ git_pull('prawn', PRAWN_DIR) do
+ `git checkout #{PRAWN_STABLE_VERSION}`
+ `git submodule update`
+ end
+ end
+end
View
106 build.xml
@@ -682,6 +682,9 @@
<arg value="--command"/>
<arg value="maybe_install_gems"/>
<arg value="mocha"/>
+ <arg value="i18n"/>
+ <arg value="jruby-memcache-client"/>
+ <arg value="tzinfo"/>
<arg value="jruby-openssl"/>
<arg value="--no-ri"/>
<arg value="--no-rdoc"/>
@@ -1669,102 +1672,17 @@
<mkdir dir="${build.dir}/nailmain"/>
</target>
- <target name="fetch-rails">
- <condition property="rails-repo-exists">
- <available file="${rails.dir}/.git"/>
- </condition>
-
- <antcall target="do-fetch-rails"/>
- <antcall target="do-update-rails"/>
- </target>
-
- <target name="do-fetch-rails" unless="rails-repo-exists">
- <!-- Rails repo might already have been pulled, so delete it -->
- <antcall target="clear-rails" inheritall="false"/>
-
- <echo message="Cloning rails repo to: ${rails.dir}"/>
- <exec executable="git">
- <arg value="clone"/>
- <arg value="--depth"/><arg value="1"/>
- <arg value="git://github.com/rails/rails.git"/>
- <arg value="${rails.dir}"/>
- </exec>
- </target>
-
- <target name="do-update-rails" if="rails-repo-exists">
- <echo message="Updating rubyspec repo -- ${rails.dir}"/>
- <exec dir="${rails.dir}" executable="git">
- <arg value="pull"/>
- </exec>
- </target>
-
- <target name="clear-rails">
- <delete dir="${rails.dir}"/>
- </target>
-
- <target name="test-rails-stable" depends="jar,install-build-gems,fetch-rails">
- <!-- Need to disable assertions because of a rogue one in OpenSSL -->
- <run-rake dir="${rails.dir}/activesupport" rake.targets="test" jvm.args="-da"/>
-
- <run-rake dir="${rails.dir}/actionmailer" rake.targets="test"/>
- <run-rake dir="${rails.dir}/activemodel" rake.targets="test"/>
- <run-rake dir="${rails.dir}/railties" rake.targets="test"/>
- </target>
-
- <target name="fetch-prawn">
- <condition property="prawn-repo-exists">
- <available file="test/prawn/.git"/>
- </condition>
-
- <antcall target="do-fetch-prawn"/>
- <antcall target="do-update-prawn"/>
- </target>
-
- <target name="do-fetch-prawn" unless="prawn-repo-exists">
- <!-- Rails repo might already have been pulled, so delete it -->
- <antcall target="clear-prawn" inheritall="false"/>
-
- <echo message="Cloning prawn repo to: test/prawn"/>
- <exec executable="git">
- <arg value="clone"/>
- <arg value="--depth"/><arg value="1"/>
- <arg value="git://github.com/sandal/prawn.git"/>
- <arg value="test/prawn"/>
- </exec>
- <exec executable="git" dir="test/prawn">
- <arg value="checkout"/>
- <arg value="0.4.1"/>
- </exec>
- <exec executable="git" dir="test/prawn">
- <arg value="submodule"/>
- <arg value="init"/>
- </exec>
- <exec executable="git" dir="test/prawn">
- <arg value="submodule"/>
- <arg value="update"/>
- </exec>
- </target>
-
- <target name="do-update-prawn" if="prawn-repo-exists">
- <echo message="Updating rubyspec repo -- test/prawn"/>
- <exec dir="test/prawn" executable="git">
- <arg value="pull"/>
- </exec>
- <exec executable="git" dir="test/prawn">
- <arg value="checkout"/>
- <arg value="0.4.1"/>
- </exec>
- <exec executable="git" dir="test/prawn">
- <arg value="submodule"/>
- <arg value="update"/>
- </exec>
- </target>
-
- <target name="clear-prawn">
- <delete dir="test/prawn"/>
+ <target name="test-rails-stable" depends="jar,install-build-gems">
+ <run-rake rake.targets="fetch_latest_rails_repo"/>
+ <!-- Need to disable assertions because of a rogue one in OpenSSL -->
+ <run-rake dir="${rails.dir}/activesupport" rake.targets="test" jvm.args="-da"/>
+ <run-rake dir="${rails.dir}/actionmailer" rake.targets="test"/>
+ <run-rake dir="${rails.dir}/activemodel" rake.targets="test"/>
+ <run-rake dir="${rails.dir}/railties" rake.targets="test"/>
</target>
- <target name="test-prawn" depends="jar,install-build-gems,fetch-prawn">
+ <target name="test-prawn" depends="jar,install-build-gems">
+ <run-rake rake.targets="fetch_latest_prawn_repo"/>
<run-rake dir="test/prawn" rake.targets="test examples"/>
</target>
View
4 default.build.properties
@@ -6,7 +6,11 @@ lib.dir=lib
dest.lib.dir=${lib.dir}
spec.dir=${base.dir}/spec
rubyspec.dir=${spec.dir}/ruby
+prawn.dir=${test.dir}/prawn
+prawn.git.repo=git://github.com/sandal/prawn.git
+prawn.stable.version=0.4.1
rails.dir=${test.dir}/rails
+rails.git.repo=git://github.com/rails/rails.git
mspec.dir=${spec.dir}/mspec
rubyspec.1.8.dir=${rubyspec.dir}/1.8
spec.tags.dir=${spec.dir}/tags
View
16 rakelib/git.rake
@@ -0,0 +1,16 @@
+def git_repo_exists?(dir)
+ File.exists? File.join(dir, ".git")
+end
+
+def git_shallow_clone(label, git_repository, local_directory)
+ puts "No #{label} repo found: cloning to #{local_directory}"
+ rm_rf local_directory # Something there, but not a git repo. Destroy!
+ `git clone --depth 1 #{git_repository} #{local_directory}`
+ Dir.chdir(local_directory) { yield } if block_given?
+end
+
+def git_pull(label, local_directory)
+ puts "#{label} repo found: updating repo at #{local_directory}"
+ `git pull`
+ Dir.chdir(local_directory) { yield } if block_given?
+end

0 comments on commit c595c02

Please sign in to comment.
Something went wrong with that request. Please try again.