robin_cms 0.1.0 → 0.1.2
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 +61 -54
- data/lib/robin_cms/data_item.rb +1 -2
- data/lib/robin_cms/version.rb +1 -1
- data/lib/robin_cms/views/layout.erb +13 -13
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 398d0d377f476c68de1e02e504cbe7353347e1f93835d3cce55811d7a90e82a3
|
4
|
+
data.tar.gz: 5b253a4f07db5e5282bf879695ec96ed51d28a2b8e667f1110213b45e0c63e98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b976e15a5ca7c7af3f44f8be1ee2df5f6ddfe766ddfedafeb6c17dd41c48dc449e13d819b0dcdac17c23263a04d9c3e7e99a1f3cc5b66d97b562c7fc8d77ecfb
|
7
|
+
data.tar.gz: 609ed3f32088e434615486ba25da6fdb199a074b0d628ee5e58f45b13f80151b7319437bad45538d636158e6b522701e3960663b2269db5f78ea3699e233ea07
|
data/README.md
CHANGED
@@ -65,6 +65,63 @@ Just the usual incantation:
|
|
65
65
|
gem install robin_cms
|
66
66
|
```
|
67
67
|
|
68
|
+
## Configuring
|
69
|
+
|
70
|
+
You can define your content model in a `_cms.yml` file like this:
|
71
|
+
|
72
|
+
```yml
|
73
|
+
url: https://example.com
|
74
|
+
title: Example
|
75
|
+
libraries:
|
76
|
+
- id: poem
|
77
|
+
type: collection
|
78
|
+
label: Poem
|
79
|
+
location: poems
|
80
|
+
filetype: html
|
81
|
+
fields:
|
82
|
+
- { label: Title, id: title, type: input }
|
83
|
+
- { label: Author, id: author_name, type: input }
|
84
|
+
- { label: Content, id: content, type: richtext }
|
85
|
+
- id: book
|
86
|
+
type: data
|
87
|
+
label: Book
|
88
|
+
location: books
|
89
|
+
filetype: yml
|
90
|
+
fields:
|
91
|
+
- { label: Title, id: title, type: input }
|
92
|
+
- { label: Author, id: author_name, type: input }
|
93
|
+
```
|
94
|
+
|
95
|
+
The admin username and password needs to be set in a `.htpasswd` file in the
|
96
|
+
root directory of the project. Obviously make sure you `.gitignore` that file.
|
97
|
+
Also make sure your static site generator is ignoring it because you don't want
|
98
|
+
it in your public directory! Each line of the `.htpasswd` file should follow
|
99
|
+
the format `<username>:<password>`, but note that only a single
|
100
|
+
username/password is supported for now. The password needs to be encrypted with
|
101
|
+
bcrypt. You can do this in Ruby with the `bcrypt` gem:
|
102
|
+
|
103
|
+
```sh
|
104
|
+
ruby -r bcrypt -e "puts BCrypt::Password.create('mypassword')"
|
105
|
+
```
|
106
|
+
|
107
|
+
Another thing to note is that if no `.htpasswd` file is found, it will
|
108
|
+
automatically create one with username "admin" and password "admin". This lets
|
109
|
+
you play around with it locally without configuring a password. So make sure
|
110
|
+
you create a `.htpasswd` file before running it in production!
|
111
|
+
|
112
|
+
You'll also need to expose a `SESSION_SECRET` environment variable. If you
|
113
|
+
don't, it will create one for you, but it creates a new secret each time
|
114
|
+
the server starts, meaning you will have to log in again whenever you restart
|
115
|
+
the server. It is recommended to create one via Ruby's SecureRandom package.
|
116
|
+
|
117
|
+
```sh
|
118
|
+
ruby -r securerandom -e "puts SecureRandom.hex(64)"
|
119
|
+
```
|
120
|
+
|
121
|
+
See the [examples](./examples) folder for a full example. I haven't written any
|
122
|
+
documentation yet, but the example `_cms.yml` file is thoroughly commented to
|
123
|
+
explain each of the fields.
|
124
|
+
|
68
125
|
## Usage
|
69
126
|
|
70
127
|
You have a few options for using this gem in your project. Firstly, you can use
|
@@ -107,60 +164,10 @@ end
|
|
107
164
|
```
|
108
165
|
|
109
166
|
After running `bundle exec jekyll serve`, the CMS should be available on your
|
110
|
-
website under `/admin`.
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
You can define your content model in a `_cms.yml` file like this:
|
115
|
-
|
116
|
-
```yml
|
117
|
-
libraries:
|
118
|
-
- name: "poem"
|
119
|
-
label: "Poem"
|
120
|
-
location: "poems"
|
121
|
-
filetype: "html"
|
122
|
-
fields:
|
123
|
-
- { label: "Title", name; "title", type: "input" }
|
124
|
-
- { label: "Author", name; "author_name", type: "input" }
|
125
|
-
- { label: "Content", name; "content", type: "richtext" }
|
126
|
-
- name: "book"
|
127
|
-
label: "Book"
|
128
|
-
location: "books"
|
129
|
-
filetype: "yml"
|
130
|
-
fields:
|
131
|
-
- { label: "Title", name; "title", type: "input" }
|
132
|
-
- { label: "Author", name; "author_name", type: "input" }
|
133
|
-
```
|
134
|
-
|
135
|
-
The admin username and password needs to be set in a `.htpasswd` file in the
|
136
|
-
root directory of the project. Obviously make sure you `.gitignore` that file.
|
137
|
-
Also make sure your static site generator is ignoring it because you don't want
|
138
|
-
it in your public directory! Each line of the `.htpasswd` file should follow
|
139
|
-
the format `<username>:<password>`, but note that only a single
|
140
|
-
username/password is supported for now. The password needs to be encrypted with
|
141
|
-
bcrypt. You can do this in Ruby with the `bcrypt` gem:
|
142
|
-
|
143
|
-
```sh
|
144
|
-
ruby -r bcrypt -e "puts BCrypt::Password.create('mypassword')"
|
145
|
-
```
|
146
|
-
|
147
|
-
Another thing to note is that if no `.htpasswd` file is found, it will
|
148
|
-
automatically create one with username "admin" and password "admin". This lets
|
149
|
-
you play around with it locally without configuring a password. So make sure
|
150
|
-
you create a `.htpasswd` file before running it in production!
|
151
|
-
|
152
|
-
You'll also need to expose a `SESSION_SECRET` environment variable. If you
|
153
|
-
don't, it will create one for you, but it creates a new secret each time
|
154
|
-
the server starts, meaning you will have to log in again whenever you restart
|
155
|
-
the server. It is recommended to create one via Ruby's SecureRandom package.
|
156
|
-
|
157
|
-
```sh
|
158
|
-
ruby -r securerandom -e "puts SecureRandom.hex(64)"
|
159
|
-
```
|
160
|
-
|
161
|
-
See the [examples](./examples) folder for a full example. I haven't written any
|
162
|
-
documentation yet, but the example `_cms.yml` file is thoroughly commented to
|
163
|
-
explain each of the fields.
|
167
|
+
website under `/admin`. Note that if using it as a Jekyll plugin, you can put
|
168
|
+
your config in Jekyll's `_config.yml` file under the `cms` field. You also
|
169
|
+
don't need to specify the `url` and `title` fields, as these are taken from the
|
170
|
+
Jekyll config.
|
164
171
|
|
165
172
|
## Testing
|
166
173
|
|
data/lib/robin_cms/data_item.rb
CHANGED
data/lib/robin_cms/version.rb
CHANGED
@@ -12,18 +12,18 @@
|
|
12
12
|
<span class="controls">
|
13
13
|
<h1><a href="/admin"><%= @config[:title] %> admin</a></h1>
|
14
14
|
</span>
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
15
|
+
<span class="controls --gap-md">
|
16
|
+
<a href="<%= @config[:url] %>" target="_blank">
|
17
|
+
<%= @config[:url] %><%= erb :new_tab %>
|
18
|
+
</a>
|
19
|
+
<% if @config[:build_command] %>
|
20
|
+
<form id="publish-form" action="/admin/publish" method="post">
|
21
|
+
<button type="submit" form="publish-form">Publish site</button>
|
22
|
+
</form>
|
23
|
+
<% end %>
|
24
|
+
<a href='<%= url("/profile") %>'>Account</a>
|
25
|
+
<a href='<%= url("/logout") %>'>Log out</a>
|
26
|
+
</span>
|
27
27
|
</header>
|
28
28
|
<% end %>
|
29
29
|
<main id="site-content">
|
@@ -33,7 +33,7 @@
|
|
33
33
|
<p>
|
34
34
|
Made with 🧡
|
35
35
|
<br />
|
36
|
-
<a href="https://
|
36
|
+
<a href="https://codeberg.org/evencuriouser/robin_cms">Robin CMS</a> <%= RobinCMS::VERSION %>
|
37
37
|
</p>
|
38
38
|
</footer>
|
39
39
|
</main>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: robin_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aron Lebani
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-09-
|
11
|
+
date: 2025-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bcrypt
|
@@ -111,12 +111,12 @@ files:
|
|
111
111
|
- lib/robin_cms/views/richtext_field.erb
|
112
112
|
- lib/robin_cms/views/select_field.erb
|
113
113
|
- lib/robin_cms/views/style.erb
|
114
|
-
homepage: https://
|
114
|
+
homepage: https://codeberg.org/evencuriouser/robin_cms
|
115
115
|
licenses:
|
116
116
|
- MIT
|
117
117
|
metadata:
|
118
|
-
homepage_uri: https://
|
119
|
-
source_code_uri: https://
|
118
|
+
homepage_uri: https://codeberg.org/evencuriouser/robin_cms
|
119
|
+
source_code_uri: https://codeberg.org/evencuriouser/robin_cms
|
120
120
|
post_install_message:
|
121
121
|
rdoc_options: []
|
122
122
|
require_paths:
|