summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md (renamed from README.rdoc)30
-rw-r--r--Rakefile63
-rw-r--r--ffi-efl.gemspec27
-rw-r--r--tasks/ann.rake83
-rw-r--r--tasks/constants.rb118
-rw-r--r--tasks/ffi.rake22
-rw-r--r--tasks/gem.rake196
-rw-r--r--tasks/git.rake38
-rw-r--r--tasks/helpers.rb130
-rw-r--r--tasks/notes.rake27
-rw-r--r--tasks/post_load.rake35
-rw-r--r--tasks/rdoc.rake46
-rw-r--r--tasks/rubyforge.rake54
-rw-r--r--tasks/setup.rb129
-rw-r--r--tasks/spec.rake44
-rw-r--r--tasks/svn.rake48
-rw-r--r--tasks/test.rake41
17 files changed, 49 insertions, 1082 deletions
diff --git a/README.rdoc b/README.md
index 8586d99..6867c41 100644
--- a/README.rdoc
+++ b/README.md
@@ -1,16 +1,17 @@
-ffi-efl
+# ffi-efl
by Jérémy Zurcher
- http://asynk.ch
+ (http://asynk.ch)
-== DESCRIPTION:
+## DESCRIPTION:
-A ruby-ffi binding to efl libraries (Enlightenment Foundation Libraries).
+A ruby-ffi binding to [efl](http://www.enlightenment.org/p.php?p=docs&l=en) libraries (Enlightenment Foundation Libraries).
-== FEATURES/PROBLEMS:
+## FEATURES/PROBLEMS:
* pretty young project ...
+* binding is complete but lacks ruby code and tests
-== SYNOPSIS:
+## SYNOPSIS:
require 'efl/elm/elm_win'
require 'efl/elm/elm_bg'
@@ -60,14 +61,15 @@ A ruby-ffi binding to efl libraries (Enlightenment Foundation Libraries).
For more examples you may look at:
-* the spec/[https://github.com/jeremyz/ffi-efl/tree/master/spec] and test/[https://github.com/jeremyz/ffi-efl/tree/master/test] folders
+* the [spec/](https://github.com/jeremyz/ffi-efl/tree/master/spec) and [test/](https://github.com/jeremyz/ffi-efl/tree/master/test) folders
-== REQUIREMENTS:
+## REQUIREMENTS:
* You need a sane enlightenment foundation libraries installation,
- for this you might like to use easy_e17.sh[http://omicron.homeip.net/projects/#easy_e17.sh].
+ for this you might like to use [easy_e17.sh](http://omicron.homeip.net/projects/#easy_e17.sh),
+ or my git aware fork (easy_e17.sh)[https://github.com/jeremyz/bin/blob/master/easy_e17.sh]
-== DOWNLOAD/INSTALL:
+## DOWNLOAD/INSTALL:
From rubygems:
@@ -79,7 +81,7 @@ or from the git repository on github:
cd ffi-efl
rake gem:install
-== RESOURCES:
+## RESOURCES:
You can find this project in a few places:
@@ -92,13 +94,13 @@ Gem:
* https://rubygems.org/gems/ffi-efl
-== CREDITS:
+## CREDITS:
Special thanks to:
* Lionel Orry
* The enlightenment team
-== LICENSE:
+## LICENSE:
-See MIT-LICENSE file.
+[MIT](http://www.opensource.org/licenses/MIT) see [MIT_LICENSE](https://github.com/jeremyz/ffi-efl/blob/master/MIT-LICENSE)
diff --git a/Rakefile b/Rakefile
index 3177599..f2c6857 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,57 +1,6 @@
-# -*- coding: UTF-8 -*-
-#
-require './lib/efl.rb'
-load './tasks/setup.rb'
-#
-# Project general information
-PROJ.name = 'ffi-efl'
-PROJ.authors = 'Jérémy Zurcher'
-PROJ.email = 'jeremy@asynk.ch'
-PROJ.url = 'https://github.com/jeremyz/ffi-efl'
-PROJ.version = Efl::VERSION
-PROJ.rubyforge.name = 'ffi-efl'
-PROJ.readme_file = 'README.rdoc'
-#
-# Annoucement
-PROJ.ann.paragraphs << 'FEATURES' << 'SYNOPSIS' << 'REQUIREMENTS' << 'DOWNLOAD/INSTALL' << 'CREDITS' << 'LICENSE'
-PROJ.ann.email[:from] = 'jeremy@asynk.ch'
-PROJ.ann.email[:to] = ['FIXME']
-PROJ.ann.email[:server] = 'localhost'
-PROJ.ann.email[:tls] = false
-# Gem specifications
-PROJ.gem.need_tar = false
-PROJ.gem.files = %w(Changelog MIT-LICENSE README.rdoc Rakefile) + Dir.glob("{ext,lib,spec,tasks}/**/*[^~]").reject { |fn| test ?d, fn }
-PROJ.gem.platform = Gem::Platform::RUBY
-PROJ.gem.required_ruby_version = ">= 1.9.2"
-#
-# Override Mr. Bones autogenerated extensions and force ours in
-#PROJ.gem.extras['extensions'] = %w(ext/extconf.rb)
-#PROJ.gem.extras['required_ruby_version'] = ">= 1.9.2"
-#
-# RDoc
-PROJ.rdoc.exclude << '^ext\/'
-PROJ.rdoc.opts << '-x' << 'ext'
-#
-# Ruby
-PROJ.ruby_opts = []
-PROJ.ruby_opts << '-I' << 'lib'
-#
-# RSpec
-PROJ.spec.files.exclude /rbx/
-PROJ.spec.opts << '--color'
-#
-# Rcov
-PROJ.rcov.opts << '-I lib'
-#
-# Dependencies
-depend_on 'ffi', '>=1.0.2'
-#
-task :default => [:spec]
-#
-desc "Build all packages"
-task :package => 'gem:package'
-#
-desc "Install the gem locally"
-task :install => 'gem:install'
-#
-# EOF
+require 'bundler/gem_tasks'
+
+require 'rspec/core/rake_task'
+RSpec::Core::RakeTask.new
+
+task :default => :spec
diff --git a/ffi-efl.gemspec b/ffi-efl.gemspec
new file mode 100644
index 0000000..878b722
--- /dev/null
+++ b/ffi-efl.gemspec
@@ -0,0 +1,27 @@
+#! /usr/bin/env ruby
+# -*- coding: UTF-8 -*-
+#
+$:.push File.expand_path("../lib", __FILE__)
+require 'efl'
+#
+Gem::Specification.new do |s|
+ s.name = "ffi-efl"
+ s.version = Efl::VERSION
+ s.authors = ["Jérémy Zurcher"]
+ s.email = ["jeremy@asynk.ch"]
+ s.homepage = "http://github.com/jeremyz/ffi-efl"
+ s.summary = %q{A ruby-ffi binding to efl libraries (Enlightenment Foundation Libraries).}
+ s.description = %q{It covers most of eina, eet, evas, ecore, emap, elementary.
+ Prototypes are extracted from C headers with sed scripts. FFI calls are generated with a ruby script.}
+
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.require_paths = ["lib"]
+
+ s.add_runtime_dependency "ffi"
+ s.add_development_dependency "rspec", ["~> 2.6"]
+ s.add_development_dependency "rake"
+end
+#
+# EOF
diff --git a/tasks/ann.rake b/tasks/ann.rake
deleted file mode 100644
index 4515ccb..0000000
--- a/tasks/ann.rake
+++ /dev/null
@@ -1,83 +0,0 @@
-# -*- coding: UTF-8 -*-
-#
-begin
- require 'bones/smtp_tls'
-rescue LoadError
- require 'net/smtp'
-end
-require 'time'
-
-namespace :ann do
-
- # A prerequisites task that all other tasks depend upon
- task :prereqs
- file PROJ.ann.file do
- ann = PROJ.ann
- puts "Generating #{ann.file}"
- File.open(ann.file,'w') do |fd|
- fd.puts("#{PROJ.name} version #{PROJ.version}")
- fd.puts(" by #{Array(PROJ.authors).first}") if PROJ.authors
- fd.puts(" #{PROJ.url}") if PROJ.url.valid?
- fd.puts(" (the \"#{PROJ.release_name}\" release)") if PROJ.release_name
- fd.puts
- fd.puts("== DESCRIPTION")
- fd.puts
- fd.puts(PROJ.description)
- fd.puts
- fd.puts(PROJ.changes.sub(%r/^.*$/, '== CHANGES'))
- fd.puts
- ann.paragraphs.each do |p|
- fd.puts "== #{p.upcase}"
- fd.puts
- fd.puts paragraphs_of(PROJ.readme_file, p).join("\n\n")
- fd.puts
- end
- fd.puts ann.text if ann.text
- end
- end
-
- desc "Create an announcement file"
- task :announcement => ['ann:prereqs', PROJ.ann.file]
-
- desc "Send an email announcement"
- task :email => ['ann:prereqs', PROJ.ann.file] do
- ann = PROJ.ann
- from = ann.email[:from] || Array(PROJ.authors).first || PROJ.email
- to = Array(ann.email[:to])
-
- ### build a mail header for RFC 822
- rfc822msg = "From: #{from}\n"
- rfc822msg << "To: #{to.join(',')}\n"
- rfc822msg << "Subject: [ANN] #{PROJ.name} #{PROJ.version}"
- rfc822msg << " (#{PROJ.release_name})" if PROJ.release_name
- rfc822msg << "\n"
- rfc822msg << "Date: #{Time.new.rfc822}\n"
- rfc822msg << "Message-Id: "
- rfc822msg << "<#{"%.8f" % Time.now.to_f}@#{ann.email[:domain]}>\n\n"
- rfc822msg << File.read(ann.file)
-
- params = [:server, :port, :domain, :acct, :passwd, :authtype].map do |key|
- ann.email[key]
- end
-
- params[3] = (PROJ.ann.email[:from] || PROJ.email) if params[3].nil?
-
-# if ann.email[:tls] and params[4].nil?
- if params[4].nil?
- STDOUT.write "Please enter your e-mail password (#{params[3]}): "
- params[4] = STDIN.gets.chomp
- end
-# params = params.shift 2 if not ann.email[:tls]
-
- ### send email
- # TODO find a way to bypass /var/lib/gems/1.9/gems/bones-3.6.5/lib/bones/smtp_tls.rb which forces starttls usage
- Net::SMTP.start(*params) {|smtp| smtp.sendmail(rfc822msg, from, to)}
- end
-end # namespace :ann
-
-desc 'Alias to ann:announcement'
-task :ann => 'ann:announcement'
-
-CLOBBER << PROJ.ann.file
-
-# EOF
diff --git a/tasks/constants.rb b/tasks/constants.rb
deleted file mode 100644
index 8a7fdfa..0000000
--- a/tasks/constants.rb
+++ /dev/null
@@ -1,118 +0,0 @@
-# -*- coding: UTF-8 -*-
-#
-require 'rbconfig'
-
-# Setup some constants
-WIN32 = %r/djgpp|(cyg|ms|bcc)win|mingw/ =~ RUBY_PLATFORM unless defined? WIN32
-
-DEV_NULL = WIN32 ? 'NUL:' : '/dev/null'
-
-def quiet( &block )
- io = [STDOUT.dup, STDERR.dup]
- STDOUT.reopen DEV_NULL
- STDERR.reopen DEV_NULL
- block.call
-ensure
- STDOUT.reopen io.first
- STDERR.reopen io.last
- $stdout, $stderr = STDOUT, STDERR
-end
-
-BUILD_DIR = "build"
-
-USE_RAKE_COMPILER = ( ( (RUBY_PLATFORM =~ /java/) ? false : true ) and test ?d, 'ext' )
-if USE_RAKE_COMPILER
- gem 'rake-compiler', '>=0.6.0'
- require 'rake/extensiontask'
- ENV['RUBY_CC_VERSION'] = '1.8.7:1.9.2'
-end
-
-LIBEXT = case RbConfig::CONFIG['host_os'].downcase
- when /darwin/
- "dylib"
- when /mswin|mingw/
- "dll"
- else
- RbConfig::CONFIG['DLEXT']
- end
-
-CPU = case RbConfig::CONFIG['host_cpu'].downcase
- when /i[3456]86/
- # Darwin always reports i686, even when running in 64bit mode
- if RbConfig::CONFIG['host_os'] =~ /darwin/ && 0xfee1deadbeef.is_a?(Fixnum)
- "x86_64"
- else
- "i386"
- end
- when /amd64|x86_64/
- "x86_64"
- when /ppc64|powerpc64/
- "powerpc64"
- when /ppc|powerpc/
- "powerpc"
- else
- RbConfig::CONFIG['host_cpu']
- end
-
-OS = case RbConfig::CONFIG['host_os'].downcase
- when /linux/
- "linux"
- when /darwin/
- "darwin"
- when /freebsd/
- "freebsd"
- when /openbsd/
- "openbsd"
- when /sunos|solaris/
- "solaris"
- when /mswin|mingw/
- "win32"
- else
- RbConfig::CONFIG['host_os'].downcase
- end
-
-CC=ENV['CC'] || RbConfig::CONFIG['CC'] || "gcc"
-
-GMAKE = RbConfig::CONFIG['host_os'].downcase =~ /bsd|solaris/ ? "gmake" : "make"
-
-
-DIFF = if WIN32 then 'diff.exe'
- else
- if quiet {system "gdiff", __FILE__, __FILE__} then 'gdiff'
- else 'diff' end
- end unless defined? DIFF
-
-SUDO = if WIN32 then ''
- else
- if quiet {system 'which sudo'} then 'sudo'
- else '' end
- end
-
-RCOV = WIN32 ? 'rcov.bat' : 'rcov'
-RDOC = WIN32 ? 'rdoc.bat' : 'rdoc'
-GEM = WIN32 ? 'gem.bat' : 'gem'
-
-%w(rcov spec/rake/spectask rubyforge bones facets/ansicode).each do |lib|
- begin
- require lib
- Object.instance_eval {const_set "HAVE_#{lib.tr('/','_').upcase}", true}
- rescue LoadError
- Object.instance_eval {const_set "HAVE_#{lib.tr('/','_').upcase}", false}
- end
-end
-
-HAVE_SVN = (Dir.entries(Dir.pwd).include?('.svn') and system("svn --version 2>&1 > #{DEV_NULL}"))
-HAVE_GIT = (Dir.entries(Dir.pwd).include?('.git') and system("git --version 2>&1 > #{DEV_NULL}"))
-
-# Add rake as a development dependency
-#
-PROJ.gem.development_dependencies << ['rake', '>=0.8.7']
-
-# Add bones as a development dependency
-#
-if HAVE_BONES
- bones_version = defined?(Bones::VERSION) ? Bones::VERSION : Bones.version
- PROJ.gem.development_dependencies << ['bones', ">= #{bones_version}"]
-end
-
-# EOF
diff --git a/tasks/ffi.rake b/tasks/ffi.rake
deleted file mode 100644
index 0ade669..0000000
--- a/tasks/ffi.rake
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- coding: UTF-8 -*-
-#
-namespace :ffi do
- #
- desc "extract api out of enlightenment headers, then generate bindings"
- task :run => [ :api, :ruby ]
- #
- desc "extract api out of enlightenment headers"
- task :api do
- sh './tools/extract-api.sh'
- end
- #
- desc "generate ffi bindings"
- task :ruby do
- sh './tools/genruby.rb'
- end
-end
-#
-desc 'Alias to ffi:run'
-task :ffi => 'ffi:run'
-#
-# EOF
diff --git a/tasks/gem.rake b/tasks/gem.rake
deleted file mode 100644
index e5e5d13..0000000
--- a/tasks/gem.rake
+++ /dev/null
@@ -1,196 +0,0 @@
-# -*- coding: UTF-8 -*-
-#
-require 'find'
-require 'rake/packagetask'
-require 'rubygems/user_interaction'
-require 'rubygems/builder'
-
-module Bones
-class GemPackageTask < Rake::PackageTask
- # Ruby GEM spec containing the metadata for this package. The
- # name, version and package_files are automatically determined
- # from the GEM spec and don't need to be explicitly provided.
- #
- attr_accessor :gem_spec
-
- # Tasks from the Bones gem directory
- attr_reader :bones_files
-
- # Create a GEM Package task library. Automatically define the gem
- # if a block is given. If no block is supplied, then +define+
- # needs to be called to define the task.
- #
- def initialize(gem_spec)
- init(gem_spec)
- yield self if block_given?
- define if block_given?
- end
-
- # Initialization tasks without the "yield self" or define
- # operations.
- #
- def init(gem)
- super(gem.name, gem.version)
- @gem_spec = gem
- @package_files += gem_spec.files if gem_spec.files
- @bones_files = []
-
- local_setup = File.join(Dir.pwd, %w[tasks setup.rb])
- if !test(?e, local_setup)
- Dir.glob(::Bones.path(%w[lib bones tasks *])).each {|fn| bones_files << fn}
- end
- end
-
- # Create the Rake tasks and actions specified by this
- # GemPackageTask. (+define+ is automatically called if a block is
- # given to +new+).
- #
- def define
- super
- task :prereqs
- task :package => ['gem:prereqs', "#{package_dir_path}/#{gem_file}"]
- file "#{package_dir_path}/#{gem_file}" => [package_dir_path] + package_files + bones_files do
- when_writing("Creating GEM") {
- chdir(package_dir_path) do
- Gem::Builder.new(gem_spec).build
- verbose(true) { mv gem_file, "../#{gem_file}" }
- end
- }
- end
-
- file package_dir_path => bones_files do
- mkdir_p package_dir rescue nil
-
- gem_spec.files = (gem_spec.files + bones_files.map {|fn| File.join('tasks', File.basename(fn))}).sort
-
- bones_files.each do |fn|
- base_fn = File.join('tasks', File.basename(fn))
- f = File.join(package_dir_path, base_fn)
- fdir = File.dirname(f)
- mkdir_p(fdir) if !File.exist?(fdir)
- if File.directory?(fn)
- mkdir_p(f)
- else
- raise "file name conflict for '#{base_fn}' (conflicts with '#{fn}')" if test(?e, f)
- safe_ln(fn, f)
- end
- end
- end
- end
-
- def gem_file
- if @gem_spec.platform == Gem::Platform::RUBY
- "#{package_name}.gem"
- else
- "#{package_name}-#{@gem_spec.platform}.gem"
- end
- end
-end # class GemPackageTask
-end # module Bones
-
-namespace :gem do
-
- PROJ.gem._spec = Gem::Specification.new do |s|
- s.name = PROJ.name
- s.version = PROJ.version
- s.summary = PROJ.summary
- s.authors = Array(PROJ.authors)
- s.email = PROJ.email
- s.homepage = Array(PROJ.url).first
- s.rubyforge_project = PROJ.rubyforge.name
-
- s.description = PROJ.description
-
- PROJ.gem.dependencies.each do |dep|
- s.add_dependency(*dep)
- end
-
- PROJ.gem.development_dependencies.each do |dep|
- s.add_development_dependency(*dep)
- end
-
- s.files = PROJ.gem.files
- s.executables = PROJ.gem.executables.map {|fn| File.basename(fn)}
- s.extensions = PROJ.gem.files.grep %r/extconf\.rb$/
-
- s.bindir = 'bin'
- dirs = Dir["{#{PROJ.libs.join(',')}}"]
- s.require_paths = dirs unless dirs.empty?
-
- incl = Regexp.new(PROJ.rdoc.include.join('|'))
- excl = PROJ.rdoc.exclude.dup.concat %w[\.rb$ ^(\.\/|\/)?ext]
- excl = Regexp.new(excl.join('|'))
- rdoc_files = PROJ.gem.files.find_all do |fn|
- case fn
- when excl; false
- when incl; true
- else false end
- end
- s.rdoc_options = PROJ.rdoc.opts + ['--main', PROJ.rdoc.main]
- s.extra_rdoc_files = rdoc_files
-
- if test ?f, PROJ.test.file
- s.test_file = PROJ.test.file
- else
- s.test_files = PROJ.test.files.to_a
- end
-
- # Do any extra stuff the user wants
- PROJ.gem.extras.each do |msg, val|
- case val
- when Proc
- val.call(s.send(msg))
- else
- s.send "#{msg}=", val
- end
- end
- end # Gem::Specification.new
-
- Bones::GemPackageTask.new(PROJ.gem._spec) do |pkg|
- pkg.need_tar = PROJ.gem.need_tar
- pkg.need_zip = PROJ.gem.need_zip
- end
-
- desc 'Show information about the gem'
- task :debug => 'gem:prereqs' do
- puts PROJ.gem._spec.to_ruby
- end
-
- desc 'Write the gemspec '
- task :spec => 'gem:prereqs' do
- File.open("#{PROJ.name}.gemspec", 'w') do |f|
- f.write PROJ.gem._spec.to_ruby
- end
- end
-
- desc 'Install the gem'
- task :install => [:clobber, 'gem:package'] do
- sh "#{SUDO} #{GEM} install --local pkg/#{PROJ.gem._spec.full_name}"
- # use this version of the command for rubygems > 1.0.0
- #sh "#{SUDO} #{GEM} install --no-update-sources pkg/#{PROJ.gem._spec.full_name}"
- end
-
- desc 'Uninstall the gem'
- task :uninstall do
- installed_list = Gem.source_index.find_name(PROJ.name)
- if installed_list and installed_list.collect { |s| s.version.to_s}.include?(PROJ.version) then
- sh "#{SUDO} #{GEM} uninstall --version '#{PROJ.version}' --ignore-dependencies --executables #{PROJ.name}"
- end
- end
-
- desc 'Reinstall the gem'
- task :reinstall => [:uninstall, :install]
-
- desc 'Cleanup the gem'
- task :cleanup do
- sh "#{SUDO} #{GEM} cleanup #{PROJ.gem._spec.name}"
- end
-end # namespace :gem
-
-desc 'Alias to gem:package'
-task :gem => 'gem:package'
-
-task :clobber => 'gem:clobber_package'
-remove_desc_for_task 'gem:clobber_package'
-
-# EOF
diff --git a/tasks/git.rake b/tasks/git.rake
deleted file mode 100644
index b219923..0000000
--- a/tasks/git.rake
+++ /dev/null
@@ -1,38 +0,0 @@
-# -*- coding: UTF-8 -*-
-#
-if HAVE_GIT
-
-namespace :git do
-
- # A prerequisites task that all other tasks depend upon
- task :prereqs
-
- desc 'Show tags from the Git repository'
- task :show_tags => 'git:prereqs' do |t|
- puts %x/git tag/
- end
-
- desc 'Create a new tag in the Git repository'
- task :create_tag => 'git:prereqs' do |t|
- v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
- abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
- tag = "%s" % [ PROJ.version ]
- msg = "Creating tag for #{PROJ.name} version #{PROJ.version}"
- puts "Creating Git tag '#{tag}'"
- unless system "git tag -a -m '#{msg}' #{tag}"
- abort "Tag creation failed"
- end
-# if %x/git remote/ =~ %r/^origin\s*$/
-# unless system "git push origin #{tag}"
-# abort "Could not push tag to remote Git repository"
-# end
-# end
- end
-
-end # namespace :git
-
-#task 'gem:release' => 'git:create_tag'
-
-end # if HAVE_GIT
-
-# EOF
diff --git a/tasks/helpers.rb b/tasks/helpers.rb
deleted file mode 100644
index df5bd50..0000000
--- a/tasks/helpers.rb
+++ /dev/null
@@ -1,130 +0,0 @@
-# -*- coding: UTF-8 -*-
-#
-require 'fileutils'
-require 'find'
-require 'date'
-#
-# Reads a file at +path+ and spits out an array of the +paragraphs+
-# specified.
-#
-# changes = paragraphs_of('History.txt', 0..1).join("\n\n")
-# summary, *description = paragraphs_of('README.txt', 3, 3..8)
-#
-def paragraphs_of( path, *paragraphs )
- title = String === paragraphs.first ? paragraphs.shift : nil
- ary = File.read(path).delete("\r").split(/\n\n+/)
-
- result = if title
- tmp, matching = [], false
- rgxp = %r/^=+\s*#{Regexp.escape(title)}/i
- paragraphs << (0..-1) if paragraphs.empty?
-
- ary.each do |val|
- if val =~ rgxp
- break if matching
- matching = true
- rgxp = %r/^=+/i
- elsif matching
- tmp << val
- end
- end
- tmp
- else ary end
-
- result.values_at(*paragraphs)
-end
-
-# Adds the given gem _name_ to the current project's dependency list. An
-# optional gem _version_ can be given. If omitted, the newest gem version
-# will be used.
-#
-def depend_on( name, version = nil )
- spec = Gem::Specification.find_by_name(name)
- version = spec.version.to_s if version.nil? and !spec.nil?
-
- PROJ.gem.dependencies << case version
- when nil; [name]
- when %r/^\d/; [name, ">= #{version}"]
- else [name, version] end
-end
-
-# Adds the given arguments to the include path if they are not already there
-#
-#def ensure_in_path( *args )
-# args.each do |path|
-# path = File.expand_path(path)
-# $:.unshift(path) if test(?d, path) and not $:.include?(path)
-# end
-#end
-
-# Find a rake task using the task name and remove any description text. This
-# will prevent the task from being displayed in the list of available tasks.
-#
-def remove_desc_for_task( names )
- Array(names).each do |task_name|
- task = Rake.application.tasks.find {|t| t.name == task_name}
- next if task.nil?
- task.instance_variable_set :@comment, nil
- end
-end
-
-# Change working directories to _dir_, call the _block_ of code, and then
-# change back to the original working directory (the current directory when
-# this method was called).
-#
-#def in_directory( dir, &block )
-# curdir = pwd
-# begin
-# cd dir
-# return block.call
-# ensure
-# cd curdir
-# end
-#end
-
-# Scans the current working directory and creates a list of files that are
-# candidates to be in the manifest.
-#
-#def manifest
-# files = []
-# exclude = PROJ.exclude.dup
-# comment = %r/^\s*#/
-#
-# # process the ignore file and add the items there to the exclude list
-# if test(?f, PROJ.ignore_file)
-# ary = []
-# File.readlines(PROJ.ignore_file).each do |line|
-# next if line =~ comment
-# line.chomp!
-# line.strip!
-# next if line.nil? or line.empty?
-#
-# glob = line =~ %r/\*\./ ? File.join('**', line) : line
-# Dir.glob(glob).each {|fn| ary << "^#{Regexp.escape(fn)}"}
-# end
-# exclude.concat ary
-# end
-#
-# # generate a regular expression from the exclude list
-# exclude = Regexp.new(exclude.join('|'))
-#
-# Find.find '.' do |path|
-# path.sub! %r/^(\.\/|\/)/o, ''
-# next unless test ?f, path
-# next if path =~ exclude
-# files << path
-# end
-# files.sort!
-#end
-
-# We need a "valid" method that determines if a string is suitable for use
-# in the gem specification.
-#
-class Object
- def valid?
- return !(self.empty? or self == "\000") if self.respond_to?(:to_str)
- return false
- end
-end
-
-# EOF
diff --git a/tasks/notes.rake b/tasks/notes.rake
deleted file mode 100644
index 7f7ee79..0000000
--- a/tasks/notes.rake
+++ /dev/null
@@ -1,27 +0,0 @@
-# -*- coding: UTF-8 -*-
-#
-if HAVE_BONES
-
-desc "Enumerate all annotations"
-task :notes do |t|
- id = if t.application.top_level_tasks.length > 1
- t.application.top_level_tasks.slice!(1..-1).join(' ')
- end
- Bones::AnnotationExtractor.enumerate(PROJ, PROJ.notes.tags.join('|'), id, :tag => true)
-end
-
-namespace :notes do
- PROJ.notes.tags.each do |tag|
- desc "Enumerate all #{tag} annotations"
- task tag.downcase.to_sym do |t|
- id = if t.application.top_level_tasks.length > 1
- t.application.top_level_tasks.slice!(1..-1).join(' ')
- end
- Bones::AnnotationExtractor.enumerate(PROJ, tag, id)
- end
- end
-end
-
-end # if HAVE_BONES
-
-# EOF
diff --git a/tasks/post_load.rake b/tasks/post_load.rake
deleted file mode 100644
index 8ccdfc9..0000000
--- a/tasks/post_load.rake
+++ /dev/null
@@ -1,35 +0,0 @@
-# -*- coding: UTF-8 -*-
-#
-# This file does not define any rake tasks. It is used to load some project
-# settings if they are not defined by the user.
-
-PROJ.exclude << ["^#{Regexp.escape(PROJ.ann.file)}$",
- "^#{Regexp.escape(PROJ.ignore_file)}$",
- "^#{Regexp.escape(PROJ.rdoc.dir)}/",
- "^#{Regexp.escape(PROJ.rcov.dir)}/"]
-
-flatten_arrays = lambda do |this,os|
- os.instance_variable_get(:@table).each do |key,val|
- next if key == :dependencies \
- or key == :development_dependencies
- case val
- when Array; val.flatten!
- when OpenStruct; this.call(this,val)
- end
- end
- end
-flatten_arrays.call(flatten_arrays,PROJ)
-
-PROJ.changes ||= paragraphs_of(PROJ.history_file, 0..1).join("\n\n")
-
-PROJ.description ||= paragraphs_of(PROJ.readme_file, 'description').join("\n\n")
-
-PROJ.summary ||= PROJ.description.split('.').first
-
-PROJ.gem.files ||= manifest
-
-PROJ.gem.executables ||= PROJ.gem.files.find_all {|fn| fn =~ %r/^bin/}
-
-PROJ.rdoc.main ||= PROJ.readme_file
-
-# EOF
diff --git a/tasks/rdoc.rake b/tasks/rdoc.rake
deleted file mode 100644
index 98ef3b8..0000000
--- a/tasks/rdoc.rake
+++ /dev/null
@@ -1,46 +0,0 @@
-# -*- coding: UTF-8 -*-
-#
-require 'rdoc/task'
-
-namespace :doc do
- desc 'Generate RDoc documentation'
- Rake::RDocTask.new do |rd|
- rdoc = PROJ.rdoc
- rd.main = rdoc.main
- rd.rdoc_dir = rdoc.dir
-
- incl = Regexp.new(rdoc.include.join('|'))
- excl = Regexp.new(rdoc.exclude.join('|'))
- files = PROJ.gem.files.find_all do |fn|
- case fn
- when excl; false
- when incl; true
- else false end
- end
- rd.rdoc_files.push(*files)
- title = "#{PROJ.name}-#{PROJ.version} Documentation"
- rf_name = PROJ.rubyforge.name
- title = "#{rf_name}'s " + title if rf_name.valid? and rf_name != title
- rd.options << "-t #{title}"
- rd.options.concat(rdoc.opts)
- end
-
- desc 'Generate ri locally for testing'
- task :ri => :clobber_ri do
- sh "#{RDOC} --ri -o ri ."
- end
-
- task :clobber_ri do
- rm_r 'ri' rescue nil
- end
-end # namespace :doc
-
-desc 'Alias to doc:rdoc'
-task :doc => 'doc:rdoc'
-
-desc 'Remove all build products'
-task :clobber => %w(doc:clobber_rdoc doc:clobber_ri)
-
-remove_desc_for_task %w(doc:clobber_rdoc)
-
-# EOF
diff --git a/tasks/rubyforge.rake b/tasks/rubyforge.rake
deleted file mode 100644
index 73be292..0000000
--- a/tasks/rubyforge.rake
+++ /dev/null
@@ -1,54 +0,0 @@
-# -*- coding: UTF-8 -*-
-#
-if PROJ.rubyforge.name.valid? && HAVE_RUBYFORGE
-
-require 'rubyforge'
-require 'rake/contrib/sshpublisher'
-
-namespace :gem do
- desc 'Package and upload to RubyForge'
- task :release => [:clobber, 'gem'] do |t|
- v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
- abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
- pkg = "pkg/#{PROJ.gem._spec.full_name}"
-
- if $DEBUG then
- puts "release_id = rf.add_release #{PROJ.rubyforge.name.inspect}, #{PROJ.name.inspect}, #{PROJ.version.inspect}, \"#{pkg}.tgz\""
- puts "rf.add_file #{PROJ.rubyforge.name.inspect}, #{PROJ.name.inspect}, release_id, \"#{pkg}.gem\""
- end
-
- rf = RubyForge.new
- rf.configure rescue nil
- puts 'Logging in'
- rf.login
-
- c = rf.userconfig
- c['release_notes'] = PROJ.description if PROJ.description
- c['release_changes'] = PROJ.changes if PROJ.changes
- c['preformatted'] = true
-
- files = Dir.glob("#{pkg}*.*")
-
- puts "Releasing #{PROJ.name} v. #{PROJ.version}"
- rf.add_release PROJ.rubyforge.name, PROJ.name, PROJ.version, *files
- end
-end # namespace :gem
-
-
-namespace :doc do
- desc "Publish RDoc to RubyForge"
- task :release => %w(doc:clobber_rdoc doc:rdoc) do
- config = YAML.load(File.read(File.expand_path('~/.rubyforge/user-config.yml')))
-
- host = "#{config['username']}@rubyforge.org"
- remote_dir = "/var/www/gforge-projects/#{PROJ.rubyforge.name}/"
- remote_dir << PROJ.rdoc.remote_dir if PROJ.rdoc.remote_dir
- local_dir = PROJ.rdoc.dir
-
- Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
- end
-end # namespace :doc
-
-end # if HAVE_RUBYFORGE
-
-# EOF
diff --git a/tasks/setup.rb b/tasks/setup.rb
deleted file mode 100644
index 5e69d02..0000000
--- a/tasks/setup.rb
+++ /dev/null
@@ -1,129 +0,0 @@
-# -*- coding: UTF-8 -*-
-#
-require 'rubygems'
-require 'rake'
-require 'rake/clean'
-require 'ostruct'
-
-class OpenStruct; undef :gem; end
-
-# TODO: make my own openstruct type object that includes descriptions
-# TODO: use the descriptions to output help on the available bones options
-
-PROJ = OpenStruct.new(
- # Project Defaults
- :name => nil,
- :summary => nil,
- :description => nil,
- :changes => nil,
- :authors => nil,
- :email => nil,
- :url => "\000",
- :version => ENV['VERSION'] || '0.0.0',
- :exclude => %w(tmp$ bak$ ~$ CVS \.svn/ \.git/ ^pkg/),
- :release_name => ENV['RELEASE'],
-
- # System Defaults
- :ruby_opts => %w(-w),
- :libs => [],
- :history_file => 'Changelog',
- :readme_file => 'README.rdoc',
- :ignore_file => '.bnsignore',
-
- # Announce
- :ann => OpenStruct.new(
- :file => 'announcement.txt',
- :text => nil,
- :paragraphs => [],
- :email => {
- :from => nil,
- :to => %w(ruby-talk@ruby-lang.org),
- :server => 'localhost',
- :port => 25,
- :domain => ENV['HOSTNAME'],
- :acct => nil,
- :passwd => nil,
- :authtype => :plain,
- :tls => true,
- }
- ),
-
- # Gem Packaging
- :gem => OpenStruct.new(
- :dependencies => [],
- :development_dependencies => [],
- :executables => nil,
- :extensions => FileList['ext/**/extconf.rb'],
- :files => nil,
- :need_tar => true,
- :need_zip => false,
- :extras => {}
- ),
-
- # File Annotations
- :notes => OpenStruct.new(
- :exclude => %w(^tasks/setup\.rb$),
- :extensions => %w(.txt .rb .erb .rdoc) << '',
- :tags => %w(FIXME OPTIMIZE TODO)
- ),
-
- # Rcov
- :rcov => OpenStruct.new(
- :dir => 'coverage',
- :opts => %w[--sort coverage -T -x lib/rcov],
- :threshold => 90.0,
- :threshold_exact => false
- ),
-
- # Rdoc
- :rdoc => OpenStruct.new(
- :opts => [],
- :include => %w(^lib/ ^bin/ ^ext/ \.txt$ \.rdoc$),
- :exclude => %w(extconf\.rb$),
- :main => nil,
- :dir => 'doc',
- :remote_dir => nil
- ),
-
- # Rubyforge
- :rubyforge => OpenStruct.new(
- :name => "\000"
- ),
-
- # Rspec
- :spec => OpenStruct.new(
- :files => FileList['spec/**/*_spec.rb'],
- :opts => []
- ),
-
- # Subversion Repository
- :svn => OpenStruct.new(
- :root => nil,
- :path => '',
- :trunk => 'trunk',
- :tags => 'tags',
- :branches => 'branches'
- ),
-
- # Test::Unit
- :test => OpenStruct.new(
- :files => FileList['test/**/test_*.rb'],
- :file => 'test/all.rb',
- :opts => []
- )
-)
-
-# Load the other rake files in the tasks folder
-tasks_dir = File.expand_path(File.dirname(__FILE__))
-post_load_fn = File.join(tasks_dir, 'post_load.rake')
-rakefiles = Dir.glob(File.join(tasks_dir, '*.rake')).sort
-rakefiles.unshift(rakefiles.delete(post_load_fn)).compact!
-import(*rakefiles)
-
-# Setup the project libraries
-%w(lib ext).each {|dir| PROJ.libs << dir if test ?d, dir}
-
-load './tasks/constants.rb'
-load './tasks/helpers.rb'
-
-# EOF
diff --git a/tasks/spec.rake b/tasks/spec.rake
deleted file mode 100644
index 7345f5c..0000000
--- a/tasks/spec.rake
+++ /dev/null
@@ -1,44 +0,0 @@
-# -*- coding: UTF-8 -*-
-#
-#if HAVE_SPEC_RAKE_SPECTASK and not PROJ.spec.files.to_a.empty?
-require 'rspec/core/rake_task'
-#
-namespace :spec do
-
- desc 'Run all specs with basic output'
- RSpec::Core::RakeTask.new(:run) do |t,args|
- t.ruby_opts = PROJ.ruby_opts
- t.rspec_opts = PROJ.spec.opts
- t.pattern = ENV['pattern'] if ENV['pattern']
- end
-
- desc 'Run all specs with text output'
- RSpec::Core::RakeTask.new(:doc) do |t|
- t.ruby_opts = PROJ.ruby_opts
- t.rspec_opts = PROJ.spec.opts + ['-fs' ]
- t.pattern = ENV['pattern'] if ENV['pattern']
- end
-
- desc 'Run all specs with html output'
- RSpec::Core::RakeTask.new(:html) do |t|
- t.ruby_opts = PROJ.ruby_opts
- t.rspec_opts = PROJ.spec.opts + ['-fh' ]
- t.pattern = ENV['pattern'] if ENV['pattern']
- end
-
- if HAVE_RCOV
- desc 'Run all specs with RCov'
- RSpec::Core::RakeTask.new(:rcov) do |t|
- t.ruby_opts = PROJ.ruby_opts
- t.rspec_opts = PROJ.spec.opts
- t.rcov = true
- t.rcov_opts = PROJ.rcov.opts + ['--exclude', 'spec']
- end
- end
-
-end # namespace :spec
-
-desc 'Alias to spec:run'
-task :spec => 'spec:run'
-
-# EOF
diff --git a/tasks/svn.rake b/tasks/svn.rake
deleted file mode 100644
index b831cbb..0000000
--- a/tasks/svn.rake
+++ /dev/null
@@ -1,48 +0,0 @@
-# -*- coding: UTF-8 -*-
-#
-if HAVE_SVN
-
-unless PROJ.svn.root
- info = %x/svn info ./
- m = %r/^Repository Root:\s+(.*)$/.match(info)
- PROJ.svn.root = (m.nil? ? '' : m[1])
-end
-PROJ.svn.root = File.join(PROJ.svn.root, PROJ.svn.path) unless PROJ.svn.path.empty?
-
-namespace :svn do
-
- # A prerequisites task that all other tasks depend upon
- task :prereqs
-
- desc 'Show tags from the SVN repository'
- task :show_tags => 'svn:prereqs' do |t|
- tags = %x/svn list #{File.join(PROJ.svn.root, PROJ.svn.tags)}/
- tags.gsub!(%r/\/$/, '')
- tags = tags.split("\n").sort {|a,b| b <=> a}
- puts tags
- end
-
- desc 'Create a new tag in the SVN repository'
- task :create_tag => 'svn:prereqs' do |t|
- v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
- abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
-
- svn = PROJ.svn
- trunk = File.join(svn.root, svn.trunk)
- tag = "%s-%s" % [PROJ.name, PROJ.version]
- tag = File.join(svn.root, svn.tags, tag)
- msg = "Creating tag for #{PROJ.name} version #{PROJ.version}"
-
- puts "Creating SVN tag '#{tag}'"
- unless system "svn cp -m '#{msg}' #{trunk} #{tag}"
- abort "Tag creation failed"
- end
- end
-
-end # namespace :svn
-
-task 'gem:release' => 'svn:create_tag'
-
-end # if PROJ.svn.path
-
-# EOF
diff --git a/tasks/test.rake b/tasks/test.rake
deleted file mode 100644
index 8257613..0000000
--- a/tasks/test.rake
+++ /dev/null
@@ -1,41 +0,0 @@
-# -*- coding: UTF-8 -*-
-#
-if test(?e, PROJ.test.file) or not PROJ.test.files.to_a.empty?
-require 'rake/testtask'
-
-namespace :test do
-
- Rake::TestTask.new(:run) do |t|
- t.libs = PROJ.libs
- t.test_files = if test(?f, PROJ.test.file) then [PROJ.test.file]
- else PROJ.test.files end
- t.ruby_opts += PROJ.ruby_opts
- t.ruby_opts += PROJ.test.opts
- end
-
- if HAVE_RCOV
- desc 'Run rcov on the unit tests'
- task :rcov => :clobber_rcov do
- opts = PROJ.rcov.opts.dup << '-o' << PROJ.rcov.dir
- opts = opts.join(' ')
- files = if test(?f, PROJ.test.file) then [PROJ.test.file]
- else PROJ.test.files end
- files = files.join(' ')
- sh "#{RCOV} #{files} #{opts}"
- end
-
- task :clobber_rcov do
- rm_r 'coverage' rescue nil
- end
- end
-
-end # namespace :test
-
-desc 'Alias to test:run'
-task :test => 'test:run'
-
-task :clobber => 'test:clobber_rcov' if HAVE_RCOV
-
-end
-
-# EOF