We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eaab209 commit 35697edCopy full SHA for 35697ed
lib/generators/superform/install/install_generator.rb
@@ -1,9 +1,13 @@
1
+require "bundler"
2
+
3
class Superform::InstallGenerator < Rails::Generators::Base
4
source_root File.expand_path("templates", __dir__)
5
6
APPLICATION_CONFIGURATION_PATH = Rails.root.join("config/application.rb")
7
8
def install_phlex_rails
9
+ return if gem_in_bundle? "phlex-rails"
10
11
gem "phlex-rails"
12
generate "phlex:install"
13
end
@@ -21,4 +25,9 @@ def autoload_components
21
25
def create_application_form
22
26
template "application_form.rb", Rails.root.join("app/views/forms/application_form.rb")
23
27
28
29
+ private
30
+ def gem_in_bundle?(gem_name)
31
+ Bundler.load.specs.any? { |spec| spec.name == gem_name }
32
+ end
24
33
0 commit comments