lookbook 0.7.2 → 0.8.0.beta.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 +4 -4
 - data/README.md +68 -8
 - data/app/controllers/lookbook/previews_controller.rb +0 -1
 - data/app/views/lookbook/previews/panels/_params.html.erb +1 -1
 - data/config/routes.rb +1 -1
 - data/lib/lookbook/engine.rb +51 -36
 - data/lib/lookbook/parser.rb +10 -6
 - data/lib/lookbook/version.rb +1 -1
 - data/lib/lookbook.rb +0 -1
 - data/lib/tasks/lookbook_tasks.rake +9 -0
 - metadata +4 -5
 - data/lib/lookbook/null_logger.rb +0 -47
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: aa9a6048a7c6da30fcf5fe7c42a0a41365c3964da88d1d639a640c1acdd97a95
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: dbbf4e04289ccadde4f37453123aabc70d982104b6933b3e139b0c65ea2a68f4
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: a9eea08255c6263b84d6212d88d4a08ac425377eb1b0f42e4c5e626e04e1281e711c3ba41df98b550e3777b4e292824884ecd5e05b733db97126ccb6ba4cd100
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 8b48c299198427e2e957eb6c3dcccf6ae1544a921ef5ae4ba37fad558dd0274a1f864e9b8a37fb5b76a49c275f74f5a73e3363a8c6c4d4092a380639b99798e8
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -13,7 +13,7 @@ 
     | 
|
| 
       13 
13 
     | 
    
         
             
            ---
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
            <div align="center">
         
     | 
| 
       16 
     | 
    
         
            -
            <a href="#installing">Installing</a> • <a href="#previews">Previews</a>  • <a href="#pages">Pages</a> • <a href="#config"> 
     | 
| 
      
 16 
     | 
    
         
            +
            <a href="#installing">Installing</a> • <a href="#previews">Previews</a>  • <a href="#pages">Pages</a> • <a href="#deployment">Deployment</a> • <a href="#config">Config</a> 
         
     | 
| 
       17 
17 
     | 
    
         
             
            </div>
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
            ---
         
     | 
| 
         @@ -72,13 +72,6 @@ The `at` property determines the root URL that the Lookbook UI will be served at 
     | 
|
| 
       72 
72 
     | 
    
         | 
| 
       73 
73 
     | 
    
         
             
            Then you can start your app as normal and navigate to `http://localhost:3000/lookbook` (or whatever mount path you specified) to view your component previews in the Lookbook UI.
         
     | 
| 
       74 
74 
     | 
    
         | 
| 
       75 
     | 
    
         
            -
            #### Mounting in Production
         
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
            If you would like to expose the Lookbook UI in production as well as in development
         
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
     | 
    
         
            -
            1. Remove the `if Rails.env.development?` condition from around the mount statement in `routes.rb`
         
     | 
| 
       80 
     | 
    
         
            -
            2. Add `config.view_component.show_previews = true` to `config/environments/production.rb`
         
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
75 
     | 
    
         | 
| 
       83 
76 
     | 
    
         
             
            <h2 id="previews">Previews</h2>
         
     | 
| 
       84 
77 
     | 
    
         | 
| 
         @@ -687,6 +680,73 @@ Default: `pages` 
     | 
|
| 
       687 
680 
     | 
    
         
             
            config.lookbook.page_route = `docs`
         
     | 
| 
       688 
681 
     | 
    
         
             
            ```
         
     | 
| 
       689 
682 
     | 
    
         | 
| 
      
 683 
     | 
    
         
            +
            <h2 id="deployment">Deploying in Production</h2>
         
     | 
| 
      
 684 
     | 
    
         
            +
             
     | 
| 
      
 685 
     | 
    
         
            +
            Lookbook is intended to be a tool for aiding the ViewComponent development process, and so is usually restricted to running only when the app is in `development` mode.
         
     | 
| 
      
 686 
     | 
    
         
            +
             
     | 
| 
      
 687 
     | 
    
         
            +
            However, it is possible to run Lookbook in a production environment if you wish.
         
     | 
| 
      
 688 
     | 
    
         
            +
             
     | 
| 
      
 689 
     | 
    
         
            +
            ### Differences between development and production
         
     | 
| 
      
 690 
     | 
    
         
            +
             
     | 
| 
      
 691 
     | 
    
         
            +
            By default, Lookbook will behave a little differently in production than it does in development:
         
     | 
| 
      
 692 
     | 
    
         
            +
             
     | 
| 
      
 693 
     | 
    
         
            +
            1. Watching files for changes is disabled
         
     | 
| 
      
 694 
     | 
    
         
            +
            2. Parsing preview files for annotations does **not** happen at runtime. Instead the preview files must be pre-parsed via a Rake task before starting the app (much like asset precompilation).
         
     | 
| 
      
 695 
     | 
    
         
            +
             
     | 
| 
      
 696 
     | 
    
         
            +
            ### Pre-parsing preview files
         
     | 
| 
      
 697 
     | 
    
         
            +
             
     | 
| 
      
 698 
     | 
    
         
            +
            Run the following command to pre-parse the preview files annotations:
         
     | 
| 
      
 699 
     | 
    
         
            +
             
     | 
| 
      
 700 
     | 
    
         
            +
            ```
         
     | 
| 
      
 701 
     | 
    
         
            +
            rake lookbook:previews:preparse
         
     | 
| 
      
 702 
     | 
    
         
            +
            ```
         
     | 
| 
      
 703 
     | 
    
         
            +
             
     | 
| 
      
 704 
     | 
    
         
            +
            If you wish to run this as part of your existing assets precompilation step, you can add the following into your app's `Rakefile`:
         
     | 
| 
      
 705 
     | 
    
         
            +
             
     | 
| 
      
 706 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 707 
     | 
    
         
            +
            Rake::Task['assets:precompile'].enhance do
         
     | 
| 
      
 708 
     | 
    
         
            +
              Rake::Task["lookbook:previews:preparse"].invoke
         
     | 
| 
      
 709 
     | 
    
         
            +
            end
         
     | 
| 
      
 710 
     | 
    
         
            +
            ```
         
     | 
| 
      
 711 
     | 
    
         
            +
             
     | 
| 
      
 712 
     | 
    
         
            +
            The pre-parsing of preview files will then take place every time `rake assets:precompile` is called and so will not need to be run separately.
         
     | 
| 
      
 713 
     | 
    
         
            +
             
     | 
| 
      
 714 
     | 
    
         
            +
            ### Configuration changes for production
         
     | 
| 
      
 715 
     | 
    
         
            +
             
     | 
| 
      
 716 
     | 
    
         
            +
            You will also need to make sure that the following configuration changes have been made when deploying to production:
         
     | 
| 
      
 717 
     | 
    
         
            +
             
     | 
| 
      
 718 
     | 
    
         
            +
            1. Make sure ViewComponent is [configured to show previews in production](https://viewcomponent.org/api.html#show_previews) (by default it is disabled when not in development):
         
     | 
| 
      
 719 
     | 
    
         
            +
             
     | 
| 
      
 720 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 721 
     | 
    
         
            +
            # config/environments/production.rb
         
     | 
| 
      
 722 
     | 
    
         
            +
            config.view_component.show_previews = true
         
     | 
| 
      
 723 
     | 
    
         
            +
            ```
         
     | 
| 
      
 724 
     | 
    
         
            +
             
     | 
| 
      
 725 
     | 
    
         
            +
            2. Remove any environment checking from around the Lookbook mounting declaration (if added as per install instructions):
         
     | 
| 
      
 726 
     | 
    
         
            +
             
     | 
| 
      
 727 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 728 
     | 
    
         
            +
            # config/routes.rb
         
     | 
| 
      
 729 
     | 
    
         
            +
            Rails.application.routes.draw do
         
     | 
| 
      
 730 
     | 
    
         
            +
              # if Rails.env.development? <- remove
         
     | 
| 
      
 731 
     | 
    
         
            +
                mount Lookbook::Engine, at: "/lookbook"
         
     | 
| 
      
 732 
     | 
    
         
            +
              # end
         
     | 
| 
      
 733 
     | 
    
         
            +
            end
         
     | 
| 
      
 734 
     | 
    
         
            +
            ```
         
     | 
| 
      
 735 
     | 
    
         
            +
             
     | 
| 
      
 736 
     | 
    
         
            +
            ### Overriding production default behaviours
         
     | 
| 
      
 737 
     | 
    
         
            +
             
     | 
| 
      
 738 
     | 
    
         
            +
            If for some reason you wish to enable file watching or runtime preview annotation parsing in production, you can always override the default behaviour using thie following config options:
         
     | 
| 
      
 739 
     | 
    
         
            +
             
     | 
| 
      
 740 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 741 
     | 
    
         
            +
            # config/environments/production.rb
         
     | 
| 
      
 742 
     | 
    
         
            +
             
     | 
| 
      
 743 
     | 
    
         
            +
            # enable file-change listening
         
     | 
| 
      
 744 
     | 
    
         
            +
            config.lookbook.listen = true 
         
     | 
| 
      
 745 
     | 
    
         
            +
             
     | 
| 
      
 746 
     | 
    
         
            +
            # enable runtime preview parsing
         
     | 
| 
      
 747 
     | 
    
         
            +
            config.lookbook.runtime_parsing = true 
         
     | 
| 
      
 748 
     | 
    
         
            +
            ```
         
     | 
| 
      
 749 
     | 
    
         
            +
             
     | 
| 
       690 
750 
     | 
    
         
             
            <h2 id="config">General Configuration</h2>
         
     | 
| 
       691 
751 
     | 
    
         | 
| 
       692 
752 
     | 
    
         
             
            Lookbook will use the ViewComponent [configuration](https://viewcomponent.org/api.html#configuration) for your project to find and render your previews so you generally you won't need to configure much else separately.
         
     | 
| 
         @@ -145,7 +145,6 @@ module Lookbook 
     | 
|
| 
       145 
145 
     | 
    
         
             
                def preview_controller
         
     | 
| 
       146 
146 
     | 
    
         
             
                  return @preview_controller if @preview_controller.present?
         
     | 
| 
       147 
147 
     | 
    
         
             
                  controller_class = Lookbook.config.preview_controller.constantize
         
     | 
| 
       148 
     | 
    
         
            -
                  controller_class.class_eval { include Lookbook::PreviewController }
         
     | 
| 
       149 
148 
     | 
    
         
             
                  controller = controller_class.new
         
     | 
| 
       150 
149 
     | 
    
         
             
                  controller.request = request
         
     | 
| 
       151 
150 
     | 
    
         
             
                  controller.response = response
         
     | 
    
        data/config/routes.rb
    CHANGED
    
    
    
        data/lib/lookbook/engine.rb
    CHANGED
    
    | 
         @@ -10,7 +10,7 @@ module Lookbook 
     | 
|
| 
       10 
10 
     | 
    
         
             
                end
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
                def logger
         
     | 
| 
       13 
     | 
    
         
            -
                  @logger ||=  
     | 
| 
      
 13 
     | 
    
         
            +
                  @logger ||= Rails.logger
         
     | 
| 
       14 
14 
     | 
    
         
             
                end
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
                def version
         
     | 
| 
         @@ -49,15 +49,17 @@ module Lookbook 
     | 
|
| 
       49 
49 
     | 
    
         
             
                  options.preview_srcdoc = false if options.preview_srcdoc.nil?
         
     | 
| 
       50 
50 
     | 
    
         
             
                  options.preview_display_params ||= {}.with_indifferent_access
         
     | 
| 
       51 
51 
     | 
    
         | 
| 
      
 52 
     | 
    
         
            +
                  options.listen = Rails.env.development? if options.listen.nil?
         
     | 
| 
       52 
53 
     | 
    
         
             
                  options.listen_paths = options.listen_paths.map(&:to_s)
         
     | 
| 
       53 
54 
     | 
    
         
             
                  options.listen_paths += options.preview_paths
         
     | 
| 
       54 
55 
     | 
    
         
             
                  options.listen_paths << (vc_options.view_component_path || Rails.root.join("app/components"))
         
     | 
| 
       55 
56 
     | 
    
         
             
                  options.listen_paths.filter! { |path| Dir.exist? path }
         
     | 
| 
       56 
57 
     | 
    
         | 
| 
       57 
     | 
    
         
            -
                  options. 
     | 
| 
       58 
     | 
    
         
            -
                  options. 
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
                  options. 
     | 
| 
      
 58 
     | 
    
         
            +
                  options.cable_mount_path ||= "/lookbook-cable"
         
     | 
| 
      
 59 
     | 
    
         
            +
                  options.cable_logger ||= Rails.logger
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
                  options.runtime_parsing = !Rails.env.production? if options.runtime_parsing.nil?
         
     | 
| 
      
 62 
     | 
    
         
            +
                  options.parser_registry_path ||= Rails.root.join("tmp/storage/.yardoc")
         
     | 
| 
       61 
63 
     | 
    
         | 
| 
       62 
64 
     | 
    
         
             
                  options.experimental_features = false unless options.experimental_features.present?
         
     | 
| 
       63 
65 
     | 
    
         
             
                end
         
     | 
| 
         @@ -73,41 +75,48 @@ module Lookbook 
     | 
|
| 
       73 
75 
     | 
    
         
             
                  )
         
     | 
| 
       74 
76 
     | 
    
         
             
                end
         
     | 
| 
       75 
77 
     | 
    
         | 
| 
       76 
     | 
    
         
            -
                initializer "lookbook.logging" do
         
     | 
| 
       77 
     | 
    
         
            -
                  if config.lookbook.debug == true
         
     | 
| 
       78 
     | 
    
         
            -
                    config.lookbook.cable.logger ||= Rails.logger
         
     | 
| 
       79 
     | 
    
         
            -
                  else
         
     | 
| 
       80 
     | 
    
         
            -
                    config.lookbook.cable.logger = Lookbook::NullLogger.new
         
     | 
| 
       81 
     | 
    
         
            -
                  end
         
     | 
| 
       82 
     | 
    
         
            -
                end
         
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
78 
     | 
    
         
             
                config.after_initialize do
         
     | 
| 
       85 
     | 
    
         
            -
                   
     | 
| 
       86 
     | 
    
         
            -
             
     | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
       88 
     | 
    
         
            -
             
     | 
| 
       89 
     | 
    
         
            -
                     
     | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
       92 
     | 
    
         
            -
                       
     | 
| 
       93 
     | 
    
         
            -
                       
     | 
| 
       94 
     | 
    
         
            -
                       
     | 
| 
       95 
     | 
    
         
            -
                    })
         
     | 
| 
       96 
     | 
    
         
            -
                  end
         
     | 
| 
       97 
     | 
    
         
            -
                  @preview_listener.start
         
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
     | 
    
         
            -
                  if Lookbook::Features.enabled?(:pages)
         
     | 
| 
       100 
     | 
    
         
            -
                    @page_listener = Listen.to(*config.lookbook.page_paths.filter { |dir| Dir.exist? dir }, only: /\.(html.*|md.*)$/) do |modified, added, removed|
         
     | 
| 
      
 79 
     | 
    
         
            +
                  preview_controller = Lookbook.config.preview_controller.constantize
         
     | 
| 
      
 80 
     | 
    
         
            +
                  preview_controller.class_eval { include Lookbook::PreviewController }
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
                  if config.lookbook.listen
         
     | 
| 
      
 83 
     | 
    
         
            +
                    @preview_listener = Listen.to(*config.lookbook.listen_paths, only: /\.(rb|html.*)$/) do |modified, added, removed|
         
     | 
| 
      
 84 
     | 
    
         
            +
                      begin
         
     | 
| 
      
 85 
     | 
    
         
            +
                        parser.parse
         
     | 
| 
      
 86 
     | 
    
         
            +
                      rescue
         
     | 
| 
      
 87 
     | 
    
         
            +
                      end
         
     | 
| 
      
 88 
     | 
    
         
            +
                      Lookbook::Preview.clear_cache
         
     | 
| 
       101 
89 
     | 
    
         
             
                      Lookbook::Engine.websocket&.broadcast("reload", {
         
     | 
| 
       102 
90 
     | 
    
         
             
                        modified: modified,
         
     | 
| 
       103 
91 
     | 
    
         
             
                        removed: removed,
         
     | 
| 
       104 
92 
     | 
    
         
             
                        added: added
         
     | 
| 
       105 
93 
     | 
    
         
             
                      })
         
     | 
| 
       106 
94 
     | 
    
         
             
                    end
         
     | 
| 
       107 
     | 
    
         
            -
                    @ 
     | 
| 
       108 
     | 
    
         
            -
             
     | 
| 
      
 95 
     | 
    
         
            +
                    @preview_listener.start
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
                    if Lookbook::Features.enabled?(:pages)
         
     | 
| 
      
 98 
     | 
    
         
            +
                      @page_listener = Listen.to(*config.lookbook.page_paths.filter { |dir| Dir.exist? dir }, only: /\.(html.*|md.*)$/) do |modified, added, removed|
         
     | 
| 
      
 99 
     | 
    
         
            +
                        Lookbook::Engine.websocket&.broadcast("reload", {
         
     | 
| 
      
 100 
     | 
    
         
            +
                          modified: modified,
         
     | 
| 
      
 101 
     | 
    
         
            +
                          removed: removed,
         
     | 
| 
      
 102 
     | 
    
         
            +
                          added: added
         
     | 
| 
      
 103 
     | 
    
         
            +
                        })
         
     | 
| 
      
 104 
     | 
    
         
            +
                      end
         
     | 
| 
      
 105 
     | 
    
         
            +
                      @page_listener.start
         
     | 
| 
      
 106 
     | 
    
         
            +
                    end
         
     | 
| 
       109 
107 
     | 
    
         | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
      
 108 
     | 
    
         
            +
                    if config.lookbook.runtime_parsing
         
     | 
| 
      
 109 
     | 
    
         
            +
                      parser.parse
         
     | 
| 
      
 110 
     | 
    
         
            +
                    else
         
     | 
| 
      
 111 
     | 
    
         
            +
                      unless File.exist?(config.lookbook.parser_registry_path)
         
     | 
| 
      
 112 
     | 
    
         
            +
                        Lookbook.logger.warn "
         
     | 
| 
      
 113 
     | 
    
         
            +
                          Runtime parsing is disabled but no registry file has been found.
         
     | 
| 
      
 114 
     | 
    
         
            +
                          Did you run `rake lookbook:preparse` before starting the app?
         
     | 
| 
      
 115 
     | 
    
         
            +
                          Expected to find registry file at #{config.lookbook.parser_registry_path}
         
     | 
| 
      
 116 
     | 
    
         
            +
                        "
         
     | 
| 
      
 117 
     | 
    
         
            +
                      end
         
     | 
| 
      
 118 
     | 
    
         
            +
                    end
         
     | 
| 
      
 119 
     | 
    
         
            +
                  end
         
     | 
| 
       111 
120 
     | 
    
         
             
                end
         
     | 
| 
       112 
121 
     | 
    
         | 
| 
       113 
122 
     | 
    
         
             
                at_exit do
         
     | 
| 
         @@ -118,18 +127,24 @@ module Lookbook 
     | 
|
| 
       118 
127 
     | 
    
         
             
                class << self
         
     | 
| 
       119 
128 
     | 
    
         
             
                  def websocket
         
     | 
| 
       120 
129 
     | 
    
         
             
                    if config.lookbook.auto_refresh
         
     | 
| 
      
 130 
     | 
    
         
            +
                      cable = ActionCable::Server::Configuration.new
         
     | 
| 
      
 131 
     | 
    
         
            +
                      cable.cable = {adapter: "async"}.with_indifferent_access
         
     | 
| 
      
 132 
     | 
    
         
            +
                      cable.mount_path = config.lookbook.cable_mount_path
         
     | 
| 
      
 133 
     | 
    
         
            +
                      cable.connection_class = -> { Lookbook::Connection }
         
     | 
| 
      
 134 
     | 
    
         
            +
                      cable.logger = config.lookbook.cable_logger
         
     | 
| 
      
 135 
     | 
    
         
            +
             
     | 
| 
       121 
136 
     | 
    
         
             
                      @websocket ||= if Rails.version.to_f >= 6.0
         
     | 
| 
       122 
     | 
    
         
            -
                        ActionCable::Server::Base.new(config:  
     | 
| 
      
 137 
     | 
    
         
            +
                        ActionCable::Server::Base.new(config: cable)
         
     | 
| 
       123 
138 
     | 
    
         
             
                      else
         
     | 
| 
       124 
139 
     | 
    
         
             
                        websocket ||= ActionCable::Server::Base.new
         
     | 
| 
       125 
     | 
    
         
            -
                        websocket.config =  
     | 
| 
      
 140 
     | 
    
         
            +
                        websocket.config = cable
         
     | 
| 
       126 
141 
     | 
    
         
             
                        websocket
         
     | 
| 
       127 
142 
     | 
    
         
             
                      end
         
     | 
| 
       128 
143 
     | 
    
         
             
                    end
         
     | 
| 
       129 
144 
     | 
    
         
             
                  end
         
     | 
| 
       130 
145 
     | 
    
         | 
| 
       131 
146 
     | 
    
         
             
                  def websocket_mount_path
         
     | 
| 
       132 
     | 
    
         
            -
                    "#{mounted_path}#{config.lookbook. 
     | 
| 
      
 147 
     | 
    
         
            +
                    "#{mounted_path}#{config.lookbook.cable_mount_path}" if websocket
         
     | 
| 
       133 
148 
     | 
    
         
             
                  end
         
     | 
| 
       134 
149 
     | 
    
         | 
| 
       135 
150 
     | 
    
         
             
                  def mounted_path
         
     | 
| 
         @@ -137,7 +152,7 @@ module Lookbook 
     | 
|
| 
       137 
152 
     | 
    
         
             
                  end
         
     | 
| 
       138 
153 
     | 
    
         | 
| 
       139 
154 
     | 
    
         
             
                  def parser
         
     | 
| 
       140 
     | 
    
         
            -
                    @parser ||= Lookbook::Parser.new(config.lookbook.preview_paths)
         
     | 
| 
      
 155 
     | 
    
         
            +
                    @parser ||= Lookbook::Parser.new(config.lookbook.preview_paths, config.lookbook.parser_registry_path)
         
     | 
| 
       141 
156 
     | 
    
         
             
                  end
         
     | 
| 
       142 
157 
     | 
    
         
             
                end
         
     | 
| 
       143 
158 
     | 
    
         
             
              end
         
     | 
    
        data/lib/lookbook/parser.rb
    CHANGED
    
    | 
         @@ -2,27 +2,31 @@ require "yard" 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            module Lookbook
         
     | 
| 
       4 
4 
     | 
    
         
             
              class Parser
         
     | 
| 
       5 
     | 
    
         
            -
                 
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
                def initialize(paths)
         
     | 
| 
      
 5 
     | 
    
         
            +
                attr_reader :registry_path
         
     | 
| 
      
 6 
     | 
    
         
            +
                def initialize(paths, registry_path)
         
     | 
| 
       8 
7 
     | 
    
         
             
                  @paths = paths.map { |p| "#{p}/**/*preview.rb" }
         
     | 
| 
       9 
     | 
    
         
            -
                   
     | 
| 
      
 8 
     | 
    
         
            +
                  @registry_path = registry_path.to_s
         
     | 
| 
      
 9 
     | 
    
         
            +
                  YARD::Registry.yardoc_file = registry_path
         
     | 
| 
       10 
10 
     | 
    
         
             
                end
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
                def parse
         
     | 
| 
       13 
13 
     | 
    
         
             
                  YARD::Registry.clear
         
     | 
| 
       14 
14 
     | 
    
         
             
                  YARD::Registry.lock_for_writing do
         
     | 
| 
       15 
15 
     | 
    
         
             
                    YARD.parse(@paths)
         
     | 
| 
       16 
     | 
    
         
            -
                    YARD::Registry.save(false,  
     | 
| 
      
 16 
     | 
    
         
            +
                    YARD::Registry.save(false, registry_path)
         
     | 
| 
       17 
17 
     | 
    
         
             
                  end
         
     | 
| 
       18 
18 
     | 
    
         
             
                end
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
                def get_code_object(path)
         
     | 
| 
       21 
21 
     | 
    
         
             
                  registry = YARD::RegistryStore.new
         
     | 
| 
       22 
     | 
    
         
            -
                  registry.load!( 
     | 
| 
      
 22 
     | 
    
         
            +
                  registry.load!(registry_path)
         
     | 
| 
       23 
23 
     | 
    
         
             
                  registry.get(path)
         
     | 
| 
       24 
24 
     | 
    
         
             
                end
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
      
 26 
     | 
    
         
            +
                # def yardoc_file_path
         
     | 
| 
      
 27 
     | 
    
         
            +
                #   Rails&.root ? Rails.root.join(YARDOC_FILE_PATH) : YARDOC_FILE_PATH
         
     | 
| 
      
 28 
     | 
    
         
            +
                # end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
       26 
30 
     | 
    
         
             
                class << self
         
     | 
| 
       27 
31 
     | 
    
         
             
                  def define_tags
         
     | 
| 
       28 
32 
     | 
    
         
             
                    YARD::Tags::Library.define_tag("Hidden status", :hidden)
         
     | 
    
        data/lib/lookbook/version.rb
    CHANGED
    
    
    
        data/lib/lookbook.rb
    CHANGED
    
    | 
         @@ -20,7 +20,6 @@ module Lookbook 
     | 
|
| 
       20 
20 
     | 
    
         
             
              autoload :PreviewExample, "lookbook/preview_example"
         
     | 
| 
       21 
21 
     | 
    
         
             
              autoload :PreviewGroup, "lookbook/preview_group"
         
     | 
| 
       22 
22 
     | 
    
         
             
              autoload :CodeInspector, "lookbook/code_inspector"
         
     | 
| 
       23 
     | 
    
         
            -
              autoload :NullLogger, "lookbook/null_logger"
         
     | 
| 
       24 
23 
     | 
    
         
             
              autoload :CodeFormatter, "lookbook/code_formatter"
         
     | 
| 
       25 
24 
     | 
    
         
             
              autoload :Markdown, "lookbook/markdown"
         
     | 
| 
       26 
25 
     | 
    
         | 
| 
         @@ -1,6 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require_relative "../lookbook"
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            namespace :lookbook do
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
              namespace :previews do
         
     | 
| 
      
 6 
     | 
    
         
            +
                desc "Preparse the previews"
         
     | 
| 
      
 7 
     | 
    
         
            +
                task :preparse do
         
     | 
| 
      
 8 
     | 
    
         
            +
                  Lookbook::Engine.parser.parse
         
     | 
| 
      
 9 
     | 
    
         
            +
                  puts "Lookbook preview parsing complete"
         
     | 
| 
      
 10 
     | 
    
         
            +
                end
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
       4 
13 
     | 
    
         
             
              namespace :release do
         
     | 
| 
       5 
14 
     | 
    
         
             
                desc "Bump the Lookbook engine version number"
         
     | 
| 
       6 
15 
     | 
    
         
             
                task :bump_version, [:version] do |t, args|
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: lookbook
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.8.0.beta.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Mark Perkins
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2022-04- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-04-09 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: actioncable
         
     | 
| 
         @@ -290,7 +290,6 @@ files: 
     | 
|
| 
       290 
290 
     | 
    
         
             
            - lib/lookbook/features.rb
         
     | 
| 
       291 
291 
     | 
    
         
             
            - lib/lookbook/lang.rb
         
     | 
| 
       292 
292 
     | 
    
         
             
            - lib/lookbook/markdown.rb
         
     | 
| 
       293 
     | 
    
         
            -
            - lib/lookbook/null_logger.rb
         
     | 
| 
       294 
293 
     | 
    
         
             
            - lib/lookbook/page.rb
         
     | 
| 
       295 
294 
     | 
    
         
             
            - lib/lookbook/page_collection.rb
         
     | 
| 
       296 
295 
     | 
    
         
             
            - lib/lookbook/params.rb
         
     | 
| 
         @@ -325,9 +324,9 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       325 
324 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       326 
325 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       327 
326 
     | 
    
         
             
              requirements:
         
     | 
| 
       328 
     | 
    
         
            -
              - - " 
     | 
| 
      
 327 
     | 
    
         
            +
              - - ">"
         
     | 
| 
       329 
328 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       330 
     | 
    
         
            -
                  version:  
     | 
| 
      
 329 
     | 
    
         
            +
                  version: 1.3.1
         
     | 
| 
       331 
330 
     | 
    
         
             
            requirements: []
         
     | 
| 
       332 
331 
     | 
    
         
             
            rubygems_version: 3.2.22
         
     | 
| 
       333 
332 
     | 
    
         
             
            signing_key:
         
     | 
    
        data/lib/lookbook/null_logger.rb
    DELETED
    
    | 
         @@ -1,47 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            module Lookbook
         
     | 
| 
       2 
     | 
    
         
            -
              class NullLogger
         
     | 
| 
       3 
     | 
    
         
            -
                def unknown(*)
         
     | 
| 
       4 
     | 
    
         
            -
                  nil
         
     | 
| 
       5 
     | 
    
         
            -
                end
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
                def fatal(*)
         
     | 
| 
       8 
     | 
    
         
            -
                  nil
         
     | 
| 
       9 
     | 
    
         
            -
                end
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                def fatal?
         
     | 
| 
       12 
     | 
    
         
            -
                  false
         
     | 
| 
       13 
     | 
    
         
            -
                end
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
                def error(*)
         
     | 
| 
       16 
     | 
    
         
            -
                  nil
         
     | 
| 
       17 
     | 
    
         
            -
                end
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
                def error?
         
     | 
| 
       20 
     | 
    
         
            -
                  false
         
     | 
| 
       21 
     | 
    
         
            -
                end
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
                def warn(*)
         
     | 
| 
       24 
     | 
    
         
            -
                  nil
         
     | 
| 
       25 
     | 
    
         
            -
                end
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                def warn?
         
     | 
| 
       28 
     | 
    
         
            -
                  false
         
     | 
| 
       29 
     | 
    
         
            -
                end
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
                def info(*)
         
     | 
| 
       32 
     | 
    
         
            -
                  nil
         
     | 
| 
       33 
     | 
    
         
            -
                end
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
                def info?
         
     | 
| 
       36 
     | 
    
         
            -
                  false
         
     | 
| 
       37 
     | 
    
         
            -
                end
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
                def debug(*)
         
     | 
| 
       40 
     | 
    
         
            -
                  nil
         
     | 
| 
       41 
     | 
    
         
            -
                end
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
                def debug?
         
     | 
| 
       44 
     | 
    
         
            -
                  false
         
     | 
| 
       45 
     | 
    
         
            -
                end
         
     | 
| 
       46 
     | 
    
         
            -
              end
         
     | 
| 
       47 
     | 
    
         
            -
            end
         
     |