Sha256: b2898a1d0d7bf34b35766a383c909e7956f9805f06053fbd00134850754201cf

Contents?: true

Size: 1.88 KB

Versions: 8

Compression:

Stored size: 1.88 KB

Contents

require 'thor'
require 'active_support'

module Hippo
    class Webpack
        class ClientConfig < Thor::Group
            include Thor::Actions

            attr_reader :directory

            attr_reader :controlling_extension
            attr_reader :hippo_root_path
            attr_reader :extension_path

            attr_reader :module_paths

            ROOT = Pathname.new(__FILE__).dirname.join('..', '..', '..')

            def self.source_root
                Hippo::Configuration.apply
                Hippo::Extensions.load_controlling_config
                Hippo::Extensions.controlling.root_path
            end

            def set_vars
                @controlling_extension = Hippo::Extensions.controlling
                @hippo_root_path = ROOT
                @extension_path = controlling_extension.root_path
            end

            def make_temp_dir
                @directory = controlling_extension.root_path.join('tmp')
                @directory.mkdir unless @directory.exist?
            end

            def set_module_paths
                @module_paths = Extensions.map { |e| e.root_path.join('client').to_s }.reverse + [
                    controlling_extension.root_path.join('node_modules').to_s,
                    directory.to_s
                ]
            end

            def write_asset_files
                say "Generating config in #{directory}", :green
                opts = { verbose: false, force: true }
                template('config/jest.config.json',
                         directory.join('jest.config.json'), opts)
                template(ROOT.join('templates','js', 'config-data.js'),
                         directory.join('hippo/config-data.js'), opts)
                template(ROOT.join('templates','js', 'screen-definitions.js'),
                         directory.join('hippo/screen-definitions.js'), opts)
            end
        end
    end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hippo-fw-0.9.9 lib/hippo/webpack/client_config.rb
hippo-fw-0.9.8 lib/hippo/webpack/client_config.rb
hippo-fw-0.9.7 lib/hippo/webpack/client_config.rb
hippo-fw-0.9.6 lib/hippo/webpack/client_config.rb
hippo-fw-0.9.5 lib/hippo/webpack/client_config.rb
hippo-fw-0.9.4 lib/hippo/webpack/client_config.rb
hippo-fw-0.9.3 lib/hippo/webpack/client_config.rb
hippo-fw-0.9.2 lib/hippo/webpack/client_config.rb