Sha256: f1499212870c113a72957775fde7fa173ea918fa38ae3e6263078625bf2c7b3f

Contents?: true

Size: 817 Bytes

Versions: 3

Compression:

Stored size: 817 Bytes

Contents

# frozen_string_literal: true

say "Installing Phlex..."

application_configuration_path = Rails.root.join("config/application.rb")
application_configuration_content = File.read(application_configuration_path)

pattern = %r(config.autoload_paths << (Rails.root.join\(.app.\)|.\#{root}/app.)\n)

unless application_configuration_content.match?(pattern)
	inject_into_class(
		application_configuration_path,
		"Application",
		%(    config.autoload_paths << "\#{root}/app"\n)
	)
end

unless Rails.root.join("app/views/application_view.rb").exist?
	create_file(Rails.root.join("app/views/application_view.rb"), <<~RUBY)
		# frozen_string_literal: true

		module Views
		  class ApplicationView < Phlex::View
		    include Rails.application.routes.url_helpers
		  end
		end
	RUBY
end

say "Phlex successfully installed!"

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
phlex-0.4.0 lib/install/phlex.rb
phlex-0.3.2 lib/install/phlex.rb
phlex-0.3.1 lib/install/phlex.rb