Class: Everywhere::Config

Inherits:
Object
  • Object
show all
Includes:
App, Auth, Data, DeepLinking, DesktopUi, Mobile, NativeDesktop, NativeMobile, Shell, Updates
Defined in:
lib/everywhere/config.rb,
lib/everywhere/config/app.rb,
lib/everywhere/config/auth.rb,
lib/everywhere/config/data.rb,
lib/everywhere/config/shell.rb,
lib/everywhere/config/mobile.rb,
lib/everywhere/config/updates.rb,
lib/everywhere/config/desktop_ui.rb,
lib/everywhere/config/deep_linking.rb,
lib/everywhere/config/native_mobile.rb,
lib/everywhere/config/native_desktop.rb

Overview

Loads config/everywhere.yml:

app:
name: My Really Awesome App
entry_path: /dashboard        # initial url on app launch
appearance:
tint_color: "#CC342D"         # a hex string...
background_color:             # ...or split by system theme
  light: "#FAF9F7"
  dark: "#1C1B1A"

Colors always normalize to { "light" => ..., "dark" => ... }.

Defined Under Namespace

Modules: App, Auth, Data, DeepLinking, DesktopUi, Mobile, NativeDesktop, NativeMobile, Shell, Updates

Constant Summary collapse

FILE =
File.join("config", "everywhere.yml")
PERMITTED_YAML_CLASSES =

Dates, times and symbols are permitted rather than fatal: an unquoted version: 2026-07-25 or mode: :remote is a typo of a string, and every value here is read as one anyway — dying on it would be theatre.

[Date, Time, Symbol].freeze

Constants included from NativeDesktop

NativeDesktop::CRATE_FEATURE, NativeDesktop::CRATE_GIT_URL, NativeDesktop::CRATE_NAME, NativeDesktop::CRATE_VERSION, NativeDesktop::RUST_FN_NAME

Constants included from NativeMobile

NativeMobile::ANDROID_ICON_FONTS, NativeMobile::DEFAULT_ANDROID_ICON_FONT, NativeMobile::KOTLIN_TYPE_NAME, NativeMobile::MAVEN_COORDINATE, NativeMobile::MAVEN_SEGMENT, NativeMobile::NATIVE_LANGUAGES, NativeMobile::NATIVE_TYPE_NAMES, NativeMobile::PACKAGE_REQUIREMENT_KEYS, NativeMobile::PACKAGE_URL, NativeMobile::PACKAGE_VERSION, NativeMobile::SCREEN_IDENTIFIER, NativeMobile::SWIFT_TYPE_NAME

Constants included from Mobile

Mobile::ANDROID_PERMISSIONS, Mobile::DEFAULT_TAB_ICONS, Mobile::IOS_USAGE_KEYS, Mobile::MOBILE_PATH_RULES, Mobile::MOBILE_PERMISSIONS

Constants included from Auth

Auth::DEFAULT_OAUTH_PATHS, Auth::URL_SCHEME

Constants included from DesktopUi

DesktopUi::WINDOW_TITLE_BARS

Constants included from Updates

Updates::UPDATES_LOOPBACK

Constants included from App

App::BUNDLE_ID

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Shell

#native_lazy_load_tabs, #native_splash_min_seconds, #to_shell_hash, #to_shell_json

Methods included from DeepLinking

#apple_app_site_association, #apple_app_site_association_json, #asset_links, #asset_links_json, #deep_linking, #deep_linking?, #deep_linking_android, #deep_linking_android?, #deep_linking_android_fingerprints, #deep_linking_android_package, #deep_linking_apple?, #deep_linking_apple_app_ids, #deep_linking_domains, #deep_linking_paths

Methods included from NativeDesktop

#native_desktop, #native_desktop?, #native_desktop_commands, #native_desktop_crate_errors, #native_desktop_crates, #native_desktop_errors, #native_desktop_setup?

Methods included from NativeMobile

#native_android, #native_android?, #native_android_components, #native_android_errors, #native_android_icon_font, #native_android_icon_font_codepoints, #native_android_icon_font_errors, #native_android_icon_font_fetched?, #native_android_icon_font_file, #native_android_icons?, #native_android_lazy_load_tabs, #native_android_package_errors, #native_android_packages, #native_android_packages?, #native_android_screens, #native_android_splash, #native_android_splash_min_seconds, #native_ios, #native_ios?, #native_ios_components, #native_ios_errors, #native_ios_lazy_load_tabs, #native_ios_package_errors, #native_ios_packages, #native_ios_packages?, #native_ios_screens, #native_ios_splash, #native_ios_splash_min_seconds, #package_identity

Methods included from Mobile

#android_manifest_permissions, #android_screen_properties, #mobile_rules, #path_configuration_hash, #path_configuration_json, #permission_errors, #permissions, #tabs, #tabs_for

Methods included from Auth

#auth, #auth_cookie?, #auth_errors, #auth_scheme, #auth_shell_hash, #auth_token_ttl, #oauth?, #oauth_path?, #oauth_paths

Methods included from DesktopUi

#menu, #tray, #window, #window_drag_height, #window_errors, #window_min_size, #window_resizable, #window_shell_hash, #window_size, #window_title, #window_title_bar

Methods included from Updates

#updates, #updates_auto, #updates_channel, #updates_errors, #updates_interval, #updates_public_key, #updates_s3, #updates_shell_hash, #updates_url

Methods included from App

#background_color, #build, #build_capabilities, #build_ruby, #build_target_specs, #bundle_id, #entry_path, #icon, #identity_errors, #mode, #name, #remote?, #remote_instances?, #remote_url, #splash, #targets, #tint_color, #version

Constructor Details

#initialize(data, root) ⇒ Config

Returns a new instance of Config.



82
83
84
85
# File 'lib/everywhere/config.rb', line 82

def initialize(data, root)
  @data = data
  @root = root
end

Instance Attribute Details

#rootObject (readonly)

Returns the value of attribute root.



80
81
82
# File 'lib/everywhere/config.rb', line 80

def root
  @root
end

Class Method Details

.channel_of(target) ⇒ Object

A target may carry a ":" suffix ("ios-arm64:testflight") that selects the distribution channel for THAT target. nil when it doesn't.



95
96
97
98
# File 'lib/everywhere/config.rb', line 95

def self.channel_of(target)
  suffix = target.to_s.split(":", 2)[1]
  suffix unless suffix.nil? || suffix.empty?
end

.load(root = Dir.pwd) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/everywhere/config.rb', line 57

def self.load(root = Dir.pwd)
  path = File.join(root, FILE)
  return new({}, root) unless File.exist?(path)

  data = YAML.safe_load_file(path, aliases: true, permitted_classes: PERMITTED_YAML_CLASSES)
  data = {} if data.nil? || data == false
  unless data.is_a?(Hash)
    # Raise, never die!: this also runs inside the packaged app's request
    # middleware, where a SystemExit would take the whole server down —
    # runtime callers rescue and keep the last good config, and the CLI's
    # top-level handler renders an Error just as cleanly.
    raise Everywhere::Error,
          "#{UI.short_path(path)} must be a mapping of sections (app:, build:, …), not a #{data.class}"
  end

  new(data, root)
rescue Psych::Exception => e
  # Psych prefixes syntax errors with the absolute path; the line/column
  # tail is the useful half, and we've already named the file.
  detail = e.message.sub(/\A\(#{Regexp.escape(path)}\):\s*/, "")
  raise Everywhere::Error, "#{UI.short_path(path)} isn't valid YAML: #{detail}"
end

.os_of(target) ⇒ Object

Every target (os-arch string) resolves to a single platform (its os), and a platform may override the app-level identity/version keys — see platforms: below. Pass target: to any of these accessors to apply the matching override; omit it for the shared app-level value.



91
# File 'lib/everywhere/config.rb', line 91

def self.os_of(target) = target.to_s.split("-", 2).first