Skip to content

Commit 1ac6f87

Browse files
committed
Update generators
Fix path references and remove the components kit include
1 parent c5fb8ee commit 1ac6f87

File tree

5 files changed

+6
-16
lines changed

5 files changed

+6
-16
lines changed

lib/generators/phlex/component/component_generator.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,8 @@ class ComponentGenerator < BaseGenerator
77
set_source_root "component.rb.erb", __dir__
88

99
def create_component
10-
template "component.rb.erb", File.join(
11-
destination_root,
12-
"app/components",
13-
class_path,
14-
"#{file_name}.rb"
15-
)
10+
@component_path = File.join("app", "components", class_path, "#{file_name}.rb")
11+
template "component.rb.erb", File.join(destination_root, @component_path)
1612
end
1713
end
1814
end

lib/generators/phlex/component/templates/component.rb.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
class Components::<%= class_name %> < Components::Base
44
def view_template
55
h1 { "<%= class_name %>" }
6-
p { "Find me in <%= @path %>" }
6+
p { "Find me in <%= @component_path %>" }
77
end
88
end

lib/generators/phlex/install/templates/base_component.rb.erb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# frozen_string_literal: true
22

33
class Components::Base < Phlex::HTML
4-
include Components
5-
64
# Include any helpers you want to be available across all components
75
include Phlex::Rails::Helpers::Routes
86

lib/generators/phlex/view/templates/view.rb.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
class Views::<%= "#{namespace}::" if namespaced? %><%= class_name %> < Views::Base
44
def view_template
55
h1 { "<%= class_name %>" }
6-
p { "Find me in <%= @path %>" }
6+
p { "Find me in <%= @view_path %>" }
77
end
88
end

lib/generators/phlex/view/view_generator.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,8 @@ class ViewGenerator < BaseGenerator
77
set_source_root "view.rb.erb", __dir__
88

99
def create_view
10-
template "view.rb.erb", File.join(
11-
destination_root,
12-
"app/views",
13-
class_path,
14-
"#{file_name}.rb"
15-
)
10+
@view_path = File.join("app", "views", class_path, "#{file_name}.rb")
11+
template "view.rb.erb", File.join(destination_root, @view_path)
1612
end
1713
end
1814
end

0 commit comments

Comments
 (0)