plug 0.1.27 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -0
  3. data/app/helpers/plug/application_helper.rb +10 -0
  4. data/app/views/layouts/plug/application.html.haml +0 -2
  5. data/app/views/plug/shared/_head.html.haml +1 -3
  6. data/lib/generators/plug/install_generator.rb +18 -0
  7. data/lib/generators/plug/templates/plug.vite.js +2 -0
  8. data/lib/plug/engine.rb +6 -4
  9. data/lib/plug/version.rb +1 -1
  10. metadata +11 -41
  11. data/app/assets/config/plug_manifest.js +0 -3
  12. data/app/assets/images/plug/favicon.png +0 -0
  13. data/app/assets/javascripts/plug/application.js +0 -18
  14. data/app/assets/javascripts/plug/trix-core.js +0 -12
  15. data/app/assets/stylesheets/plug/_settings.scss +0 -865
  16. data/app/assets/stylesheets/plug/application.scss +0 -43
  17. data/app/assets/stylesheets/plug/blocks/_alert.scss +0 -5
  18. data/app/assets/stylesheets/plug/blocks/_menu.scss +0 -11
  19. data/app/assets/stylesheets/plug/blocks/_nav.scss +0 -9
  20. data/app/assets/stylesheets/plug/blocks/_notice.scss +0 -4
  21. data/app/assets/stylesheets/plug/blocks/_state.scss +0 -11
  22. data/app/assets/stylesheets/plug/blocks/_task-button.scss +0 -3
  23. data/app/assets/stylesheets/plug/foundation_and_overrides.scss +0 -59
  24. data/app/assets/stylesheets/plug/milligram.scss +0 -635
  25. data/app/assets/stylesheets/plug/mixins/_bem.scss +0 -17
  26. data/app/assets/stylesheets/plug/normalize.scss +0 -447
  27. data/app/assets/stylesheets/plug/partials/_main.scss +0 -4
  28. data/app/assets/stylesheets/plug/partials/_utils.scss +0 -3
  29. data/app/assets/stylesheets/plug/trix-overrides.scss +0 -8
  30. data/app/assets/stylesheets/plug/trix.scss +0 -374
  31. data/app/assets/stylesheets/plug/variables/_colors.scss +0 -8
  32. 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: 3b24b659f1fef423ad79f8327fcc139c2fe76855e46cc1891f058e90d0a3010f
4
- data.tar.gz: 73d8bffaa03bf0e913ade43e26d1eefd57ccba71d22bcdd23f65caeca4424d05
3
+ metadata.gz: 93d959b1cce72eb10a7dfb1708c75acca84dae5bf7ec85b91a8b97e02c094b5c
4
+ data.tar.gz: fa51e5f82f7c8113b370c83c33c8b5119948e744f42e302f341073dd0bba20fa
5
5
  SHA512:
6
- metadata.gz: 28ff4f598b31181a73247d0448ce972d7d7dc0afef95417e10a7f8b922d7444e1e0c897a9aaed253ab73aa1fe347c355f82f0cc9c234368a85ca0f9cb6de5f8e
7
- data.tar.gz: 46e9dda363fa11bda56f4496e4b212a8c61293e2f0cf9b31613b940c32a744c8a4bf6e3d2968319ffe539a1c42c83d1059cac27f5960891beebd6ec8aa3a2a2c
6
+ metadata.gz: efd393e765ebba44fee818a02850193b3c3630cd6a1aa08da5dc1d8dfda764db432e4c421742b5bcfafdfb6e0c2f84226c01b8a0799c1e87c7a81f8833330cce
7
+ data.tar.gz: dae650a9a2304a57777eb6b76f33ea86a38a83bc27e3ae16e55e70bec94ad9a98dc0c391de7188638e187a8b244537a7eaef26c396bf945fe706c89db329b801
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
@@ -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'
@@ -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' }
@@ -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/engine.rb CHANGED
@@ -8,10 +8,12 @@ module Plug
8
8
  class Engine < ::Rails::Engine
9
9
  isolate_namespace Plug
10
10
 
11
- initializer 'plug.assets.precompile' do |app|
12
- app.config.assets.precompile += %w[
13
- plug/application.js plug/application.css plug/favicon.png
14
- ]
11
+ if defined?(Sprockets)
12
+ initializer 'plug.assets.precompile' do |app|
13
+ app.config.assets.precompile += %w[
14
+ plug/application.js plug/application.css plug/favicon.png
15
+ ]
16
+ end
15
17
  end
16
18
 
17
19
  config.generators do |g|
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.27'
4
+ VERSION = '0.2.0' # Update version in package.json too
5
5
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plug
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.27
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boost
8
8
  - DNZ
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-09-19 00:00:00.000000000 Z
12
+ date: 2024-07-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aasm
@@ -67,20 +67,6 @@ dependencies:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '5.2'
70
- - !ruby/object:Gem::Dependency
71
- name: sass-rails
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: '0'
77
- type: :runtime
78
- prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: '0'
84
70
  - !ruby/object:Gem::Dependency
85
71
  name: capybara
86
72
  requirement: !ruby/object:Gem::Requirement
@@ -189,28 +175,6 @@ files:
189
175
  - MIT-LICENSE
190
176
  - README.md
191
177
  - 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
178
  - app/controllers/plug/api/api_controller.rb
215
179
  - app/controllers/plug/api/features_controller.rb
216
180
  - app/controllers/plug/api/site_notices_controller.rb
@@ -245,6 +209,7 @@ files:
245
209
  - db/migrate/20180424015828_add_theme_to_plug_site_notice.rb
246
210
  - lib/generators/plug/install_generator.rb
247
211
  - lib/generators/plug/templates/plug.rb
212
+ - lib/generators/plug/templates/plug.vite.js
248
213
  - lib/plug.rb
249
214
  - lib/plug/configuration.rb
250
215
  - lib/plug/constraint.rb
@@ -255,7 +220,12 @@ homepage: https://github.com/digitalnz/plug
255
220
  licenses:
256
221
  - MIT
257
222
  metadata: {}
258
- post_install_message:
223
+ post_install_message: |
224
+ ### Upgrading Plug from 0.1.x to 0.2.x ###
225
+
226
+ Due to introduction of Vite support, some additional dependencies and configuration will be needed.
227
+ Running `bin/rails g plug:install` will add extra js dependencies and configuration to your project.
228
+ `0.2.x`` doesn't support asset pipelines anymore. Use Vite.js instead.
259
229
  rdoc_options: []
260
230
  require_paths:
261
231
  - lib
@@ -271,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
241
  version: '0'
272
242
  requirements: []
273
243
  rubygems_version: 3.2.32
274
- signing_key:
244
+ signing_key:
275
245
  specification_version: 4
276
246
  summary: Rails engine that can plug/unplug features
277
247
  test_files: []
@@ -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
- });