rap 0.13.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History +6 -3
- data/README +1 -1
- data/bin/rap +11 -7
- data/lib/rap/declarations.rb +15 -15
- data/lib/rap/rake.rb +3 -2
- data/lib/rap/{declaration_task.rb → task.rb} +26 -22
- metadata +4 -4
data/History
CHANGED
@@ -1,10 +1,13 @@
|
|
1
|
+
== 0.17.1 / 2009-06-06
|
2
|
+
|
3
|
+
Updates for Tap-0.17.1.
|
4
|
+
|
5
|
+
* Refactored DeclarationTask as Rap::Task
|
6
|
+
|
1
7
|
== 0.13.0 / 2009-05-25
|
2
8
|
|
3
9
|
Updates to use Tap-0.17.0.
|
4
10
|
|
5
|
-
* added Test task
|
6
|
-
* added Manifest task
|
7
|
-
|
8
11
|
== 0.12.3 / 2009-03-23
|
9
12
|
|
10
13
|
Update executable to use Tap-0.12.4. No significant changes.
|
data/README
CHANGED
@@ -102,7 +102,7 @@ minor and sometimes no changes.
|
|
102
102
|
|
103
103
|
==== Regarding Tap
|
104
104
|
|
105
|
-
Rap tasks (ie subclasses of Rap::
|
105
|
+
Rap tasks (ie subclasses of Rap::Task) are designed to behave like
|
106
106
|
Rake tasks. As such Rap tasks:
|
107
107
|
|
108
108
|
* return nil and pass nil in workflows
|
data/bin/rap
CHANGED
@@ -56,15 +56,19 @@ when '--help', nil, '-T'
|
|
56
56
|
else
|
57
57
|
begin
|
58
58
|
schema = Tap::Schema.parse(ARGV)
|
59
|
-
|
60
|
-
if
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
nil
|
59
|
+
schema.tasks.each_pair do |key, task|
|
60
|
+
if tasc = env[:task][task[0]]
|
61
|
+
task[0] = tasc
|
62
|
+
elsif Rap::Rake.has_rakefile?
|
63
|
+
warn "warning: implict rake for '#{task.join(' ')}'"
|
64
|
+
task.unshift(Rap::Rake)
|
66
65
|
end
|
67
66
|
end
|
67
|
+
|
68
|
+
app = Tap::App.instance
|
69
|
+
app.build(schema, :resources => env)
|
70
|
+
Tap::Exe.set_signals(app)
|
71
|
+
app.run
|
68
72
|
rescue
|
69
73
|
raise if $DEBUG
|
70
74
|
puts $!.message
|
data/lib/rap/declarations.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'rap/
|
1
|
+
require 'rap/task'
|
2
2
|
require 'rap/utils'
|
3
3
|
|
4
4
|
module Rap
|
@@ -21,19 +21,19 @@ module Rap
|
|
21
21
|
# t.class # => Nested::Sample
|
22
22
|
# end
|
23
23
|
#
|
24
|
-
# Normally all declared tasks are subclasses of
|
25
|
-
# subclasses of
|
24
|
+
# Normally all declared tasks are subclasses of Rap::Task, but
|
25
|
+
# subclasses of Rap::Task can declare tasks as well.
|
26
26
|
#
|
27
|
-
# class Alt <
|
27
|
+
# class Alt < Rap::Task
|
28
28
|
# end
|
29
29
|
#
|
30
30
|
# include Rap::Declarations
|
31
31
|
#
|
32
|
-
# desc "task one, a subclass of
|
32
|
+
# desc "task one, a subclass of Rap::Task"
|
33
33
|
# o = Rap.task(:one)
|
34
34
|
# o.class # => One
|
35
|
-
# o.class.superclass # =>
|
36
|
-
# o.class.desc.to_s # => "task one, a subclass of
|
35
|
+
# o.class.superclass # => Rap::Task
|
36
|
+
# o.class.desc.to_s # => "task one, a subclass of Rap::Task"
|
37
37
|
#
|
38
38
|
# namespace(:nest) do
|
39
39
|
# desc "task two, a nested subclass of Alt"
|
@@ -43,10 +43,10 @@ module Rap
|
|
43
43
|
# t.class.desc.to_s # => "task two, a nested subclass of Alt"
|
44
44
|
# end
|
45
45
|
#
|
46
|
-
# This feature is only available to subclasses of
|
46
|
+
# This feature is only available to subclasses of Rap::Task and can
|
47
47
|
# be very useful for creating inheritance hierarchies. Note that other
|
48
48
|
# declaration methods like 'desc' and 'namespace' are not available on
|
49
|
-
#
|
49
|
+
# Rap::Task or subclasses, just 'task'.
|
50
50
|
#
|
51
51
|
# See the {Syntax Reference}[link:files/doc/Syntax%20Reference.html] for more
|
52
52
|
# information.
|
@@ -81,11 +81,11 @@ module Rap
|
|
81
81
|
end
|
82
82
|
|
83
83
|
# Declares a task with a rake-like syntax. Task generates a subclass of
|
84
|
-
#
|
84
|
+
# Rap::Task, nested within the current namespace.
|
85
85
|
def task(*args, &action)
|
86
86
|
# resolve arguments and declare unknown dependencies
|
87
87
|
name, configs, dependencies, arg_names = resolve_args(args) do |dependency|
|
88
|
-
register
|
88
|
+
register Rap::Task.subclass(dependency)
|
89
89
|
end
|
90
90
|
|
91
91
|
# generate the task class
|
@@ -198,11 +198,11 @@ module Rap
|
|
198
198
|
name.to_s.tr(":", "/")
|
199
199
|
end
|
200
200
|
|
201
|
-
# The class of task declared by task, by default
|
201
|
+
# The class of task declared by task, by default Rap::Task.
|
202
202
|
# Used as a hook to set the declaring class in including modules
|
203
|
-
# (such as
|
203
|
+
# (such as Rap::Task itself).
|
204
204
|
def declaration_class
|
205
|
-
|
205
|
+
Rap::Task
|
206
206
|
end
|
207
207
|
|
208
208
|
# Registers a task class with the Declarations.env, if necessary.
|
@@ -225,7 +225,7 @@ module Rap
|
|
225
225
|
end
|
226
226
|
end
|
227
227
|
|
228
|
-
class
|
228
|
+
class Task
|
229
229
|
class << self
|
230
230
|
# :stopdoc:
|
231
231
|
alias original_desc desc
|
data/lib/rap/rake.rb
CHANGED
@@ -25,8 +25,9 @@ module Rap
|
|
25
25
|
puts help
|
26
26
|
exit
|
27
27
|
end
|
28
|
-
argv
|
29
|
-
|
28
|
+
argv.collect! {|arg| arg == '--rake-help' ? '--help' : arg}
|
29
|
+
|
30
|
+
new({}, app)
|
30
31
|
end
|
31
32
|
|
32
33
|
# Returns true if Rake detects a rakefile.
|
@@ -5,7 +5,7 @@ require 'rap/description'
|
|
5
5
|
|
6
6
|
module Rap
|
7
7
|
|
8
|
-
#
|
8
|
+
# Rap tasks are a special breed of Tap::Task designed to behave much
|
9
9
|
# like Rake tasks. As such, declaration tasks:
|
10
10
|
#
|
11
11
|
# * return nil and pass nil in workflows
|
@@ -13,7 +13,7 @@ module Rap
|
|
13
13
|
# * are effectively singletons (one instance per app)
|
14
14
|
# * allow for multiple actions
|
15
15
|
#
|
16
|
-
# The
|
16
|
+
# The Rap::Task class partially includes Declarations so subclasses
|
17
17
|
# may directly declare tasks. A few alias acrobatics makes it so that ONLY
|
18
18
|
# Declarations#task is made available (desc cannot be used because Task
|
19
19
|
# classes already use that method for documentation, and namespace
|
@@ -22,7 +22,7 @@ module Rap
|
|
22
22
|
# Weird? Yes, but it leads to this syntax:
|
23
23
|
#
|
24
24
|
# # [Rapfile]
|
25
|
-
# # class Subclass < Rap::
|
25
|
+
# # class Subclass < Rap::Task
|
26
26
|
# # def helper(); "help"; end
|
27
27
|
# # end
|
28
28
|
# #
|
@@ -32,7 +32,7 @@ module Rap
|
|
32
32
|
# % rap help
|
33
33
|
# got help
|
34
34
|
#
|
35
|
-
class
|
35
|
+
class Task < Tap::Task
|
36
36
|
class << self
|
37
37
|
|
38
38
|
# Sets actions.
|
@@ -60,14 +60,8 @@ module Rap
|
|
60
60
|
args
|
61
61
|
end
|
62
62
|
|
63
|
-
#
|
64
|
-
#
|
65
|
-
# arguments are stored on the instance. The arguments are returned
|
66
|
-
# as normal in the [instance, args] result.
|
67
|
-
#
|
68
|
-
# These atypical behaviors handle various situations on the command
|
69
|
-
# line. Setting the args this way, for example, allows arguments to
|
70
|
-
# be specified on dependency tasks:
|
63
|
+
# Parses as normal, but also stores the arguments on the instance to
|
64
|
+
# allows arguments to be specified on dependency tasks:
|
71
65
|
#
|
72
66
|
# # [Rapfile]
|
73
67
|
# # Rap.task(:a, :obj) {|t, a| puts "A #{a.obj}"}
|
@@ -77,19 +71,29 @@ module Rap
|
|
77
71
|
# A hello
|
78
72
|
# B world
|
79
73
|
#
|
74
|
+
def parse!(argv=ARGV, app=Tap::App.instance)
|
75
|
+
instance = super
|
76
|
+
instance.args = argv
|
77
|
+
instance
|
78
|
+
end
|
79
|
+
|
80
|
+
# Instantiates the instance of self for app and reconfigures it as
|
81
|
+
# specified in argh.
|
80
82
|
def instantiate(argh={}, app=Tap::App.instance)
|
81
|
-
config = argh[:config]
|
82
|
-
config_file = argh[:config_file]
|
83
|
-
|
84
83
|
instance = self.instance(app)
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
84
|
+
|
85
|
+
if config = argh[:config]
|
86
|
+
instance.reconfigure(config)
|
87
|
+
end
|
88
|
+
|
89
|
+
if args = argh[:args]
|
90
|
+
instance.args = args
|
91
|
+
end
|
92
|
+
|
93
|
+
instance
|
90
94
|
end
|
91
95
|
|
92
|
-
# Looks up or creates the
|
96
|
+
# Looks up or creates the Rap::Task subclass specified by const_name
|
93
97
|
# and adds the configs and dependencies.
|
94
98
|
#
|
95
99
|
# Configurations are always validated using the yaml transformation block
|
@@ -101,7 +105,7 @@ module Rap
|
|
101
105
|
constants.inject(base) do |namespace, const|
|
102
106
|
# nesting Task classes into other Task classes is required
|
103
107
|
# for namespaces with the same name as a task
|
104
|
-
namespace.const_set(const, Class.new(
|
108
|
+
namespace.const_set(const, Class.new(Rap::Task))
|
105
109
|
end.const_set(subclass_const, Class.new(self))
|
106
110
|
end
|
107
111
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.
|
4
|
+
version: 0.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Chiang
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-06-06 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.17.
|
23
|
+
version: 0.17.1
|
24
24
|
version:
|
25
25
|
description:
|
26
26
|
email: simon.a.chiang@gmail.com
|
@@ -34,7 +34,7 @@ extra_rdoc_files:
|
|
34
34
|
- History
|
35
35
|
- doc/Syntax Reference
|
36
36
|
files:
|
37
|
-
- lib/rap/
|
37
|
+
- lib/rap/task.rb
|
38
38
|
- lib/rap/declarations.rb
|
39
39
|
- lib/rap/description.rb
|
40
40
|
- lib/rap/rake.rb
|