plug 0.1.28 → 0.2.1

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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -0
  3. data/app/frontend/entrypoints/plug.js +2 -0
  4. data/app/helpers/plug/application_helper.rb +10 -0
  5. data/app/views/layouts/plug/application.html.haml +0 -2
  6. data/app/views/plug/features/index.html.haml +2 -2
  7. data/app/views/plug/shared/_head.html.haml +1 -3
  8. data/app/views/plug/site_notices/index.html.haml +2 -2
  9. data/config/initializers/plug.rb +7 -0
  10. data/lib/generators/plug/install_generator.rb +18 -0
  11. data/lib/generators/plug/templates/plug.vite.js +2 -0
  12. data/lib/plug/version.rb +1 -1
  13. metadata +16 -30
  14. data/app/assets/config/plug_manifest.js +0 -3
  15. data/app/assets/images/plug/favicon.png +0 -0
  16. data/app/assets/javascripts/plug/application.js +0 -18
  17. data/app/assets/javascripts/plug/trix-core.js +0 -12
  18. data/app/assets/stylesheets/plug/_settings.scss +0 -865
  19. data/app/assets/stylesheets/plug/application.scss +0 -43
  20. data/app/assets/stylesheets/plug/blocks/_alert.scss +0 -5
  21. data/app/assets/stylesheets/plug/blocks/_menu.scss +0 -11
  22. data/app/assets/stylesheets/plug/blocks/_nav.scss +0 -9
  23. data/app/assets/stylesheets/plug/blocks/_notice.scss +0 -4
  24. data/app/assets/stylesheets/plug/blocks/_state.scss +0 -11
  25. data/app/assets/stylesheets/plug/blocks/_task-button.scss +0 -3
  26. data/app/assets/stylesheets/plug/foundation_and_overrides.scss +0 -59
  27. data/app/assets/stylesheets/plug/milligram.scss +0 -635
  28. data/app/assets/stylesheets/plug/mixins/_bem.scss +0 -17
  29. data/app/assets/stylesheets/plug/normalize.scss +0 -447
  30. data/app/assets/stylesheets/plug/partials/_main.scss +0 -4
  31. data/app/assets/stylesheets/plug/partials/_utils.scss +0 -3
  32. data/app/assets/stylesheets/plug/trix-overrides.scss +0 -8
  33. data/app/assets/stylesheets/plug/trix.scss +0 -374
  34. data/app/assets/stylesheets/plug/variables/_colors.scss +0 -8
  35. data/app/assets/stylesheets/plug/variables/_typography.scss +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3556a736fbc35dff94da6c72d970f7c422236e1683b2cba7db007b2fc5b8da52
4
- data.tar.gz: 37f1decdea6b40930cca641c5ea94f6fd51a4d15459564cedec8ba4a09981870
3
+ metadata.gz: 576b81e9d938343d962459062f25f3fc4ebc069876e994de50e2fd7525fc2881
4
+ data.tar.gz: a608747d874db0fd78de1fca5209c523df2fe5ae61d80d9644e0bf4ddfc88060
5
5
  SHA512:
6
- metadata.gz: 0d6ef1d4c19fea0e4c3d7fae41621482e6a8f72f0ac0e6058a364dbd937e03b0cac3b8be4bb05d021735fe745999aec3f61afb1de0bec76b006e734422947396
7
- data.tar.gz: 9d035f49418d267bee068a55181a1fb44006c4ae428790b8b036487de4a412d841e21e6428b97294e7948cc7a2512773b743de18269adcc29047e6a48fea42da
6
+ metadata.gz: 973d242dd4d0ba3429d6864fb6e74a02f6dff7db64c3f6d8656cb62bcd341002aec64ce7f394bf3f672bc03e41a7ea3b490fa34add9728b3e1db66b85cbd33da
7
+ data.tar.gz: a294e5b4e35d65ca7cc70aa5816995c0b2d5887816589e078ec882c002678c2d3170a54e2c93383a78a1886e580694c6384187495b004bab19d5dd0bbb161a16
data/README.md CHANGED
@@ -129,6 +129,15 @@ Make sure to **bump** the version. Rubygems don't accept version overrides.
129
129
  → gem push plug-<version>.gem
130
130
  ```
131
131
 
132
+ ### Publishing to `npmjs.com`
133
+
134
+ Make sure to match the version with the Rubygems version.
135
+
136
+ ```bash
137
+ → npm login
138
+ → npm publish --access public
139
+ ```
140
+
132
141
  ### TODOs
133
142
 
134
143
  - Ability to disable all features using one button
@@ -0,0 +1,2 @@
1
+ import "@digitalnz/plug/src/plug/stylesheets/base.scss";
2
+ import "@digitalnz/plug/src/plug/base";
@@ -2,5 +2,15 @@
2
2
 
3
3
  module Plug
4
4
  module ApplicationHelper
5
+ def asset_tags
6
+ asset_source = defined?(ViteRuby) ? :vite : :other
7
+
8
+ case asset_source
9
+ when :vite
10
+ vite_javascript_tag 'entrypoints/plug'
11
+ else
12
+ raise 'Plug does not support asset pipelines anymore. Use Vite.js instead.'
13
+ end
14
+ end
5
15
  end
6
16
  end
@@ -6,5 +6,3 @@
6
6
  .container
7
7
  = render 'plug/shared/nav'
8
8
  = yield
9
-
10
- /= render 'shared/footer'
@@ -30,8 +30,8 @@
30
30
  %tbody
31
31
  - @features.each do |feature|
32
32
  %tr
33
- %td= link_to feature.name, edit_feature_path(feature), class: 'strong'
34
- %td= feature.description
33
+ %td= link_to sanitize(feature.name), edit_feature_path(feature), class: 'strong'
34
+ %td= sanitize(feature.description)
35
35
  %td= feature.slug
36
36
  %td{ width: 150, align: 'center' }
37
37
  - if feature.state == 'enabled'
@@ -3,9 +3,7 @@
3
3
  %meta{content: 'width=device-width, initial-scale=1.0', name: 'viewport'}/
4
4
  %title Plug
5
5
 
6
- = stylesheet_link_tag 'plug/application', media: 'all'
7
- = javascript_include_tag 'plug/application'
8
- = favicon_link_tag 'plug/favicon.png'
9
6
  = csrf_meta_tags
7
+ = asset_tags
10
8
 
11
9
  %script{ defer: '', src: 'https://use.fontawesome.com/releases/v5.13.0/js/all.js' }
@@ -26,8 +26,8 @@
26
26
  %tbody
27
27
  - @site_notices.each do |site_notice|
28
28
  %tr
29
- %td= link_to site_notice.name, edit_site_notice_path(site_notice), class: 'strong'
30
- %td= site_notice.notice.html_safe
29
+ %td= link_to sanitize(site_notice.name), edit_site_notice_path(site_notice), class: 'strong'
30
+ %td= sanitize(site_notice.notice.html_safe)
31
31
  %td= site_notice.slug
32
32
  %td{ width: 150, align: 'center' }
33
33
  - if site_notice.state == 'enabled'
@@ -0,0 +1,7 @@
1
+ # /config/initializers/plug.rb
2
+
3
+ Plug.configure do |config|
4
+ config.auth_user = 'admin'
5
+ config.auth_password = 'password'
6
+ config.themes = ['default', 'dark']
7
+ end
@@ -11,5 +11,23 @@ module Plug
11
11
  def mount_engine
12
12
  inject_into_file('config/routes.rb', "\n mount Plug::Engine => '/plug', as: 'plug'\n\n", before: /^end/)
13
13
  end
14
+
15
+ def setup_vite_assets
16
+ copy_file 'plug.vite.js', 'app/frontend/entrypoints/plug.js'
17
+ end
18
+
19
+ def add_plug_package
20
+ package_json_path = 'package.json'
21
+
22
+ if File.exist?(package_json_path)
23
+ package_json = JSON.parse(File.read(package_json_path))
24
+ package_json['dependencies'] ||= {}
25
+ package_json['dependencies']['@digitalnz/plug'] ||= "^#{Plug::VERSION}"
26
+
27
+ File.write(package_json_path, JSON.pretty_generate(package_json) + "\n")
28
+ else
29
+ say 'package.json not found. Please ensure you are running this generator in the root directory of your Rails project.', :red
30
+ end
31
+ end
14
32
  end
15
33
  end
@@ -0,0 +1,2 @@
1
+ import "@digitalnz/plug/src/plug/stylesheets/base.scss";
2
+ import "@digitalnz/plug/src/plug/base";
data/lib/plug/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Plug
4
- VERSION = '0.1.28'
4
+ VERSION = '0.2.1' # Update version in package.json too
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plug
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.28
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boost
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-11-14 00:00:00.000000000 Z
12
+ date: 2025-07-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aasm
@@ -68,13 +68,13 @@ dependencies:
68
68
  - !ruby/object:Gem::Version
69
69
  version: '5.2'
70
70
  - !ruby/object:Gem::Dependency
71
- name: sass-rails
71
+ name: capybara
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - ">="
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
- type: :runtime
77
+ type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
@@ -82,7 +82,7 @@ dependencies:
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  - !ruby/object:Gem::Dependency
85
- name: capybara
85
+ name: factory_bot_rails
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - ">="
@@ -96,7 +96,7 @@ dependencies:
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  - !ruby/object:Gem::Dependency
99
- name: factory_bot_rails
99
+ name: puma
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
102
  - - ">="
@@ -189,34 +189,13 @@ files:
189
189
  - MIT-LICENSE
190
190
  - README.md
191
191
  - Rakefile
192
- - app/assets/config/plug_manifest.js
193
- - app/assets/images/plug/favicon.png
194
- - app/assets/javascripts/plug/application.js
195
- - app/assets/javascripts/plug/trix-core.js
196
- - app/assets/stylesheets/plug/_settings.scss
197
- - app/assets/stylesheets/plug/application.scss
198
- - app/assets/stylesheets/plug/blocks/_alert.scss
199
- - app/assets/stylesheets/plug/blocks/_menu.scss
200
- - app/assets/stylesheets/plug/blocks/_nav.scss
201
- - app/assets/stylesheets/plug/blocks/_notice.scss
202
- - app/assets/stylesheets/plug/blocks/_state.scss
203
- - app/assets/stylesheets/plug/blocks/_task-button.scss
204
- - app/assets/stylesheets/plug/foundation_and_overrides.scss
205
- - app/assets/stylesheets/plug/milligram.scss
206
- - app/assets/stylesheets/plug/mixins/_bem.scss
207
- - app/assets/stylesheets/plug/normalize.scss
208
- - app/assets/stylesheets/plug/partials/_main.scss
209
- - app/assets/stylesheets/plug/partials/_utils.scss
210
- - app/assets/stylesheets/plug/trix-overrides.scss
211
- - app/assets/stylesheets/plug/trix.scss
212
- - app/assets/stylesheets/plug/variables/_colors.scss
213
- - app/assets/stylesheets/plug/variables/_typography.scss
214
192
  - app/controllers/plug/api/api_controller.rb
215
193
  - app/controllers/plug/api/features_controller.rb
216
194
  - app/controllers/plug/api/site_notices_controller.rb
217
195
  - app/controllers/plug/application_controller.rb
218
196
  - app/controllers/plug/features_controller.rb
219
197
  - app/controllers/plug/site_notices_controller.rb
198
+ - app/frontend/entrypoints/plug.js
220
199
  - app/helpers/plug/application_helper.rb
221
200
  - app/mailers/plug/application_mailer.rb
222
201
  - app/models/plug/application_record.rb
@@ -238,6 +217,7 @@ files:
238
217
  - app/views/plug/site_notices/edit.html.haml
239
218
  - app/views/plug/site_notices/index.html.haml
240
219
  - app/views/plug/site_notices/new.html.haml
220
+ - config/initializers/plug.rb
241
221
  - config/routes.rb
242
222
  - db/migrate/20171207020316_create_plug_features.rb
243
223
  - db/migrate/20180128202026_add_notice_to_plug_features.rb
@@ -245,6 +225,7 @@ files:
245
225
  - db/migrate/20180424015828_add_theme_to_plug_site_notice.rb
246
226
  - lib/generators/plug/install_generator.rb
247
227
  - lib/generators/plug/templates/plug.rb
228
+ - lib/generators/plug/templates/plug.vite.js
248
229
  - lib/plug.rb
249
230
  - lib/plug/configuration.rb
250
231
  - lib/plug/constraint.rb
@@ -255,7 +236,12 @@ homepage: https://github.com/digitalnz/plug
255
236
  licenses:
256
237
  - MIT
257
238
  metadata: {}
258
- post_install_message:
239
+ post_install_message: |
240
+ ### Upgrading Plug from 0.1.x to 0.2.x ###
241
+
242
+ Due to introduction of Vite support, some additional dependencies and configuration will be needed.
243
+ Running `bin/rails g plug:install` will add extra js dependencies and configuration to your project.
244
+ `0.2.x`` doesn't support asset pipelines anymore. Use Vite.js instead.
259
245
  rdoc_options: []
260
246
  require_paths:
261
247
  - lib
@@ -270,7 +256,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
256
  - !ruby/object:Gem::Version
271
257
  version: '0'
272
258
  requirements: []
273
- rubygems_version: 3.2.32
259
+ rubygems_version: 3.3.26
274
260
  signing_key:
275
261
  specification_version: 4
276
262
  summary: Rails engine that can plug/unplug features
@@ -1,3 +0,0 @@
1
- //= link ../images/favicon.png
2
- //= link_directory ../javascripts/plug .js
3
- //= link_directory ../stylesheets/plug .css
Binary file
@@ -1,18 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // compiled file. JavaScript code in this file should be added after the last require_* statement.
9
- //
10
- // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
- // about supported directives.
12
- //
13
- //= require_tree .
14
-
15
- // Prevent drag and drop from the editor
16
- document.addEventListener('trix-file-accept', function(event) {
17
- event.preventDefault();
18
- });