Class: SchemaFerry::Pipeline
- Inherits:
-
Object
- Object
- SchemaFerry::Pipeline
- Includes:
- Support::DropDetectable
- Defined in:
- lib/schema_ferry/pipeline.rb
Constant Summary
Constants included from Support::DropDetectable
Support::DropDetectable::DROP_LINE
Instance Method Summary collapse
- #apply!(allow_drops: true) ⇒ Object
- #dry_run ⇒ Object
-
#initialize(config) ⇒ Pipeline
constructor
A new instance of Pipeline.
Constructor Details
#initialize(config) ⇒ Pipeline
Returns a new instance of Pipeline.
7 8 9 |
# File 'lib/schema_ferry/pipeline.rb', line 7 def initialize(config) @config = config end |
Instance Method Details
#apply!(allow_drops: true) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/schema_ferry/pipeline.rb', line 15 def apply!(allow_drops: true) schemafile = build_schemafile unless allow_drops drops = detect_drops(write(schemafile, dry_run: true)) unless drops.empty? raise DropNotAllowedError, "refused: the diff contains drop(s):\n#{drops.join("\n")}" end end write(schemafile, dry_run: false) end |
#dry_run ⇒ Object
11 12 13 |
# File 'lib/schema_ferry/pipeline.rb', line 11 def dry_run write(build_schemafile, dry_run: true) end |