ffi-efl 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog +2 -0
- data/MIT-LICENSE +18 -0
- data/README.rdoc +56 -0
- data/Rakefile +56 -0
- data/lib/efl/ecore/ecore-ffi.rb +390 -0
- data/lib/efl/ecore/ecore_evas-ffi.rb +378 -0
- data/lib/efl/ecore/ecore_getopt-ffi.rb +68 -0
- data/lib/efl/ecore/ecore_input-ffi.rb +78 -0
- data/lib/efl/ecore.rb +34 -0
- data/lib/efl/ecore_getopt.rb +43 -0
- data/lib/efl/edje/edje-ffi.rb +459 -0
- data/lib/efl/edje.rb +12 -0
- data/lib/efl/eet/eet-ffi.rb +333 -0
- data/lib/efl/eet.rb +58 -0
- data/lib/efl/eina/eina_types-ffi.rb +44 -0
- data/lib/efl/elementary/elementary-ffi.rb +3179 -0
- data/lib/efl/elementary.rb +43 -0
- data/lib/efl/evas/evas-ffi.rb +1294 -0
- data/lib/efl/evas.rb +108 -0
- data/lib/efl/ffi.rb +63 -0
- data/lib/efl.rb +14 -0
- data/spec/ecore_getopt_spec.rb +43 -0
- data/spec/ecore_spec.rb +151 -0
- data/spec/edje_spec.rb +22 -0
- data/spec/eet_spec.rb +107 -0
- data/spec/evas_spec.rb +103 -0
- data/tasks/ann.rake +83 -0
- data/tasks/constants.rb +114 -0
- data/tasks/ffi.rake +22 -0
- data/tasks/gem.rake +197 -0
- data/tasks/git.rake +38 -0
- data/tasks/helpers.rb +130 -0
- data/tasks/notes.rake +27 -0
- data/tasks/post_load.rake +35 -0
- data/tasks/rdoc.rake +46 -0
- data/tasks/rubyforge.rake +54 -0
- data/tasks/setup.rb +129 -0
- data/tasks/spec.rake +44 -0
- data/tasks/svn.rake +48 -0
- data/tasks/test.rake +41 -0
- data/test/test_elm_win.rb +38 -0
- data/test/test_elm_win_class.rb +49 -0
- metadata +124 -0
data/tasks/constants.rb
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
2
|
+
#
|
3
|
+
require 'rbconfig'
|
4
|
+
|
5
|
+
# Setup some constants
|
6
|
+
WIN32 = %r/djgpp|(cyg|ms|bcc)win|mingw/ =~ RUBY_PLATFORM unless defined? WIN32
|
7
|
+
|
8
|
+
DEV_NULL = WIN32 ? 'NUL:' : '/dev/null'
|
9
|
+
|
10
|
+
def quiet( &block )
|
11
|
+
io = [STDOUT.dup, STDERR.dup]
|
12
|
+
STDOUT.reopen DEV_NULL
|
13
|
+
STDERR.reopen DEV_NULL
|
14
|
+
block.call
|
15
|
+
ensure
|
16
|
+
STDOUT.reopen io.first
|
17
|
+
STDERR.reopen io.last
|
18
|
+
$stdout, $stderr = STDOUT, STDERR
|
19
|
+
end
|
20
|
+
|
21
|
+
BUILD_DIR = "build"
|
22
|
+
|
23
|
+
USE_RAKE_COMPILER = ( ( (RUBY_PLATFORM =~ /java/) ? false : true ) and test ?d, 'ext' )
|
24
|
+
if USE_RAKE_COMPILER
|
25
|
+
gem 'rake-compiler', '>=0.6.0'
|
26
|
+
require 'rake/extensiontask'
|
27
|
+
ENV['RUBY_CC_VERSION'] = '1.8.7:1.9.2'
|
28
|
+
end
|
29
|
+
|
30
|
+
LIBEXT = case Config::CONFIG['host_os'].downcase
|
31
|
+
when /darwin/
|
32
|
+
"dylib"
|
33
|
+
when /mswin|mingw/
|
34
|
+
"dll"
|
35
|
+
else
|
36
|
+
Config::CONFIG['DLEXT']
|
37
|
+
end
|
38
|
+
|
39
|
+
CPU = case Config::CONFIG['host_cpu'].downcase
|
40
|
+
when /i[3456]86/
|
41
|
+
# Darwin always reports i686, even when running in 64bit mode
|
42
|
+
if Config::CONFIG['host_os'] =~ /darwin/ && 0xfee1deadbeef.is_a?(Fixnum)
|
43
|
+
"x86_64"
|
44
|
+
else
|
45
|
+
"i386"
|
46
|
+
end
|
47
|
+
when /amd64|x86_64/
|
48
|
+
"x86_64"
|
49
|
+
when /ppc64|powerpc64/
|
50
|
+
"powerpc64"
|
51
|
+
when /ppc|powerpc/
|
52
|
+
"powerpc"
|
53
|
+
else
|
54
|
+
Config::CONFIG['host_cpu']
|
55
|
+
end
|
56
|
+
|
57
|
+
OS = case Config::CONFIG['host_os'].downcase
|
58
|
+
when /linux/
|
59
|
+
"linux"
|
60
|
+
when /darwin/
|
61
|
+
"darwin"
|
62
|
+
when /freebsd/
|
63
|
+
"freebsd"
|
64
|
+
when /openbsd/
|
65
|
+
"openbsd"
|
66
|
+
when /sunos|solaris/
|
67
|
+
"solaris"
|
68
|
+
when /mswin|mingw/
|
69
|
+
"win32"
|
70
|
+
else
|
71
|
+
Config::CONFIG['host_os'].downcase
|
72
|
+
end
|
73
|
+
|
74
|
+
CC=ENV['CC'] || Config::CONFIG['CC'] || "gcc"
|
75
|
+
|
76
|
+
GMAKE = Config::CONFIG['host_os'].downcase =~ /bsd|solaris/ ? "gmake" : "make"
|
77
|
+
|
78
|
+
|
79
|
+
DIFF = if WIN32 then 'diff.exe'
|
80
|
+
else
|
81
|
+
if quiet {system "gdiff", __FILE__, __FILE__} then 'gdiff'
|
82
|
+
else 'diff' end
|
83
|
+
end unless defined? DIFF
|
84
|
+
|
85
|
+
SUDO = if WIN32 then ''
|
86
|
+
else
|
87
|
+
if quiet {system 'which sudo'} then 'sudo'
|
88
|
+
else '' end
|
89
|
+
end
|
90
|
+
|
91
|
+
RCOV = WIN32 ? 'rcov.bat' : 'rcov'
|
92
|
+
RDOC = WIN32 ? 'rdoc.bat' : 'rdoc'
|
93
|
+
GEM = WIN32 ? 'gem.bat' : 'gem'
|
94
|
+
|
95
|
+
%w(rcov spec/rake/spectask rubyforge bones facets/ansicode).each do |lib|
|
96
|
+
begin
|
97
|
+
require lib
|
98
|
+
Object.instance_eval {const_set "HAVE_#{lib.tr('/','_').upcase}", true}
|
99
|
+
rescue LoadError
|
100
|
+
Object.instance_eval {const_set "HAVE_#{lib.tr('/','_').upcase}", false}
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
HAVE_SVN = (Dir.entries(Dir.pwd).include?('.svn') and system("svn --version 2>&1 > #{DEV_NULL}"))
|
105
|
+
HAVE_GIT = (Dir.entries(Dir.pwd).include?('.git') and system("git --version 2>&1 > #{DEV_NULL}"))
|
106
|
+
|
107
|
+
# Add bones as a development dependency
|
108
|
+
#
|
109
|
+
if HAVE_BONES
|
110
|
+
bones_version = defined?(Bones::VERSION) ? Bones::VERSION : Bones.version
|
111
|
+
PROJ.gem.development_dependencies << ['bones', ">= #{bones_version}"]
|
112
|
+
end
|
113
|
+
|
114
|
+
# EOF
|
data/tasks/ffi.rake
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
2
|
+
#
|
3
|
+
namespace :ffi do
|
4
|
+
#
|
5
|
+
desc "extract api out of enlightenment headers, then generate bindings"
|
6
|
+
task :run => [ :api, :ruby ]
|
7
|
+
#
|
8
|
+
desc "extract api out of enlightenment headers"
|
9
|
+
task :api do
|
10
|
+
sh './tools/extract-api.sh'
|
11
|
+
end
|
12
|
+
#
|
13
|
+
desc "generate ffi bindings"
|
14
|
+
task :ruby do
|
15
|
+
sh 'ruby ./tools/genruby.rb'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
#
|
19
|
+
desc 'Alias to ffi:run'
|
20
|
+
task :ffi => 'ffi:run'
|
21
|
+
#
|
22
|
+
# EOF
|
data/tasks/gem.rake
ADDED
@@ -0,0 +1,197 @@
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
2
|
+
#
|
3
|
+
require 'find'
|
4
|
+
require 'rake/packagetask'
|
5
|
+
require 'rubygems/user_interaction'
|
6
|
+
require 'rubygems/builder'
|
7
|
+
|
8
|
+
module Bones
|
9
|
+
class GemPackageTask < Rake::PackageTask
|
10
|
+
# Ruby GEM spec containing the metadata for this package. The
|
11
|
+
# name, version and package_files are automatically determined
|
12
|
+
# from the GEM spec and don't need to be explicitly provided.
|
13
|
+
#
|
14
|
+
attr_accessor :gem_spec
|
15
|
+
|
16
|
+
# Tasks from the Bones gem directory
|
17
|
+
attr_reader :bones_files
|
18
|
+
|
19
|
+
# Create a GEM Package task library. Automatically define the gem
|
20
|
+
# if a block is given. If no block is supplied, then +define+
|
21
|
+
# needs to be called to define the task.
|
22
|
+
#
|
23
|
+
def initialize(gem_spec)
|
24
|
+
init(gem_spec)
|
25
|
+
yield self if block_given?
|
26
|
+
define if block_given?
|
27
|
+
end
|
28
|
+
|
29
|
+
# Initialization tasks without the "yield self" or define
|
30
|
+
# operations.
|
31
|
+
#
|
32
|
+
def init(gem)
|
33
|
+
super(gem.name, gem.version)
|
34
|
+
@gem_spec = gem
|
35
|
+
@package_files += gem_spec.files if gem_spec.files
|
36
|
+
@bones_files = []
|
37
|
+
|
38
|
+
local_setup = File.join(Dir.pwd, %w[tasks setup.rb])
|
39
|
+
if !test(?e, local_setup)
|
40
|
+
Dir.glob(::Bones.path(%w[lib bones tasks *])).each {|fn| bones_files << fn}
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# Create the Rake tasks and actions specified by this
|
45
|
+
# GemPackageTask. (+define+ is automatically called if a block is
|
46
|
+
# given to +new+).
|
47
|
+
#
|
48
|
+
def define
|
49
|
+
super
|
50
|
+
task :prereqs
|
51
|
+
task :package => ['gem:prereqs', "#{package_dir_path}/#{gem_file}"]
|
52
|
+
file "#{package_dir_path}/#{gem_file}" => [package_dir_path] + package_files + bones_files do
|
53
|
+
when_writing("Creating GEM") {
|
54
|
+
chdir(package_dir_path) do
|
55
|
+
Gem::Builder.new(gem_spec).build
|
56
|
+
verbose(true) { mv gem_file, "../#{gem_file}" }
|
57
|
+
end
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
file package_dir_path => bones_files do
|
62
|
+
mkdir_p package_dir rescue nil
|
63
|
+
|
64
|
+
gem_spec.files = (gem_spec.files + bones_files.map {|fn| File.join('tasks', File.basename(fn))}).sort
|
65
|
+
|
66
|
+
bones_files.each do |fn|
|
67
|
+
base_fn = File.join('tasks', File.basename(fn))
|
68
|
+
f = File.join(package_dir_path, base_fn)
|
69
|
+
fdir = File.dirname(f)
|
70
|
+
mkdir_p(fdir) if !File.exist?(fdir)
|
71
|
+
if File.directory?(fn)
|
72
|
+
mkdir_p(f)
|
73
|
+
else
|
74
|
+
raise "file name conflict for '#{base_fn}' (conflicts with '#{fn}')" if test(?e, f)
|
75
|
+
safe_ln(fn, f)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def gem_file
|
82
|
+
if @gem_spec.platform == Gem::Platform::RUBY
|
83
|
+
"#{package_name}.gem"
|
84
|
+
else
|
85
|
+
"#{package_name}-#{@gem_spec.platform}.gem"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end # class GemPackageTask
|
89
|
+
end # module Bones
|
90
|
+
|
91
|
+
namespace :gem do
|
92
|
+
|
93
|
+
PROJ.gem._spec = Gem::Specification.new do |s|
|
94
|
+
s.name = PROJ.name
|
95
|
+
s.version = PROJ.version
|
96
|
+
s.summary = PROJ.summary
|
97
|
+
s.authors = Array(PROJ.authors)
|
98
|
+
s.email = PROJ.email
|
99
|
+
s.homepage = Array(PROJ.url).first
|
100
|
+
s.rubyforge_project = PROJ.rubyforge.name
|
101
|
+
|
102
|
+
s.description = PROJ.description
|
103
|
+
|
104
|
+
PROJ.gem.dependencies.each do |dep|
|
105
|
+
s.add_dependency(*dep)
|
106
|
+
end
|
107
|
+
|
108
|
+
PROJ.gem.development_dependencies.each do |dep|
|
109
|
+
s.add_development_dependency(*dep)
|
110
|
+
end
|
111
|
+
|
112
|
+
s.files = PROJ.gem.files
|
113
|
+
s.executables = PROJ.gem.executables.map {|fn| File.basename(fn)}
|
114
|
+
s.extensions = PROJ.gem.files.grep %r/extconf\.rb$/
|
115
|
+
|
116
|
+
s.bindir = 'bin'
|
117
|
+
dirs = Dir["{#{PROJ.libs.join(',')}}"]
|
118
|
+
s.require_paths = dirs unless dirs.empty?
|
119
|
+
|
120
|
+
incl = Regexp.new(PROJ.rdoc.include.join('|'))
|
121
|
+
excl = PROJ.rdoc.exclude.dup.concat %w[\.rb$ ^(\.\/|\/)?ext]
|
122
|
+
excl = Regexp.new(excl.join('|'))
|
123
|
+
rdoc_files = PROJ.gem.files.find_all do |fn|
|
124
|
+
case fn
|
125
|
+
when excl; false
|
126
|
+
when incl; true
|
127
|
+
else false end
|
128
|
+
end
|
129
|
+
s.rdoc_options = PROJ.rdoc.opts + ['--main', PROJ.rdoc.main]
|
130
|
+
s.extra_rdoc_files = rdoc_files
|
131
|
+
s.has_rdoc = true
|
132
|
+
|
133
|
+
if test ?f, PROJ.test.file
|
134
|
+
s.test_file = PROJ.test.file
|
135
|
+
else
|
136
|
+
s.test_files = PROJ.test.files.to_a
|
137
|
+
end
|
138
|
+
|
139
|
+
# Do any extra stuff the user wants
|
140
|
+
PROJ.gem.extras.each do |msg, val|
|
141
|
+
case val
|
142
|
+
when Proc
|
143
|
+
val.call(s.send(msg))
|
144
|
+
else
|
145
|
+
s.send "#{msg}=", val
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end # Gem::Specification.new
|
149
|
+
|
150
|
+
Bones::GemPackageTask.new(PROJ.gem._spec) do |pkg|
|
151
|
+
pkg.need_tar = PROJ.gem.need_tar
|
152
|
+
pkg.need_zip = PROJ.gem.need_zip
|
153
|
+
end
|
154
|
+
|
155
|
+
desc 'Show information about the gem'
|
156
|
+
task :debug => 'gem:prereqs' do
|
157
|
+
puts PROJ.gem._spec.to_ruby
|
158
|
+
end
|
159
|
+
|
160
|
+
desc 'Write the gemspec '
|
161
|
+
task :spec => 'gem:prereqs' do
|
162
|
+
File.open("#{PROJ.name}.gemspec", 'w') do |f|
|
163
|
+
f.write PROJ.gem._spec.to_ruby
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
desc 'Install the gem'
|
168
|
+
task :install => [:clobber, 'gem:package'] do
|
169
|
+
sh "#{SUDO} #{GEM} install --local pkg/#{PROJ.gem._spec.full_name}"
|
170
|
+
# use this version of the command for rubygems > 1.0.0
|
171
|
+
#sh "#{SUDO} #{GEM} install --no-update-sources pkg/#{PROJ.gem._spec.full_name}"
|
172
|
+
end
|
173
|
+
|
174
|
+
desc 'Uninstall the gem'
|
175
|
+
task :uninstall do
|
176
|
+
installed_list = Gem.source_index.find_name(PROJ.name)
|
177
|
+
if installed_list and installed_list.collect { |s| s.version.to_s}.include?(PROJ.version) then
|
178
|
+
sh "#{SUDO} #{GEM} uninstall --version '#{PROJ.version}' --ignore-dependencies --executables #{PROJ.name}"
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
desc 'Reinstall the gem'
|
183
|
+
task :reinstall => [:uninstall, :install]
|
184
|
+
|
185
|
+
desc 'Cleanup the gem'
|
186
|
+
task :cleanup do
|
187
|
+
sh "#{SUDO} #{GEM} cleanup #{PROJ.gem._spec.name}"
|
188
|
+
end
|
189
|
+
end # namespace :gem
|
190
|
+
|
191
|
+
desc 'Alias to gem:package'
|
192
|
+
task :gem => 'gem:package'
|
193
|
+
|
194
|
+
task :clobber => 'gem:clobber_package'
|
195
|
+
remove_desc_for_task 'gem:clobber_package'
|
196
|
+
|
197
|
+
# EOF
|
data/tasks/git.rake
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
2
|
+
#
|
3
|
+
if HAVE_GIT
|
4
|
+
|
5
|
+
namespace :git do
|
6
|
+
|
7
|
+
# A prerequisites task that all other tasks depend upon
|
8
|
+
task :prereqs
|
9
|
+
|
10
|
+
desc 'Show tags from the Git repository'
|
11
|
+
task :show_tags => 'git:prereqs' do |t|
|
12
|
+
puts %x/git tag/
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'Create a new tag in the Git repository'
|
16
|
+
task :create_tag => 'git:prereqs' do |t|
|
17
|
+
v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
|
18
|
+
abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
|
19
|
+
tag = "%s" % [ PROJ.version ]
|
20
|
+
msg = "Creating tag for #{PROJ.name} version #{PROJ.version}"
|
21
|
+
puts "Creating Git tag '#{tag}'"
|
22
|
+
unless system "git tag -a -m '#{msg}' #{tag}"
|
23
|
+
abort "Tag creation failed"
|
24
|
+
end
|
25
|
+
# if %x/git remote/ =~ %r/^origin\s*$/
|
26
|
+
# unless system "git push origin #{tag}"
|
27
|
+
# abort "Could not push tag to remote Git repository"
|
28
|
+
# end
|
29
|
+
# end
|
30
|
+
end
|
31
|
+
|
32
|
+
end # namespace :git
|
33
|
+
|
34
|
+
#task 'gem:release' => 'git:create_tag'
|
35
|
+
|
36
|
+
end # if HAVE_GIT
|
37
|
+
|
38
|
+
# EOF
|
data/tasks/helpers.rb
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
2
|
+
#
|
3
|
+
require 'fileutils'
|
4
|
+
require 'find'
|
5
|
+
require 'date'
|
6
|
+
#
|
7
|
+
# Reads a file at +path+ and spits out an array of the +paragraphs+
|
8
|
+
# specified.
|
9
|
+
#
|
10
|
+
# changes = paragraphs_of('History.txt', 0..1).join("\n\n")
|
11
|
+
# summary, *description = paragraphs_of('README.txt', 3, 3..8)
|
12
|
+
#
|
13
|
+
def paragraphs_of( path, *paragraphs )
|
14
|
+
title = String === paragraphs.first ? paragraphs.shift : nil
|
15
|
+
ary = File.read(path).delete("\r").split(/\n\n+/)
|
16
|
+
|
17
|
+
result = if title
|
18
|
+
tmp, matching = [], false
|
19
|
+
rgxp = %r/^=+\s*#{Regexp.escape(title)}/i
|
20
|
+
paragraphs << (0..-1) if paragraphs.empty?
|
21
|
+
|
22
|
+
ary.each do |val|
|
23
|
+
if val =~ rgxp
|
24
|
+
break if matching
|
25
|
+
matching = true
|
26
|
+
rgxp = %r/^=+/i
|
27
|
+
elsif matching
|
28
|
+
tmp << val
|
29
|
+
end
|
30
|
+
end
|
31
|
+
tmp
|
32
|
+
else ary end
|
33
|
+
|
34
|
+
result.values_at(*paragraphs)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Adds the given gem _name_ to the current project's dependency list. An
|
38
|
+
# optional gem _version_ can be given. If omitted, the newest gem version
|
39
|
+
# will be used.
|
40
|
+
#
|
41
|
+
def depend_on( name, version = nil )
|
42
|
+
spec = Gem.source_index.find_name(name).last
|
43
|
+
version = spec.version.to_s if version.nil? and !spec.nil?
|
44
|
+
|
45
|
+
PROJ.gem.dependencies << case version
|
46
|
+
when nil; [name]
|
47
|
+
when %r/^\d/; [name, ">= #{version}"]
|
48
|
+
else [name, version] end
|
49
|
+
end
|
50
|
+
|
51
|
+
# Adds the given arguments to the include path if they are not already there
|
52
|
+
#
|
53
|
+
#def ensure_in_path( *args )
|
54
|
+
# args.each do |path|
|
55
|
+
# path = File.expand_path(path)
|
56
|
+
# $:.unshift(path) if test(?d, path) and not $:.include?(path)
|
57
|
+
# end
|
58
|
+
#end
|
59
|
+
|
60
|
+
# Find a rake task using the task name and remove any description text. This
|
61
|
+
# will prevent the task from being displayed in the list of available tasks.
|
62
|
+
#
|
63
|
+
def remove_desc_for_task( names )
|
64
|
+
Array(names).each do |task_name|
|
65
|
+
task = Rake.application.tasks.find {|t| t.name == task_name}
|
66
|
+
next if task.nil?
|
67
|
+
task.instance_variable_set :@comment, nil
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# Change working directories to _dir_, call the _block_ of code, and then
|
72
|
+
# change back to the original working directory (the current directory when
|
73
|
+
# this method was called).
|
74
|
+
#
|
75
|
+
#def in_directory( dir, &block )
|
76
|
+
# curdir = pwd
|
77
|
+
# begin
|
78
|
+
# cd dir
|
79
|
+
# return block.call
|
80
|
+
# ensure
|
81
|
+
# cd curdir
|
82
|
+
# end
|
83
|
+
#end
|
84
|
+
|
85
|
+
# Scans the current working directory and creates a list of files that are
|
86
|
+
# candidates to be in the manifest.
|
87
|
+
#
|
88
|
+
#def manifest
|
89
|
+
# files = []
|
90
|
+
# exclude = PROJ.exclude.dup
|
91
|
+
# comment = %r/^\s*#/
|
92
|
+
#
|
93
|
+
# # process the ignore file and add the items there to the exclude list
|
94
|
+
# if test(?f, PROJ.ignore_file)
|
95
|
+
# ary = []
|
96
|
+
# File.readlines(PROJ.ignore_file).each do |line|
|
97
|
+
# next if line =~ comment
|
98
|
+
# line.chomp!
|
99
|
+
# line.strip!
|
100
|
+
# next if line.nil? or line.empty?
|
101
|
+
#
|
102
|
+
# glob = line =~ %r/\*\./ ? File.join('**', line) : line
|
103
|
+
# Dir.glob(glob).each {|fn| ary << "^#{Regexp.escape(fn)}"}
|
104
|
+
# end
|
105
|
+
# exclude.concat ary
|
106
|
+
# end
|
107
|
+
#
|
108
|
+
# # generate a regular expression from the exclude list
|
109
|
+
# exclude = Regexp.new(exclude.join('|'))
|
110
|
+
#
|
111
|
+
# Find.find '.' do |path|
|
112
|
+
# path.sub! %r/^(\.\/|\/)/o, ''
|
113
|
+
# next unless test ?f, path
|
114
|
+
# next if path =~ exclude
|
115
|
+
# files << path
|
116
|
+
# end
|
117
|
+
# files.sort!
|
118
|
+
#end
|
119
|
+
|
120
|
+
# We need a "valid" method that determines if a string is suitable for use
|
121
|
+
# in the gem specification.
|
122
|
+
#
|
123
|
+
class Object
|
124
|
+
def valid?
|
125
|
+
return !(self.empty? or self == "\000") if self.respond_to?(:to_str)
|
126
|
+
return false
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
# EOF
|
data/tasks/notes.rake
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
2
|
+
#
|
3
|
+
if HAVE_BONES
|
4
|
+
|
5
|
+
desc "Enumerate all annotations"
|
6
|
+
task :notes do |t|
|
7
|
+
id = if t.application.top_level_tasks.length > 1
|
8
|
+
t.application.top_level_tasks.slice!(1..-1).join(' ')
|
9
|
+
end
|
10
|
+
Bones::AnnotationExtractor.enumerate(PROJ, PROJ.notes.tags.join('|'), id, :tag => true)
|
11
|
+
end
|
12
|
+
|
13
|
+
namespace :notes do
|
14
|
+
PROJ.notes.tags.each do |tag|
|
15
|
+
desc "Enumerate all #{tag} annotations"
|
16
|
+
task tag.downcase.to_sym do |t|
|
17
|
+
id = if t.application.top_level_tasks.length > 1
|
18
|
+
t.application.top_level_tasks.slice!(1..-1).join(' ')
|
19
|
+
end
|
20
|
+
Bones::AnnotationExtractor.enumerate(PROJ, tag, id)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end # if HAVE_BONES
|
26
|
+
|
27
|
+
# EOF
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
2
|
+
#
|
3
|
+
# This file does not define any rake tasks. It is used to load some project
|
4
|
+
# settings if they are not defined by the user.
|
5
|
+
|
6
|
+
PROJ.exclude << ["^#{Regexp.escape(PROJ.ann.file)}$",
|
7
|
+
"^#{Regexp.escape(PROJ.ignore_file)}$",
|
8
|
+
"^#{Regexp.escape(PROJ.rdoc.dir)}/",
|
9
|
+
"^#{Regexp.escape(PROJ.rcov.dir)}/"]
|
10
|
+
|
11
|
+
flatten_arrays = lambda do |this,os|
|
12
|
+
os.instance_variable_get(:@table).each do |key,val|
|
13
|
+
next if key == :dependencies \
|
14
|
+
or key == :development_dependencies
|
15
|
+
case val
|
16
|
+
when Array; val.flatten!
|
17
|
+
when OpenStruct; this.call(this,val)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
flatten_arrays.call(flatten_arrays,PROJ)
|
22
|
+
|
23
|
+
PROJ.changes ||= paragraphs_of(PROJ.history_file, 0..1).join("\n\n")
|
24
|
+
|
25
|
+
PROJ.description ||= paragraphs_of(PROJ.readme_file, 'description').join("\n\n")
|
26
|
+
|
27
|
+
PROJ.summary ||= PROJ.description.split('.').first
|
28
|
+
|
29
|
+
PROJ.gem.files ||= manifest
|
30
|
+
|
31
|
+
PROJ.gem.executables ||= PROJ.gem.files.find_all {|fn| fn =~ %r/^bin/}
|
32
|
+
|
33
|
+
PROJ.rdoc.main ||= PROJ.readme_file
|
34
|
+
|
35
|
+
# EOF
|
data/tasks/rdoc.rake
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
2
|
+
#
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
|
5
|
+
namespace :doc do
|
6
|
+
desc 'Generate RDoc documentation'
|
7
|
+
Rake::RDocTask.new do |rd|
|
8
|
+
rdoc = PROJ.rdoc
|
9
|
+
rd.main = rdoc.main
|
10
|
+
rd.rdoc_dir = rdoc.dir
|
11
|
+
|
12
|
+
incl = Regexp.new(rdoc.include.join('|'))
|
13
|
+
excl = Regexp.new(rdoc.exclude.join('|'))
|
14
|
+
files = PROJ.gem.files.find_all do |fn|
|
15
|
+
case fn
|
16
|
+
when excl; false
|
17
|
+
when incl; true
|
18
|
+
else false end
|
19
|
+
end
|
20
|
+
rd.rdoc_files.push(*files)
|
21
|
+
title = "#{PROJ.name}-#{PROJ.version} Documentation"
|
22
|
+
rf_name = PROJ.rubyforge.name
|
23
|
+
title = "#{rf_name}'s " + title if rf_name.valid? and rf_name != title
|
24
|
+
rd.options << "-t #{title}"
|
25
|
+
rd.options.concat(rdoc.opts)
|
26
|
+
end
|
27
|
+
|
28
|
+
desc 'Generate ri locally for testing'
|
29
|
+
task :ri => :clobber_ri do
|
30
|
+
sh "#{RDOC} --ri -o ri ."
|
31
|
+
end
|
32
|
+
|
33
|
+
task :clobber_ri do
|
34
|
+
rm_r 'ri' rescue nil
|
35
|
+
end
|
36
|
+
end # namespace :doc
|
37
|
+
|
38
|
+
desc 'Alias to doc:rdoc'
|
39
|
+
task :doc => 'doc:rdoc'
|
40
|
+
|
41
|
+
desc 'Remove all build products'
|
42
|
+
task :clobber => %w(doc:clobber_rdoc doc:clobber_ri)
|
43
|
+
|
44
|
+
remove_desc_for_task %w(doc:clobber_rdoc)
|
45
|
+
|
46
|
+
# EOF
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
2
|
+
#
|
3
|
+
if PROJ.rubyforge.name.valid? && HAVE_RUBYFORGE
|
4
|
+
|
5
|
+
require 'rubyforge'
|
6
|
+
require 'rake/contrib/sshpublisher'
|
7
|
+
|
8
|
+
namespace :gem do
|
9
|
+
desc 'Package and upload to RubyForge'
|
10
|
+
task :release => [:clobber, 'gem'] do |t|
|
11
|
+
v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
|
12
|
+
abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
|
13
|
+
pkg = "pkg/#{PROJ.gem._spec.full_name}"
|
14
|
+
|
15
|
+
if $DEBUG then
|
16
|
+
puts "release_id = rf.add_release #{PROJ.rubyforge.name.inspect}, #{PROJ.name.inspect}, #{PROJ.version.inspect}, \"#{pkg}.tgz\""
|
17
|
+
puts "rf.add_file #{PROJ.rubyforge.name.inspect}, #{PROJ.name.inspect}, release_id, \"#{pkg}.gem\""
|
18
|
+
end
|
19
|
+
|
20
|
+
rf = RubyForge.new
|
21
|
+
rf.configure rescue nil
|
22
|
+
puts 'Logging in'
|
23
|
+
rf.login
|
24
|
+
|
25
|
+
c = rf.userconfig
|
26
|
+
c['release_notes'] = PROJ.description if PROJ.description
|
27
|
+
c['release_changes'] = PROJ.changes if PROJ.changes
|
28
|
+
c['preformatted'] = true
|
29
|
+
|
30
|
+
files = Dir.glob("#{pkg}*.*")
|
31
|
+
|
32
|
+
puts "Releasing #{PROJ.name} v. #{PROJ.version}"
|
33
|
+
rf.add_release PROJ.rubyforge.name, PROJ.name, PROJ.version, *files
|
34
|
+
end
|
35
|
+
end # namespace :gem
|
36
|
+
|
37
|
+
|
38
|
+
namespace :doc do
|
39
|
+
desc "Publish RDoc to RubyForge"
|
40
|
+
task :release => %w(doc:clobber_rdoc doc:rdoc) do
|
41
|
+
config = YAML.load(File.read(File.expand_path('~/.rubyforge/user-config.yml')))
|
42
|
+
|
43
|
+
host = "#{config['username']}@rubyforge.org"
|
44
|
+
remote_dir = "/var/www/gforge-projects/#{PROJ.rubyforge.name}/"
|
45
|
+
remote_dir << PROJ.rdoc.remote_dir if PROJ.rdoc.remote_dir
|
46
|
+
local_dir = PROJ.rdoc.dir
|
47
|
+
|
48
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
49
|
+
end
|
50
|
+
end # namespace :doc
|
51
|
+
|
52
|
+
end # if HAVE_RUBYFORGE
|
53
|
+
|
54
|
+
# EOF
|