bake 0.18.0 → 0.18.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/bake/input.rb +26 -0
- data/bake/output.rb +24 -0
- data/lib/bake/documentation.rb +1 -1
- data/lib/bake/loaders.rb +2 -2
- data/lib/bake/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +4 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45dc14db128a03b0d45937817bbbf8b2d74d1762c5eb09706334113b1bcf2102
|
4
|
+
data.tar.gz: 6ecb1fe731b1440fc73a831d182b00d134d5b8572ac8d37a2f4b7ec188b5af46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75621544ab473d069454794226b840adfb5e670eb3c7ccecd0cc197122b9a3d06e6541d16ab4819ee4037c284eac91da8defd2a45ef747ccfac2e285368f5681
|
7
|
+
data.tar.gz: '068df1863a48a29cacc02d5ad64b98b8f5af0d6c03b82334699894932fa8aee26e258e8bcf27aab3929680b6c46aa01ba24a5512fe161d226eede9d87c73350f'
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/bake/input.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
FORMATS = {
|
3
|
+
json: ->(file){require 'json'; JSON.parse(file.read)},
|
4
|
+
yaml: ->(file){require 'yaml'; YAML.load(file.read)},
|
5
|
+
}
|
6
|
+
|
7
|
+
# Parse an input file (defaulting to stdin) in the specified format (defaulting to JSON).
|
8
|
+
# @parameter file [Input] The input file.
|
9
|
+
# @parameter format [Symbol] The input format, e.g. json, yaml.
|
10
|
+
def input(file: $stdin, format: :json)
|
11
|
+
format_for(format).call(file)
|
12
|
+
end
|
13
|
+
|
14
|
+
# Parse some input text in the specified format (defaulting to JSON).
|
15
|
+
# @parameter text [String] The input text.
|
16
|
+
# @parameter format [Symbol] The input format, e.g. json, yaml.
|
17
|
+
def parse(text, format: :json)
|
18
|
+
file = StringIO.new(text)
|
19
|
+
format_for(format).call(file)
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def format_for(name)
|
25
|
+
FORMATS[name]
|
26
|
+
end
|
data/bake/output.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
FORMATS = {
|
3
|
+
json: ->(file, value){require 'json'; file.puts(JSON.pretty_generate(value))},
|
4
|
+
pp: ->(file, value){require 'pp'; PP.pp(value, file)},
|
5
|
+
raw: ->(file, value){file.puts(value)},
|
6
|
+
yaml: ->(file, value){require 'yaml'; file.puts(YAML.dump(value))},
|
7
|
+
}
|
8
|
+
|
9
|
+
# Dump the last result to the specified file (defaulting to stdout) in the specified format (defaulting to Ruby's pretty print).
|
10
|
+
# @parameter input [Array(Integer)]
|
11
|
+
# @parameter file [Output] The input file.
|
12
|
+
# @parameter format [Symbol] The output format.
|
13
|
+
def output(input:, file: $stdout, format: :pp)
|
14
|
+
format_for(format).call(file, input)
|
15
|
+
|
16
|
+
# Allow chaining of output processing:
|
17
|
+
return input
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def format_for(name)
|
23
|
+
FORMATS[name]
|
24
|
+
end
|
data/lib/bake/documentation.rb
CHANGED
@@ -81,7 +81,7 @@ module Bake
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
-
PARAMETER = /\A
|
84
|
+
PARAMETER = /\A@param(eter)?\s+(?<name>.*?)\s+\[(?<type>.*?)\](\s+(?<details>.*?))?\z/
|
85
85
|
|
86
86
|
# The parameter lines of the comment block.
|
87
87
|
# e.g. `@parameter value [String] The value.`
|
data/lib/bake/loaders.rb
CHANGED
@@ -83,6 +83,8 @@ module Bake
|
|
83
83
|
# @parameter current [String] The path to start searching from.
|
84
84
|
def append_from_root(current = Dir.pwd, **options)
|
85
85
|
while current
|
86
|
+
Console.logger.debug(self) {"Checking current #{current}..."}
|
87
|
+
|
86
88
|
append_path(current, **options)
|
87
89
|
|
88
90
|
parent = File.dirname(current)
|
@@ -97,8 +99,6 @@ module Bake
|
|
97
99
|
|
98
100
|
# Enumerate all loaded gems and add them.
|
99
101
|
def append_from_gems
|
100
|
-
Console.logger.debug(self) {::Gem.loaded_specs.keys.grep(/bake/)}
|
101
|
-
|
102
102
|
::Gem.loaded_specs.each do |name, spec|
|
103
103
|
Console.logger.debug(self) {"Checking gem #{name}: #{spec.full_gem_path}..."}
|
104
104
|
|
data/lib/bake/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.18.
|
4
|
+
version: 0.18.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -102,6 +102,8 @@ executables:
|
|
102
102
|
extensions: []
|
103
103
|
extra_rdoc_files: []
|
104
104
|
files:
|
105
|
+
- bake/input.rb
|
106
|
+
- bake/output.rb
|
105
107
|
- bin/bake
|
106
108
|
- lib/bake.rb
|
107
109
|
- lib/bake/arguments.rb
|
@@ -151,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
153
|
- !ruby/object:Gem::Version
|
152
154
|
version: '0'
|
153
155
|
requirements: []
|
154
|
-
rubygems_version: 3.3.
|
156
|
+
rubygems_version: 3.3.7
|
155
157
|
signing_key:
|
156
158
|
specification_version: 4
|
157
159
|
summary: A replacement for rake with a simpler syntax.
|
metadata.gz.sig
CHANGED
Binary file
|