summaryrefslogtreecommitdiffstats
path: root/tasks/csts.rake
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2009-02-28 21:19:37 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2009-02-28 21:19:37 +0100
commit0a8b6ea5dc6a9d56638b985dd67b0c45f167e381 (patch)
tree1932cb877c3e623f9a300c37971bb4e073670aea /tasks/csts.rake
parent50bb456cf469f73d3a32474dc07bd58c0c64dba1 (diff)
downloadmmap-ruby-master.zip
mmap-ruby-master.tar.gz
mmap goes rakeified, build and test OKHEADmaster
Diffstat (limited to 'tasks/csts.rake')
-rw-r--r--tasks/csts.rake72
1 files changed, 72 insertions, 0 deletions
diff --git a/tasks/csts.rake b/tasks/csts.rake
new file mode 100644
index 0000000..be656e3
--- /dev/null
+++ b/tasks/csts.rake
@@ -0,0 +1,72 @@
+
+# GLOBAL CONFIG
+F_CHMOD = 0644
+D_CHMOD = 0755
+
+# VERSION
+RUBY_1_9 = RUBY_VERSION =~ /^1\.9/
+WIN = (RUBY_PLATFORM =~ /mswin|cygwin/)
+SUDO = (WIN ? "" : "sudo" )
+
+# EXTENSIONS
+HAVE_EXT = File.directory? "#{EXT_DIR}"
+EXT_CONF_FILES = FileList["#{EXT_DIR}/**/extconf.rb"]
+EXT_SRC_FILES = FileList["#{EXT_DIR}/**/*.{c,h}"]
+EXT_FILES = EXT_SRC_FILES + EXT_CONF_FILES
+
+# FILES
+RAKE_FILES = FileList[RAKEFILE, PRJ_FILE, GEM_SPEC_FILE, SETUP_FILE, "#{RAKE_DIR}/*"]
+BIN_FILES = FileList["#{BIN_DIR}/**/*"]
+LIB_FILES = FileList["#{LIB_DIR}/**/*.rb"]
+TEST_FILES = FileList["#{TEST_DIR}/**/test_*.rb"]
+RDOC_FILES = FileList[README, CHANGES, LICENSE]
+
+# DIST FILES
+DIST_FILES = FileList[]
+DIST_FILES.include(RAKE_FILES)
+DIST_FILES.include(BIN_FILES)
+DIST_FILES.include(LIB_FILES)
+DIST_FILES.include(TEST_FILES)
+DIST_FILES.include(RDOC_FILES)
+DIST_FILES.include(DATA_FILES)
+DIST_FILES.include(EXT_FILES) if HAVE_EXT
+DIST_FILES.include("#{RDOC_DIR}/**/*.{html,css}", 'man/*.[0-9]')
+DIST_FILES.exclude('**/tmp_*', '**/*.tmp')
+
+#
+CLEAN.include( 'README' ) if File.exist? 'README.rb'
+CLEAN.include( 'CHANGES' ) if File.exist? 'CHANGES.rb'
+CLEAN.include( FileList["#{EXT_DIR}/**/*.{o,so}","#{EXT_DIR}/**/Makefile"], '.config' ) if HAVE_EXT
+
+# LOADPATH
+REQUIRE_PATHS = [LIB_DIR]
+REQUIRE_PATHS << FileList["#{EXT_DIR}/**"] if HAVE_EXT
+#$LOAD_PATH.concat REQUIRE_PATHS
+
+# C EXTENSIONS TASKS
+if HAVE_EXT
+ CONFIG_OPTS = ENV['CONFIG']
+ file_create '.config' do
+ ruby "setup.rb -q config #{CONFIG_OPTS}"
+ end
+
+ desc 'Configure and make C extensions. The CONFIG variable is passed to \'setup.rb config\''
+ task :make_ext => '.config' do
+ ruby "setup.rb -q setup"
+ end
+
+ task :test_ext => :make_ext
+ desc 'Run test after making the extensions.'
+ task :test => :make_ext do
+ Rake::Task[:test_ext].invoke
+ end
+end
+
+# CERTIFICATE
+cert_dir = ENV['CERT_DIR'] ||= File.expand_path(File.join('~', '.gem'))
+HAVE_CERT = File.readable?(File.join(cert_dir, 'gem-private_key.pem')) and File.readable?(File.join(cert_dir, 'gem-public_cert.pem'))
+if HAVE_CERT
+ CERT_PRIVATE = File.join(cert_dir, 'gem-private_key.pem')
+ CERT_PUBLIC = File.join(cert_dir, 'gem-public_cert.pem')
+end
+