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 extensions

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



189
190
191
192
193
194
195
196
197
198
199
# File 'lib/plushie.rb', line 189

def initialize
  @binary_path = nil
  @source_path = nil
  @build_name = "plushie-custom"
  @extensions = []
  @extension_config = {}
  @test_backend = nil
  @artifacts = [:bin]
  @bin_file = nil
  @wasm_dir = nil
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>)


175
176
177
# File 'lib/plushie.rb', line 175

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)


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

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)


144
145
146
# File 'lib/plushie.rb', line 144

def binary_path
  @binary_path
end

#build_nameString

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

Returns:

  • (String)


155
156
157
# File 'lib/plushie.rb', line 155

def build_name
  @build_name
end

#extension_configHash

Runtime configuration map passed to widget extensions via the Settings wire message. Keyed by extension config_key.

Returns:

  • (Hash)


164
165
166
# File 'lib/plushie.rb', line 164

def extension_config
  @extension_config
end

#extensionsArray<Class>

Extension classes to include in custom builds.

Returns:

  • (Array<Class>)


159
160
161
# File 'lib/plushie.rb', line 159

def extensions
  @extensions
end

#source_pathString?

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

Returns:

  • (String, nil)


149
150
151
# File 'lib/plushie.rb', line 149

def source_path
  @source_path
end

#test_backendSymbol?

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

Returns:

  • (Symbol, nil)


169
170
171
# File 'lib/plushie.rb', line 169

def test_backend
  @test_backend
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)


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

def wasm_dir
  @wasm_dir
end