scrapbook 0.2.0 → 0.2.1

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: ca937f0e8c26f5b3ea2676b64135cf711e53ce2e17ac407c67abc7f934bfc482
4
- data.tar.gz: 90069e6ac7f4e344b8a6f245dc8e8c2fc02c5b052df51fec6fea7cac7658c9e2
3
+ metadata.gz: 19b4fdaf3007e60e0cd40c09d70fe04ee9c9b522552dc0060f718aba02fcaadd
4
+ data.tar.gz: 015d92510a0e2eacff22b81d163983de1ff88d2bc60f7f523e69dbfbc841d591
5
5
  SHA512:
6
- metadata.gz: d53088db3d75baeca477c9358ffe7c52483e9f13a370d5c1c4a021ec5017f5d0d108bea466d9194547bd6258852ca2e2b47b2dc468ef66126f784302d88be911
7
- data.tar.gz: d337a10422bed9966cb1cba24fa8362b63a8f5afed5e16572dc13248679a0d993c122fd06972ff8fd89eed2257892698ec33052c4d8d6945cabfc9788507d361
6
+ metadata.gz: c23dc644bb467bd0655a781615095e6cb74fd7ccc47dc0281a1877089bf42617fae23cbc182d290b437f96669328a899cda705a7ea69c299df0fb9f0e58f39c3
7
+ data.tar.gz: 379b7626edd2752d95c039d6daaf947f668c0dc4a1571685b58879a11509987df0da474184a4f37896c1585135e0ea7bc7be9c044e80bc78385a2f0566c287dc
data/README.md CHANGED
@@ -26,7 +26,7 @@ end
26
26
 
27
27
  And then execute:
28
28
 
29
- ```bash
29
+ ```
30
30
  $> bundle install
31
31
  $> bundle exec rails generate scrapbook:install
32
32
  ```
@@ -70,12 +70,12 @@ path you want: `mount Scrapbook::Engine => "/scrappy"`.
70
70
  You can configure one or more folders to be separate root scrapbooks via the
71
71
  `config.scrapbook.paths` option. This option defaults to an empty array which allows for
72
72
  using the shovel operator to add your paths:
73
- ```ruby
74
- Rails.application.configure do
75
- config.scrapbook.paths << Rails.root.join("scrapbooks/main")
76
- config.scrapbook.paths << Rails.root.join("scrapbooks/scratch")
77
- end
78
- ```
73
+ ```ruby
74
+ Rails.application.configure do
75
+ config.scrapbook.paths << Rails.root.join("scrapbooks/main")
76
+ config.scrapbook.paths << Rails.root.join("scrapbooks/scratch")
77
+ end
78
+ ```
79
79
  If no paths have been added, Scrapbook will use `Rails.root.join('scrapbook')` as the
80
80
  location it expects the scrapbook to be at. The first folder path in the array is considered
81
81
  the default scrapbook and will be available at the root mount point configured in the routes
@@ -85,17 +85,17 @@ We recommend only running Scrapbook in development / non-production Rails enviro
85
85
  However, if you find yourself needing to be able to run it in an environment precompiles its
86
86
  assets, you will need to configure Scrapbook to be part of the precompilation. You can do
87
87
  this by setting `config.scrapbook.precompile_assets` to "true":
88
- ```ruby
89
- Rails.application.configure do
90
- config.scrapbook.precompile_assets = true
91
- end
92
- ```
88
+ ```ruby
89
+ Rails.application.configure do
90
+ config.scrapbook.precompile_assets = true
91
+ end
92
+ ```
93
93
 
94
94
 
95
95
  ## Contributing
96
96
 
97
- If you have a question about Scrapbook, feel free to ask in [the repository's Discussions]
98
- [Discussions]. Before starting any work or creating any issues, please read [the
97
+ If you have a question about Scrapbook, feel free to ask in [the repository's
98
+ Discussions][Discussions]. Before starting any work or creating any issues, please read [the
99
99
  contribution guidelines](CONTRIBUTING.md).
100
100
 
101
101
  ## Development Setup
@@ -116,7 +116,7 @@ Once Tailwind's CLI has been installed, you can run it using the command below t
116
116
  Scrapbook's CSS:
117
117
 
118
118
  ```
119
- $> npx tailwindcss -i app/assets/stylesheets/scrapbook/application.tailwind.css -o app/assets/builds/scrapbook/tailwind.css --minify --watch
119
+ $> npx tailwindcss -i app/assets/stylesheets/scrapbook/application.tailwind.css -o app/assets/builds/scrapbook/application.css --minify --watch
120
120
  ```
121
121
 
122
122
  (Note, the "tailwindcss-rails" gem currently doesn't support Rails engines, so we have to
@@ -130,7 +130,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
130
130
  you may not use this file except in compliance with the License.
131
131
  You may obtain a copy of the License at
132
132
 
133
- http://www.apache.org/licenses/LICENSE-2.0
133
+ [http://www.apache.org/licenses/LICENSE-2.0]()
134
134
 
135
135
  Unless required by applicable law or agreed to in writing, software
136
136
  distributed under the License is distributed on an "AS IS" BASIS,
@@ -139,4 +139,4 @@ See the License for the specific language governing permissions and
139
139
  limitations under the License.
140
140
 
141
141
 
142
- [Discussion]: https://github.com/bfad/scrapbook/discussions
142
+ [Discussions]: https://github.com/bfad/scrapbook/discussions
@@ -11,7 +11,11 @@ module Scrapbook
11
11
  def short_path_to(pathname, scrapbook = nil)
12
12
  scrapbook ||= Scrapbook.find_scrapbook_for(pathname)
13
13
 
14
- view.short_page_path(scrapbook.relative_page_path_for(pathname)).gsub(/%2F/i, '/')
14
+ if scrapbook.root == ::Scrapbook::Engine.config.scrapbook.paths.first
15
+ view.short_page_path(scrapbook.relative_page_path_for(pathname))
16
+ else
17
+ view.book_page_path(scrapbook.relative_page_path_for(pathname), book: scrapbook.name)
18
+ end
15
19
  end
16
20
 
17
21
  def remove_handler_exts_from(pathname)
@@ -5,8 +5,7 @@
5
5
  <%= csrf_meta_tags %>
6
6
  <%= csp_meta_tag %>
7
7
 
8
- <%= stylesheet_link_tag "scrapbook/tailwind", "data-turbo-track": "reload" %>
9
- <%= stylesheet_link_tag "scrapbook/application", media: "all" %>
8
+ <%= stylesheet_link_tag "scrapbook/application", media: "all", "data-turbo-track": "reload" %>
10
9
  </head>
11
10
  <body class="flex">
12
11
  <nav class="flex-none min-w-[20ch] max-w-[50%] h-screen overflow-scroll children:px-4 py-2 border-solid border-sky-700 border-0 border-r"><%= render 'layouts/scrapbook/folder_listing', scrapbook: local_assigns[:scrapbook], pathname: local_assigns[:pathname] %></nav>
data/config/routes.rb CHANGED
@@ -11,6 +11,6 @@ Scrapbook::Engine.routes.draw do
11
11
 
12
12
  get '.raw/:book/pages/*id', to: 'pages#raw', as: :raw_page,
13
13
  constraints: {book: book_regex, id: /.*/}, defaults: {raw: true}
14
- get ':book/*id', to: 'pages#show', constraints: {book: book_regex, id: /.*/}
14
+ get ':book/*id', to: 'pages#show', constraints: {book: book_regex, id: /.*/}, as: :book_page
15
15
  get '*id', to: 'pages#show', constraints: {id: /.*/}, as: :short_page
16
16
  end
@@ -11,6 +11,16 @@ module Scrapbook
11
11
  def install
12
12
  generate 'scrapbook:routes', options.fetch('url-path')
13
13
  generate 'scrapbook:new', options.fetch('path-with-name')
14
+ sprockets_support
15
+ end
16
+
17
+ private
18
+
19
+ def sprockets_support
20
+ relative_path = 'app/assets/config/manifest.js'
21
+ return unless FileTest.exist?(File.expand_path(relative_path, destination_root))
22
+
23
+ insert_into_file(relative_path, '//= link scrapbook/application.css')
14
24
  end
15
25
  end
16
26
  end
@@ -18,7 +18,7 @@ module Scrapbook
18
18
  initializer 'scrapbook.assets' do |app|
19
19
  if app.config.scrapbook.precompile_assets && app.config.respond_to?(:assets)
20
20
  app.config.assets.precompile.concat %w[
21
- scrapbook/tailwind.css
21
+ scrapbook/application.css
22
22
  ]
23
23
  end
24
24
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Scrapbook
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrapbook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brad Lindsay
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-18 00:00:00.000000000 Z
11
+ date: 2022-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -41,9 +41,8 @@ files:
41
41
  - LICENSE.txt
42
42
  - README.md
43
43
  - Rakefile
44
- - app/assets/builds/scrapbook/tailwind.css
44
+ - app/assets/builds/scrapbook/application.css
45
45
  - app/assets/config/scrapbook_manifest.js
46
- - app/assets/stylesheets/scrapbook/application.css
47
46
  - app/assets/stylesheets/scrapbook/application.tailwind.css
48
47
  - app/controllers/scrapbook/application_controller.rb
49
48
  - app/controllers/scrapbook/empty_controller.rb
@@ -1,15 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
- * files in this directory. Styles in this file should be added after the last require_* statement.
11
- * It is generally better to create a new file per style scope.
12
- *
13
- *= require_tree .
14
- *= require_self
15
- */