flgen 0.20.0 → 0.22.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 +4 -0
- data/lib/flgen/context.rb +16 -4
- data/lib/flgen/file_list.rb +10 -4
- data/lib/flgen/predefined_macros.yaml +2 -0
- data/lib/flgen/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33b0814c2fcfc9046509b233599f28062043c2caae0ff1cdbcfcce692b28f729
|
4
|
+
data.tar.gz: 601b18c81b39f94ec8d0d71c19494c91f399bfecd89ce9f63928acfe33a4c1c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8ea63bd6b701bf74a700790073955bdfce440da096e31026c47d703bf5c37111c600e3334aa7d0415c7e66579a461068a5676d3eb50d7ada10870d1503d4a20
|
7
|
+
data.tar.gz: dfa623a93062f38fccbb9692bf7aadc7837e0339bb1d8dc7994034addaf18d6d39b7143f8b9fbf6198307dad3c12335e6ce0162625141beba3640dd7e1471f28
|
data/README.md
CHANGED
@@ -45,8 +45,12 @@ FLGen prives APIs listed below to describe your filelists.
|
|
45
45
|
* Return `true` if the given directory exists.
|
46
46
|
* `define_macro(name, value = nil)`
|
47
47
|
* Define a text macro.
|
48
|
+
* `undefine_macro(name)`
|
49
|
+
* Undefine the given macro.
|
48
50
|
* `macro?(name)`/`macro_defined?(name)`
|
49
51
|
* Return `true` if the given macro is defined.
|
52
|
+
* `macro(name)`
|
53
|
+
* Return the value of the given macro.
|
50
54
|
* `env?(name)`
|
51
55
|
* Return `true` if the givne environment variable is defined.
|
52
56
|
* `env(name)`
|
data/lib/flgen/context.rb
CHANGED
@@ -39,8 +39,12 @@ module FLGen
|
|
39
39
|
add_macro_definition(k, v, false)
|
40
40
|
end
|
41
41
|
|
42
|
+
def undefine_macro(macro)
|
43
|
+
remove_macro(macro)
|
44
|
+
end
|
45
|
+
|
42
46
|
def macros
|
43
|
-
@macros ||=
|
47
|
+
@macros ||= {}
|
44
48
|
end
|
45
49
|
|
46
50
|
def add_include_directory(directory)
|
@@ -106,16 +110,24 @@ module FLGen
|
|
106
110
|
|
107
111
|
def add_macro_definition(macro, value, predefined)
|
108
112
|
name = macro.to_sym
|
109
|
-
macros
|
113
|
+
macros[name] = value || true
|
110
114
|
add_macro_argument(name, value) unless predefined
|
111
115
|
end
|
112
116
|
|
113
117
|
def add_macro_argument(name, value)
|
114
|
-
arguments
|
115
|
-
.delete_if { |argument| argument.type == :define && argument.name == name }
|
118
|
+
arguments.delete_if { |arg| macro_definition?(arg, name) }
|
116
119
|
add_compile_argument(Arguments::Define.new(name, value))
|
117
120
|
end
|
118
121
|
|
122
|
+
def remove_macro(macro)
|
123
|
+
name = macro.to_sym
|
124
|
+
arguments.reject! { |arg| macro_definition?(arg, name) } && macros.delete(name)
|
125
|
+
end
|
126
|
+
|
127
|
+
def macro_definition?(arg, name)
|
128
|
+
arg.type == :define && arg.name == name
|
129
|
+
end
|
130
|
+
|
119
131
|
def directory_already_added?(type, path)
|
120
132
|
arguments
|
121
133
|
.any? { |argument| argument.type == type && argument.path == path }
|
data/lib/flgen/file_list.rb
CHANGED
@@ -49,12 +49,20 @@ module FLGen
|
|
49
49
|
@context.define_macro(macro, value)
|
50
50
|
end
|
51
51
|
|
52
|
+
def undefine_macro(macro)
|
53
|
+
@context.undefine_macro(macro)
|
54
|
+
end
|
55
|
+
|
52
56
|
def macro?(macro)
|
53
|
-
@context.macros.
|
57
|
+
@context.macros.key?(macro.to_sym)
|
54
58
|
end
|
55
59
|
|
56
60
|
alias_method :macro_defined?, :macro?
|
57
61
|
|
62
|
+
def macro(name)
|
63
|
+
@context.macros[name.to_sym]
|
64
|
+
end
|
65
|
+
|
58
66
|
def env?(name)
|
59
67
|
ENV.key?(name.to_s)
|
60
68
|
end
|
@@ -122,9 +130,7 @@ module FLGen
|
|
122
130
|
end
|
123
131
|
|
124
132
|
def raise_no_entry_error(path, location, raise_error)
|
125
|
-
|
126
|
-
|
127
|
-
raise NoEntryError.new(path, location)
|
133
|
+
raise_error && (raise NoEntryError.new(path, location))
|
128
134
|
end
|
129
135
|
|
130
136
|
def glob_files(patterns, from, method_name, location)
|
data/lib/flgen/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flgen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.22.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taichi Ishitani
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Filelist generator
|
14
14
|
email:
|
@@ -65,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: '0'
|
67
67
|
requirements: []
|
68
|
-
rubygems_version: 3.5.
|
68
|
+
rubygems_version: 3.5.9
|
69
69
|
signing_key:
|
70
70
|
specification_version: 4
|
71
71
|
summary: Filelist generator
|