Class: Lemans::Config::Setup
- Inherits:
-
Object
- Object
- Lemans::Config::Setup
- Defined in:
- lib/lemans/config/setup.rb
Overview
One phase's preparation: the files uploaded into the sandbox and the commands run against them. A bare list is shorthand for commands only.
Instance Attribute Summary collapse
-
#commands ⇒ Object
Files are [local absolute, remote relative] pairs; commands run in order.
-
#files ⇒ Object
Files are [local absolute, remote relative] pairs; commands run in order.
Class Method Summary collapse
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize ⇒ Setup
constructor
A new instance of Setup.
- #merge(other) ⇒ Object
Constructor Details
#initialize ⇒ Setup
Returns a new instance of Setup.
28 29 30 31 |
# File 'lib/lemans/config/setup.rb', line 28 def initialize @files = [] @commands = [] end |
Instance Attribute Details
#commands ⇒ Object
Files are [local absolute, remote relative] pairs; commands run in order.
26 27 28 |
# File 'lib/lemans/config/setup.rb', line 26 def commands @commands end |
#files ⇒ Object
Files are [local absolute, remote relative] pairs; commands run in order.
26 27 28 |
# File 'lib/lemans/config/setup.rb', line 26 def files @files end |
Class Method Details
.from_config(data, root:) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/lemans/config/setup.rb', line 9 def from_config(data, root:) return if data.nil? conf = new case data when Hash conf.commands = Array(data["commands"]) conf.files = Array(data["files"]).map { [ root.join(it), it ] } else conf.commands = Array(data) end conf end |
Instance Method Details
#empty? ⇒ Boolean
40 |
# File 'lib/lemans/config/setup.rb', line 40 def empty? = files.empty? && commands.empty? |
#merge(other) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/lemans/config/setup.rb', line 33 def merge(other) dup.tap do |merged| merged.files = files + other.files merged.commands = commands + other.commands end end |