dogfood 0.1.0 → 0.1.1
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/dogfood/cli.rb +22 -4
- data/lib/dogfood/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 93baf06e414b181624c84decd7ba9fb434c983cbdb72c46c98fed78e597ff1c3
|
|
4
|
+
data.tar.gz: 2d8cc07a607a74be6fa67f1e04279e3e600c250230b6ec3accfea0f6afd1a3a8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 480f7e8463937d4f2ea1ba4f393dd2b816956898cc9f70db90d9c3477d624519c0ad3728a0d98f34f7769aec2efe60c6c0f427046b2a3f9dd603f89cb5acb0bd
|
|
7
|
+
data.tar.gz: ff98caf2d27c13948dc4b87097502f85e5cbe3ed979545a919cb33cd467ad9655cefef852c5d97e113b7a576680ae3771f581ea5ab1be1db2ee1ad6063b3ae19
|
data/lib/dogfood/cli.rb
CHANGED
|
@@ -63,7 +63,7 @@ module Dogfood
|
|
|
63
63
|
FileUtils.mkdir_p(File.dirname(@options[:output]))
|
|
64
64
|
File.write(@options[:output], output)
|
|
65
65
|
|
|
66
|
-
puts "Generated
|
|
66
|
+
puts "Generated dogfood: #{@options[:output]}"
|
|
67
67
|
puts "Days: #{result[:days].length}"
|
|
68
68
|
puts "Seed: #{result[:seed]}"
|
|
69
69
|
end
|
|
@@ -144,12 +144,30 @@ module Dogfood
|
|
|
144
144
|
|
|
145
145
|
def explain_scenario(name)
|
|
146
146
|
klass = Dogfood::Pack.current.find_scenario(name)
|
|
147
|
-
|
|
147
|
+
|
|
148
|
+
if klass.respond_to?(:compiled_ast)
|
|
149
|
+
puts Dogfood::DSL::ExplainRenderer.new(klass.compiled_ast).render
|
|
150
|
+
else
|
|
151
|
+
puts render_ruby_story(name, klass)
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Ruby story classes have no compiled AST (that only exists for YAML
|
|
156
|
+
# scenarios). Fall back to introspecting the class for an explain view.
|
|
157
|
+
def render_ruby_story(name, klass)
|
|
158
|
+
lines = []
|
|
159
|
+
lines << "Scenario: #{name}"
|
|
160
|
+
lines << "Title: #{klass.new(rng: Dogfood::Randomness.new(seed: 0), id: 'WO-000').title}"
|
|
161
|
+
lines << "Type: Ruby story class"
|
|
162
|
+
lines << ""
|
|
163
|
+
lines << "This scenario is implemented as a Ruby class (#{klass.name}) rather than a YAML file."
|
|
164
|
+
lines << "Run it with `--scenario #{name}` (without --dry-run) to see its generated steps."
|
|
165
|
+
lines.join("\n")
|
|
148
166
|
end
|
|
149
167
|
|
|
150
168
|
def default_output_path
|
|
151
169
|
timestamp = Time.now.strftime("%Y-%m-%d-%H%M%S")
|
|
152
|
-
"tmp/
|
|
170
|
+
"tmp/dogfood/#{timestamp}-dogfood.md"
|
|
153
171
|
end
|
|
154
172
|
|
|
155
173
|
def print_help
|
|
@@ -163,7 +181,7 @@ module Dogfood
|
|
|
163
181
|
--fleet-ratio RATIO Fraction of fleet stories (default: 0.25)
|
|
164
182
|
--seed N Set random seed for reproducibility
|
|
165
183
|
--random Use a random seed (prints it)
|
|
166
|
-
--output PATH, -o PATH Output file path (default: tmp/
|
|
184
|
+
--output PATH, -o PATH Output file path (default: tmp/dogfood/<timestamp>.md)
|
|
167
185
|
--list, -l List available scenarios
|
|
168
186
|
--explain FILE Compile FILE and print the stage/decision tree, no RNG
|
|
169
187
|
--dry-run --scenario N Same as --explain but takes a registered name
|
data/lib/dogfood/version.rb
CHANGED