shoelace-rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/main.yml +85 -0
  3. data/.gitignore +20 -0
  4. data/Appraisals +25 -0
  5. data/CHANGELOG.md +3 -0
  6. data/CODE_OF_CONDUCT.md +84 -0
  7. data/Gemfile +11 -0
  8. data/LICENSE.txt +21 -0
  9. data/README.md +178 -0
  10. data/Rakefile +27 -0
  11. data/app/helpers/shoelace/form_helper.rb +451 -0
  12. data/bin/console +15 -0
  13. data/bin/setup +8 -0
  14. data/dist/.keep +0 -0
  15. data/dist/types/.keep +0 -0
  16. data/gemfiles/rails_50.gemfile +12 -0
  17. data/gemfiles/rails_51.gemfile +11 -0
  18. data/gemfiles/rails_52.gemfile +11 -0
  19. data/gemfiles/rails_60.gemfile +11 -0
  20. data/gemfiles/rails_61.gemfile +11 -0
  21. data/gemfiles/rails_70.gemfile +11 -0
  22. data/gemfiles/rails_edge.gemfile +14 -0
  23. data/lib/shoelace/engine.rb +8 -0
  24. data/lib/shoelace/rails/version.rb +7 -0
  25. data/lib/shoelace/rails.rb +10 -0
  26. data/lib/shoelace/testing.rb +40 -0
  27. data/package.json +50 -0
  28. data/rollup.config.js +49 -0
  29. data/shoelace-rails.gemspec +35 -0
  30. data/src/index.ts +2 -0
  31. data/src/turbo/index.ts +6 -0
  32. data/src/turbo/polyfills/formdata-event.js +27 -0
  33. data/src/turbo/sl-turbo-form.ts +110 -0
  34. data/src/turbolinks/features/confirm.ts +42 -0
  35. data/src/turbolinks/features/disable.ts +94 -0
  36. data/src/turbolinks/features/remote.ts +107 -0
  37. data/src/turbolinks/index.ts +6 -0
  38. data/src/turbolinks/selectors.ts +38 -0
  39. data/src/turbolinks/start.ts +38 -0
  40. data/src/turbolinks/turbolinks.ts +78 -0
  41. data/src/turbolinks/utils/ajax.ts +146 -0
  42. data/src/turbolinks/utils/csp.ts +20 -0
  43. data/src/turbolinks/utils/csrf.ts +33 -0
  44. data/src/turbolinks/utils/dom.ts +40 -0
  45. data/src/turbolinks/utils/event.ts +57 -0
  46. data/src/turbolinks/utils/form.ts +58 -0
  47. data/test/dummy_app/Gemfile +19 -0
  48. data/test/dummy_app/Rakefile +6 -0
  49. data/test/dummy_app/app/controllers/hotwire_forms_controller.rb +46 -0
  50. data/test/dummy_app/app/controllers/turbolinks_forms_controller.rb +37 -0
  51. data/test/dummy_app/app/models/user.rb +16 -0
  52. data/test/dummy_app/app/packs/entrypoints/hotwire.js +1 -0
  53. data/test/dummy_app/app/packs/entrypoints/turbolinks.js +5 -0
  54. data/test/dummy_app/app/views/hotwire_forms/form.html.erb +45 -0
  55. data/test/dummy_app/app/views/hotwire_forms/show.html.erb +5 -0
  56. data/test/dummy_app/app/views/layouts/application.html.erb +39 -0
  57. data/test/dummy_app/app/views/turbolinks_forms/form.html.erb +44 -0
  58. data/test/dummy_app/app/views/turbolinks_forms/show.html.erb +5 -0
  59. data/test/dummy_app/bin/rails +5 -0
  60. data/test/dummy_app/bin/webpack +18 -0
  61. data/test/dummy_app/bin/yarn +18 -0
  62. data/test/dummy_app/config/application.rb +16 -0
  63. data/test/dummy_app/config/boot.rb +4 -0
  64. data/test/dummy_app/config/environment.rb +2 -0
  65. data/test/dummy_app/config/environments/development.rb +10 -0
  66. data/test/dummy_app/config/environments/test.rb +18 -0
  67. data/test/dummy_app/config/routes.rb +4 -0
  68. data/test/dummy_app/config/webpack/development.js +5 -0
  69. data/test/dummy_app/config/webpack/production.js +1 -0
  70. data/test/dummy_app/config/webpack/test.js +5 -0
  71. data/test/dummy_app/config/webpacker.yml +33 -0
  72. data/test/dummy_app/config.ru +6 -0
  73. data/test/dummy_app/package.json +24 -0
  74. data/test/dummy_app/test/system/hotwire_form_test.rb +65 -0
  75. data/test/dummy_app/test/system/turbolinks_form_test.rb +39 -0
  76. data/test/dummy_app/test/test_helper.rb +68 -0
  77. data/test/helpers/form_helper_test.rb +397 -0
  78. data/test/test_helper.rb +18 -0
  79. data/tsconfig.json +19 -0
  80. data/yarn.lock +249 -0
  81. metadata +196 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1c7cf138c772d734257018fa691d7082b04caf56da45e2d5243041d9a90e345b
4
+ data.tar.gz: 1902dd8b4ee4d41e57dd3ede4bfe4c71f21a1fc7607d02524e052667a3481330
5
+ SHA512:
6
+ metadata.gz: e6fb93a87eabac57355bd4a2a7d567d1e94680c0b59d0dc40731d46b76b3eb4ca74cce56f6c720b7bd63f4845de37a93a735a8013ea21e3d1d7a3c8b5aa22722
7
+ data.tar.gz: de7ddf7f75dee4a26b71eb95cf1ae3d29e9884080a25abe8f575352b0068a3c5d5e459852947ce8d286999cec6ca218efd77f9587f32ba9c44efd56ceac8fc6f
@@ -0,0 +1,85 @@
1
+ name: Build
2
+
3
+ on:
4
+ - push
5
+ - pull_request
6
+
7
+ jobs:
8
+ unit:
9
+ strategy:
10
+ matrix:
11
+ ruby_version:
12
+ - '3.1'
13
+ - '3.0'
14
+ - '2.7'
15
+ - 'jruby-9.3.3.0'
16
+ gemfile:
17
+ - gemfiles/rails_70.gemfile
18
+ - gemfiles/rails_61.gemfile
19
+ - gemfiles/rails_60.gemfile
20
+ runs-on: ubuntu-18.04
21
+ env:
22
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
23
+ steps:
24
+ - uses: actions/checkout@v2
25
+ - name: Install curl
26
+ run: sudo apt-get install curl libcurl4-openssl-dev
27
+ - name: Set up Ruby
28
+ uses: ruby/setup-ruby@v1
29
+ with:
30
+ ruby-version: ${{ matrix.ruby_version }}
31
+ bundler-cache: true
32
+ - run: bundle exec rake test
33
+
34
+ system:
35
+ runs-on: ubuntu-18.04
36
+ steps:
37
+ - uses: actions/checkout@v2
38
+ - name: Set up Ruby
39
+ uses: ruby/setup-ruby@v1
40
+ with:
41
+ ruby-version: 3.1.0
42
+ bundler-cache: true
43
+ - name: Install dependencies
44
+ run: |
45
+ rm -rf node_modules &&
46
+ yarn install &&
47
+ yarn add tslib &&
48
+ bundle
49
+ - name: Run the system test in the dummy app
50
+ run: rake test:system
51
+
52
+ # browser_tests:
53
+ # runs-on: ubuntu-18.04
54
+ # steps:
55
+ # - uses: actions/checkout@v2
56
+ # - name: Set up Ruby
57
+ # uses: ruby/setup-ruby@v1
58
+ # with:
59
+ # ruby-version: 3.1.0
60
+ # bundler-cache: true
61
+ # - name: Install dependencies
62
+ # run: |
63
+ # rm -rf node_modules &&
64
+ # yarn install &&
65
+ # yarn add tslib &&
66
+ # bundle
67
+ # - name: 'BrowserStack Env Setup'
68
+ # uses: 'browserstack/github-actions/setup-env@master'
69
+ # with:
70
+ # username: ${{ secrets.BROWSERSTACK_USERNAME }}
71
+ # access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
72
+ # - name: 'Start BrowserStackLocal Tunnel'
73
+ # uses: 'browserstack/github-actions/setup-local@master'
74
+ # with:
75
+ # local-testing: 'start'
76
+ # local-logging-level: 'all-logs'
77
+ # local-identifier: 'random'
78
+ # - name: Run the system test in the dummy app
79
+ # run: rake test:system
80
+ # env:
81
+ # BROWSERSTACK_URL: ${{ secrets.BROWSERSTACK_URL }}
82
+ # - name: 'Stop BrowserStackLocal'
83
+ # uses: 'browserstack/github-actions/setup-local@master'
84
+ # with:
85
+ # local-testing: 'stop'
data/.gitignore ADDED
@@ -0,0 +1,20 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ Gemfile.lock
10
+ node_modules
11
+ dist
12
+ .npmrc
13
+
14
+ test/dummy_app/yarn.lock
15
+ test/dummy_app/log/
16
+ test/dummy_app/tmp/
17
+ test/dummy_app/public/
18
+ .pryrc
19
+ gemfiles/*.lock
20
+ BrowserStackLocal
data/Appraisals ADDED
@@ -0,0 +1,25 @@
1
+ appraise "rails_edge" do
2
+ git "https://github.com/rails/rails.git" do
3
+ gem "rails"
4
+ gem "railties"
5
+ gem "activesupport"
6
+ end
7
+ end
8
+
9
+ appraise "rails_70" do
10
+ gem "rails", "~> 6.1.0"
11
+ gem "railties", "~> 6.1.0"
12
+ gem "activesupport", "~> 6.1.0"
13
+ end
14
+
15
+ appraise "rails_61" do
16
+ gem "rails", '~> 6.1.0'
17
+ gem "railties", '~> 6.1.0'
18
+ gem "activesupport", '~> 6.1.0'
19
+ end
20
+
21
+ appraise "rails_60" do
22
+ gem "rails", '~> 6.0.0'
23
+ gem "railties", '~> 6.0.0'
24
+ gem "activesupport", '~> 6.0.0'
25
+ end
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ## [0.1.0] - 2022-02-17
2
+
3
+ - First release!
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at yuki24@hey.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in shoelace-rails.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ # Need this PR: https://github.com/rails/rails-dom-testing/pull/84 for easier DOM testing:
11
+ gem 'rails-dom-testing', git: "https://github.com/rails/rails-dom-testing.git", ref: "8f5acdfc"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Yuki Nishijima
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,178 @@
1
+ # Shoelace Rails
2
+
3
+ The `shoelace-rails` gem adds useful helper methods for [Shoelace.style](https://shoelace.style), the design system.
4
+
5
+ ## Installation
6
+
7
+ This document assumes that you use the [`webpacker`](https://github.com/rails/webpacker) or
8
+ the [`jsbundling-rails`](https://github.com/rails/jsbundling-rails) gem. You may have to tweak the examples here if
9
+ you do not use it. However, the principle here should be the same regardless of the JS bundler you use.
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'shoelace-rails'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ ```
20
+ $ bundle install
21
+ ```
22
+
23
+ Additionally, you need to add the following npm packages:
24
+
25
+ ```sh
26
+ $ yarn add @shoelace-style/shoelace copy-webpack-plugin
27
+ ```
28
+
29
+ ## Set up CSS
30
+
31
+ ### Asset Pipeline
32
+
33
+ Add the following lines to the `app/assets/stylesheets/application.css` if you need the sprockets gem:
34
+
35
+ ```scss
36
+ /*
37
+ *= require @shoelace-style/shoelace/dist/themes/light.css
38
+ *= require @shoelace-style/shoelace/dist/themes/dark.css
39
+ */
40
+ ```
41
+
42
+ ### Webpack & CSS Loader
43
+
44
+ Add the following lines to the `app/packs/entrypoints/application.js` if you prefer the webpack and CSS loader:
45
+
46
+ ```js
47
+ import "@shoelace-style/shoelace/dist/themes/light.css"
48
+ import "@shoelace-style/shoelace/dist/themes/dark.css" // Optional dark mode
49
+ ```
50
+
51
+ ## Set up Javascript
52
+
53
+ In order to use Shoelace the icons need to be copied to the `public/assets` directory so they will show pu properly.
54
+
55
+ If you are using the `jsbundling-rails` gem and have `webpack.config.js` in the top level directory of your project, Add th
56
+ e configuration for the `CopyPlugin`:
57
+
58
+ ```js
59
+ // webpack.config.js
60
+ const CopyPlugin = require("copy-webpack-plugin")
61
+ const path = require('path')
62
+
63
+ module.exports = {
64
+ ...,
65
+ plugins: [
66
+ new CopyPlugin({
67
+ patterns: [
68
+ {
69
+ from: path.resolve(__dirname, "node_modules/@shoelace-style/shoelace/dist/assets"),
70
+ to: path.resolve(__dirname, "public/assets"),
71
+ },
72
+ ],
73
+ }),
74
+ ],
75
+ }
76
+ ```
77
+
78
+ If you are using the `webpacker` gem, you could add the same configuration but to `config/webpack/environment.js`:
79
+
80
+ ```js
81
+ // config/webpack/environment.js
82
+ const { environment } = require('@rails/webpacker')
83
+ const path = require('path')
84
+ const CopyPlugin = require('copy-webpack-plugin')
85
+
86
+ // Add shoelace icons to webpack's build process
87
+ environment.plugins.append(
88
+ 'CopyPlugin',
89
+ new CopyPlugin({
90
+ patterns: [
91
+ {
92
+ from: path.resolve(__dirname, '../../node_modules/@shoelace-style/shoelace/dist/assets'),
93
+ to: path.resolve(__dirname, '../../public/packs/js/assets')
94
+ }
95
+ ]
96
+ })
97
+ )
98
+
99
+ module.exports = environment
100
+ ```
101
+
102
+ Finally, import the shoelace dependency in the entrypoint file:
103
+
104
+ ```js
105
+ import "@shoelace-style/shoelace"
106
+ ```
107
+
108
+ That's it!
109
+
110
+ ## View Helpers
111
+
112
+ As explained above, this gem provides drop-in replacements to. Here is a short example of how the form helper works:
113
+
114
+ ```erb
115
+ <%= sl_form_for @user do |form| %>
116
+ <% # Text input: https://shoelace.style/components/input %>
117
+ <%= form.text_field :name %>
118
+ <%= form.password_field :password, placeholder: "Password Toggle", 'toggle-password': true %>
119
+
120
+ <% # Radio buttons: https://shoelace.style/components/color-picker %>
121
+ <%= form.color_field :color %>
122
+
123
+ <% # Radio buttons: https://shoelace.style/components/radio %>
124
+ <%= form.collection_radio_buttons :status, { id_1: "Option 1", id_2: "Option 2", id_3: "Option 3" }, :first, :last %>
125
+
126
+ <% # Select: https://shoelace.style/components/select %>
127
+ <%= form.collection_select :tag, { id_1: "Option 1", id_2: "Option 2", id_3: "Option 3" }, :first, :last, {}, { placeholder: "Select one" } %>
128
+
129
+ <%= form.submit %>
130
+ <% end %>
131
+ ```
132
+
133
+ And this code will produce:
134
+
135
+ ```html
136
+ <sl-form class="new_user" id="new_user" data-remote="true" action="/" accept-charset="UTF-8" method="post">
137
+ <sl-input label="Name" type="text" name="user[name]" id="user_name"></sl-input>
138
+ <sl-input label="Password" type="password" name="user[password]" id="user_password"></sl-input>
139
+ <sl-color-picker value="#ffffff" name="user[color]" id="user_color"></sl-color-picker>
140
+
141
+ <sl-radio-group no-fieldset="true">
142
+ <sl-radio value="id_1" name="user[status]" id="user_status_id_1">Option 1</sl-radio>
143
+ <sl-radio value="id_2" name="user[status]" id="user_status_id_2">Option 2</sl-radio>
144
+ <sl-radio value="id_3" name="user[status]" id="user_status_id_3">Option 3</sl-radio>
145
+ </sl-radio-group>
146
+
147
+ <sl-select placeholder="Select one" name="user[tag]" id="user_tag">
148
+ <sl-menu-item value="id_1">Option 1</sl-menu-item>
149
+ <sl-menu-item value="id_2">Option 2</sl-menu-item>
150
+ <sl-menu-item value="id_3">Option 3</sl-menu-item>
151
+ </sl-select>
152
+
153
+ <sl-button submit="true" type="primary" data-disable-with="Create User">Create User</sl-button>
154
+ </sl-form>
155
+ ```
156
+
157
+ ## Development
158
+
159
+ 1. Run `bundle install`
160
+ 2. Make a change and add test coverage
161
+ 3. Run `bundle rails test`
162
+ 4. Make a commit and push it to GitHub
163
+ 5. Send us a pull request
164
+
165
+ ## Contributing
166
+
167
+ Bug reports and pull requests are welcome on GitHub at https://github.com/yuki24/shoelace-rails. This project is
168
+ intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the
169
+ [code of conduct](https://github.com/yuki24/shoelace-rails/blob/master/CODE_OF_CONDUCT.md).
170
+
171
+ ## License
172
+
173
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
174
+
175
+ ## Code of Conduct
176
+
177
+ Everyone interacting in the Shoelace::Rails project's codebases, issue trackers, chat rooms and mailing lists is
178
+ expected to follow the [code of conduct](https://github.com/yuki24/shoelace-rails/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/*_test.rb"].exclude("test/dummy_app/**/*")
10
+ end
11
+
12
+ namespace :test do
13
+ task :system do
14
+ Bundler.with_original_env do
15
+ sh <<~CMD
16
+ yarn build &&
17
+ cd test/dummy_app &&
18
+ yarn &&
19
+ bundle &&
20
+ RAILS_ENV=test rails webpacker:compile
21
+ rails test:system
22
+ CMD
23
+ end
24
+ end
25
+ end
26
+
27
+ task default: [:test, :'test:system']