phlex-rails 2.0.0.beta1 → 2.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eba6c0a4545578f13da48e443ca0751b5549eefd6cb9b2f866d0cfe436f5451b
4
- data.tar.gz: 21695f056968e79c6f692328d2666b9933fbf63ef3def64a46eced386019faaa
3
+ metadata.gz: 884bb8de02703c59d0756050a402a853af780a4c9bc37805483d3446b17acdb2
4
+ data.tar.gz: de4bd44c31da7580ec9c158d1d004b03c3be89b419b78abc5c6eb9b67b97e1c0
5
5
  SHA512:
6
- metadata.gz: cece72abf570509143731193eaf0052c4a724ee294bf022b041751dc36e832e139cb808db3eb1ffd3d77a8fb41bc22c4013ad1824b86bc3fe3455a28c41d8c3a
7
- data.tar.gz: afa2c05f30141978622fb6f964d426742e2ce772bfb3c0752b470f6e44217ac7f00f6800d975f6305a4b1cd498ed98ff613fbdb8a3202c02b155554791a81ff2
6
+ metadata.gz: 20f911fd5441cbca7281b63c94b4d1f3ef8b604c88550b5e0b1c4889eab9286f827430a7e05cd35b3be8c49d9d0679f781c33ee8d0e7a6d8bdfbf3676d3a54bd
7
+ data.tar.gz: 0a096db9f03bc6164b5cf951128a2b751d2de052588aea26f1a8c82a36d125798c198fbd32b06ebce2e0b6c65c52158f8d17e0d61586408307cd98808266e84b
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Generates a new Phlex component
3
+
4
+ Example:
5
+ rails generate phlex:component Sidebar
6
+
7
+ This will create:
8
+ app/components/sidebar.rb
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Components::<%= class_name %> < Components::Base
4
+ def view_template
5
+ h1 { "<%= class_name %>" }
6
+ p { "Find me in <%= @path %>" }
7
+ end
8
+ end
@@ -0,0 +1,10 @@
1
+ Description:
2
+ Installs Phlex
3
+
4
+ Example:
5
+ rails generate phlex:install
6
+
7
+ This will create:
8
+ app/views/base.rb
9
+ app/components/base.rb
10
+ app/initializers/phlex.rb
@@ -10,7 +10,7 @@ module Phlex::Generators
10
10
  if tailwind_configuration_path
11
11
  insert_into_file tailwind_configuration_path, after: "content: [" do
12
12
  "\n './app/views/**/*.rb', // Phlex views" \
13
- "\n './app/components/**/*.rb', // Phlex components" \
13
+ "\n './app/components/**/*.rb', // Phlex components" \
14
14
  end
15
15
  end
16
16
  end
@@ -23,10 +23,6 @@ module Phlex::Generators
23
23
  template "base_view.rb.erb", Rails.root.join("app/views/base.rb")
24
24
  end
25
25
 
26
- def create_hello_component
27
- template "hello_component.rb.erb", Rails.root.join("app/components/hello.rb")
28
- end
29
-
30
26
  def create_initializer
31
27
  template "phlex.rb.erb", Rails.root.join("config/initializers/phlex.rb")
32
28
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Components::Base < Phlex::HTML
4
+ include Components
5
+
6
+ # Include any helpers you want to be available across all components
7
+ include Phlex::Rails::Helpers::Routes
8
+
9
+ if Rails.env.development?
10
+ def before_template
11
+ comment { "Before #{self.class.name}" }
12
+ super
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Views::Base < Components::Base
4
+ # The ApplicationView is an abstract class for all your views.
5
+
6
+ # By default, it inherits from `ApplicationComponent`, but you
7
+ # can change that to `Phlex::HTML` if you want to keep views and
8
+ # components independent.
9
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Views
4
+ end
5
+
6
+ module Components
7
+ extend Phlex::Kit
8
+ end
9
+
10
+ Rails.autoloaders.main.push_dir(
11
+ "#{Rails.root}/app/views", namespace: Views
12
+ )
13
+
14
+ Rails.autoloaders.main.push_dir(
15
+ "#{Rails.root}/app/components", namespace: Components
16
+ )
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Generates a Phlex view with the given name
3
+
4
+ Example:
5
+ rails generate phlex:view Articles::Index
6
+
7
+ This will create:
8
+ app/views/articles/index.rb
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Views::<%= "#{namespace}::" if namespaced? %><%= class_name %> < Views::Base
4
+ def view_template
5
+ h1 { "<%= class_name %>" }
6
+ p { "Find me in <%= @path %>" }
7
+ end
8
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Phlex
4
4
  module Rails
5
- VERSION = "2.0.0.beta1"
5
+ VERSION = "2.0.0.beta2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phlex-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta1
4
+ version: 2.0.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Drapper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-12 00:00:00.000000000 Z
11
+ date: 2024-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: phlex
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.0.beta1
19
+ version: 2.0.0.beta2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.0.0.beta1
26
+ version: 2.0.0.beta2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: railties
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -53,8 +53,16 @@ extra_rdoc_files: []
53
53
  files:
54
54
  - LICENSE.txt
55
55
  - README.md
56
+ - lib/generators/phlex/component/USAGE
56
57
  - lib/generators/phlex/component/component_generator.rb
58
+ - lib/generators/phlex/component/templates/component.rb.erb
59
+ - lib/generators/phlex/install/USAGE
57
60
  - lib/generators/phlex/install/install_generator.rb
61
+ - lib/generators/phlex/install/templates/base_component.rb.erb
62
+ - lib/generators/phlex/install/templates/base_view.rb.erb
63
+ - lib/generators/phlex/install/templates/phlex.rb.erb
64
+ - lib/generators/phlex/view/USAGE
65
+ - lib/generators/phlex/view/templates/view.rb.erb
58
66
  - lib/generators/phlex/view/view_generator.rb
59
67
  - lib/phlex-rails.rb
60
68
  - lib/phlex/rails.rb