turbo_material 0.2.17 → 0.2.19
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 +4 -4
- data/Rakefile +7 -5
- data/app/controllers/turbo_material/application_controller.rb +2 -0
- data/app/helpers/turbo_material/application_helper.rb +2 -0
- data/app/helpers/turbo_material/checkbox_helper.rb +3 -1
- data/app/helpers/turbo_material/chip_set_helper.rb +4 -2
- data/app/helpers/turbo_material/chips_input_helper.rb +3 -1
- data/app/helpers/turbo_material/chips_input_options_helper.rb +3 -1
- data/app/helpers/turbo_material/chips_select_helper.rb +3 -1
- data/app/helpers/turbo_material/data_table_helper.rb +2 -0
- data/app/helpers/turbo_material/input_helper.rb +4 -2
- data/app/helpers/turbo_material/menu_button_helper.rb +3 -1
- data/app/helpers/turbo_material/modal_helper.rb +3 -1
- data/app/helpers/turbo_material/radio_helper.rb +3 -1
- data/app/helpers/turbo_material/select_helper.rb +3 -1
- data/app/helpers/turbo_material/switch_helper.rb +3 -1
- data/app/helpers/turbo_material/textarea_helper.rb +3 -1
- data/app/helpers/turbo_material/tooltip_helper.rb +3 -1
- data/app/jobs/turbo_material/application_job.rb +2 -0
- data/app/mailers/turbo_material/application_mailer.rb +4 -2
- data/app/models/turbo_material/application_record.rb +2 -0
- data/config/importmap.rb +6 -4
- data/config/routes.rb +2 -0
- data/lib/generators/turbo_material/install_generator.rb +67 -38
- data/lib/lookbook/checkbox_preview.rb +4 -2
- data/lib/lookbook/chips_select_preview.rb +8 -7
- data/lib/lookbook/input_preview.rb +4 -2
- data/lib/lookbook/radio_preview.rb +4 -2
- data/lib/lookbook/select_preview.rb +2 -1
- data/lib/lookbook/switch_preview.rb +4 -2
- data/lib/lookbook/textarea_preview.rb +4 -2
- data/lib/tasks/install.rake +5 -0
- data/lib/tasks/turbo_material_tasks.rake +2 -0
- data/lib/turbo_material/configuration.rb +3 -3
- data/lib/turbo_material/engine.rb +10 -10
- data/lib/turbo_material/post_install.rb +10 -0
- data/lib/turbo_material/version.rb +3 -1
- data/lib/turbo_material.rb +5 -3
- metadata +21 -17
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: fbceaa36f447d1f2c7c2ebd92923b28a9973ac5129768c53da94f5bbcf3a3a3c
         | 
| 4 | 
            +
              data.tar.gz: b303476e7e72c5d1a96761b12cde4a01a8262a71181babe0841d1e416594f91e
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 31ef5cec5146f44354ffcc912dd772efd9b92c69f666646073005186a87746b953c2039899b2fc5a31ad78fffe5b2d448458a231fc92733bcec8ff8ddc10cc8f
         | 
| 7 | 
            +
              data.tar.gz: a3f6ca5281ff7d61282ba1ec72439c1cfd8a377096982ad6dd34fdb5f513b3e0c750113aa4a65eae5ef69cd0864c38c8193f33693b2ebe8d09e9656fa38c2d0d
         | 
    
        data/Rakefile
    CHANGED
    
    | @@ -1,8 +1,10 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            -
             | 
| 4 | 
            -
            load "rails/tasks/engine.rake"
         | 
| 3 | 
            +
            require 'bundler/setup'
         | 
| 5 4 |  | 
| 6 | 
            -
             | 
| 5 | 
            +
            APP_RAKEFILE = File.expand_path('test/dummy/Rakefile', __dir__)
         | 
| 6 | 
            +
            load 'rails/tasks/engine.rake'
         | 
| 7 7 |  | 
| 8 | 
            -
             | 
| 8 | 
            +
            load 'rails/tasks/statistics.rake'
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            require 'bundler/gem_tasks'
         | 
| @@ -1,11 +1,13 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            module TurboMaterial
         | 
| 2 4 | 
             
              module ChipSetHelper
         | 
| 3 5 | 
             
                def material_chip_set(kwargs = {})
         | 
| 4 | 
            -
                  render  | 
| 6 | 
            +
                  render 'components/chip_set', **kwargs
         | 
| 5 7 | 
             
                end
         | 
| 6 8 |  | 
| 7 9 | 
             
                def material_chip(kwargs = {})
         | 
| 8 | 
            -
                  render  | 
| 10 | 
            +
                  render 'components/chip', **kwargs
         | 
| 9 11 | 
             
                end
         | 
| 10 12 | 
             
              end
         | 
| 11 13 | 
             
            end
         | 
| @@ -1,7 +1,9 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            module TurboMaterial
         | 
| 2 4 | 
             
              module MenuButtonHelper
         | 
| 3 5 | 
             
                def material_menu_button(kwargs = {}, &block)
         | 
| 4 | 
            -
                  render  | 
| 6 | 
            +
                  render 'components/menu_button', **kwargs do
         | 
| 5 7 | 
             
                    capture(&block) if block_given?
         | 
| 6 8 | 
             
                  end
         | 
| 7 9 | 
             
                end
         | 
| @@ -1,8 +1,10 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            module TurboMaterial
         | 
| 2 4 | 
             
              module TooltipHelper
         | 
| 3 5 | 
             
                def material_tooltip(kwargs = {}, &block)
         | 
| 4 6 | 
             
                  content = block_given? ? capture(&block) : nil
         | 
| 5 | 
            -
                  render  | 
| 7 | 
            +
                  render 'components/tooltip', **kwargs, content: content
         | 
| 6 8 | 
             
                end
         | 
| 7 9 | 
             
              end
         | 
| 8 10 | 
             
            end
         | 
    
        data/config/importmap.rb
    CHANGED
    
    | @@ -1,4 +1,6 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 4 | 
            -
            pin  | 
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            pin_all_from File.expand_path('../app/assets/javascripts', __dir__)
         | 
| 4 | 
            +
            pin '@rails/request.js', to: 'https://ga.jspm.io/npm:@rails/request.js@0.0.9/src/index.js'
         | 
| 5 | 
            +
            pin 'stimulus-use', to: 'https://ga.jspm.io/npm:stimulus-use@0.51.3/dist/index.js'
         | 
| 6 | 
            +
            pin 'hotkeys-js', to: 'https://ga.jspm.io/npm:hotkeys-js@3.10.2/dist/hotkeys.esm.js'
         | 
    
        data/config/routes.rb
    CHANGED
    
    
| @@ -2,78 +2,107 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            module TurboMaterial
         | 
| 4 4 | 
             
              class InstallGenerator < Rails::Generators::Base
         | 
| 5 | 
            -
                source_root File.expand_path(' | 
| 5 | 
            +
                source_root File.expand_path('templates', __dir__)
         | 
| 6 6 |  | 
| 7 | 
            -
                START_MARKER = "// #{Engine.name} raw CSS. This section is auto-generated by the turbo_material installer." | 
| 8 | 
            -
                END_MARKER = "// End of auto-generated #{Engine.name} raw CSS. Version:" | 
| 7 | 
            +
                START_MARKER = "// #{Engine.name} raw CSS. This section is auto-generated by the turbo_material installer."
         | 
| 8 | 
            +
                END_MARKER = "// End of auto-generated #{Engine.name} raw CSS. Version:"
         | 
| 9 9 | 
             
                HEAD_LINKS = <<-HTML.rstrip.freeze
         | 
| 10 10 |  | 
| 11 11 |  | 
| 12 12 | 
             
                <link href="//cdn.jsdelivr.net/npm/material-components-web@latest/dist/material-components-web.min.css" rel="stylesheet">
         | 
| 13 13 | 
             
                <script src="//cdn.jsdelivr.net/npm/material-components-web@latest/dist/material-components-web.min.js"></script>
         | 
| 14 | 
            -
                <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" | 
| 14 | 
            +
                <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">#{' '}
         | 
| 15 15 | 
             
                HTML
         | 
| 16 | 
            +
                CLASS_REGEX = %r(\.\\?(!?[-_a-zA-Z0-9\[\]/:]+)(?=[^}]*\{)).freeze
         | 
| 17 | 
            +
                TAILWIND_CONFIG_PATH = Rails.root.join('config/tailwind.config.js')
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                class_option :update_tailwind_only,
         | 
| 20 | 
            +
                             type: :boolean,
         | 
| 21 | 
            +
                             default: false,
         | 
| 22 | 
            +
                             desc: 'Only update Tailwind configuration'
         | 
| 16 23 |  | 
| 17 24 | 
             
                def update_tailwind_config
         | 
| 18 | 
            -
                   | 
| 19 | 
            -
                  css_content = File.read(tailwind_css_path)
         | 
| 20 | 
            -
                  css_content.gsub!(/\/\*.*?\*\//m, '')
         | 
| 21 | 
            -
                  css_content.gsub!(/\{[^}]*}/m, '{}')
         | 
| 22 | 
            -
                  css_content.gsub!(/\\\[/, '[')
         | 
| 23 | 
            -
                  css_content.gsub!( /\\\]/, ']')
         | 
| 25 | 
            +
                  return unless TAILWIND_CONFIG_PATH.exist?
         | 
| 24 26 |  | 
| 25 | 
            -
                   | 
| 26 | 
            -
             | 
| 27 | 
            +
                  if tailwind_config_up_to_date?
         | 
| 28 | 
            +
                    puts 'Tailwind config is up to date'
         | 
| 29 | 
            +
                    return
         | 
| 30 | 
            +
                  end
         | 
| 27 31 |  | 
| 28 | 
            -
                   | 
| 32 | 
            +
                  classes = extract_tailwind_classes
         | 
| 29 33 |  | 
| 30 | 
            -
                   | 
| 31 | 
            -
                     | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
                    CONFIG
         | 
| 34 | 
            +
                  content_config = <<~CONFIG.strip_heredoc
         | 
| 35 | 
            +
                    #{START_MARKER}
         | 
| 36 | 
            +
                    { raw: '<div class="#{classes.join(' ')}"></div>', extension: 'html' },
         | 
| 37 | 
            +
                    #{END_MARKER} #{TurboMaterial::VERSION}
         | 
| 38 | 
            +
                  CONFIG
         | 
| 36 39 |  | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
                       | 
| 41 | 
            -
                     | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 44 | 
            -
                       | 
| 40 | 
            +
                  if File.read(TAILWIND_CONFIG_PATH.to_s).include?(START_MARKER)
         | 
| 41 | 
            +
                    gsub_file TAILWIND_CONFIG_PATH,
         | 
| 42 | 
            +
                              /#{Regexp.escape(START_MARKER)}.*?#{Regexp.escape(END_MARKER)}.*?$/m do |_match|
         | 
| 43 | 
            +
                      content_config.strip
         | 
| 44 | 
            +
                    end
         | 
| 45 | 
            +
                  else
         | 
| 46 | 
            +
                    insert_into_file TAILWIND_CONFIG_PATH, after: 'content: [' do
         | 
| 47 | 
            +
                      "\n#{content_config.strip}"
         | 
| 45 48 | 
             
                    end
         | 
| 46 49 | 
             
                  end
         | 
| 47 50 | 
             
                end
         | 
| 48 51 |  | 
| 49 52 | 
             
                def add_turbo_material_js_controllers
         | 
| 53 | 
            +
                  return if options[:update_tailwind_only]
         | 
| 54 | 
            +
             | 
| 50 55 | 
             
                  controllers_path = Rails.root.join('app/javascript/controllers/index.js')
         | 
| 51 56 | 
             
                  if controllers_path.exist? && controllers_path.read.include?('eagerLoadControllersFrom("controllers", application)')
         | 
| 52 57 | 
             
                    if controllers_path.read.include?('eagerLoadControllersFrom("turbo_material", application)')
         | 
| 53 | 
            -
                      puts  | 
| 58 | 
            +
                      puts '`app/javascript/controllers/index.js` already contains `eagerLoadControllersFrom("turbo_material", application)`'
         | 
| 54 59 | 
             
                    else
         | 
| 55 60 | 
             
                      insert_into_file controllers_path, after: 'eagerLoadControllersFrom("controllers", application)' do
         | 
| 56 61 | 
             
                        "\neagerLoadControllersFrom(\"turbo_material\", application)\n"
         | 
| 57 62 | 
             
                      end
         | 
| 58 63 | 
             
                    end
         | 
| 59 64 | 
             
                  else
         | 
| 60 | 
            -
                    puts  | 
| 65 | 
            +
                    puts '`app/javascript/controllers/index.js` does not exist or does not contain `eagerLoadControllersFrom("controllers", application)`'
         | 
| 61 66 | 
             
                  end
         | 
| 62 67 | 
             
                end
         | 
| 63 68 |  | 
| 64 69 | 
             
                def add_material_components_web_to_app_layout
         | 
| 70 | 
            +
                  return if options[:update_tailwind_only]
         | 
| 71 | 
            +
             | 
| 65 72 | 
             
                  layout_path = Rails.root.join('app/views/layouts/application.html.erb')
         | 
| 66 | 
            -
                   | 
| 67 | 
            -
                     | 
| 68 | 
            -
             | 
| 69 | 
            -
             | 
| 70 | 
            -
             | 
| 71 | 
            -
             | 
| 72 | 
            -
                      end
         | 
| 73 | 
            -
                    end
         | 
| 73 | 
            +
                  unless layout_path.exist? && layout_path.read.include?('<%= csp_meta_tag %>')
         | 
| 74 | 
            +
                    raise '`app/views/layouts/application.html.erb` does not exist or does not contain `<%= csp_meta_tag %>`'
         | 
| 75 | 
            +
                  end
         | 
| 76 | 
            +
             | 
| 77 | 
            +
                  if layout_path.read.include?('<link href="//cdn.jsdelivr.net/npm/material-components-web@latest/dist/material-components-web.min.css" rel="stylesheet">')
         | 
| 78 | 
            +
                    puts '`app/views/layouts/application.html.erb` head already contains material components web links'
         | 
| 74 79 | 
             
                  else
         | 
| 75 | 
            -
                     | 
| 80 | 
            +
                    insert_into_file layout_path, after: '<%= csp_meta_tag %>' do
         | 
| 81 | 
            +
                      HEAD_LINKS
         | 
| 82 | 
            +
                    end
         | 
| 76 83 | 
             
                  end
         | 
| 77 84 | 
             
                end
         | 
| 85 | 
            +
             | 
| 86 | 
            +
                private
         | 
| 87 | 
            +
             | 
| 88 | 
            +
                def tailwind_config_up_to_date?
         | 
| 89 | 
            +
                  return false unless TAILWIND_CONFIG_PATH.exist?
         | 
| 90 | 
            +
             | 
| 91 | 
            +
                  content = File.read(TAILWIND_CONFIG_PATH)
         | 
| 92 | 
            +
                  content.include?("#{END_MARKER} #{TurboMaterial::VERSION}")
         | 
| 93 | 
            +
                end
         | 
| 94 | 
            +
             | 
| 95 | 
            +
                def extract_tailwind_classes
         | 
| 96 | 
            +
                  tailwind_css_path = Engine.root.join('app/assets/dist/turbo_material/tailwind.css')
         | 
| 97 | 
            +
                  css_content = File.read(tailwind_css_path)
         | 
| 98 | 
            +
                  css_content.gsub!(%r{/\*.*?\*/}m, '')
         | 
| 99 | 
            +
                  css_content.gsub!(/\{[^}]*}/m, '{}')
         | 
| 100 | 
            +
                  css_content.gsub!('>:not([hidden])~:not([hidden])', '')
         | 
| 101 | 
            +
                  css_content.gsub!(/\\\[/, '[')
         | 
| 102 | 
            +
                  css_content.gsub!(/\\\]/, ']')
         | 
| 103 | 
            +
                  css_content.gsub!(%r{\\/}, '/')
         | 
| 104 | 
            +
                  css_content.gsub!(/\\:/, ':')
         | 
| 105 | 
            +
                  css_content.scan(CLASS_REGEX).flatten.uniq.sort
         | 
| 106 | 
            +
                end
         | 
| 78 107 | 
             
              end
         | 
| 79 108 | 
             
            end
         | 
| @@ -1,8 +1,10 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            +
            class CheckboxPreview < Lookbook::Preview
         | 
| 3 4 | 
             
              # @param label text
         | 
| 4 5 | 
             
              # @param disabled toggle
         | 
| 5 6 | 
             
              def default(label: 'Checkbox', disabled: false)
         | 
| 6 | 
            -
                render 'common/form', helper_name: 'material_checkbox', label: label, name: 'checkbox', id: 'Checkbox', | 
| 7 | 
            +
                render 'common/form', helper_name: 'material_checkbox', label: label, name: 'checkbox', id: 'Checkbox',
         | 
| 8 | 
            +
                                      disabled: disabled
         | 
| 7 9 | 
             
              end
         | 
| 8 10 | 
             
            end
         | 
| @@ -1,15 +1,16 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            +
            class ChipsSelectPreview < Lookbook::Preview
         | 
| 3 4 | 
             
              # @param label text
         | 
| 4 5 | 
             
              # @param disabled toggle
         | 
| 5 6 | 
             
              # @param required toggle
         | 
| 6 7 | 
             
              def default(label: 'Chips Select', disabled: false, required: false)
         | 
| 7 8 | 
             
                render 'common/form', helper_name: 'material_chips_select', label: label, name: 'checkbox',
         | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 9 | 
            +
                                      id: 'Input', disabled: disabled, value: [],
         | 
| 10 | 
            +
                                      options: [
         | 
| 11 | 
            +
                                        { value: '1', label: 'Option 1' },
         | 
| 12 | 
            +
                                        { value: '2', label: 'Option 2' },
         | 
| 13 | 
            +
                                        { value: '3', label: 'Option 3' }
         | 
| 14 | 
            +
                                      ]
         | 
| 14 15 | 
             
              end
         | 
| 15 16 | 
             
            end
         | 
| @@ -1,10 +1,12 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            +
            class InputPreview < Lookbook::Preview
         | 
| 3 4 | 
             
              # @param label text
         | 
| 4 5 | 
             
              # @param disabled toggle
         | 
| 5 6 | 
             
              # @param required toggle
         | 
| 6 7 | 
             
              # @param style select { choices: [filled, outlined] }
         | 
| 7 8 | 
             
              def default(label: 'Input', disabled: false, required: false, style: 'filled')
         | 
| 8 | 
            -
                render 'common/form', helper_name: 'material_input', label: label, name: 'checkbox', id: 'Input', | 
| 9 | 
            +
                render 'common/form', helper_name: 'material_input', label: label, name: 'checkbox', id: 'Input',
         | 
| 10 | 
            +
                                      disabled: disabled, required: required, style: style
         | 
| 9 11 | 
             
              end
         | 
| 10 12 | 
             
            end
         | 
| @@ -1,9 +1,11 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            +
            class RadioPreview < Lookbook::Preview
         | 
| 3 4 | 
             
              # @param label text
         | 
| 4 5 | 
             
              # @param disabled toggle
         | 
| 5 6 | 
             
              # @param required toggle
         | 
| 6 7 | 
             
              def default(label: 'Radio', disabled: false, required: false)
         | 
| 7 | 
            -
                render 'common/form', helper_name: 'material_radio', label: label, name: 'checkbox', id: 'Input', | 
| 8 | 
            +
                render 'common/form', helper_name: 'material_radio', label: label, name: 'checkbox', id: 'Input',
         | 
| 9 | 
            +
                                      disabled: disabled, required: required
         | 
| 8 10 | 
             
              end
         | 
| 9 11 | 
             
            end
         | 
| @@ -1,10 +1,12 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            +
            class SwitchPreview < Lookbook::Preview
         | 
| 3 4 | 
             
              # @param label text
         | 
| 4 5 | 
             
              # @param true_label text
         | 
| 5 6 | 
             
              # @param false_label text
         | 
| 6 7 | 
             
              # @param disabled toggle
         | 
| 7 8 | 
             
              def default(label: 'Switch', disabled: false, required: false, true_label: nil, false_label: nil)
         | 
| 8 | 
            -
                render 'common/form', helper_name: 'material_switch', label: label, name: 'checkbox', id: 'Input', | 
| 9 | 
            +
                render 'common/form', helper_name: 'material_switch', label: label, name: 'checkbox', id: 'Input',
         | 
| 10 | 
            +
                                      disabled: disabled, true_label: true_label, false_label: false_label
         | 
| 9 11 | 
             
              end
         | 
| 10 12 | 
             
            end
         | 
| @@ -1,9 +1,11 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            +
            class TextareaPreview < Lookbook::Preview
         | 
| 3 4 | 
             
              # @param label text
         | 
| 4 5 | 
             
              # @param disabled toggle
         | 
| 5 6 | 
             
              # @param required toggle
         | 
| 6 7 | 
             
              def default(label: 'Textarea', disabled: false, required: false)
         | 
| 7 | 
            -
                render 'common/form', helper_name: 'material_textarea', label: label, name: 'textarea', id: 'Text', | 
| 8 | 
            +
                render 'common/form', helper_name: 'material_textarea', label: label, name: 'textarea', id: 'Text',
         | 
| 9 | 
            +
                                      disabled: disabled, required: required
         | 
| 8 10 | 
             
              end
         | 
| 9 11 | 
             
            end
         | 
    
        data/lib/tasks/install.rake
    CHANGED
    
    | @@ -5,4 +5,9 @@ namespace :turbo_material do | |
| 5 5 | 
             
              task install: :environment do
         | 
| 6 6 | 
             
                Rails::Command.invoke :generate, ['turbo_material:install']
         | 
| 7 7 | 
             
              end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              desc 'Updates Tailwind configuration'
         | 
| 10 | 
            +
              task update_tailwind: :environment do
         | 
| 11 | 
            +
                Rails::Command.invoke :generate, %w[turbo_material:install --update-tailwind-only]
         | 
| 12 | 
            +
              end
         | 
| 8 13 | 
             
            end
         | 
| @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            -
            require  | 
| 3 | 
            +
            require 'importmap-rails'
         | 
| 4 4 |  | 
| 5 5 | 
             
            module TurboMaterial
         | 
| 6 6 | 
             
              class Engine < ::Rails::Engine
         | 
| @@ -26,26 +26,26 @@ module TurboMaterial | |
| 26 26 | 
             
                  end
         | 
| 27 27 | 
             
                end
         | 
| 28 28 |  | 
| 29 | 
            -
                initializer  | 
| 29 | 
            +
                initializer 'turbo_material.importmap', before: 'importmap' do |app|
         | 
| 30 30 | 
             
                  # NOTE: this will add pins from this engine to the main app
         | 
| 31 31 | 
             
                  # https://github.com/rails/importmap-rails#composing-import-maps
         | 
| 32 | 
            -
                  app.config.importmap.paths << root.join( | 
| 32 | 
            +
                  app.config.importmap.paths << root.join('config/importmap.rb')
         | 
| 33 33 |  | 
| 34 34 | 
             
                  # NOTE: something about cache; I did not look into it.
         | 
| 35 35 | 
             
                  # https://github.com/rails/importmap-rails#sweeping-the-cache-in-development-and-test
         | 
| 36 | 
            -
                  app.config.importmap.cache_sweepers << root.join( | 
| 36 | 
            +
                  app.config.importmap.cache_sweepers << root.join('app/assets/javascripts')
         | 
| 37 37 | 
             
                end
         | 
| 38 38 |  | 
| 39 39 | 
             
                # NOTE: add engine manifest to precompile assets in production
         | 
| 40 | 
            -
                initializer  | 
| 40 | 
            +
                initializer 'turbo_material.assets' do |app|
         | 
| 41 41 | 
             
                  app.config.assets.precompile += %w[turbo_material_manifest]
         | 
| 42 42 | 
             
                end
         | 
| 43 43 |  | 
| 44 | 
            -
                initializer  | 
| 45 | 
            -
                  app.config.assets.paths << root.join( | 
| 46 | 
            -
                  app.config.assets.precompile <<  | 
| 47 | 
            -
                  app.config.assets.paths << root.join( | 
| 48 | 
            -
                  app.config.assets.precompile <<  | 
| 44 | 
            +
                initializer 'turbo_material.precompile' do |app|
         | 
| 45 | 
            +
                  app.config.assets.paths << root.join('app/assets/javascripts')
         | 
| 46 | 
            +
                  app.config.assets.precompile << 'turbo_material/application.js'
         | 
| 47 | 
            +
                  app.config.assets.paths << root.join('app/assets/dist')
         | 
| 48 | 
            +
                  app.config.assets.precompile << 'turbo_material/tailwind.css'
         | 
| 49 49 | 
             
                end
         | 
| 50 50 | 
             
              end
         | 
| 51 51 | 
             
            end
         | 
| @@ -0,0 +1,10 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module TurboMaterial
         | 
| 4 | 
            +
              def self.post_install
         | 
| 5 | 
            +
                puts 'TurboMaterial: Running post install tasks...'
         | 
| 6 | 
            +
              rescue StandardError => e
         | 
| 7 | 
            +
                puts "TurboMaterial: Failed to update Tailwind configuration. Error: #{e.message}"
         | 
| 8 | 
            +
                puts "You may need to run 'bin/rails turbo_material:install' manually to complete the setup."
         | 
| 9 | 
            +
              end
         | 
| 10 | 
            +
            end
         | 
    
        data/lib/turbo_material.rb
    CHANGED
    
    | @@ -1,6 +1,8 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
             | 
| 3 | 
            -
            require  | 
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require 'turbo_material/version'
         | 
| 4 | 
            +
            require 'turbo_material/engine'
         | 
| 5 | 
            +
            require 'turbo_material/configuration'
         | 
| 4 6 |  | 
| 5 7 | 
             
            module TurboMaterial
         | 
| 6 8 | 
             
              class << self
         | 
    
        metadata
    CHANGED
    
    | @@ -1,49 +1,49 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: turbo_material
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.2. | 
| 4 | 
            +
              version: 0.2.19
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Sergey Moiseev
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2025-01-09 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 | 
            -
              name: rails
         | 
| 14 | 
            +
              name: importmap-rails
         | 
| 15 15 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 16 | 
             
                requirements:
         | 
| 17 17 | 
             
                - - "~>"
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version:  | 
| 20 | 
            -
                - - ">="
         | 
| 21 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 22 | 
            -
                    version: 7.1.2
         | 
| 19 | 
            +
                    version: 2.0.1
         | 
| 23 20 | 
             
              type: :runtime
         | 
| 24 21 | 
             
              prerelease: false
         | 
| 25 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 26 23 | 
             
                requirements:
         | 
| 27 24 | 
             
                - - "~>"
         | 
| 28 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 29 | 
            -
                    version:  | 
| 30 | 
            -
                - - ">="
         | 
| 31 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 32 | 
            -
                    version: 7.1.2
         | 
| 26 | 
            +
                    version: 2.0.1
         | 
| 33 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 34 | 
            -
              name:  | 
| 28 | 
            +
              name: rails
         | 
| 35 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 36 30 | 
             
                requirements:
         | 
| 37 | 
            -
                - - " | 
| 31 | 
            +
                - - ">="
         | 
| 38 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 39 | 
            -
                    version:  | 
| 33 | 
            +
                    version: 7.1.2
         | 
| 34 | 
            +
                - - "<"
         | 
| 35 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 36 | 
            +
                    version: '9.0'
         | 
| 40 37 | 
             
              type: :runtime
         | 
| 41 38 | 
             
              prerelease: false
         | 
| 42 39 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 43 40 | 
             
                requirements:
         | 
| 44 | 
            -
                - - " | 
| 41 | 
            +
                - - ">="
         | 
| 45 42 | 
             
                  - !ruby/object:Gem::Version
         | 
| 46 | 
            -
                    version:  | 
| 43 | 
            +
                    version: 7.1.2
         | 
| 44 | 
            +
                - - "<"
         | 
| 45 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 46 | 
            +
                    version: '9.0'
         | 
| 47 47 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 48 48 | 
             
              name: stimulus-rails
         | 
| 49 49 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -171,6 +171,7 @@ files: | |
| 171 171 | 
             
            - lib/turbo_material.rb
         | 
| 172 172 | 
             
            - lib/turbo_material/configuration.rb
         | 
| 173 173 | 
             
            - lib/turbo_material/engine.rb
         | 
| 174 | 
            +
            - lib/turbo_material/post_install.rb
         | 
| 174 175 | 
             
            - lib/turbo_material/version.rb
         | 
| 175 176 | 
             
            homepage: https://github.com/full-stack-biz/turbo_material
         | 
| 176 177 | 
             
            licenses:
         | 
| @@ -179,7 +180,10 @@ metadata: | |
| 179 180 | 
             
              allowed_push_host: https://rubygems.org
         | 
| 180 181 | 
             
              homepage_uri: https://github.com/full-stack-biz/turbo_material
         | 
| 181 182 | 
             
              source_code_uri: https://github.com/full-stack-biz/turbo_material
         | 
| 182 | 
            -
            post_install_message:
         | 
| 183 | 
            +
            post_install_message: |
         | 
| 184 | 
            +
              Installing `turbo_material` gem. Please, follow the instructions in the README.md file.
         | 
| 185 | 
            +
             | 
| 186 | 
            +
              After that, please, run `bin/rails turbo_material:install` to install the gem and add necessary files and configurations to your project.
         | 
| 183 187 | 
             
            rdoc_options: []
         | 
| 184 188 | 
             
            require_paths:
         | 
| 185 189 | 
             
            - lib
         |