rake-builder 0.0.17 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- data/examples/01_hello_world_cpp/vendor/bundle/gems/json-1.7.6/Rakefile +412 -0
- data/examples/01_hello_world_cpp/vendor/bundle/gems/json-1.7.6/ext/json/ext/fbuffer/fbuffer.h +185 -0
- data/examples/01_hello_world_cpp/vendor/bundle/gems/json-1.7.6/ext/json/ext/generator/generator.c +1427 -0
- data/examples/01_hello_world_cpp/vendor/bundle/gems/json-1.7.6/ext/json/ext/generator/generator.h +149 -0
- data/examples/01_hello_world_cpp/vendor/bundle/gems/json-1.7.6/ext/json/ext/parser/parser.c +2204 -0
- data/examples/01_hello_world_cpp/vendor/bundle/gems/json-1.7.6/ext/json/ext/parser/parser.h +77 -0
- data/examples/01_hello_world_cpp/vendor/bundle/gems/rake-10.0.3/Rakefile +374 -0
- data/examples/01_hello_world_cpp/vendor/bundle/gems/rake-10.0.3/doc/example/a.c +6 -0
- data/examples/01_hello_world_cpp/vendor/bundle/gems/rake-10.0.3/doc/example/b.c +6 -0
- data/examples/01_hello_world_cpp/vendor/bundle/gems/rake-10.0.3/doc/example/main.c +11 -0
- data/lib/rake/builder.rb +39 -70
- data/lib/rake/builder/presenters/makefile_am/builder_collection_presenter.rb +46 -0
- data/lib/rake/builder/presenters/makefile_am/builder_presenter.rb +40 -0
- data/lib/rake/builder/version.rb +1 -1
- data/spec/autoconf_spec.rb +1 -22
- data/spec/project_spec.rb +20 -0
- data/spec/unit/rake/builder/presenters/makefile_am/builder_collection_presenter_spec.rb +55 -0
- data/spec/unit/rake/builder/presenters/makefile_am/builder_presenter_spec.rb +71 -0
- data/spec/unit/rake/builder_spec.rb +46 -0
- metadata +24 -4
@@ -0,0 +1,77 @@
|
|
1
|
+
#ifndef _PARSER_H_
|
2
|
+
#define _PARSER_H_
|
3
|
+
|
4
|
+
#include "ruby.h"
|
5
|
+
|
6
|
+
#ifndef HAVE_RUBY_RE_H
|
7
|
+
#include "re.h"
|
8
|
+
#endif
|
9
|
+
|
10
|
+
#ifdef HAVE_RUBY_ST_H
|
11
|
+
#include "ruby/st.h"
|
12
|
+
#else
|
13
|
+
#include "st.h"
|
14
|
+
#endif
|
15
|
+
|
16
|
+
#define option_given_p(opts, key) RTEST(rb_funcall(opts, i_key_p, 1, key))
|
17
|
+
|
18
|
+
/* unicode */
|
19
|
+
|
20
|
+
typedef unsigned long UTF32; /* at least 32 bits */
|
21
|
+
typedef unsigned short UTF16; /* at least 16 bits */
|
22
|
+
typedef unsigned char UTF8; /* typically 8 bits */
|
23
|
+
|
24
|
+
#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
|
25
|
+
#define UNI_SUR_HIGH_START (UTF32)0xD800
|
26
|
+
#define UNI_SUR_HIGH_END (UTF32)0xDBFF
|
27
|
+
#define UNI_SUR_LOW_START (UTF32)0xDC00
|
28
|
+
#define UNI_SUR_LOW_END (UTF32)0xDFFF
|
29
|
+
|
30
|
+
typedef struct JSON_ParserStruct {
|
31
|
+
VALUE Vsource;
|
32
|
+
char *source;
|
33
|
+
long len;
|
34
|
+
char *memo;
|
35
|
+
VALUE create_id;
|
36
|
+
int max_nesting;
|
37
|
+
int current_nesting;
|
38
|
+
int allow_nan;
|
39
|
+
int parsing_name;
|
40
|
+
int symbolize_names;
|
41
|
+
int quirks_mode;
|
42
|
+
VALUE object_class;
|
43
|
+
VALUE array_class;
|
44
|
+
int create_additions;
|
45
|
+
VALUE match_string;
|
46
|
+
FBuffer *fbuffer;
|
47
|
+
} JSON_Parser;
|
48
|
+
|
49
|
+
#define GET_PARSER \
|
50
|
+
GET_PARSER_INIT; \
|
51
|
+
if (!json->Vsource) rb_raise(rb_eTypeError, "uninitialized instance")
|
52
|
+
#define GET_PARSER_INIT \
|
53
|
+
JSON_Parser *json; \
|
54
|
+
Data_Get_Struct(self, JSON_Parser, json)
|
55
|
+
|
56
|
+
#define MinusInfinity "-Infinity"
|
57
|
+
#define EVIL 0x666
|
58
|
+
|
59
|
+
static UTF32 unescape_unicode(const unsigned char *p);
|
60
|
+
static int convert_UTF32_to_UTF8(char *buf, UTF32 ch);
|
61
|
+
static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *result);
|
62
|
+
static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result);
|
63
|
+
static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *result);
|
64
|
+
static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *result);
|
65
|
+
static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result);
|
66
|
+
static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd);
|
67
|
+
static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *result);
|
68
|
+
static VALUE convert_encoding(VALUE source);
|
69
|
+
static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self);
|
70
|
+
static VALUE cParser_parse(VALUE self);
|
71
|
+
static JSON_Parser *JSON_allocate();
|
72
|
+
static void JSON_mark(JSON_Parser *json);
|
73
|
+
static void JSON_free(JSON_Parser *json);
|
74
|
+
static VALUE cJSON_parser_s_allocate(VALUE klass);
|
75
|
+
static VALUE cParser_source(VALUE self);
|
76
|
+
|
77
|
+
#endif
|
@@ -0,0 +1,374 @@
|
|
1
|
+
# Rakefile for rake -*- ruby -*-
|
2
|
+
|
3
|
+
# Copyright 2003, 2004, 2005 by Jim Weirich (jim@weirichhouse.org)
|
4
|
+
# All rights reserved.
|
5
|
+
|
6
|
+
# This file may be distributed under an MIT style license. See
|
7
|
+
# MIT-LICENSE for details.
|
8
|
+
|
9
|
+
require 'rbconfig'
|
10
|
+
require 'rubygems'
|
11
|
+
|
12
|
+
system_rake = File.join RbConfig::CONFIG['rubylibdir'], 'rake.rb'
|
13
|
+
|
14
|
+
# Use our rake, not the installed rake from system
|
15
|
+
if $".include? system_rake or $".grep(/rake\/name_space\.rb$/).empty? then
|
16
|
+
exec Gem.ruby, '-Ilib', 'bin/rake', *ARGV
|
17
|
+
end
|
18
|
+
|
19
|
+
require 'rubygems/package_task'
|
20
|
+
|
21
|
+
require 'rake/clean'
|
22
|
+
require 'rake/testtask'
|
23
|
+
|
24
|
+
begin
|
25
|
+
gem 'rdoc'
|
26
|
+
require 'rdoc/task'
|
27
|
+
rescue Gem::LoadError
|
28
|
+
end
|
29
|
+
|
30
|
+
CLEAN.include('**/*.o', '*.dot', '**/*.rbc')
|
31
|
+
CLOBBER.include('doc/example/main')
|
32
|
+
CLOBBER.include('TAGS')
|
33
|
+
CLOBBER.include('coverage', 'rcov_aggregate')
|
34
|
+
|
35
|
+
# Prevent OS X from including extended attribute junk in the tar output
|
36
|
+
ENV['COPY_EXTENDED_ATTRIBUTES_DISABLE'] = 'true'
|
37
|
+
|
38
|
+
def announce(msg='')
|
39
|
+
STDERR.puts msg
|
40
|
+
end
|
41
|
+
|
42
|
+
# Determine the current version of the software
|
43
|
+
|
44
|
+
if `ruby -Ilib ./bin/rake --version` =~ /rake, version ([0-9a-z.]+)$/
|
45
|
+
CURRENT_VERSION = $1
|
46
|
+
else
|
47
|
+
CURRENT_VERSION = "0.0.0"
|
48
|
+
end
|
49
|
+
|
50
|
+
$package_version = CURRENT_VERSION
|
51
|
+
|
52
|
+
SRC_RB = FileList['lib/**/*.rb']
|
53
|
+
|
54
|
+
# The default task is run if rake is given no explicit arguments.
|
55
|
+
|
56
|
+
desc "Default Task"
|
57
|
+
task :default => :test
|
58
|
+
|
59
|
+
# Test Tasks ---------------------------------------------------------
|
60
|
+
|
61
|
+
Rake::TestTask.new do |t|
|
62
|
+
files = FileList['test/helper.rb', 'test/test_*.rb']
|
63
|
+
t.loader = :rake
|
64
|
+
t.test_files = files
|
65
|
+
t.libs << "."
|
66
|
+
t.warning = true
|
67
|
+
end
|
68
|
+
|
69
|
+
begin
|
70
|
+
require 'rcov/rcovtask'
|
71
|
+
IGNORE_COVERAGE_IN = FileList[
|
72
|
+
'lib/rake/rdoctask.rb',
|
73
|
+
'lib/rake/testtask.rb',
|
74
|
+
'lib/rake/packagetask.rb',
|
75
|
+
'lib/rake/clean.rb',
|
76
|
+
]
|
77
|
+
|
78
|
+
unless File::ALT_SEPARATOR
|
79
|
+
IGNORE_COVERAGE_IN.include(
|
80
|
+
'lib/rake/alt_system.rb',
|
81
|
+
'lib/rake/win32.rb')
|
82
|
+
end
|
83
|
+
|
84
|
+
Rcov::RcovTask.new do |t|
|
85
|
+
t.libs << "test"
|
86
|
+
t.rcov_opts = [
|
87
|
+
'-xRakefile', '-xrakefile', '-xpublish.rf',
|
88
|
+
'-xlib/rake/contrib', '-x/Library', '-x.rvm',
|
89
|
+
'--text-report',
|
90
|
+
'--sort coverage'
|
91
|
+
] + FileList['rakelib/*.rake'].pathmap("-x%p") +
|
92
|
+
IGNORE_COVERAGE_IN.map { |fn| "-x#{fn}" }
|
93
|
+
t.test_files = FileList[
|
94
|
+
'test/lib/*_test.rb',
|
95
|
+
'test/contrib/*_test.rb',
|
96
|
+
'test/functional/*_test.rb'
|
97
|
+
]
|
98
|
+
t.output_dir = 'coverage'
|
99
|
+
t.verbose = true
|
100
|
+
end
|
101
|
+
rescue LoadError
|
102
|
+
task :rcov do
|
103
|
+
puts "RCov is not available"
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
# CVS Tasks ----------------------------------------------------------
|
108
|
+
|
109
|
+
# Install rake using the standard install.rb script.
|
110
|
+
|
111
|
+
desc "Install the application"
|
112
|
+
task :install do
|
113
|
+
ruby "install.rb"
|
114
|
+
end
|
115
|
+
|
116
|
+
# Create a task to build the RDOC documentation tree.
|
117
|
+
|
118
|
+
BASE_RDOC_OPTIONS = [
|
119
|
+
'--line-numbers', '--show-hash',
|
120
|
+
'--main', 'README.rdoc',
|
121
|
+
'--title', 'Rake -- Ruby Make'
|
122
|
+
]
|
123
|
+
|
124
|
+
if defined?(RDoc::Task) then
|
125
|
+
RDoc::Task.new do |rdoc|
|
126
|
+
rdoc.rdoc_dir = 'html'
|
127
|
+
rdoc.title = "Rake -- Ruby Make"
|
128
|
+
rdoc.options = BASE_RDOC_OPTIONS.dup
|
129
|
+
|
130
|
+
rdoc.rdoc_files.include('README.rdoc', 'MIT-LICENSE', 'TODO', 'CHANGES')
|
131
|
+
rdoc.rdoc_files.include('lib/**/*.rb', 'doc/**/*.rdoc')
|
132
|
+
rdoc.rdoc_files.exclude(/\bcontrib\b/)
|
133
|
+
end
|
134
|
+
else
|
135
|
+
warn "RDoc 2.4.2+ is required to build documentation"
|
136
|
+
end
|
137
|
+
|
138
|
+
# ====================================================================
|
139
|
+
# Create a task that will package the Rake software into distributable
|
140
|
+
# tar, zip and gem files.
|
141
|
+
|
142
|
+
PKG_FILES = FileList[
|
143
|
+
'.gemtest',
|
144
|
+
'install.rb',
|
145
|
+
'CHANGES',
|
146
|
+
'MIT-LICENSE',
|
147
|
+
'README.rdoc',
|
148
|
+
'Rakefile',
|
149
|
+
'TODO',
|
150
|
+
'bin/rake',
|
151
|
+
'lib/**/*.rb',
|
152
|
+
'test/**/*.rb',
|
153
|
+
'doc/**/*'
|
154
|
+
]
|
155
|
+
PKG_FILES.exclude('doc/example/*.o')
|
156
|
+
PKG_FILES.exclude('TAGS')
|
157
|
+
PKG_FILES.exclude(%r{doc/example/main$})
|
158
|
+
|
159
|
+
if ! defined?(Gem)
|
160
|
+
puts "Package Target requires RubyGems"
|
161
|
+
else
|
162
|
+
SPEC = Gem::Specification.new do |s|
|
163
|
+
s.name = 'rake'
|
164
|
+
s.version = $package_version
|
165
|
+
s.summary = "Ruby based make-like utility."
|
166
|
+
s.description = <<-EOF.delete "\n"
|
167
|
+
Rake is a Make-like program implemented in Ruby. Tasks and dependencies are
|
168
|
+
specified in standard Ruby syntax.
|
169
|
+
EOF
|
170
|
+
|
171
|
+
s.required_ruby_version = '>= 1.8.6'
|
172
|
+
s.required_rubygems_version = '>= 1.3.2'
|
173
|
+
s.add_development_dependency 'minitest', '~> 2.1'
|
174
|
+
|
175
|
+
s.files = PKG_FILES.to_a
|
176
|
+
|
177
|
+
s.executables = ["rake"]
|
178
|
+
|
179
|
+
s.extra_rdoc_files = FileList[
|
180
|
+
'README.rdoc',
|
181
|
+
'MIT-LICENSE',
|
182
|
+
'TODO',
|
183
|
+
'CHANGES',
|
184
|
+
'doc/**/*.rdoc'
|
185
|
+
]
|
186
|
+
|
187
|
+
s.rdoc_options = BASE_RDOC_OPTIONS
|
188
|
+
|
189
|
+
s.author = "Jim Weirich"
|
190
|
+
s.email = "jim@weirichhouse.org"
|
191
|
+
s.homepage = "http://rake.rubyforge.org"
|
192
|
+
s.rubyforge_project = "rake"
|
193
|
+
end
|
194
|
+
|
195
|
+
Gem::PackageTask.new(SPEC) do |pkg|
|
196
|
+
pkg.need_zip = true
|
197
|
+
pkg.need_tar = true
|
198
|
+
end
|
199
|
+
|
200
|
+
file "rake.gemspec" => ["Rakefile", "lib/rake.rb"] do |t|
|
201
|
+
require 'yaml'
|
202
|
+
open(t.name, "w") { |f| f.puts SPEC.to_yaml }
|
203
|
+
end
|
204
|
+
|
205
|
+
desc "Create a stand-alone gemspec"
|
206
|
+
task :gemspec => "rake.gemspec"
|
207
|
+
end
|
208
|
+
|
209
|
+
# Misc tasks =========================================================
|
210
|
+
|
211
|
+
def count_lines(filename)
|
212
|
+
lines = 0
|
213
|
+
codelines = 0
|
214
|
+
open(filename) { |f|
|
215
|
+
f.each do |line|
|
216
|
+
lines += 1
|
217
|
+
next if line =~ /^\s*$/
|
218
|
+
next if line =~ /^\s*#/
|
219
|
+
codelines += 1
|
220
|
+
end
|
221
|
+
}
|
222
|
+
[lines, codelines]
|
223
|
+
end
|
224
|
+
|
225
|
+
def show_line(msg, lines, loc)
|
226
|
+
printf "%6s %6s %s\n", lines.to_s, loc.to_s, msg
|
227
|
+
end
|
228
|
+
|
229
|
+
desc "Count lines in the main rake file"
|
230
|
+
task :lines do
|
231
|
+
total_lines = 0
|
232
|
+
total_code = 0
|
233
|
+
show_line("File Name", "LINES", "LOC")
|
234
|
+
SRC_RB.each do |fn|
|
235
|
+
lines, codelines = count_lines(fn)
|
236
|
+
show_line(fn, lines, codelines)
|
237
|
+
total_lines += lines
|
238
|
+
total_code += codelines
|
239
|
+
end
|
240
|
+
show_line("TOTAL", total_lines, total_code)
|
241
|
+
end
|
242
|
+
|
243
|
+
# Define an optional publish target in an external file. If the
|
244
|
+
# publish.rf file is not found, the publish targets won't be defined.
|
245
|
+
|
246
|
+
load "publish.rf" if File.exist? "publish.rf"
|
247
|
+
|
248
|
+
# Support Tasks ------------------------------------------------------
|
249
|
+
|
250
|
+
RUBY_FILES = FileList['**/*.rb'].exclude('pkg')
|
251
|
+
|
252
|
+
desc "Look for TODO and FIXME tags in the code"
|
253
|
+
task :todo do
|
254
|
+
RUBY_FILES.egrep(/#.*(FIXME|TODO|TBD)/)
|
255
|
+
end
|
256
|
+
|
257
|
+
desc "List all ruby files"
|
258
|
+
task :rubyfiles do
|
259
|
+
puts RUBY_FILES
|
260
|
+
puts FileList['bin/*'].exclude('bin/*.rb')
|
261
|
+
end
|
262
|
+
task :rf => :rubyfiles
|
263
|
+
|
264
|
+
# --------------------------------------------------------------------
|
265
|
+
# Creating a release
|
266
|
+
|
267
|
+
def plugin(plugin_name)
|
268
|
+
require "rake/plugins/#{plugin_name}"
|
269
|
+
end
|
270
|
+
|
271
|
+
task :noop
|
272
|
+
#plugin "release_manager"
|
273
|
+
|
274
|
+
desc "Make a new release"
|
275
|
+
task :release, [:rel, :reuse, :reltest] => [
|
276
|
+
:prerelease,
|
277
|
+
:clobber,
|
278
|
+
:test,
|
279
|
+
:update_version,
|
280
|
+
:package,
|
281
|
+
:tag
|
282
|
+
] do
|
283
|
+
announce
|
284
|
+
announce "**************************************************************"
|
285
|
+
announce "* Release #{$package_version} Complete."
|
286
|
+
announce "* Packages ready to upload."
|
287
|
+
announce "**************************************************************"
|
288
|
+
announce
|
289
|
+
end
|
290
|
+
|
291
|
+
# Validate that everything is ready to go for a release.
|
292
|
+
task :prerelease, :rel, :reuse, :reltest do |t, args|
|
293
|
+
$package_version = args.rel
|
294
|
+
announce
|
295
|
+
announce "**************************************************************"
|
296
|
+
announce "* Making RubyGem Release #{$package_version}"
|
297
|
+
announce "* (current version #{CURRENT_VERSION})"
|
298
|
+
announce "**************************************************************"
|
299
|
+
announce
|
300
|
+
|
301
|
+
# Is a release number supplied?
|
302
|
+
unless args.rel
|
303
|
+
fail "Usage: rake release[X.Y.Z] [REUSE=tag_suffix]"
|
304
|
+
end
|
305
|
+
|
306
|
+
# Is the release different than the current release.
|
307
|
+
# (or is REUSE set?)
|
308
|
+
if $package_version == CURRENT_VERSION && ! args.reuse
|
309
|
+
fail "Current version is #{$package_version}, must specify REUSE=tag_suffix to reuse version"
|
310
|
+
end
|
311
|
+
|
312
|
+
# Are all source files checked in?
|
313
|
+
if args.reltest
|
314
|
+
announce "Release Task Testing, skipping checked-in file test"
|
315
|
+
else
|
316
|
+
announce "Checking for unchecked-in files..."
|
317
|
+
data = `svn st`
|
318
|
+
unless data =~ /^$/
|
319
|
+
abort "svn status is not clean ... do you have unchecked-in files?"
|
320
|
+
end
|
321
|
+
announce "No outstanding checkins found ... OK"
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
task :update_version, [:rel, :reuse, :reltest] => [:prerelease] do |t, args|
|
326
|
+
if args.rel == CURRENT_VERSION
|
327
|
+
announce "No version change ... skipping version update"
|
328
|
+
else
|
329
|
+
announce "Updating Rake version to #{args.rel}"
|
330
|
+
open("lib/rake.rb") do |rakein|
|
331
|
+
open("lib/rake.rb.new", "w") do |rakeout|
|
332
|
+
rakein.each do |line|
|
333
|
+
if line =~ /^RAKEVERSION\s*=\s*/
|
334
|
+
rakeout.puts "RAKEVERSION = '#{args.rel}'"
|
335
|
+
else
|
336
|
+
rakeout.puts line
|
337
|
+
end
|
338
|
+
end
|
339
|
+
end
|
340
|
+
end
|
341
|
+
mv "lib/rake.rb.new", "lib/rake.rb"
|
342
|
+
if args.reltest
|
343
|
+
announce "Release Task Testing, skipping commiting of new version"
|
344
|
+
else
|
345
|
+
sh %{svn commit -m "Updated to version #{args.rel}" lib/rake.rb} # "
|
346
|
+
end
|
347
|
+
end
|
348
|
+
end
|
349
|
+
|
350
|
+
desc "Tag all the CVS files with the latest release number (REL=x.y.z)"
|
351
|
+
task :tag, [:rel, :reuse, :reltest] => [:prerelease] do |t, args|
|
352
|
+
reltag = "REL_#{args.rel.gsub(/\./, '_')}"
|
353
|
+
reltag << args.reuse.gsub(/\./, '_') if args.reuse
|
354
|
+
announce "Tagging Repository with [#{reltag}]"
|
355
|
+
if args.reltest
|
356
|
+
announce "Release Task Testing, skipping CVS tagging"
|
357
|
+
else
|
358
|
+
sh %{svn copy svn+ssh://rubyforge.org/var/svn/rake/trunk svn+ssh://rubyforge.org/var/svn/rake/tags/#{reltag} -m 'Commiting release #{reltag}'} ###'
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
362
|
+
# Require experimental XForge/Metaproject support.
|
363
|
+
|
364
|
+
load 'xforge.rf' if File.exist?('xforge.rf')
|
365
|
+
|
366
|
+
desc "Where is the current directory. This task displays\nthe current rake directory"
|
367
|
+
task :where_am_i do
|
368
|
+
puts Rake.original_dir
|
369
|
+
end
|
370
|
+
|
371
|
+
task :failure => :really_fail
|
372
|
+
task :really_fail do
|
373
|
+
fail "oops"
|
374
|
+
end
|