Class: Mxrb::Writer
- Inherits:
-
Object
- Object
- Mxrb::Writer
- Defined in:
- lib/mxrb/writer.rb
Overview
Applies a DSL definition to a new or existing MPR. Names are used as the
stable key, making repeated mxrb generate runs idempotent.
Constant Summary collapse
- GLYPH_ICON_CODES =
{ 'home' => 57_377, 'pets' => 57_349, 'heart' => 57_349, 'calendar' => 57_609, 'calendar_today' => 57_609, 'user' => 57_352, 'search' => 57_347, 'settings' => 57_369, 'trash' => 57_376, 'file' => 57_378, 'time' => 57_379, 'shopping_cart' => 57_622 }.freeze
- LEGACY_NAVIGATION_PROFILES =
{ "Desktop" => "DesktopProfile", "Tablet" => "TabletProfile", "Phone" => "PhoneProfile", "OfflinePhone" => "OfflinePhoneProfile", "HybridPhone" => "HybridPhoneProfile6", "HybridTablet" => "HybridTabletProfile6" }.freeze
Instance Method Summary collapse
-
#initialize(path, definition) ⇒ Writer
constructor
A new instance of Writer.
- #write! ⇒ Object
Constructor Details
#initialize(path, definition) ⇒ Writer
Returns a new instance of Writer.
31 32 33 34 |
# File 'lib/mxrb/writer.rb', line 31 def initialize(path, definition) @path = File.(path) @definition = definition end |
Instance Method Details
#write! ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/mxrb/writer.rb', line 36 def write! create_project! unless File.exist?(@path) mpr = IO::MprFile.open(@path) mpr.transaction do apply(mpr) mpr.write_architecture_definition(@definition) end materialize_project_assets materialize_design_system self ensure mpr&.close end |