Permalink
Browse files

Rakefile for windows users

  • Loading branch information...
1 parent 035ab56 commit 78da1668585c21a21e7334db96da24d391c2d0a5 @DaveGit DaveGit committed Nov 24, 2012
Showing with 53 additions and 0 deletions.
  1. +53 −0 Rakefile_windows
View
@@ -0,0 +1,53 @@
+require 'fileutils'
+require './lib/sqldroid/version'
+
+# ANDROID_SDK_HOME = File.dirname(File.dirname(`which dx`))
+ANDROID_SDK_HOME = ENV['ANDROID_SDK_HOME']
+PKG_DIR = File.expand_path "pkg"
+JAR = "sqldroid-#{SQLDroid::VERSION}.jar"
+JAR_IN_PKG = "#{PKG_DIR}/#{JAR}"
+LIB_DIR = File.expand_path 'lib/sqldroid'
+JAR_IN_GEM = "#{LIB_DIR}/#{JAR}"
+GEM_FILE = "sqldroid-#{SQLDroid::VERSION}.gem"
+GEM_FILE_PKG = "#{PKG_DIR}/#{GEM_FILE}"
+JAVA_SRC_FILES = Dir[File.expand_path 'src/**/*.java']
+
+
+desc 'Generate the binary and source jars'
+task :jar => JAR_IN_PKG
+
+file JAR_IN_PKG => JAVA_SRC_FILES do
+ FileUtils.mkdir_p 'bin'
+ sh "find ./src -name *.java > sources_list.txt"
+ sh "javac -source 1.6 -target 1.6 -cp #{ANDROID_SDK_HOME}/platforms/android-11/android.jar -d bin @sources_list.txt"
+ FileUtils.mkdir_p PKG_DIR
+ Dir.chdir 'bin' do
+ sh "jar cf #{PKG_DIR}/#{JAR} org"
+ end
+end
+
+file JAR_IN_GEM => JAR_IN_PKG do
+ FileUtils.rm_rf Dir["#{LIB_DIR}/sqldroid-*.jar"]
+ FileUtils.cp JAR_IN_PKG, JAR_IN_GEM
+end
+
+desc 'Create a RubyGem for SQLDroid'
+task :gem => GEM_FILE_PKG
+
+file GEM_FILE_PKG => JAR_IN_GEM do
+ sh 'gem build sqldroid.gemspec'
+ FileUtils.mv GEM_FILE, GEM_FILE_PKG
+end
+
+desc 'Tag the project and push the tag to GitHub'
+task :tag do
+ output = `git status --porcelain`
+ raise "Workspace not clean!\n#{output}" unless output.empty?
+ sh "git tag #{SQLDroid::VERSION}"
+ sh "git push --tags"
+end
+
+desc 'Release SQLDroid as a Ruby gem to rubygems.org'
+task :release => [:tag, GEM_FILE_PKG] do
+ sh "gem push #{GEM_FILE_PKG}"
+end

0 comments on commit 78da166

Please sign in to comment.