applix 0.3.5 → 0.3.6
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/VERSION +1 -1
- data/lib/applix.rb +3 -3
- data/spec/applix_spec.rb +12 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.6
|
data/lib/applix.rb
CHANGED
@@ -22,8 +22,8 @@ usage: #{$0} <args...>
|
|
22
22
|
options = (defaults.merge options)
|
23
23
|
args = (options.delete :args)
|
24
24
|
|
25
|
-
# pre handle
|
26
|
-
@prolog_cb.call(
|
25
|
+
# pre handle, can modify args & options
|
26
|
+
@prolog_cb.call(args, options) unless @prolog_cb.nil?
|
27
27
|
|
28
28
|
# it's either :any
|
29
29
|
if task = tasks[:any]
|
@@ -36,7 +36,7 @@ usage: #{$0} <args...>
|
|
36
36
|
|
37
37
|
# post handle
|
38
38
|
unless @epilog_cb.nil?
|
39
|
-
rc = @epilog_cb.call(rc,
|
39
|
+
rc = @epilog_cb.call(rc, args, options)
|
40
40
|
end
|
41
41
|
|
42
42
|
rc # return result code from handle callbacks, not the epilog_cb
|
data/spec/applix_spec.rb
CHANGED
@@ -2,9 +2,20 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
2
|
|
3
3
|
describe "Applix" do
|
4
4
|
|
5
|
+
it 'prolog can even temper with arguments to modify the handle sequence' do
|
6
|
+
Applix.main(['a', 'b']) do
|
7
|
+
prolog { |args, options|
|
8
|
+
args.should == ['a', 'b']
|
9
|
+
args.reverse!
|
10
|
+
}
|
11
|
+
handle(:a) { raise 'shoule not be called!' }
|
12
|
+
handle(:b) { :b_was_called }
|
13
|
+
end.should == :b_was_called
|
14
|
+
end
|
15
|
+
|
5
16
|
it 'prolog has read/write access to args and options' do
|
6
17
|
Applix.main(['func']) do
|
7
|
-
prolog {
|
18
|
+
prolog { |args, options|
|
8
19
|
args.should == ['func']
|
9
20
|
options[:prolog] = Time.now
|
10
21
|
}
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: applix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.3.
|
5
|
+
version: 0.3.6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- dirk luesebrink
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-08-
|
13
|
+
date: 2011-08-17 00:00:00 +02:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -139,7 +139,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
139
139
|
requirements:
|
140
140
|
- - ">="
|
141
141
|
- !ruby/object:Gem::Version
|
142
|
-
hash:
|
142
|
+
hash: 819130283461250046
|
143
143
|
segments:
|
144
144
|
- 0
|
145
145
|
version: "0"
|