mdt-core 0.0.2 → 0.1.0
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.
- checksums.yaml +4 -4
- data/README.md +8 -1
- data/lib/mdt/commands/base.rb +3 -3
- data/lib/mdt/data_storage.rb +27 -0
- data/lib/mdt/helpers/runner.rb +2 -2
- data/lib/mdt/version.rb +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aac4f6d4cf30d705b05f676a19c0362d58652f5ec7279da28d43f586366b0dbf
|
4
|
+
data.tar.gz: ebd0b6a0664389ca483229c16f64de53ac8ad1e18605f3fcb3f31fde909e3ae2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3fe371ccb821f5b81981b8d320423336a556df58d7cf2c1d9a3b22ce6e6bdef37bd149dd670e7d0d196122a2f07db0a201adeda6116d8823cb4bdd810802b56
|
7
|
+
data.tar.gz: b58dbd1f8080d9fcc08cf685f6cc9b892b9b041fabd2e5caa1cc1aa07f64eccfc930d22dff57fb152e61279886f6e2bd235195cd816961b3b7b3d6a45d050819
|
data/README.md
CHANGED
@@ -13,6 +13,8 @@ MDT is a deployment automation tool that is designed to be simple and easily ext
|
|
13
13
|
|
14
14
|
Be sure to also install any modules that you need.
|
15
15
|
|
16
|
+
Alternatively, please see [mdt](https://github.com/Phitherek/mdt "mdt") for the convenience gem providing the basic modules.
|
17
|
+
|
16
18
|
## Usage
|
17
19
|
|
18
20
|
The gem installs an executable called `mdt` that is used in a way described below:
|
@@ -38,7 +40,12 @@ MDT defines 5 modular objects that can be used to build a simple deploy flow. Th
|
|
38
40
|
## Known modules
|
39
41
|
|
40
42
|
* [mdt-dummy](https://github.com/Phitherek/mdt-dummy "mdt-dummy") - a module containing dummy implementations of each extensible MDT class. They can be used to skip a particular deployment step.
|
43
|
+
* [mdt-simple](https://github.com/Phitherek/mdt-simple "mdt-simple") - a module that contains simple implementations for MDT.
|
41
44
|
|
42
45
|
## Contributing
|
43
46
|
|
44
|
-
You can contribute to the development of MDT by submitting an issue or pull request. You can also extend MDT's capabilities by creating your own module in accordance with guidelines in MODULE_GUIDELINES.md and submitting it to RubyGems.
|
47
|
+
You can contribute to the development of MDT by submitting an issue or pull request. You can also extend MDT's capabilities by creating your own module in accordance with guidelines in MODULE_GUIDELINES.md and submitting it to RubyGems.
|
48
|
+
|
49
|
+
## Documentation
|
50
|
+
|
51
|
+
Generated RDoc documentation can be found [here](http://www.rubydoc.info/github/Phitherek/mdt-core "here").
|
data/lib/mdt/commands/base.rb
CHANGED
@@ -10,9 +10,9 @@ module MDT
|
|
10
10
|
|
11
11
|
# A method that defines how to execute a command and how to apply command modifiers. Raises MDT::Errors::OverrideNeeded.
|
12
12
|
# Arguments:
|
13
|
-
# +key+ - a key identifier of a particular command
|
14
|
-
# +modifiers+ - an array of command modifier configurations - each configuration is a Hash that includes modifier type and modifier options
|
15
|
-
# +options+ - options for command as a Hash
|
13
|
+
# * +key+ - a key identifier of a particular command
|
14
|
+
# * +modifiers+ - an array of command modifier configurations - each configuration is a Hash that includes modifier type and modifier options
|
15
|
+
# * +options+ - options for command as a Hash
|
16
16
|
def execute(key, modifiers = [], options = {})
|
17
17
|
raise MDT::Errors::OverrideNeeded.new('execute')
|
18
18
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'singleton'
|
2
|
+
|
3
|
+
module MDT
|
4
|
+
# Implements a singleton key-value data storage to be used across MDT. Uses a bit of metaprogramming for ease of use.
|
5
|
+
class DataStorage
|
6
|
+
include Singleton
|
7
|
+
|
8
|
+
# Initializes the storage with empty Hash.
|
9
|
+
def initialize
|
10
|
+
@storage = {}
|
11
|
+
end
|
12
|
+
|
13
|
+
# Override method_missing to delegate to the storage hash.
|
14
|
+
def method_missing(m, *args, &block)
|
15
|
+
if /^(\w+)=$/ =~ m
|
16
|
+
@storage[$1.to_sym] = args[0]
|
17
|
+
else
|
18
|
+
@storage[m.to_sym]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# Override respond_to? to always return true as it always delegates to the hash.
|
23
|
+
def respond_to?(method_name, include_private = false)
|
24
|
+
true
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/mdt/helpers/runner.rb
CHANGED
@@ -5,8 +5,8 @@ module MDT
|
|
5
5
|
class Runner
|
6
6
|
# A method that processes an array of contents that includes configurations for commands and command groups.
|
7
7
|
# Arguments:
|
8
|
-
# +contents+ - an array of configurations for commands and command groups. Refer to example configuration file in the code repository for structure description
|
9
|
-
# +modifiers+ - an array of configurations for command modifiers that have to be applied to every command defined in +contents+
|
8
|
+
# * +contents+ - an array of configurations for commands and command groups. Refer to example configuration file in the code repository for structure description
|
9
|
+
# * +modifiers+ - an array of configurations for command modifiers that have to be applied to every command defined in +contents+
|
10
10
|
# Returns:
|
11
11
|
# * 1 on failure, otherwise 0
|
12
12
|
def self.process_contents(contents, modifiers = [])
|
data/lib/mdt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mdt-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Phitherek_
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -42,6 +42,7 @@ files:
|
|
42
42
|
- lib/mdt/command_modifiers/base.rb
|
43
43
|
- lib/mdt/commands.rb
|
44
44
|
- lib/mdt/commands/base.rb
|
45
|
+
- lib/mdt/data_storage.rb
|
45
46
|
- lib/mdt/directory_choosers.rb
|
46
47
|
- lib/mdt/directory_choosers/base.rb
|
47
48
|
- lib/mdt/errors.rb
|