robin_cms 0.1.4 → 0.1.5
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 +36 -108
- data/lib/robin_cms/configuration-schema.json +3 -1
- data/lib/robin_cms/configuration.rb +7 -1
- data/lib/robin_cms/item.rb +4 -0
- data/lib/robin_cms/version.rb +1 -1
- data/lib/robin_cms/views/image_field.erb +3 -0
- data/lib/robin_cms/views/input_field.erb +3 -0
- data/lib/robin_cms/views/library_item.erb +1 -1
- data/lib/robin_cms/views/richtext_field.erb +3 -0
- data/lib/robin_cms/views/select_field.erb +3 -0
- data/lib/robin_cms/views/stylesheet.css.erb +12 -5
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 667498a061c442f90e57b20fdd7a12db60e76f447e0a948be22276620c5532ef
|
|
4
|
+
data.tar.gz: 4e6317eee498285fc39f939cb86b80847ab9e5c629ad7864efe8c2761ff17bb7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a5ae9452f1da1b65f19f21798d5036109e88114af97bdf1c3d10d453992034361cedf22805e660b380b0b2cbcd5083b2ec005ea900b4666b436e58a78078395f
|
|
7
|
+
data.tar.gz: 15395c440febd9fd0dea69bc7cf99c9338a3d97eef5a039662e46670e1d1dfe0b259a4004c3378d595d2b1398a23a860980a8476c79959696fd69edbe5471942
|
data/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
> This software is currently in beta. There may be bugs and breaking changes.
|
|
5
5
|
> If you find a bug, I'd love to hear about it.
|
|
6
6
|
|
|
7
|
-

|
|
7
|
+

|
|
8
8
|
|
|
9
9
|
Robin CMS is a minimalist flat-file CMS built with Ruby and Sinatra. It is
|
|
10
10
|
designed to be used by developers for creating custom built websites where the
|
|
@@ -61,125 +61,53 @@ that are commonly found in CMS software have been omitted.
|
|
|
61
61
|
content. You can however add richtext fields to your content models (see
|
|
62
62
|
example below).
|
|
63
63
|
|
|
64
|
-
## Installation
|
|
65
|
-
|
|
66
|
-
Just the usual incantation:
|
|
67
|
-
|
|
68
|
-
```sh
|
|
69
|
-
gem install robin_cms
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
## Configuring
|
|
73
|
-
|
|
74
|
-
You can define your content model in a `_cms.yml` file like this:
|
|
75
|
-
|
|
76
|
-
```yml
|
|
77
|
-
url: https://example.com
|
|
78
|
-
title: Example
|
|
79
|
-
libraries:
|
|
80
|
-
- id: poem
|
|
81
|
-
type: collection
|
|
82
|
-
label: Poem
|
|
83
|
-
location: poems
|
|
84
|
-
filetype: html
|
|
85
|
-
fields:
|
|
86
|
-
- { label: Title, id: title, type: input }
|
|
87
|
-
- { label: Author, id: author_name, type: input }
|
|
88
|
-
- { label: Content, id: content, type: richtext }
|
|
89
|
-
- id: book
|
|
90
|
-
type: data
|
|
91
|
-
label: Book
|
|
92
|
-
location: books
|
|
93
|
-
filetype: yml
|
|
94
|
-
fields:
|
|
95
|
-
- { label: Title, id: title, type: input }
|
|
96
|
-
- { label: Author, id: author_name, type: input }
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
The admin username and password needs to be set in a `.htpasswd` file in the
|
|
100
|
-
root directory of the project. Obviously make sure you `.gitignore` that file.
|
|
101
|
-
Also make sure your static site generator is ignoring it because you don't want
|
|
102
|
-
it in your public directory! Each line of the `.htpasswd` file should follow
|
|
103
|
-
the format `<username>:<password>`, but note that only a single
|
|
104
|
-
username/password is supported for now. The password needs to be encrypted with
|
|
105
|
-
bcrypt. You can do this in Ruby with the `bcrypt` gem:
|
|
106
|
-
|
|
107
|
-
```sh
|
|
108
|
-
ruby -r bcrypt -e "puts BCrypt::Password.create('mypassword')"
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
Another thing to note is that if no `.htpasswd` file is found, it will
|
|
112
|
-
automatically create one with username "admin" and password "admin". This lets
|
|
113
|
-
you play around with it locally without configuring a password. So make sure
|
|
114
|
-
you create a `.htpasswd` file before running it in production!
|
|
115
|
-
|
|
116
|
-
You'll also need to expose a `SESSION_SECRET` environment variable. If you
|
|
117
|
-
don't, it will create one for you, but it creates a new secret each time
|
|
118
|
-
the server starts, meaning you will have to log in again whenever you restart
|
|
119
|
-
the server. It is recommended to create one via Ruby's SecureRandom package.
|
|
120
|
-
|
|
121
|
-
```sh
|
|
122
|
-
ruby -r securerandom -e "puts SecureRandom.hex(64)"
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
See the [examples](./examples) folder for a full example. I haven't written any
|
|
126
|
-
documentation yet, but the example `_cms.yml` file is thoroughly commented to
|
|
127
|
-
explain each of the fields.
|
|
128
|
-
|
|
129
64
|
## Usage
|
|
130
65
|
|
|
131
|
-
|
|
132
|
-
it directly as a CMS for any Static Site Generator with the following
|
|
133
|
-
`config.ru`:
|
|
134
|
-
|
|
135
|
-
```ruby
|
|
136
|
-
require 'robin_cms'
|
|
137
|
-
map "/admin" { run RobinCMS::CMS.new }
|
|
138
|
-
```
|
|
66
|
+
Robin CMS is packaged as a Ruby gem, so installation is as simple as
|
|
139
67
|
|
|
140
|
-
|
|
141
|
-
in your browser.
|
|
68
|
+
gem install robin_cms
|
|
142
69
|
|
|
143
|
-
|
|
70
|
+
It's possible to use the CMS in a few different ways. You can use it as a
|
|
71
|
+
standalone CMS for any Static Site Generator, you can embed it in a dynamic
|
|
72
|
+
Sinatra app, or you can use it as a Jekyll plugin. If you're already using
|
|
73
|
+
Jekyll as your SSG, this is the simplest approach.
|
|
144
74
|
|
|
145
|
-
|
|
146
|
-
require 'robin_cms'
|
|
147
|
-
require 'sinatra'
|
|
75
|
+
See the [documentation](./docs/index.adoc) for further information on usage.
|
|
148
76
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
get '/' do
|
|
152
|
-
'Hello, world!'
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
run Sinatra::Application.new
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
Yet another option is to use it as a [Jekyll](https://jekyllrb.com/) plugin. To
|
|
159
|
-
do this, you just need to pop `robin_cms` in the `:jekyll_plugins` group of
|
|
160
|
-
your `Gemfile` like so:
|
|
161
|
-
|
|
162
|
-
```
|
|
163
|
-
gem "jekyll"
|
|
164
|
-
|
|
165
|
-
group :jekyll_plugins do
|
|
166
|
-
gem "robin_cms"
|
|
167
|
-
end
|
|
168
|
-
```
|
|
77
|
+
## Configuring
|
|
169
78
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
79
|
+
Your content model is defined in a single YAML file. It acts as a sort of
|
|
80
|
+
schema for your content. An example YAML file looks like this:
|
|
81
|
+
|
|
82
|
+
url: https://example.com
|
|
83
|
+
title: Example
|
|
84
|
+
libraries:
|
|
85
|
+
- id: poem
|
|
86
|
+
type: collection
|
|
87
|
+
label: Poem
|
|
88
|
+
location: poems
|
|
89
|
+
filetype: html
|
|
90
|
+
fields:
|
|
91
|
+
- { label: Title, id: title, type: input }
|
|
92
|
+
- { label: Author, id: author_name, type: input }
|
|
93
|
+
- { label: Content, id: content, type: richtext }
|
|
94
|
+
- id: book
|
|
95
|
+
type: data
|
|
96
|
+
label: Book
|
|
97
|
+
location: books
|
|
98
|
+
filetype: yml
|
|
99
|
+
fields:
|
|
100
|
+
- { label: Title, id: title, type: input }
|
|
101
|
+
- { label: Author, id: author_name, type: input }
|
|
102
|
+
|
|
103
|
+
See the [docs](./docs/index.adoc) for more details on configuration. You can
|
|
104
|
+
also find some examples [here](./examples).
|
|
175
105
|
|
|
176
106
|
## Testing
|
|
177
107
|
|
|
178
108
|
Unit test are written in RSpec. To run them:
|
|
179
109
|
|
|
180
|
-
|
|
181
|
-
rspec
|
|
182
|
-
```
|
|
110
|
+
rake test
|
|
183
111
|
|
|
184
112
|
## Roadmap
|
|
185
113
|
|
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
"options": { "$ref": "#/$defs/options_schema" },
|
|
70
70
|
"dimensions": { "$ref": "#/$defs/image_dimensions_schema" },
|
|
71
71
|
"filetype": { "$ref": "#/$defs/image_filetype_schema" },
|
|
72
|
+
"description": { "type": "string" },
|
|
72
73
|
"order": { "type": "number" }
|
|
73
74
|
}
|
|
74
75
|
}
|
|
@@ -108,7 +109,8 @@
|
|
|
108
109
|
"readonly": { "type": "boolean" },
|
|
109
110
|
"options": { "$ref": "#/$defs/options_schema" },
|
|
110
111
|
"dimensions": { "$ref": "#/$defs/image_dimensions_schema" },
|
|
111
|
-
"filetype": { "$ref": "#/$defs/image_filetype_schema" }
|
|
112
|
+
"filetype": { "$ref": "#/$defs/image_filetype_schema" },
|
|
113
|
+
"description": { "type": "string" }
|
|
112
114
|
}
|
|
113
115
|
}
|
|
114
116
|
}
|
|
@@ -42,6 +42,7 @@ module RobinCMS
|
|
|
42
42
|
id: "title",
|
|
43
43
|
type: "text",
|
|
44
44
|
required: true,
|
|
45
|
+
description: "Provide a short, descriptive title.",
|
|
45
46
|
order: 1
|
|
46
47
|
}, {
|
|
47
48
|
label: "Published date",
|
|
@@ -65,6 +66,9 @@ module RobinCMS
|
|
|
65
66
|
label: "Published",
|
|
66
67
|
value: true
|
|
67
68
|
}],
|
|
69
|
+
description: "Set this to draft if you're not ready to publish this item
|
|
70
|
+
just yet. Draft items won't appear on your website, even after clicking
|
|
71
|
+
'Publish site'.",
|
|
68
72
|
order: 2
|
|
69
73
|
}].freeze
|
|
70
74
|
|
|
@@ -74,7 +78,9 @@ module RobinCMS
|
|
|
74
78
|
}, {
|
|
75
79
|
id: "image_alt",
|
|
76
80
|
type: "text",
|
|
77
|
-
label: "Alt text"
|
|
81
|
+
label: "Alt text",
|
|
82
|
+
description: "Provide a descriptive and concise description of your
|
|
83
|
+
image. This helps to improve the accessibility of your website."
|
|
78
84
|
}].freeze
|
|
79
85
|
|
|
80
86
|
def self.parse(config_file: "_cms.yml", jekyll_plugin: false)
|
data/lib/robin_cms/item.rb
CHANGED
data/lib/robin_cms/version.rb
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
<label for="<%= safe_id('image', 'field') %>"><%= field[:label] %></label>
|
|
2
|
+
<% if field[:description] %>
|
|
3
|
+
<small><%= field[:description] %></small>
|
|
4
|
+
<% end %>
|
|
2
5
|
<%#
|
|
3
6
|
There is a bug here where if you upload a different image with the
|
|
4
7
|
same name, it shows the old image due to caching. This is a very
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<h2>
|
|
3
3
|
<% if @item.id %>Edit<% else %>New<% end %> <%= @library[:label_singular].downcase %>
|
|
4
4
|
</h2>
|
|
5
|
-
<%= erb :library_actions, locals: { has_delete: @
|
|
5
|
+
<%= erb :library_actions, locals: { has_delete: @item.can_delete? } %>
|
|
6
6
|
</header>
|
|
7
7
|
<form
|
|
8
8
|
class="card"
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<link rel="stylesheet" type="text/css" href="https://unpkg.com/trix@2.0.8/dist/trix.css">
|
|
2
2
|
<script type="text/javascript" src="https://unpkg.com/trix@2.0.8/dist/trix.umd.min.js"></script>
|
|
3
3
|
<label for="<%= safe_id(field[:id], 'field') %>"><%= field[:label] %></label>
|
|
4
|
+
<% if field[:description] %>
|
|
5
|
+
<small><%= field[:description] %></small>
|
|
6
|
+
<% end %>
|
|
4
7
|
<input
|
|
5
8
|
id="richtext-content"
|
|
6
9
|
type="hidden"
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
--border-radius: 8px;
|
|
4
4
|
--bg-color: rgb(246, 246, 247);
|
|
5
5
|
--font-color: #141414;
|
|
6
|
+
--font-color-light: #44474a;
|
|
6
7
|
--link-color: rgb(71, 95, 145);
|
|
7
8
|
--accent-color: <%= @config[:accent_color] %>;
|
|
8
9
|
--accent-color-light: <%= @config[:accent_color] %>1e;
|
|
@@ -24,10 +25,6 @@
|
|
|
24
25
|
--box-shadow-input: inset rgba(0, 0, 0, 0.1) 0px 1px 0px 0px;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
test {
|
|
28
|
-
te
|
|
29
|
-
}
|
|
30
|
-
|
|
31
28
|
@media only screen and (max-width: 1250px) {
|
|
32
29
|
:root {
|
|
33
30
|
--content-left-margin: 3rem;
|
|
@@ -153,7 +150,10 @@ tbody tr:hover td {
|
|
|
153
150
|
|
|
154
151
|
label {
|
|
155
152
|
display: block;
|
|
156
|
-
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
small {
|
|
156
|
+
color: var(--font-color-light);
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
input {
|
|
@@ -190,6 +190,13 @@ select {
|
|
|
190
190
|
box-shadow: var(--box-shadow-input);
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
+
input,
|
|
194
|
+
select,
|
|
195
|
+
trix-toolbar {
|
|
196
|
+
display: block;
|
|
197
|
+
margin-top: var(--padding-xs);
|
|
198
|
+
}
|
|
199
|
+
|
|
193
200
|
button {
|
|
194
201
|
padding: var(--padding-xxs) var(--padding-xs);
|
|
195
202
|
color: var(--accent-color);
|
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.5
|
|
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-10-
|
|
11
|
+
date: 2025-10-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bcrypt
|
|
@@ -66,7 +66,7 @@ dependencies:
|
|
|
66
66
|
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
68
|
version: '2.2'
|
|
69
|
-
description:
|
|
69
|
+
description: Robin CMS is a simple, flat-file CMS for Static Site Generators.
|
|
70
70
|
email:
|
|
71
71
|
- aron@lebani.dev
|
|
72
72
|
executables: []
|
|
@@ -111,11 +111,11 @@ 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/stylesheet.css.erb
|
|
114
|
-
homepage: https://
|
|
114
|
+
homepage: https://robincms.org
|
|
115
115
|
licenses:
|
|
116
116
|
- MIT
|
|
117
117
|
metadata:
|
|
118
|
-
homepage_uri: https://
|
|
118
|
+
homepage_uri: https://robincms.org
|
|
119
119
|
source_code_uri: https://codeberg.org/evencuriouser/robin_cms
|
|
120
120
|
post_install_message:
|
|
121
121
|
rdoc_options: []
|
|
@@ -135,5 +135,5 @@ requirements: []
|
|
|
135
135
|
rubygems_version: 3.5.16
|
|
136
136
|
signing_key:
|
|
137
137
|
specification_version: 4
|
|
138
|
-
summary: A
|
|
138
|
+
summary: A simple, flat-file CMS for Static Site Generators.
|
|
139
139
|
test_files: []
|