view_component_helper 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2a181c3cf10f982308ec54d811c0252ca343b05a9ac843f4c13cfda732afb237
4
+ data.tar.gz: ba82e95eae2d5e27205514364f581cc2cfac5344a7aa1ab7af2b1596d5f5dc4c
5
+ SHA512:
6
+ metadata.gz: 8a846d1d9ab0c176bfa09c71044122f2fd0103231b94e918559e930c405724b245b6ae75fb4675a8b19601e839747743106ee8202d4a4ee38feb24c40354ce4c
7
+ data.tar.gz: 4785a6ba4652646aea49f1f8f964fc36ccd38796d23dd5ea70472c0ea101ddbb60913e0b1d5f278a652c5383c9046ceb4114f1a41475f9c40a915cdaab9aab04
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2023-07-30
4
+
5
+ - Initial release
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in view_component_helper.gemspec
6
+ gemspec
7
+
8
+ gem "rails"
9
+ gem "view_component"
10
+
11
+ gem "rake", "~> 13.0"
12
+
13
+ gem "rspec", "~> 3.0"
14
+
15
+ gem "rubocop", "~> 1.21"
data/Gemfile.lock ADDED
@@ -0,0 +1,202 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ view_component_helper (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ actioncable (7.0.6)
10
+ actionpack (= 7.0.6)
11
+ activesupport (= 7.0.6)
12
+ nio4r (~> 2.0)
13
+ websocket-driver (>= 0.6.1)
14
+ actionmailbox (7.0.6)
15
+ actionpack (= 7.0.6)
16
+ activejob (= 7.0.6)
17
+ activerecord (= 7.0.6)
18
+ activestorage (= 7.0.6)
19
+ activesupport (= 7.0.6)
20
+ mail (>= 2.7.1)
21
+ net-imap
22
+ net-pop
23
+ net-smtp
24
+ actionmailer (7.0.6)
25
+ actionpack (= 7.0.6)
26
+ actionview (= 7.0.6)
27
+ activejob (= 7.0.6)
28
+ activesupport (= 7.0.6)
29
+ mail (~> 2.5, >= 2.5.4)
30
+ net-imap
31
+ net-pop
32
+ net-smtp
33
+ rails-dom-testing (~> 2.0)
34
+ actionpack (7.0.6)
35
+ actionview (= 7.0.6)
36
+ activesupport (= 7.0.6)
37
+ rack (~> 2.0, >= 2.2.4)
38
+ rack-test (>= 0.6.3)
39
+ rails-dom-testing (~> 2.0)
40
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
41
+ actiontext (7.0.6)
42
+ actionpack (= 7.0.6)
43
+ activerecord (= 7.0.6)
44
+ activestorage (= 7.0.6)
45
+ activesupport (= 7.0.6)
46
+ globalid (>= 0.6.0)
47
+ nokogiri (>= 1.8.5)
48
+ actionview (7.0.6)
49
+ activesupport (= 7.0.6)
50
+ builder (~> 3.1)
51
+ erubi (~> 1.4)
52
+ rails-dom-testing (~> 2.0)
53
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
54
+ activejob (7.0.6)
55
+ activesupport (= 7.0.6)
56
+ globalid (>= 0.3.6)
57
+ activemodel (7.0.6)
58
+ activesupport (= 7.0.6)
59
+ activerecord (7.0.6)
60
+ activemodel (= 7.0.6)
61
+ activesupport (= 7.0.6)
62
+ activestorage (7.0.6)
63
+ actionpack (= 7.0.6)
64
+ activejob (= 7.0.6)
65
+ activerecord (= 7.0.6)
66
+ activesupport (= 7.0.6)
67
+ marcel (~> 1.0)
68
+ mini_mime (>= 1.1.0)
69
+ activesupport (7.0.6)
70
+ concurrent-ruby (~> 1.0, >= 1.0.2)
71
+ i18n (>= 1.6, < 2)
72
+ minitest (>= 5.1)
73
+ tzinfo (~> 2.0)
74
+ ast (2.4.2)
75
+ builder (3.2.4)
76
+ concurrent-ruby (1.2.2)
77
+ crass (1.0.6)
78
+ date (3.3.3)
79
+ diff-lcs (1.5.0)
80
+ erubi (1.12.0)
81
+ globalid (1.1.0)
82
+ activesupport (>= 5.0)
83
+ i18n (1.14.1)
84
+ concurrent-ruby (~> 1.0)
85
+ json (2.6.3)
86
+ loofah (2.21.3)
87
+ crass (~> 1.0.2)
88
+ nokogiri (>= 1.12.0)
89
+ mail (2.8.1)
90
+ mini_mime (>= 0.1.1)
91
+ net-imap
92
+ net-pop
93
+ net-smtp
94
+ marcel (1.0.2)
95
+ method_source (1.0.0)
96
+ mini_mime (1.1.2)
97
+ minitest (5.18.1)
98
+ net-imap (0.3.6)
99
+ date
100
+ net-protocol
101
+ net-pop (0.1.2)
102
+ net-protocol
103
+ net-protocol (0.2.1)
104
+ timeout
105
+ net-smtp (0.3.3)
106
+ net-protocol
107
+ nio4r (2.5.9)
108
+ nokogiri (1.15.3-x86_64-darwin)
109
+ racc (~> 1.4)
110
+ parallel (1.23.0)
111
+ parser (3.2.2.3)
112
+ ast (~> 2.4.1)
113
+ racc
114
+ racc (1.7.1)
115
+ rack (2.2.7)
116
+ rack-test (2.1.0)
117
+ rack (>= 1.3)
118
+ rails (7.0.6)
119
+ actioncable (= 7.0.6)
120
+ actionmailbox (= 7.0.6)
121
+ actionmailer (= 7.0.6)
122
+ actionpack (= 7.0.6)
123
+ actiontext (= 7.0.6)
124
+ actionview (= 7.0.6)
125
+ activejob (= 7.0.6)
126
+ activemodel (= 7.0.6)
127
+ activerecord (= 7.0.6)
128
+ activestorage (= 7.0.6)
129
+ activesupport (= 7.0.6)
130
+ bundler (>= 1.15.0)
131
+ railties (= 7.0.6)
132
+ rails-dom-testing (2.1.1)
133
+ activesupport (>= 5.0.0)
134
+ minitest
135
+ nokogiri (>= 1.6)
136
+ rails-html-sanitizer (1.6.0)
137
+ loofah (~> 2.21)
138
+ nokogiri (~> 1.14)
139
+ railties (7.0.6)
140
+ actionpack (= 7.0.6)
141
+ activesupport (= 7.0.6)
142
+ method_source
143
+ rake (>= 12.2)
144
+ thor (~> 1.0)
145
+ zeitwerk (~> 2.5)
146
+ rainbow (3.1.1)
147
+ rake (13.0.6)
148
+ regexp_parser (2.8.1)
149
+ rexml (3.2.5)
150
+ rspec (3.11.0)
151
+ rspec-core (~> 3.11.0)
152
+ rspec-expectations (~> 3.11.0)
153
+ rspec-mocks (~> 3.11.0)
154
+ rspec-core (3.11.0)
155
+ rspec-support (~> 3.11.0)
156
+ rspec-expectations (3.11.1)
157
+ diff-lcs (>= 1.2.0, < 2.0)
158
+ rspec-support (~> 3.11.0)
159
+ rspec-mocks (3.11.1)
160
+ diff-lcs (>= 1.2.0, < 2.0)
161
+ rspec-support (~> 3.11.0)
162
+ rspec-support (3.11.1)
163
+ rubocop (1.52.1)
164
+ json (~> 2.3)
165
+ parallel (~> 1.10)
166
+ parser (>= 3.2.2.3)
167
+ rainbow (>= 2.2.2, < 4.0)
168
+ regexp_parser (>= 1.8, < 3.0)
169
+ rexml (>= 3.2.5, < 4.0)
170
+ rubocop-ast (>= 1.28.0, < 2.0)
171
+ ruby-progressbar (~> 1.7)
172
+ unicode-display_width (>= 2.4.0, < 3.0)
173
+ rubocop-ast (1.29.0)
174
+ parser (>= 3.2.1.0)
175
+ ruby-progressbar (1.13.0)
176
+ thor (1.2.2)
177
+ timeout (0.4.0)
178
+ tzinfo (2.0.6)
179
+ concurrent-ruby (~> 1.0)
180
+ unicode-display_width (2.4.2)
181
+ view_component (2.82.0)
182
+ activesupport (>= 5.2.0, < 8.0)
183
+ concurrent-ruby (~> 1.0)
184
+ method_source (~> 1.0)
185
+ websocket-driver (0.7.5)
186
+ websocket-extensions (>= 0.1.0)
187
+ websocket-extensions (0.1.5)
188
+ zeitwerk (2.6.8)
189
+
190
+ PLATFORMS
191
+ x86_64-darwin-21
192
+
193
+ DEPENDENCIES
194
+ rails
195
+ rake (~> 13.0)
196
+ rspec (~> 3.0)
197
+ rubocop (~> 1.21)
198
+ view_component
199
+ view_component_helper!
200
+
201
+ BUNDLED WITH
202
+ 2.3.25
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 yapr llc (yamitake)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # ViewComponentHelper
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/view_component_helper`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Install the gem and add to the application's Gemfile by executing:
10
+
11
+ $ bundle add view_component_helper
12
+
13
+ If bundler is not being used to manage dependencies, install the gem by executing:
14
+
15
+ $ gem install view_component_helper
16
+
17
+ ## Usage
18
+
19
+ TODO: Write usage instructions here
20
+
21
+ ## Development
22
+
23
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
24
+
25
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
26
+
27
+ ## Contributing
28
+
29
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/view_component_helper.
30
+
31
+ ## License
32
+
33
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -0,0 +1,9 @@
1
+ require 'view_component_helper/view_helper'
2
+ module ViewComponentHelper
3
+ class Engine < ::Rails::Engine
4
+ isolate_namespace ViewComponentHelper
5
+ initializer 'view_component_helper.action_view_helpers' do
6
+ ActiveSupport.on_load(:action_view) { include ViewComponentHelper::ViewHelper }
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ViewComponentHelper
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,18 @@
1
+ module ViewComponentHelper
2
+ module ViewHelper
3
+ def render_view_component(path, *args, **kwargs, &)
4
+ render component_class_for(path).new(*args, **kwargs, &)
5
+ end
6
+
7
+ alias render_vc render_view_component
8
+
9
+ private
10
+
11
+ def component_class_for(path)
12
+ class_names = path.to_s.split("/")
13
+ component_name = class_names.map(&:capitalize).join("::")
14
+
15
+ component_name.constantize
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "view_component_helper/version"
4
+
5
+ module ViewComponentHelper
6
+ class Error < StandardError; end
7
+ end
@@ -0,0 +1,4 @@
1
+ module ViewComponentHelper
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/view_component_helper/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "view_component_helper"
7
+ spec.version = ViewComponentHelper::VERSION
8
+ spec.authors = ["yamitake"]
9
+ spec.email = ["take.yapr@gmail.com"]
10
+
11
+ spec.summary = "This gem enables easy invocation of View helper methods for view_component, simplifying their integration."
12
+ spec.description = "The 'view_component_helper' gem streamlines View helper method invocation for view_component. Simplify integration and boost productivity. "
13
+ spec.homepage = "https://github.com/yapr/view_component_helper"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 2.6.0"
16
+
17
+ # spec.metadata["allowed_push_host"] = "https://github.com/yapr/view_component_helper"
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = "https://github.com/yapr/view_component_helper"
21
+ spec.metadata["changelog_uri"] = "https://github.com/yapr/view_component_helper"
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(__dir__) do
26
+ `git ls-files -z`.split("\x0").reject do |f|
27
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
28
+ end
29
+ end
30
+ spec.bindir = "exe"
31
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ["lib"]
33
+
34
+ # Uncomment to register a new dependency of your gem
35
+ # spec.add_dependency "example-gem", "~> 1.0"
36
+
37
+ # For more information and examples about making a new gem, check out our
38
+ # guide at: https://bundler.io/guides/creating_gem.html
39
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: view_component_helper
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - yamitake
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-07-30 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: 'The ''view_component_helper'' gem streamlines View helper method invocation
14
+ for view_component. Simplify integration and boost productivity. '
15
+ email:
16
+ - take.yapr@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - ".rspec"
22
+ - ".rubocop.yml"
23
+ - CHANGELOG.md
24
+ - Gemfile
25
+ - Gemfile.lock
26
+ - LICENSE.txt
27
+ - README.md
28
+ - Rakefile
29
+ - lib/view_component_helper.rb
30
+ - lib/view_component_helper/engine.rb
31
+ - lib/view_component_helper/version.rb
32
+ - lib/view_component_helper/view_helper.rb
33
+ - sig/view_component_helper.rbs
34
+ - view_component_helper.gemspec
35
+ homepage: https://github.com/yapr/view_component_helper
36
+ licenses:
37
+ - MIT
38
+ metadata:
39
+ homepage_uri: https://github.com/yapr/view_component_helper
40
+ source_code_uri: https://github.com/yapr/view_component_helper
41
+ changelog_uri: https://github.com/yapr/view_component_helper
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 2.6.0
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ requirements: []
57
+ rubygems_version: 3.3.7
58
+ signing_key:
59
+ specification_version: 4
60
+ summary: This gem enables easy invocation of View helper methods for view_component,
61
+ simplifying their integration.
62
+ test_files: []