build 2.3.0 → 2.4.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/build/name.rb +13 -0
- data/lib/build/version.rb +1 -1
- data/spec/build/name_spec.rb +4 -0
- 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: 2ff45ea87e1981c7bca236c6e1be7b945eac13d2334966d817b15141cf805dce
|
4
|
+
data.tar.gz: ccc2fbfede04a3da49894eeeb590830cddc3db7d792b3ea5e90e14eac7827cfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b636b894115ad36203394a084a3d915c753ecf61fb0c1498ca1e398b2b9fd8128c678c050e61c426eb5cca8d005c6819ee27908eca3bc7a81c751367af3cb34
|
7
|
+
data.tar.gz: 0437a28306e544b779b030688fb6957e7dda8bed1d449eaf39fd48878e967b8186bb3be0169aec2739568d9d149b0e160b476d004687c147284654473b699a33
|
data/lib/build/name.rb
CHANGED
@@ -22,6 +22,10 @@ module Build
|
|
22
22
|
class Name
|
23
23
|
def initialize(text)
|
24
24
|
@text = text
|
25
|
+
|
26
|
+
@identifier = nil
|
27
|
+
@target = nil
|
28
|
+
@key = nil
|
25
29
|
end
|
26
30
|
|
27
31
|
def self.from_target(string)
|
@@ -30,18 +34,27 @@ module Build
|
|
30
34
|
|
31
35
|
attr :text
|
32
36
|
|
37
|
+
# @return [String] suitable for constant identifier.
|
33
38
|
def identifier
|
34
39
|
@identifier ||= @text.gsub(/\s+/, '')
|
35
40
|
end
|
36
41
|
|
42
|
+
# @return [String] suitable for target name.
|
37
43
|
def target
|
38
44
|
@target ||= @text.gsub(/\s+/, '-').downcase
|
39
45
|
end
|
40
46
|
|
47
|
+
# @return [String] suitable for variable name.
|
48
|
+
def key(*postfix)
|
49
|
+
@key ||= ([@text] + postfix).collect{|part| part.downcase.gsub(/\s+/, '_')}.join('_')
|
50
|
+
end
|
51
|
+
|
52
|
+
# @return [String] suitable for C macro name.
|
41
53
|
def macro(prefix = [])
|
42
54
|
(Array(prefix) + [@text]).collect{|name| name.upcase.gsub(/\s+/, '_')}.join('_')
|
43
55
|
end
|
44
56
|
|
57
|
+
# @return [String] suitable for C header guard macro.
|
45
58
|
def header_guard(path)
|
46
59
|
macro(path) + '_H'
|
47
60
|
end
|
data/lib/build/version.rb
CHANGED
data/spec/build/name_spec.rb
CHANGED
@@ -34,6 +34,10 @@ RSpec.describe Build::Name do
|
|
34
34
|
expect(name.target).to be == 'foo-bar'
|
35
35
|
end
|
36
36
|
|
37
|
+
it "should generate useful key names" do
|
38
|
+
expect(name.key('executable')).to be == 'foo_bar_executable'
|
39
|
+
end
|
40
|
+
|
37
41
|
it "should generate useful macro names" do
|
38
42
|
expect(name.macro).to be == 'FOO_BAR'
|
39
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: build
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: build-graph
|
@@ -200,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
200
200
|
- !ruby/object:Gem::Version
|
201
201
|
version: '0'
|
202
202
|
requirements: []
|
203
|
-
rubygems_version: 3.0.
|
203
|
+
rubygems_version: 3.0.3
|
204
204
|
signing_key:
|
205
205
|
specification_version: 4
|
206
206
|
summary: Build is a framework for working with task based build systems.
|