rant 0.4.4 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS +38 -0
- data/README +4 -2
- data/Rantfile +50 -12
- data/doc/examples/c_cpp/c++/problem_1_1/another_test.cpp +6 -0
- data/doc/examples/c_cpp/c++/problem_1_1/another_test.h +5 -0
- data/doc/examples/c_cpp/c++/problem_1_1/main.cpp +12 -0
- data/doc/examples/c_cpp/c++/problem_1_1/test.cpp +6 -0
- data/doc/examples/c_cpp/c++/problem_1_1/test.h +5 -0
- data/doc/examples/c_cpp/c++/template.rf +15 -0
- data/doc/examples/c_cpp/c/problem_1_1/another_test.c +6 -0
- data/doc/examples/c_cpp/c/problem_1_1/another_test.h +7 -0
- data/doc/examples/c_cpp/c/problem_1_1/main.c +12 -0
- data/doc/examples/c_cpp/c/problem_1_1/test.c +6 -0
- data/doc/examples/c_cpp/c/problem_1_1/test.h +7 -0
- data/doc/examples/c_cpp/c/template.rf +15 -0
- data/doc/examples/c_cpp/root.rant +46 -0
- data/doc/homepage/index.html +115 -0
- data/doc/homepage/rant_home.css +98 -0
- data/doc/rant.1 +129 -0
- data/doc/rant.rdoc +5 -6
- data/doc/rantfile.rdoc +55 -32
- data/doc/subdirs.rdoc +147 -0
- data/lib/rant.rb +47 -49
- data/lib/rant/coregen.rb +20 -20
- data/lib/rant/import.rb +63 -11
- data/lib/rant/import/archive.rb +47 -15
- data/lib/rant/import/archive/tgz.rb +1 -1
- data/lib/rant/import/autoclean.rb +28 -26
- data/lib/rant/import/c/dependencies.rb +1 -1
- data/lib/rant/import/directedrule.rb +1 -4
- data/lib/rant/import/metadata.rb +30 -7
- data/lib/rant/import/nodes/default.rb +67 -13
- data/lib/rant/import/rubypackage.rb +1 -1
- data/lib/rant/import/rubytest.rb +25 -19
- data/lib/rant/import/signedfile.rb +14 -8
- data/lib/rant/import/sys/more.rb +22 -0
- data/lib/rant/import/sys/tgz.rb +43 -0
- data/lib/rant/import/sys/zip.rb +42 -0
- data/lib/rant/node.rb +19 -13
- data/lib/rant/plugin/configure.rb +1 -1
- data/lib/rant/progress.rb +33 -0
- data/lib/rant/rantenv.rb +7 -7
- data/lib/rant/rantlib.rb +246 -256
- data/lib/rant/rantsys.rb +61 -22
- data/lib/rant/rantvar.rb +7 -9
- data/misc/TODO +18 -0
- data/misc/devel-notes +4 -1
- data/test/Rantfile +17 -3
- data/test/deprecated/README +6 -0
- data/test/deprecated/test_0_4_8.rb +41 -0
- data/test/deprecated/test_0_5_2.rb +33 -0
- data/test/import/md5/root.rant +9 -0
- data/test/import/md5/test_md5.rb +45 -0
- data/test/import/metadata/Rantfile +2 -2
- data/test/import/metadata/test_metadata.rb +2 -2
- data/test/import/package/test_package.rb +40 -1
- data/test/import/signedfile/sub1/Rantfile +1 -1
- data/test/import/sys/data/pkg.tgz +0 -0
- data/test/import/sys/data/pkg.zip +0 -0
- data/test/import/sys/data/pkg/bin/test +0 -0
- data/test/import/sys/data/pkg/bin/test.o +0 -0
- data/test/import/sys/data/pkg/test.c +6 -0
- data/test/import/sys/data/pkg/test.h +7 -0
- data/test/import/sys/data/pkg2.zip +0 -0
- data/test/import/sys/test_tgz.rb +38 -0
- data/test/import/sys/test_zip.rb +68 -0
- data/test/import/sys/tgz.rf +6 -0
- data/test/import/sys/zip.rf +15 -0
- data/test/project2/{rantfile.rb → root.rant} +0 -0
- data/test/project2/test_project.rb +3 -8
- data/test/project_rb1/{rantfile.rb → rantfile} +1 -1
- data/test/project_rb1/test_project_rb1.rb +3 -5
- data/test/rant-import/test_rant-import.rb +22 -10
- data/test/subdirs/sub1/Rantfile +1 -1
- data/test/subdirs/sub2/{rantfile.rb → rantfile} +0 -0
- data/test/subdirs/sub2/sub/rantfile +1 -1
- data/test/subdirs2/root.rant +36 -0
- data/test/subdirs2/sub00/sub.rant +8 -0
- data/test/subdirs2/sub1/sub.rant +13 -0
- data/test/subdirs2/test_subdirs2.rb +239 -0
- data/test/test_examples.rb +91 -0
- data/test/test_filetask.rb +51 -11
- data/test/test_rant_interface.rb +24 -0
- data/test/test_rantfile_api.rb +54 -2
- data/test/test_sourcenode.rb +30 -0
- data/test/test_sys.rb +143 -15
- data/test/test_task.rb +16 -22
- data/test/tutil.rb +22 -38
- metadata +67 -9
data/lib/rant/rantsys.rb
CHANGED
@@ -6,6 +6,20 @@
|
|
6
6
|
require 'fileutils'
|
7
7
|
require 'rant/rantenv'
|
8
8
|
|
9
|
+
# Fix FileUtils::Verbose visibility issue
|
10
|
+
if RUBY_VERSION == "1.8.3"
|
11
|
+
module FileUtils
|
12
|
+
METHODS = singleton_methods - %w(private_module_function
|
13
|
+
commands options have_option? options_of collect_method)
|
14
|
+
module Verbose
|
15
|
+
class << self
|
16
|
+
public(*::FileUtils::METHODS)
|
17
|
+
end
|
18
|
+
public(*::FileUtils::METHODS)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
9
23
|
module Rant
|
10
24
|
|
11
25
|
class FileList
|
@@ -124,17 +138,25 @@ module Rant
|
|
124
138
|
end
|
125
139
|
##############################################################
|
126
140
|
|
141
|
+
if Object.method_defined? :fcall # in Ruby 1.9 like __send__
|
127
142
|
def resolve
|
128
143
|
@pending = false
|
129
|
-
@actions.each
|
130
|
-
self.send(*action)
|
131
|
-
}
|
132
|
-
@actions.clear
|
144
|
+
@actions.each{ |action| self.fcall(*action) }.clear
|
133
145
|
ix = ignore_rx
|
134
146
|
if ix
|
135
147
|
@files.reject! { |f| f =~ ix && !@keep[f] }
|
136
148
|
end
|
137
149
|
end
|
150
|
+
else
|
151
|
+
def resolve
|
152
|
+
@pending = false
|
153
|
+
@actions.each{ |action| self.__send__(*action) }.clear
|
154
|
+
ix = ignore_rx
|
155
|
+
if ix
|
156
|
+
@files.reject! { |f| f =~ ix && !@keep[f] }
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
138
160
|
|
139
161
|
def include(*patterns)
|
140
162
|
patterns.flatten.each { |pat|
|
@@ -269,7 +291,7 @@ module Rant
|
|
269
291
|
elems = nil
|
270
292
|
@files.reject! { |entry|
|
271
293
|
next if @keep[entry]
|
272
|
-
elems = Sys.
|
294
|
+
elems = Sys.split_all(entry)
|
273
295
|
i = elems.index(name)
|
274
296
|
if i
|
275
297
|
path = File.join(*elems[0..i])
|
@@ -303,7 +325,7 @@ module Rant
|
|
303
325
|
elems = nil
|
304
326
|
elem = nil
|
305
327
|
@files.reject! { |entry|
|
306
|
-
elems = Sys.
|
328
|
+
elems = Sys.split_all(entry)
|
307
329
|
elems.any? { |elem|
|
308
330
|
elem =~ /#{suffix}$/ && !@keep[entry]
|
309
331
|
}
|
@@ -322,7 +344,7 @@ module Rant
|
|
322
344
|
def apply_no_prefix(prefix)
|
323
345
|
elems = elem = nil
|
324
346
|
@files.reject! { |entry|
|
325
|
-
elems = Sys.
|
347
|
+
elems = Sys.split_all(entry)
|
326
348
|
elems.any? { |elem|
|
327
349
|
elem =~ /^#{prefix}/ && !@keep[entry]
|
328
350
|
}
|
@@ -513,7 +535,7 @@ module Rant
|
|
513
535
|
# We override the output method of the FileUtils module to
|
514
536
|
# allow the Rant application to control output.
|
515
537
|
def fu_output_message(msg) #:nodoc:
|
516
|
-
|
538
|
+
# direct calls through Rant::Sys are silent
|
517
539
|
end
|
518
540
|
private :fu_output_message
|
519
541
|
|
@@ -534,21 +556,25 @@ module Rant
|
|
534
556
|
cmd_args.flatten!
|
535
557
|
cmd = cmd_args.join(" ")
|
536
558
|
fu_output_message cmd
|
559
|
+
success = system(*cmd_args)
|
537
560
|
if block_given?
|
538
|
-
|
539
|
-
|
540
|
-
|
561
|
+
block[$?]
|
562
|
+
elsif !success
|
563
|
+
raise CommandError.new(cmd, $?)
|
541
564
|
end
|
542
565
|
end
|
543
566
|
|
544
567
|
# Run a new Ruby interpreter with the given arguments:
|
545
568
|
# sys.ruby "install.rb"
|
546
569
|
def ruby(*args, &block)
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
570
|
+
if args.empty?
|
571
|
+
# The empty string argument ensures that +system+
|
572
|
+
# doesn't start a subshell but invokes ruby directly.
|
573
|
+
# The empty string argument is ignored by ruby.
|
574
|
+
sh(Env::RUBY, '', &block)
|
575
|
+
else
|
576
|
+
sh(args.unshift(Env::RUBY), &block)
|
577
|
+
end
|
552
578
|
end
|
553
579
|
|
554
580
|
# Returns a string that can be used as a valid path argument
|
@@ -573,15 +599,26 @@ module Rant
|
|
573
599
|
end
|
574
600
|
|
575
601
|
# Split a path in all elements.
|
576
|
-
def
|
602
|
+
def split_all(path)
|
577
603
|
base, last = File.split(path)
|
578
604
|
return [last] if base == "." || last == "/"
|
579
605
|
return [base, last] if base == "/"
|
580
|
-
|
606
|
+
split_all(base) + [last]
|
581
607
|
end
|
582
608
|
|
609
|
+
def split_path(str)
|
610
|
+
str.split(Env.on_windows? ? ";" : ":")
|
611
|
+
end
|
612
|
+
|
583
613
|
extend self
|
584
614
|
|
615
|
+
if RUBY_VERSION >= "1.9.0"
|
616
|
+
class << self
|
617
|
+
public(*::FileUtils::METHODS)
|
618
|
+
end
|
619
|
+
public(*::FileUtils::METHODS)
|
620
|
+
end
|
621
|
+
|
585
622
|
end # module Sys
|
586
623
|
|
587
624
|
# An instance of this class is returned from the +sys+ method in
|
@@ -592,9 +629,6 @@ module Rant
|
|
592
629
|
class SysObject
|
593
630
|
include Sys
|
594
631
|
|
595
|
-
# The controlling Rant compiler.
|
596
|
-
attr_reader :rac
|
597
|
-
|
598
632
|
def initialize(rac)
|
599
633
|
@rac = rac or
|
600
634
|
raise ArgumentError, "controller required"
|
@@ -610,10 +644,15 @@ module Rant
|
|
610
644
|
RacFileList.new(@rac, *patterns)
|
611
645
|
end
|
612
646
|
|
647
|
+
def expand_path(path)
|
648
|
+
File.expand_path(@rac.project_to_fs_path(path))
|
649
|
+
end
|
650
|
+
|
613
651
|
private
|
614
652
|
# Delegates FileUtils messages to +rac+.
|
615
653
|
def fu_output_message(cmd)
|
616
654
|
@rac.cmd_msg cmd
|
617
655
|
end
|
618
656
|
end
|
619
|
-
end
|
657
|
+
end # module Rant
|
658
|
+
# this line prevents ruby 1.8.3 from crashing with: [BUG] unknown node type 0
|
data/lib/rant/rantvar.rb
CHANGED
@@ -16,16 +16,14 @@
|
|
16
16
|
# If you're looking for general info about Rant, read the
|
17
17
|
# README[link:files/README.html].
|
18
18
|
module Rant
|
19
|
-
VERSION
|
19
|
+
VERSION = '0.4.6'
|
20
20
|
|
21
21
|
# Those are the filenames for rantfiles.
|
22
22
|
# Case matters!
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
]
|
28
|
-
SUB_RANTFILES = ["subrant"]
|
23
|
+
ROOT_RANTFILE = "root.rant"
|
24
|
+
SUB_RANTFILE = "sub.rant"
|
25
|
+
RANTFILES = [ "Rantfile", "rantfile", ROOT_RANTFILE ]
|
26
|
+
DEPRECATED_RANTFILES = [ "Rantfile.rb", "rantfile.rb" ]
|
29
27
|
|
30
28
|
# Names of plugins and imports for which code was loaded.
|
31
29
|
# Files that where loaded with the `import' commant are directly
|
@@ -39,7 +37,7 @@ module Rant
|
|
39
37
|
class RantDoneException < StandardError
|
40
38
|
end
|
41
39
|
|
42
|
-
class
|
40
|
+
class Error < StandardError
|
43
41
|
end
|
44
42
|
|
45
43
|
# This module is a namespace for generator classes.
|
@@ -127,7 +125,7 @@ module Rant
|
|
127
125
|
|
128
126
|
module RantVar
|
129
127
|
|
130
|
-
class Error <
|
128
|
+
class Error < Rant::Error
|
131
129
|
end
|
132
130
|
|
133
131
|
class ConstraintError < Error
|
data/misc/TODO
CHANGED
@@ -1,11 +1,29 @@
|
|
1
1
|
|
2
2
|
= TODO
|
3
3
|
|
4
|
+
== Update documentation with regards to resolve hooks.
|
5
|
+
|
6
|
+
The argument list for resolve hooks has changed in version 0.4.5.
|
7
|
+
A hook has to accept two arguments now, the first is the target name
|
8
|
+
and the second is the project directory the resolve action is relative
|
9
|
+
to. Previously, a resolve hook got only the target name as argument.
|
10
|
+
|
11
|
+
== Eventually replace <tt>#</tt> with another symbol.
|
12
|
+
|
13
|
+
The # symbol as reference to the project's root directory should
|
14
|
+
eventuelly get replaced with a better fitting symbol. Many shells
|
15
|
+
interpret it as comment start and thus escaping/quoting is needed if
|
16
|
+
<tt>#some_target</tt> arguments are used on the commandline. This
|
17
|
+
could get a common source of annoyance/bugs.
|
18
|
+
|
19
|
+
Favorite candidate is currently <tt>@</tt>.
|
20
|
+
|
4
21
|
== Improve SourceNode types
|
5
22
|
|
6
23
|
Currently a SourceNode can only have other SourceNodes or files as
|
7
24
|
prerequisites. But if e.g., a header file should be autogenerated,
|
8
25
|
this isn't sufficient anymore.
|
26
|
+
Done (0.4.5).
|
9
27
|
|
10
28
|
---
|
11
29
|
Update
|
data/misc/devel-notes
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
|
2
|
+
== Rant::Env.find_bin...
|
3
|
+
... could honour PATHEXT on windows.
|
4
|
+
|
2
5
|
== Task alias
|
3
6
|
Since +alias+ is a Ruby keyword, we could use +nick+ to create task
|
4
7
|
alises.
|
5
8
|
Other choices: short, cut, name, label, syn, synonym, ident, term,
|
6
|
-
shortcut, abbreviation
|
9
|
+
shortcut, abbreviation, link
|
7
10
|
|
8
11
|
== Here docs
|
9
12
|
Don't use here documents in the Rant sources, imports and plugins.
|
data/test/Rantfile
CHANGED
@@ -20,11 +20,11 @@ file "version.t" do |t|
|
|
20
20
|
end
|
21
21
|
|
22
22
|
gen Action do
|
23
|
-
|
23
|
+
rant.build "version.t"
|
24
24
|
end
|
25
25
|
|
26
26
|
auto_t_task = source "auto.rf"
|
27
|
-
|
27
|
+
rant.abort unless auto_t_task.name == "auto.t"
|
28
28
|
|
29
29
|
task :clean do
|
30
30
|
sys.rm_f %w(auto.t auto.rf version.t)
|
@@ -45,7 +45,7 @@ task :subdir_tmp do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
task :build_test_t do |t|
|
48
|
-
|
48
|
+
rant.build "tmp.t/test.t"
|
49
49
|
# just ensure we're NOT in the tmp.t directory
|
50
50
|
#STDERR.puts Dir.pwd
|
51
51
|
test(?d, "tmp.t") or t.fail
|
@@ -87,4 +87,18 @@ end
|
|
87
87
|
|
88
88
|
task :dep_on_make_files => ["make_files.t"]
|
89
89
|
|
90
|
+
task "print_name.t" do |t|
|
91
|
+
puts t.full_name
|
92
|
+
end
|
93
|
+
|
94
|
+
file "depends_name.t" => "print_name.t" do |t|
|
95
|
+
import "sys/more"
|
96
|
+
sys.write_to_file t.name, File.read(t.source) + "a\n"
|
97
|
+
end
|
98
|
+
|
99
|
+
task "call-make" do |t|
|
100
|
+
make "print_name.t"
|
101
|
+
puts t.full_name
|
102
|
+
end
|
103
|
+
|
90
104
|
# vim: ft=ruby
|
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
require 'test/unit'
|
3
|
+
require 'tutil'
|
4
|
+
|
5
|
+
$test_deprecated_dir ||= File.expand_path(File.dirname(__FILE__))
|
6
|
+
|
7
|
+
class TestDeprecated_0_4_8 < Test::Unit::TestCase
|
8
|
+
include Rant::TestUtil
|
9
|
+
|
10
|
+
def setup
|
11
|
+
Dir.chdir $test_deprecated_dir
|
12
|
+
end
|
13
|
+
def test_Rantfile_rb
|
14
|
+
in_local_temp_dir do
|
15
|
+
write_to_file "Rantfile.rb", <<-EOF
|
16
|
+
task :a do |t|
|
17
|
+
puts t.name
|
18
|
+
end
|
19
|
+
EOF
|
20
|
+
out, err = assert_rant
|
21
|
+
assert_equal("a\n", out)
|
22
|
+
assert_match(/\bWARNING\b/, err)
|
23
|
+
assert_match(/\bRantfile\.rb\b/, err)
|
24
|
+
assert_match(/\bdeprecated\b/, err)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
def test_rantfile_rb
|
28
|
+
in_local_temp_dir do
|
29
|
+
write_to_file "Rantfile.rb", <<-EOF
|
30
|
+
task :a do |t|
|
31
|
+
puts t.name
|
32
|
+
end
|
33
|
+
EOF
|
34
|
+
out, err = assert_rant
|
35
|
+
assert_equal("a\n", out)
|
36
|
+
assert_match(/\bWARNING\b/, err)
|
37
|
+
assert_match(/\bRantfile\.rb\b/, err)
|
38
|
+
assert_match(/\bdeprecated\b/, err)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
|
2
|
+
require 'test/unit'
|
3
|
+
require 'tutil'
|
4
|
+
|
5
|
+
$test_deprecated_dir ||= File.expand_path(File.dirname(__FILE__))
|
6
|
+
|
7
|
+
class TestDeprecated_0_5_2 < Test::Unit::TestCase
|
8
|
+
include Rant::TestUtil
|
9
|
+
|
10
|
+
def setup
|
11
|
+
Dir.chdir $test_deprecated_dir
|
12
|
+
end
|
13
|
+
def test_method_rac
|
14
|
+
in_local_temp_dir do
|
15
|
+
write_to_file "root.rant", <<-EOF
|
16
|
+
import "sys/more"
|
17
|
+
file "f" do |t|
|
18
|
+
sys.write_to_file t.name, "nix"
|
19
|
+
end
|
20
|
+
task :a do
|
21
|
+
rac.build "f"
|
22
|
+
end
|
23
|
+
EOF
|
24
|
+
out, err = assert_rant("a")
|
25
|
+
assert test(?f, "f")
|
26
|
+
assert_equal "nix", File.read("f")
|
27
|
+
assert_match(/\bWARNING\b/, err)
|
28
|
+
assert_match(/\brac\b/, err)
|
29
|
+
assert_match(/\brant\b/, err)
|
30
|
+
assert_match(/\bdeprecated\b/, err)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
|
2
|
+
require 'test/unit'
|
3
|
+
require 'tutil'
|
4
|
+
|
5
|
+
$test_import_md5_dir ||= File.expand_path(File.dirname(__FILE__))
|
6
|
+
|
7
|
+
class TestImportMd5 < Test::Unit::TestCase
|
8
|
+
include Rant::TestUtil
|
9
|
+
def setup
|
10
|
+
# Ensure we run in test directory.
|
11
|
+
Dir.chdir($test_import_md5_dir)
|
12
|
+
end
|
13
|
+
def teardown
|
14
|
+
Dir.chdir($test_import_md5_dir)
|
15
|
+
Rant::Sys.rm_f Rant::FileList["**/*.rant.meta"]
|
16
|
+
Rant::Sys.rm_rf Rant::FileList["*.t", "*.tt"]
|
17
|
+
end
|
18
|
+
def test_rule_root_and_subdir
|
19
|
+
Rant::Sys.mkdir "sub.td"
|
20
|
+
Rant::Sys.touch "sub.td/a.tt"
|
21
|
+
out, err = assert_rant "sub.td/a.t"
|
22
|
+
assert err.empty?
|
23
|
+
assert_match(/\bwriting\b.*a\.t\b/, out)
|
24
|
+
out, err = assert_rant "sub.td/a.t"
|
25
|
+
assert err.empty?
|
26
|
+
assert out.empty?
|
27
|
+
Dir.chdir "sub.td"
|
28
|
+
out, err = assert_rant "-u", "a.t"
|
29
|
+
assert err.empty?
|
30
|
+
lines = out.split(/\n/)
|
31
|
+
assert(lines.size == 1)
|
32
|
+
assert(out !~ /writing|a\.t/)
|
33
|
+
Dir.chdir $test_import_md5_dir
|
34
|
+
out, err = assert_rant "sub.td/a.t"
|
35
|
+
assert err.empty?
|
36
|
+
assert out.empty?
|
37
|
+
assert_rant "autoclean"
|
38
|
+
assert !test(?e, "sub.td/a.t")
|
39
|
+
assert !test(?e, "sub.td/.rant.meta")
|
40
|
+
assert Dir["**/*.rant.meta"].empty?
|
41
|
+
ensure
|
42
|
+
Dir.chdir $test_import_md5_dir
|
43
|
+
Rant::Sys.rm_rf "sub.td"
|
44
|
+
end
|
45
|
+
end
|
@@ -8,9 +8,9 @@ var[:__metadata__].set("cmd", "touch a", "a")
|
|
8
8
|
|
9
9
|
if var[:subdir]
|
10
10
|
subdirs "sub"
|
11
|
-
|
11
|
+
rant.goto "sub"
|
12
12
|
p var[:__metadata__].fetch("cmd", "b", "sub")
|
13
|
-
|
13
|
+
rant.goto "@"
|
14
14
|
else
|
15
15
|
p var[:__metadata__].fetch("cmd", "a")
|
16
16
|
end
|