lookbook 0.9.4 → 0.9.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5617747c0cc6eca338a14139a9bc770b155656496676d5bc1b1ffbc61f08a0c4
4
- data.tar.gz: ec66261ebd66850c9e30893825d3bd03096e2425c207dc449b12f0bb2489f9c6
3
+ metadata.gz: 5e37b94615d684a28d33c6e058e62511007997df7ac6fc834a524e87aac05180
4
+ data.tar.gz: 81888f9888ada74bef21cc7f9ff37842e568789d9892aafd17e6c95b131e70f8
5
5
  SHA512:
6
- metadata.gz: 9c9e23c5e73b16775efa80595fb06323f09417e62ece899aaae648c677ac30885e0dd354b7032cd74e85a04447754f55a88ef0f0ad62d9d69998958edb15d783
7
- data.tar.gz: b6c78c07414bbe524881cd04719d0b04c69b470a70862f09bdfe2804fe33ab36b658298a5807726a413f0ae20bddaadbc7c60fff3632f9ac04dfc524c9437564
6
+ metadata.gz: b70b963ad24e380ca914a28bb7456a490ac8ad1de6cc87fe8afda2cfc48f7219cc73a864e74dfab05795f3ee16c0b935a1f283f76e4b7fc809400845eb695e40
7
+ data.tar.gz: b3c4da6fe93b94bdd2c7b58d1a9d21451e4e12ebdbe550b529203859518bf50a77edc80c7284e2d6de35bde22b6fef77bff9993c644662c59d7f489340f75526
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <div align="center">
2
- <h1>👀 Lookbook 👀</h1>
2
+ <h1>Lookbook</h1>
3
3
 
4
4
  <p>A native development UI for <a href="http://viewcomponent.org/">ViewComponent</a></p>
5
5
 
@@ -13,7 +13,9 @@
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="#deployment">Deployment</a> • <a href="#config">Config</a>
16
+
17
+ <p><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></p>
18
+ <p><a href="#beta-info">🚨 Lookbook v1.0 (beta) - testers wanted! 🚨</a></p>
17
19
  </div>
18
20
 
19
21
  ---
@@ -26,16 +28,32 @@ Lookbook uses [RDoc/Yard-style comment tags](#annotating-preview-files) to exten
26
28
 
27
29
  ![Lookbook UI](.github/assets/lookbook_screenshot.png)
28
30
 
29
- ### Features
30
31
 
31
- - Tree-style navigation menu with live search/filter
32
- - Resizable preview window for responsive testing
33
- - Highlighted preview source code and HTML output
34
- - Auto-updating UI when component or preview files are updated _(Rails v6.0+ only)_
35
- - Use comment tag annotations for granular customisation of the preview experience
36
- - Fully compatible with standard the ViewComponent preview system
37
- - In-browser live-editable preview parameters (similar to basic Storybook Controls/Knobs)
38
- - [**Experimental**] Markdown-powerered documentation pages with embeddable previews
32
+ <h2 id="beta-info">🚨 Lookbook v1.0 (beta)</h3>
33
+
34
+ The Lookbook v1.0 release is coming soon with a bunch of new features and under-the hood improvements.
35
+
36
+ ### Testing out the beta
37
+
38
+ If you are already using Lookbook in your project, just update the Lookbook gem to the latest beta release and then head over to the [beta documentation site](https://beta.lookbook.build/) to read more about the new features.
39
+
40
+ ```ruby
41
+ gem "lookbook", ">= 1.0.0.beta.7"
42
+ ```
43
+
44
+ If you are **new to Lookbook** then check out the <a href="https://beta.lookbook.build/guide/quick-start/">v1.0 quick start guide</a> for more detailed instructions on installing Lookbook in your project
45
+
46
+ > Please do <a href="https://github.com/allmarkedup/lookbook/issues">open an issue</a> or <a href="https://github.com/allmarkedup/lookbook/discussions">start a discussion</a> if you need any help with anything. Comments, feedback and suggestions are always appreciated!
47
+
48
+ <h4>Useful Resources</h4>
49
+
50
+ * 👉 <a href="https://lookbook-demo-app-v1-0-beta.herokuapp.com/lookbook">v1.0 demo app</a> <em>(The repo for the demo app <a href="https://github.com/allmarkedup/lookbook-demo/tree/v1.0-beta">is here</a> if you want to dig in further)</em>
51
+ * 👉 <a href="https://beta.lookbook.build/">v1.0 documentation site</a> _(work in progress!)_
52
+ * 👉 <a href="https://github.com/allmarkedup/lookbook/tree/v1.0-beta">v1.0-beta branch</a>
53
+
54
+ ---
55
+
56
+ **⚠️ Note: The rest of the documentation on this page is related to the current, stable `v0.9.x` branch.**
39
57
 
40
58
  ## Lookbook demo
41
59
 
@@ -1,5 +1,6 @@
1
1
  module Lookbook
2
2
  class ApplicationController < ActionController::Base
3
+ content_security_policy false, if: -> { Rails.env.development? }
3
4
  protect_from_forgery with: :exception
4
5
 
5
6
  helper Lookbook::ApplicationHelper
@@ -2,6 +2,7 @@ require "rails"
2
2
  require "view_component"
3
3
  require "action_cable/engine"
4
4
  require "listen"
5
+ require "rake"
5
6
 
6
7
  module Lookbook
7
8
  class << self
@@ -83,10 +84,36 @@ module Lookbook
83
84
  @preview_controller = Lookbook.config.preview_controller.constantize
84
85
  @preview_controller.include(Lookbook::PreviewController)
85
86
 
87
+ if Gem::Version.new(Rails.version) >= Gem::Version.new("6.1.3.1")
88
+ # Rails.application.server is only available for newer Rails versions
89
+ Rails.application.server do
90
+ init_listeners
91
+ end
92
+ else
93
+ # Fallback for older Rails versions - don't start listeners if running in a rake task.
94
+ unless File.basename($0) == "rake" || Rake.application.top_level_tasks.any?
95
+ init_listeners
96
+ end
97
+ end
98
+
99
+ if config.lookbook.runtime_parsing
100
+ Lookbook::Engine.parser.parse
101
+ else
102
+ unless File.exist?(config.lookbook.parser_registry_path)
103
+ Lookbook.logger.warn "
104
+ Runtime parsing is disabled but no registry file has been found.
105
+ Did you run `rake lookbook:preparse` before starting the app?
106
+ Expected to find registry file at #{config.lookbook.parser_registry_path}
107
+ "
108
+ end
109
+ end
110
+ end
111
+
112
+ def init_listeners
86
113
  if config.lookbook.listen
87
114
  @preview_listener = Listen.to(*config.lookbook.listen_paths, only: /\.(#{config.lookbook.listen_extensions.join("|")})$/) do |modified, added, removed|
88
115
  begin
89
- parser.parse
116
+ Lookbook::Engine.parser.parse
90
117
  rescue
91
118
  end
92
119
  Lookbook::Preview.clear_cache
@@ -109,18 +136,6 @@ module Lookbook
109
136
  @page_listener.start
110
137
  end
111
138
  end
112
-
113
- if config.lookbook.runtime_parsing
114
- parser.parse
115
- else
116
- unless File.exist?(config.lookbook.parser_registry_path)
117
- Lookbook.logger.warn "
118
- Runtime parsing is disabled but no registry file has been found.
119
- Did you run `rake lookbook:preparse` before starting the app?
120
- Expected to find registry file at #{config.lookbook.parser_registry_path}
121
- "
122
- end
123
- end
124
139
  end
125
140
 
126
141
  at_exit do
@@ -141,9 +156,9 @@ module Lookbook
141
156
  @websocket ||= if Rails.version.to_f >= 6.0
142
157
  ActionCable::Server::Base.new(config: cable)
143
158
  else
144
- @websocket ||= ActionCable::Server::Base.new
145
- @websocket.config = cable
146
- @websocket
159
+ ws = ActionCable::Server::Base.new
160
+ ws.config = cable
161
+ ws
147
162
  end
148
163
  end
149
164
  end
@@ -1,3 +1,3 @@
1
1
  module Lookbook
2
- VERSION = "0.9.4"
2
+ VERSION = "0.9.7"
3
3
  end
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.9.4
4
+ version: 0.9.7
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-08-23 00:00:00.000000000 Z
11
+ date: 2022-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actioncable