Class: Plushie::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/plushie.rb

Overview

Global configuration for the Plushie SDK.

Examples:

Basic setup

Plushie.configure do |config|
  config.binary_path = "/opt/plushie/bin/plushie"
  config.source_path = "~/projects/plushie"
end

With custom widgets

Plushie.configure do |config|
  config.widgets = [MyGauge, MyChart]
  config.build_name = "my-dashboard-plushie"
  config.widget_config = {
    "sparkline" => {"max_samples" => 1000}
  }
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



216
217
218
219
220
221
222
223
224
225
226
227
# File 'lib/plushie.rb', line 216

def initialize
  @binary_path = nil
  @source_path = nil
  @build_name = "plushie-custom"
  @widgets = []
  @widget_config = {}
  @test_backend = nil
  @artifacts = [:bin]
  @bin_file = nil
  @wasm_dir = nil
  @validate_props = false
end

Instance Attribute Details

#artifactsArray<Symbol>

Which artifacts to install with download/build tasks. Default: +[:bin]+. Set to +[:bin, :wasm]+ for projects that need both the native binary and the WASM renderer.

Returns:

  • (Array<Symbol>)


197
198
199
# File 'lib/plushie.rb', line 197

def artifacts
  @artifacts
end

#bin_fileString?

Override destination path for the native binary. Used by +rake plushie:download+ and +rake plushie:build+. Env var +PLUSHIE_BIN_FILE+ takes precedence.

Returns:

  • (String, nil)


203
204
205
# File 'lib/plushie.rb', line 203

def bin_file
  @bin_file
end

#binary_pathString?

Explicit path to the plushie binary. Overrides all resolution. Equivalent to PLUSHIE_BINARY_PATH env var.

Returns:

  • (String, nil)


166
167
168
# File 'lib/plushie.rb', line 166

def binary_path
  @binary_path
end

#build_nameString

Custom binary name for native widget builds. Defaults to "plushie-custom". Used as the Cargo binary target name and the installed filename.

Returns:

  • (String)


177
178
179
# File 'lib/plushie.rb', line 177

def build_name
  @build_name
end

#source_pathString?

Path to the plushie Rust source checkout. Used by rake plushie:build. Equivalent to PLUSHIE_RUST_SOURCE_PATH env var.

Returns:

  • (String, nil)


171
172
173
# File 'lib/plushie.rb', line 171

def source_path
  @source_path
end

#test_backendSymbol?

Test backend (:mock, :headless, :windowed). Equivalent to PLUSHIE_TEST_BACKEND env var.

Returns:

  • (Symbol, nil)


191
192
193
# File 'lib/plushie.rb', line 191

def test_backend
  @test_backend
end

#validate_propsBoolean

Enable renderer-side prop validation. When true, the renderer emits diagnostic events for unknown or invalid props.

Returns:

  • (Boolean)


214
215
216
# File 'lib/plushie.rb', line 214

def validate_props
  @validate_props
end

#wasm_dirString?

Override output directory for WASM renderer files. Used by +rake plushie:download+. Env var +PLUSHIE_WASM_DIR+ takes precedence.

Returns:

  • (String, nil)


209
210
211
# File 'lib/plushie.rb', line 209

def wasm_dir
  @wasm_dir
end

#widget_configHash

Runtime configuration map passed to native widgets via the Settings wire message. Keyed by widget type.

Returns:

  • (Hash)


186
187
188
# File 'lib/plushie.rb', line 186

def widget_config
  @widget_config
end

#widgetsArray<Class>

Widget classes to include in custom builds.

Returns:

  • (Array<Class>)


181
182
183
# File 'lib/plushie.rb', line 181

def widgets
  @widgets
end