rcoli 0.5.2 → 0.5.3

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/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rcoli (0.5.2)
4
+ rcoli (0.5.3)
5
5
  highline (~> 1.6.11)
6
6
 
7
7
  GEM
data/lib/rcoli/model.rb CHANGED
@@ -135,6 +135,14 @@ module RCoLi
135
135
  setter :description
136
136
  setter :syntax
137
137
 
138
+ def solitaire
139
+ @solitaire = true
140
+ end
141
+
142
+ def solitaire?
143
+ return true == @solitaire
144
+ end
145
+
138
146
  def initialize(name)
139
147
  @name = name
140
148
  end
@@ -168,12 +176,23 @@ module RCoLi
168
176
  parse_args(args, result)
169
177
  if result.command
170
178
  action = result.command.get_action
179
+ raise "Invalid configuration. Missing action block." unless action
180
+ context.instance_exec(result.global_options, result.options, result.arguments, &@pre_action) if (@pre_action and !result.command.solitaire?)
171
181
  context.instance_exec(result.global_options, result.options, result.arguments, &action)
182
+ context.instance_exec(result.global_options, result.options, result.arguments, &@post_action) if (@post_action and !result.command.solitaire?)
172
183
  else
173
184
  say "Display UI"
174
185
  end
175
186
  end
176
187
 
188
+ def pre(&block)
189
+ @pre_action = block
190
+ end
191
+
192
+ def post(&block)
193
+ @post_action = block
194
+ end
195
+
177
196
  end
178
197
 
179
198
 
data/lib/rcoli/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module RCoLi
2
2
 
3
- VERSION = '0.5.2'
3
+ VERSION = '0.5.3'
4
4
 
5
5
  end
data/lib/rcoli.rb CHANGED
@@ -10,6 +10,7 @@ def application(id, &block)
10
10
  @program.name id
11
11
  @program.command(:help) do |c|
12
12
  c.description "Display help documentation"
13
+ c.solitaire
13
14
  c.action do |global_opts, opts, args|
14
15
  @program.help args
15
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rcoli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -77,7 +77,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
77
77
  version: '0'
78
78
  segments:
79
79
  - 0
80
- hash: -3437254255706801343
80
+ hash: 4363719608537841093
81
81
  required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  none: false
83
83
  requirements:
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  version: '0'
87
87
  segments:
88
88
  - 0
89
- hash: -3437254255706801343
89
+ hash: 4363719608537841093
90
90
  requirements: []
91
91
  rubyforge_project:
92
92
  rubygems_version: 1.8.24