evt-constant 2.1.0.1 → 2.1.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/lib/constant/controls/script.rb +61 -0
- data/lib/constant/controls.rb +1 -0
- data/lib/constant/import/macro.rb +7 -1
- data/lib/constant/import.rb +4 -0
- 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: d0e34b89c8c9aec6ef54da871a992f086616ceee7f411ee1b43bf070cc9b80de
|
|
4
|
+
data.tar.gz: 34e6bf8e3b33b7fd2260e75400a9eed3ac82ebe8e3d86ff7b94b82877c3ec7ad
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 52f10483f068718f662c3471ab19b397dc33deaf477bd741b5359b7d8e71e8daff8df05a014c0cd5e6f04a427aa0fdc95b835f03dfafd2f06152fb7596041ac8
|
|
7
|
+
data.tar.gz: 86d07e6c53ec8cdbda773639f61e0a82ed9f7b20375fa966f1289a3f7e48c23147b2911c55ac703c2106becf7f4ed424ccfbeded5cb622b77b7d1c6974f50392
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
require "open3"
|
|
2
|
+
|
|
3
|
+
module Constant
|
|
4
|
+
module Controls
|
|
5
|
+
module Script
|
|
6
|
+
def self.top_level_import(origin_name: nil, inner_constants: nil)
|
|
7
|
+
origin_name ||= "SomeOrigin"
|
|
8
|
+
inner_constants ||= ["SomeInnerConstant"]
|
|
9
|
+
|
|
10
|
+
inner_constant_definitions = inner_constants.map do |inner_constant_name|
|
|
11
|
+
"#{inner_constant_name} = ::Module.new"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
inner_constant_resolutions = inner_constants.map do |inner_constant_name|
|
|
15
|
+
"puts #{inner_constant_name}.name"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
definitions = inner_constant_definitions.join("\n")
|
|
19
|
+
resolutions = inner_constant_resolutions.join("\n")
|
|
20
|
+
|
|
21
|
+
source = <<~RUBY
|
|
22
|
+
require "constant"
|
|
23
|
+
|
|
24
|
+
module #{origin_name}
|
|
25
|
+
#{definitions}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
include Constant::Import
|
|
29
|
+
|
|
30
|
+
import #{origin_name}
|
|
31
|
+
|
|
32
|
+
#{resolutions}
|
|
33
|
+
RUBY
|
|
34
|
+
|
|
35
|
+
Example.new(source)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
class Example
|
|
39
|
+
include Initializer
|
|
40
|
+
|
|
41
|
+
initializer :source
|
|
42
|
+
|
|
43
|
+
def run
|
|
44
|
+
load_path_options = $LOAD_PATH.map do |load_path_entry|
|
|
45
|
+
"-I#{load_path_entry}"
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
command = ["ruby", *load_path_options, "-e", source]
|
|
49
|
+
|
|
50
|
+
output, error_output, status = Open3.capture3(*command)
|
|
51
|
+
|
|
52
|
+
if not status.success?
|
|
53
|
+
raise "Script failed\n\n#{source}\n#{error_output}"
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
output.split("\n")
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
data/lib/constant/controls.rb
CHANGED
|
@@ -2,7 +2,13 @@ module Constant
|
|
|
2
2
|
module Import
|
|
3
3
|
module Macro
|
|
4
4
|
def __import_constant(origin_constant, **kwargs)
|
|
5
|
-
|
|
5
|
+
destination = self
|
|
6
|
+
|
|
7
|
+
if not destination.is_a?(::Module)
|
|
8
|
+
destination = destination.class
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
Import.(origin_constant, destination, **kwargs)
|
|
6
12
|
end
|
|
7
13
|
|
|
8
14
|
alias import __import_constant
|
data/lib/constant/import.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: evt-constant
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.1.0
|
|
4
|
+
version: 2.1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- The Eventide Project
|
|
@@ -48,6 +48,7 @@ files:
|
|
|
48
48
|
- lib/constant/constant.rb
|
|
49
49
|
- lib/constant/controls.rb
|
|
50
50
|
- lib/constant/controls/constant.rb
|
|
51
|
+
- lib/constant/controls/script.rb
|
|
51
52
|
- lib/constant/define.rb
|
|
52
53
|
- lib/constant/import.rb
|
|
53
54
|
- lib/constant/import/macro.rb
|
|
@@ -71,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
71
72
|
- !ruby/object:Gem::Version
|
|
72
73
|
version: '0'
|
|
73
74
|
requirements: []
|
|
74
|
-
rubygems_version: 4.0.
|
|
75
|
+
rubygems_version: 4.0.17
|
|
75
76
|
specification_version: 4
|
|
76
77
|
summary: ''
|
|
77
78
|
test_files: []
|