Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

More work on build & package scripts

  • Loading branch information...
commit 57e1369dffda31fa607ae10d108b16da9d58e47f 1 parent f0ceb42
@danlucraft danlucraft authored
View
29 Rakefile
@@ -5,6 +5,30 @@
require 'rubygems'
require 'fileutils'
+if RUBY_PLATFORM =~ /mswin/
+ begin
+ require 'win32console'
+ rescue LoadError
+ ARGV << "--nocolour"
+ end
+end
+
+GREEN_FG = "\033[1;32m"
+RED_FG = "\033[1;31m"
+RED_BG = "\033[1;37m\033[41m"
+GREY_BG = "\033[40m"
+CLEAR_COLOURS = "\033[0m"
+
+def cputs(text, colours, opts={})
+ colours.each {|colour| print colour }
+ print text
+ if opts[:no_newline]
+ print CLEAR_COLOURS
+ else
+ puts CLEAR_COLOURS
+ end
+end
+
include FileUtils
cd(File.dirname(__FILE__))
@@ -14,6 +38,11 @@ def execute_and_check(command)
$?.to_i == 0 ? true : raise
end
+def execute(command)
+ puts %x{#{command}}
+ $?.to_i == 0 ? true : false
+end
+
Dir[File.join(File.dirname(__FILE__), *%w[plugins *])].each do |plugin_dir|
rakefiles = [File.join(plugin_dir, "Rakefile")] +
Dir[File.join(plugin_dir, "tasks", "*.rake")]
View
84 plugins/redcar/tasks/build.rake
@@ -1,8 +1,46 @@
desc "Build bundled dependencies (NOT WORKING YET)"
-task :build => ["build:gtksourceview2", "build:gtkmateview"]
+task :build => [
+ # "build:gtksourceview2",
+ # "build:gtkmateview",
+ "build:gtk",
+ "build:libs",
+ "build:rubygnome2",
+ "build:check_gems"
+]
+
+def check_header(name)
+ (Dir["/usr/include/#{name}"] + Dir["/usr/local/include/#{name}"]).any?
+end
+
+def check_so(name)
+ (Dir["/usr/lib/#{name}"] + Dir["/usr/local/lib/#{name}"]).any?
+end
+
+def found(name, opts={})
+ cputs("#{name.ljust(30, ".")} found", [GREEN_FG, GREY_BG], opts)
+end
+
+def missing(name, opts={})
+ cputs("#{name.ljust(30, ".")} not found", [RED_FG, GREY_BG], opts)
+end
namespace :build do
+ task :rubygnome2 do
+ begin
+ require 'gtk2'
+ found("Ruby-GNOME2")
+ rescue LoadError
+ missing("Ruby-GNOME2")
+ end
+ begin
+ require 'gtksourceview2'
+ found("ruby-gtksourceview2")
+ rescue LoadError
+ missing("ruby-gtksourceview2")
+ end
+ end
+
task :gtkmateview do
puts "Building gtkmateview"
execute_and_check "tar xzvf vendor/gtkmateview.tar.gz -C vendor/"
@@ -22,7 +60,47 @@ namespace :build do
end
end
- task :oniguruma do
- puts "Building oniguruma"
+ task :libs do
+ cputs("Libraries", GREEN_FG)
+ [
+ ["onig*", "*libonig*", "Oniguruma"],
+ ["gtkmateview*", "libgtkmateview*", "gtkmateview"]
+ ].each do |header, so, name|
+ if (!header or check_header(header)) and
+ (!so or check_so(so))
+ found(name)
+ else
+ missing(name)
+ end
+ end
+ end
+
+ task :gtk do
+ cputs("GTK", [GREEN_FG], :no_newline => true)
+ %w[glib gtk+-2.0 gtksourceview-2.0 xulrunner-gtkmozembed].each do |pkg|
+ if execute("pkg-config --exists #{pkg}")
+ found(pkg, :no_newline => true)
+ else
+ missing(pkg, :no_newline => true)
+ end
+ end
+ puts
+ puts
+ end
+
+ task :check_gems do
+ cputs("\nRubygems", GREEN_FG)
+ %w(oniguruma cucumber zerenity).each do |gem|
+ begin
+ require gem
+ found(gem)
+ rescue LoadError
+ missing(gem)
+ end
+ end
end
end
+
+
+
+
View
27 plugins/redcar/tasks/package.rake
@@ -1,21 +1,34 @@
desc "Package a Redcar release (NOT WORKING YET)"
-task :package => ["package:gtkmateview", "package:rubygtksourceview2"]
+task :package => ["package:gtkmateview", "package:rubygtksourceview2", "package:oniguruma"]
+
+RUBYGTKSOURCEVIEW2_TARBALL = "vendor/ruby-gtksourceview2.tar.bz2"
+GTKMATEVIEW_TARBALL = "vendor/gtkmateview.tar.gz"
+ONIGURUMA_TARBALL = "vendor/onig-5.9.1.tar.gz"
namespace :package do
+ task :clean do
+ rm_f RUBYGTKSOURCEVIEW2_TARBALL
+ rm_f GTKMATEVIEW_TARBALL
+ rm_f ONIGURUMA_TARBALL
+ end
+
task :rubygtksourceview2 do
- rm_f "vendor/ruby-gtksourceview2.tar.bz2"
- execute_and_check "wget http://redcareditor.com/packages/ruby-gtksourceview2.tar.bz2 -O vendor/ruby-gtksourceview2.tar.bz2"
+ unless File.exist?(RUBYGTKSOURCEVIEW2_TARBALL)
+ execute_and_check "wget http://redcareditor.com/packages/ruby-gtksourceview2.tar.bz2 -O #{RUBYGTKSOURCEVIEW2_TARBALL}"
+ end
end
task :gtkmateview do
- rm_f "vendor/ruby-gtkmateview.tar.gz"
- execute_and_check "wget http://github.com/danlucraft/gtkmateview/tarball/master -O vendor/gtkmateview.tar.gz"
+ unless File.exist?(GTKMATEVIEW_TARBALL)
+ execute_and_check "wget http://github.com/danlucraft/gtkmateview/tarball/master -O #{GTKMATEVIEW_TARBALL}"
+ end
end
task :oniguruma do
- rm_f "vendor/onig-5.9.1.tar.gz"
- execute_and_check "wget http://www.geocities.jp/kosako3/oniguruma/archive/onig-5.9.1.tar.gz -O vendor/onig-5.9.1.tar.gz"
+ unless File.exist?(ONIGURUMA_TARBALL)
+ execute_and_check "wget http://www.geocities.jp/kosako3/oniguruma/archive/onig-5.9.1.tar.gz -O #{ONIGURUMA_TARBALL}"
+ end
end
def clean_git_dir(dir)
Please sign in to comment.
Something went wrong with that request. Please try again.