lite-command 2.1.3 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/CHANGELOG.md +13 -0
- data/Gemfile.lock +16 -13
- data/README.md +191 -174
- data/lib/generators/lite/command/install_generator.rb +15 -0
- data/lib/generators/lite/command/templates/install.rb +5 -0
- data/lib/lite/command/base.rb +20 -17
- data/lib/lite/command/configuration.rb +35 -0
- data/lib/lite/command/fault.rb +8 -8
- data/lib/lite/command/internals/attributes.rb +64 -0
- data/lib/lite/command/internals/{call.rb → calls.rb} +8 -4
- data/lib/lite/command/internals/{execute.rb → executions.rb} +11 -10
- data/lib/lite/command/internals/{fault.rb → faults.rb} +12 -6
- data/lib/lite/command/internals/{result.rb → results.rb} +1 -1
- data/lib/lite/command/sequence.rb +1 -1
- data/lib/lite/command/step.rb +1 -7
- data/lib/lite/command/utils.rb +11 -5
- data/lib/lite/command/version.rb +1 -1
- data/lib/lite/command.rb +10 -8
- data/lite-command.gemspec +1 -0
- metadata +24 -9
- data/lib/lite/command/attribute.rb +0 -102
- data/lib/lite/command/attribute_validator.rb +0 -35
- data/lib/lite/command/internals/context.rb +0 -46
@@ -1,46 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Lite
|
4
|
-
module Command
|
5
|
-
module Internals
|
6
|
-
module Context
|
7
|
-
|
8
|
-
def self.included(base)
|
9
|
-
base.extend ClassMethods
|
10
|
-
end
|
11
|
-
|
12
|
-
module ClassMethods
|
13
|
-
|
14
|
-
def attribute(*args, **options)
|
15
|
-
args.each do |method_name|
|
16
|
-
attribute = Lite::Command::Attribute.new(method_name, options)
|
17
|
-
attributes[method_name] = attribute
|
18
|
-
|
19
|
-
define_method(method_name) do
|
20
|
-
ivar = :"@#{method_name}"
|
21
|
-
return instance_variable_get(ivar) if instance_variable_defined?(ivar)
|
22
|
-
|
23
|
-
instance_variable_set(ivar, attribute.value)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def attributes
|
29
|
-
@attributes ||= {}
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
def validate_context_attributes
|
37
|
-
validator = Lite::Command::AttributeValidator.new(self)
|
38
|
-
return if validator.valid?
|
39
|
-
|
40
|
-
invalid!("Invalid context attributes", validator.errors)
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|