sitepress-rails 5.0.0.beta3 → 5.0.0.beta4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 443c3d5ccdfa98e1b995ae899d3d8e20dd7ffb4c98a8d5700be29384847e838d
4
- data.tar.gz: a7664658ced9775dbbde217f0247933851edbbbebb6c2cd5ca8d1e893163f2fd
3
+ metadata.gz: 520f12ebb471b2c8bef53404dc4938f12637f90929f6a89b6b405845e559cf33
4
+ data.tar.gz: ea78740263ce5ca251797554191b85e3db15f61fb58276a38b9dd2bfbfb182b9
5
5
  SHA512:
6
- metadata.gz: e092de737d65d1e5eca7eefedcdf1f1129af9872e1fdca7418c5bf0b9192fe9fd71c885698779fe120f958c1e525f734a1fd919b3e457646354bbc3eb78e8e25
7
- data.tar.gz: 3eab694d5c52e70410f9f2dde9421e31f5a329aed6f83bd5d447df29df2b9b870cef72a128627810fc7552277f071d88b59aae3b0803a9436826ced73e16fab0
6
+ metadata.gz: a747326ecbf65fdd35c79cbe0b534f4944a483f948b6cfe35e5969f8fa6889cfc885723cb1795a0c839482b4da7fffe9e049502002beb20aeb1b1e5ed9888bc5
7
+ data.tar.gz: 5d672444a44805361af25604a082bed879217f63f341a5ced5cba09ab85697d6d003ef6f420d6a43bd34fbaf48d13b943ede6b6e8860bbf4499686fdbeccf35a
data/README.md CHANGED
@@ -31,13 +31,13 @@ You can serve any number of Sitepress sites from one Rails app — for example a
31
31
 
32
32
  ```ruby
33
33
  # 1. config/initializers/sitepress.rb — register the site at boot
34
- Sitepress.sites << Sitepress::Site.new(root_path: "app/sitepress/admin_docs")
34
+ Sitepress.sites << Sitepress::Site.new(root_path: "app/content/admin_docs")
35
35
  ```
36
36
 
37
37
  ```ruby
38
38
  # 2. app/controllers/admin/docs_controller.rb — bind it to a controller
39
39
  class Admin::DocsController < Sitepress::SiteController
40
- self.site = Sitepress.sites.fetch("app/sitepress/admin_docs")
40
+ self.site = Sitepress.sites.fetch("app/content/admin_docs")
41
41
 
42
42
  layout "admin"
43
43
  before_action :require_admin
@@ -63,7 +63,7 @@ A typo in the path string fails loud at controller class load:
63
63
 
64
64
  ```
65
65
  NotFoundError: No Sitepress site registered at "app/contnet".
66
- Registered: ["app/sitepress/admin_docs"]
66
+ Registered: ["app/content/admin_docs"]
67
67
  ```
68
68
 
69
69
  **Why three pieces and not one?** Boot ordering forces it. Zeitwerk needs helper / model paths registered before its eager-load pass, which happens before the first request — that's what `Sitepress.sites <<` does and it's the only piece that *has* to live in an initializer. The controller binding (`self.site = ...`) is just `class_attribute` plus a writer that `prepend_view_path`s the site's view directories onto *this controller's* lookup chain (so multi-site view lookups stay local — no global ActionView pollution). Routes own the URL → controller binding, with the mount path read from the surrounding `scope`/`namespace`.
@@ -73,7 +73,7 @@ The same site can be referenced by more than one controller — a public reader
73
73
  ### Generator
74
74
 
75
75
  ```bash
76
- bin/rails generate sitepress:site app/sitepress/admin_docs
76
+ bin/rails generate sitepress:site app/content/admin_docs
77
77
  ```
78
78
 
79
79
  Scaffolds the content directory tree (`pages/`, `helpers/`, `models/`, `assets/`), a stub index template, a controller subclass with `self.site = Sitepress.sites.fetch(...)` already filled in, and either creates or appends to `config/initializers/sitepress.rb` with the registration line. Pass `--mount-at=/admin/docs` to also inject a `scope` block into `config/routes.rb`; without the flag, the generator just prints the routes line for you to paste.
@@ -84,7 +84,7 @@ Compilation is split into single-site and multi-site forms so single-site users
84
84
 
85
85
  - `rake sitepress:compile` — compiles the configured default site only.
86
86
  - `rake sitepress:sites:compile` — compiles every registered site (default + `Sitepress.sites`) to `tmp/sitepress/<basename>`. Each site lives in its own subdirectory so two sites never collide on output.
87
- - `rake "sitepress:sites:compile[app/sitepress/admin_docs]"` — compiles a single registered site by `root_path`. Raises `Sitepress::NotFoundError` listing registered paths if no match.
87
+ - `rake "sitepress:sites:compile[app/content/admin_docs]"` — compiles a single registered site by `root_path`. Raises `Sitepress::NotFoundError` listing registered paths if no match.
88
88
  - `rake sitepress:sites` — lists the configured default site and everything in `Sitepress.sites`.
89
89
 
90
90
  Two env vars adjust the compile tasks:
@@ -42,10 +42,10 @@ module Sitepress
42
42
  # apps. See `Sitepress::Sites` for the full API; the common usage is:
43
43
  #
44
44
  # # config/initializers/sitepress.rb
45
- # Sitepress.sites << Sitepress::Site.new(root_path: "app/sitepress/admin_docs")
45
+ # Sitepress.sites << Sitepress::Site.new(root_path: "app/content/admin_docs")
46
46
  #
47
47
  # # somewhere later (e.g. a controller class body)
48
- # Sitepress.sites.fetch("app/sitepress/admin_docs")
48
+ # Sitepress.sites.fetch("app/content/admin_docs")
49
49
  def self.sites
50
50
  configuration.sites
51
51
  end
@@ -10,7 +10,7 @@ module Sitepress
10
10
  # via `class_attribute :site` and have routing pick it up:
11
11
  #
12
12
  # class Admin::DocsController < Sitepress::SiteController
13
- # self.site = Sitepress.sites.fetch("app/sitepress/admin_docs")
13
+ # self.site = Sitepress.sites.fetch("app/content/admin_docs")
14
14
  # end
15
15
  #
16
16
  # `path_prefix` is the URL prefix the route is mounted under (e.g.
@@ -9,10 +9,10 @@ module Sitepress
9
9
  # forms or between `<<` and a non-chaining `add`.
10
10
  #
11
11
  # # config/initializers/sitepress.rb
12
- # Sitepress.sites << Sitepress::Site.new(root_path: "app/sitepress/admin_docs")
12
+ # Sitepress.sites << Sitepress::Site.new(root_path: "app/content/admin_docs")
13
13
  #
14
14
  # # somewhere later
15
- # Sitepress.sites.fetch("app/sitepress/admin_docs") # => Sitepress::Site
15
+ # Sitepress.sites.fetch("app/content/admin_docs") # => Sitepress::Site
16
16
  # Sitepress.sites.fetch("nope") # => raises NotFoundError
17
17
  # Sitepress.sites.each { |site| ... }
18
18
  #
@@ -57,7 +57,7 @@ module Sitepress
57
57
  # the standard Rails way:
58
58
  #
59
59
  # class Admin::DocsController < Sitepress::SiteController
60
- # self.site = Sitepress.sites.fetch("app/sitepress/admin_docs")
60
+ # self.site = Sitepress.sites.fetch("app/content/admin_docs")
61
61
  # end
62
62
  #
63
63
  # `class_attribute` gives us a normal class-level reader/writer
@@ -10,17 +10,17 @@ Description:
10
10
  from the path's basename.
11
11
 
12
12
  Example:
13
- bin/rails generate sitepress:site app/sitepress/admin_docs
13
+ bin/rails generate sitepress:site app/content/admin_docs
14
14
 
15
15
  This will create:
16
- app/sitepress/admin_docs/pages/index.html.erb
17
- app/sitepress/admin_docs/helpers/.keep
18
- app/sitepress/admin_docs/models/.keep
19
- app/sitepress/admin_docs/assets/.keep
16
+ app/content/admin_docs/pages/index.html.erb
17
+ app/content/admin_docs/helpers/.keep
18
+ app/content/admin_docs/models/.keep
19
+ app/content/admin_docs/assets/.keep
20
20
  app/controllers/admin_docs_controller.rb
21
21
 
22
22
  And add to config/initializers/sitepress.rb:
23
- Sitepress.sites << Sitepress::Site.new(root_path: "app/sitepress/admin_docs")
23
+ Sitepress.sites << Sitepress::Site.new(root_path: "app/content/admin_docs")
24
24
 
25
25
  You'll need to mount the controller in config/routes.rb manually —
26
26
  the generator prints the line to copy.
@@ -3,7 +3,7 @@ require "rails/generators/base"
3
3
  module Sitepress
4
4
  # Scaffolds a new Sitepress site for multi-site Rails apps. Usage:
5
5
  #
6
- # bin/rails generate sitepress:site app/sitepress/admin_docs
6
+ # bin/rails generate sitepress:site app/content/admin_docs
7
7
  #
8
8
  # See the USAGE file for the full description.
9
9
  class SiteGenerator < Rails::Generators::Base
@@ -11,7 +11,7 @@ module Sitepress
11
11
 
12
12
  argument :root_path,
13
13
  type: :string,
14
- desc: "Path the site lives at on disk, relative to Rails root (e.g. app/sitepress/admin_docs)"
14
+ desc: "Path the site lives at on disk, relative to Rails root (e.g. app/content/admin_docs)"
15
15
 
16
16
  class_option :mount_at,
17
17
  type: :string,
@@ -1,3 +1,3 @@
1
1
  class SecondaryController < Sitepress::SiteController
2
- self.site = Sitepress.sites.fetch(Rails.root.join("app/sitepress/secondary").to_s)
2
+ self.site = Sitepress.sites.fetch(Rails.root.join("app/content/secondary").to_s)
3
3
  end
@@ -1,7 +1,7 @@
1
1
  # Multi-site registration for the dummy app's integration test.
2
- # Register a "secondary" site rooted at app/sitepress/secondary so the
2
+ # Register a "secondary" site rooted at app/content/secondary so the
3
3
  # end-to-end multi-site spec can hit it through a real Rails request
4
4
  # cycle.
5
5
  Sitepress.sites << Sitepress::Site.new(
6
- root_path: Rails.root.join("app/sitepress/secondary")
6
+ root_path: Rails.root.join("app/content/secondary")
7
7
  )