Module: ReactManifest

Defined in:
lib/react_manifest.rb,
lib/react_manifest/railtie.rb,
lib/react_manifest/scanner.rb,
lib/react_manifest/version.rb,
lib/react_manifest/watcher.rb,
lib/react_manifest/reporter.rb,
lib/react_manifest/generator.rb,
lib/react_manifest/view_helpers.rb,
lib/react_manifest/configuration.rb,
lib/react_manifest/dependency_map.rb,
lib/react_manifest/tree_classifier.rb,
lib/react_manifest/application_analyzer.rb,
lib/react_manifest/application_migrator.rb

Defined Under Namespace

Modules: ViewHelpers, Watcher Classes: ApplicationAnalyzer, ApplicationMigrator, Configuration, DependencyMap, Generator, Railtie, Reporter, Scanner, TreeClassifier

Constant Summary collapse

VERSION =
"0.2.8".freeze

Class Method Summary collapse

Class Method Details

.configurationObject



17
18
19
# File 'lib/react_manifest.rb', line 17

def configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



21
22
23
# File 'lib/react_manifest.rb', line 21

def configure
  yield configuration
end

.reset!Object



25
26
27
# File 'lib/react_manifest.rb', line 25

def reset!
  @configuration = nil
end

.resolve_bundles(ctrl_name) ⇒ Object

Returns the ordered list of bundle logical names for a given controller. Used by the react_bundle_tag view helper.



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/react_manifest.rb', line 31

def resolve_bundles(ctrl_name)
  config  = configuration
  bundles = []

  # 1. Shared bundle always first
  shared = resolve_bundle_reference(config, config.shared_bundle)
  bundles << shared if shared

  # 2. always_include bundles (e.g. ux_main)
  config.always_include.each do |b|
    resolved = resolve_bundle_reference(config, b)
    bundles << resolved if resolved && !bundles.include?(resolved)
  end

  # 3. Controller-specific bundle
  # Try fully-namespaced first: admin/users → ux_admin_users
  # Then drop segments: ux_admin
  controller_candidates(ctrl_name).each do |candidate|
    resolved = resolve_bundle_reference(config, candidate)
    if resolved && !bundles.include?(resolved)
      bundles << resolved
      break
    end
  end

  bundles
end