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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8f5e84e866312bd228f0fa94068f9a1553c52ef15221e541f933f3713c6ca84
4
- data.tar.gz: 382acac5d2fddd967522af9f7c97a7a2dde1ab73a12dc67655a31ce3ee7108cc
3
+ metadata.gz: 93baf06e414b181624c84decd7ba9fb434c983cbdb72c46c98fed78e597ff1c3
4
+ data.tar.gz: 2d8cc07a607a74be6fa67f1e04279e3e600c250230b6ec3accfea0f6afd1a3a8
5
5
  SHA512:
6
- metadata.gz: e3876f850dcd5bcc59b58728ad4df5090400ae2fd6ad7391edd9a2f26db9a48104f416c7300810a252d4907ae9eadb1aa0bf5fc160c737eb95189739784e55c2
7
- data.tar.gz: b1f219bb17809b21fbb1ddcaaf44941bb47c30497513c27341a24a366d453f5eec8c293702a9ea6ffaf39613b255e37dec6df22376a5b3128bd37f97c8087db2
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 simulation: #{@options[:output]}"
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
- puts Dogfood::DSL::ExplainRenderer.new(klass.compiled_ast).render
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/simulations/#{timestamp}-simulation.md"
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/simulations/<timestamp>.md)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dogfood
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dogfood
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben D'Angelo