Class: Cukedep::ActionTriplet
- Inherits:
-
Object
- Object
- Cukedep::ActionTriplet
- Defined in:
- lib/cukedep/file-action.rb
Overview
An (file) action triplet combines three FileActions that are executed in sequence.
Instance Attribute Summary collapse
-
#copy_action ⇒ Object
readonly
Returns the value of attribute copy_action.
-
#delete_action ⇒ Object
readonly
Returns the value of attribute delete_action.
-
#save_action ⇒ Object
readonly
Returns the value of attribute save_action.
Class Method Summary collapse
-
.builtin(anEvent) ⇒ Object
Retrieve the 'built-in' action triplet associated with the given event.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(theActionSettings) ⇒ ActionTriplet
constructor
[theActionSettings] An object that responds to the [] operator.
-
#run!(currentDir, projectDir) ⇒ Object
Launch the file actions in sequence.
Constructor Details
#initialize(theActionSettings) ⇒ ActionTriplet
[theActionSettings] An object that responds to the [] operator. The argument of the operator must be: :save_patterns, :save_subdir, :delete_patterns, :delete_subdir, :copy_patterns, :copy_subdir
151 152 153 154 155 156 157 158 |
# File 'lib/cukedep/file-action.rb', line 151 def initialize(theActionSettings) @save_action = CopyAction.new(theActionSettings[:save_patterns], theActionSettings[:save_subdir]) @delete_action = DeleteAction.new(theActionSettings[:delete_patterns], theActionSettings[:delete_subdir]) @copy_action = CopyAction.new(theActionSettings[:copy_patterns], theActionSettings[:copy_subdir]) end |
Instance Attribute Details
#copy_action ⇒ Object (readonly)
Returns the value of attribute copy_action.
145 146 147 |
# File 'lib/cukedep/file-action.rb', line 145 def copy_action @copy_action end |
#delete_action ⇒ Object (readonly)
Returns the value of attribute delete_action.
144 145 146 |
# File 'lib/cukedep/file-action.rb', line 144 def delete_action @delete_action end |
#save_action ⇒ Object (readonly)
Returns the value of attribute save_action.
143 144 145 |
# File 'lib/cukedep/file-action.rb', line 143 def save_action @save_action end |
Class Method Details
.builtin(anEvent) ⇒ Object
Retrieve the 'built-in' action triplet associated with the given event. Return nil if no triplet was found for the event.
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/cukedep/file-action.rb', line 177 def self.builtin(anEvent) @@builtin_actions ||= { before_each: ActionTriplet.new( save_patterns: [], save_subdir: '', delete_patterns: ['*.feature'], delete_subdir: './features', copy_patterns: [], copy_subdir: './features' ), after_each: ActionTriplet.new( save_patterns: [], save_subdir: '', delete_patterns: ['*.feature'], # Remove feature files after the run delete_subdir: './features', copy_patterns: [], copy_subdir: '' ) } return @@builtin_actions.fetch(anEvent, nil) end |
Instance Method Details
#==(other) ⇒ Object
160 161 162 163 164 165 166 |
# File 'lib/cukedep/file-action.rb', line 160 def ==(other) return true if object_id == other.object_id return (save_action == other.save_action) && (delete_action == other.delete_action) && (copy_action == other.copy_action) end |
#run!(currentDir, projectDir) ⇒ Object
Launch the file actions in sequence.
169 170 171 172 173 |
# File 'lib/cukedep/file-action.rb', line 169 def run!(currentDir, projectDir) save_action.run!(projectDir, currentDir) delete_action.run!(projectDir) copy_action.run!(currentDir, projectDir) end |