simplec 0.4.0 → 0.4.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
  SHA1:
3
- metadata.gz: 30941905c919979a56cf165241070e5da7822192
4
- data.tar.gz: 48b105ceabc6246c9b3cdbcc30dcbdc1a479696d
3
+ metadata.gz: 97eb4b055eff958715400003bbf1a6296fa5c4af
4
+ data.tar.gz: ab0e7a5baa49e1389b8e925ec17063fb9683db84
5
5
  SHA512:
6
- metadata.gz: f9b3616fc0b37ae640025027a50f55a41a52bbc6187ffc781de995717311142b922fafb1990bc98290fdbdfe6378173257842051a892a65ca3d96e3038ac8024
7
- data.tar.gz: 8e1fbe53a20d80b5362d16ff6a71be9d5c62ae97a855dc97e1f753010d9e92079ddb78733bbf3f6ca23e9544a973efb91b29618bc72957e10ae0e56ac892fc6c
6
+ metadata.gz: f3a22c3c561611dee863c259c6aa358689a9ab9779efd8111e6d2c1348fd107b373757d7070d2589f0a1401c1d9495609afb093fc863550f3a21ad11413e12c3
7
+ data.tar.gz: 6b68170c0d3f3958e69f844dfbd90a8cc4926aafbe106b602600f2bf4667d146796678e2979d45d22f60d5782abc31d4eedab35f2740d5f7ecc27532d30439ca
data/README.md CHANGED
@@ -1,29 +1,34 @@
1
1
  # Simplec
2
2
 
3
- ### A CMS for developers, built by developers.
3
+ ### A CMS that stays out of the way.
4
4
 
5
- This gem handles all of the rote parts of a CMS, but gets out of the way for
6
- everything else. In Rails it is easy to build things from scratch, but it is
7
- a waste of resources to build again and again. This library is an attempt to
8
- get all of the good parts of a CMS without the baggage of a CMS that takes
9
- over the entire ecosystem.
5
+ This gem handles all of the rote parts of a CMS, but gets out of the way for everything else.
6
+
7
+ In Rails it is easy to build things from scratch, but it is a waste of resources
8
+ to build again and again. This library is an attempt to get all of the good
9
+ parts of a CMS without the baggage of a CMS that takes over the entire
10
+ ecosystem.
10
11
 
11
12
  ## Dependencies
12
- - rails >= 5.0.5
13
13
 
14
- - pg >= 0.21.0; postgres >= 9.5
14
+ - rails >= 5.0.5
15
15
 
16
- We hate dependencies, but postgres is just too good. We use it for search
17
- and JSONB.
16
+ This probably can be lowered to older versions.
18
17
 
19
- - imagemagick
18
+ - pg >= 0.21.0; Postgres >= 9.5
20
19
 
21
- For image processing. Note there is a known vulnerability, please update
22
- accordingly: https://imagetragick.com/
20
+ We hate dependencies, but Postgres is just too good. We use it for search
21
+ and JSONB. If you think we could make this database agnostic, we are open
22
+ for contributions!
23
23
 
24
24
  - dragonfly
25
25
 
26
- We still hate dependencies, but this is a necessity and the best option.
26
+ We still hate dependencies, but this is a necessity and one of the best
27
+ options. We might change it out for ActiveStorage.
28
+
29
+ - imagemagick
30
+
31
+ For image processing.
27
32
 
28
33
  ## Recommended Dependencies
29
34
 
@@ -44,19 +49,23 @@ application.**
44
49
 
45
50
  _Optionally, you can create a separate set of assets for only the admin via
46
51
  standard Rails methods. Or you could not include them and deal with the
47
- fallout. ;-)_
52
+ fallout. We are happy to accept pull requests! ;-)_
48
53
 
49
54
 
50
55
  ## Features
56
+
51
57
  - Pages with Templates
52
58
 
53
59
  - Subdomain support
54
60
 
55
- - Use application models or assets in CMS pages
56
-
57
61
  - Search (coming soon)
58
62
 
63
+ - Documents and Document Sets (local or S3/Google/etc)
64
+
65
+ - Use application models or assets in CMS pages
66
+
59
67
  ## Anti-Features
68
+
60
69
  - User management
61
70
 
62
71
  - Permissions
@@ -69,6 +78,9 @@ fallout. ;-)_
69
78
  - simplec-blog: Don't always need or want a blog bundled in. (You might have
70
79
  your own.)
71
80
 
81
+ - simplec-sections: Sections compose pages. Configure pages composed of Sections
82
+ rather than taking a page hook line and sinker.
83
+
72
84
  - simplec-admin: Opinionated, prebuilt way of managing pages. Take it or leave
73
85
  it. Or don't mount it and generate scaffold controllers and views for basic
74
86
  functions.
@@ -238,6 +250,8 @@ used to generate uuid primary keys.
238
250
  Installation varies per operating system. Image magic is used by dragonfly
239
251
  for on the fly (then cached) image manipulation.
240
252
 
253
+ Note there is a known vulnerability, please update accordingly: https://imagetragick.com/
254
+
241
255
  See this page for a good cheat sheet: http://markevans.github.io/dragonfly/imagemagick
242
256
 
243
257
  ## Roadmap
@@ -265,6 +279,12 @@ See this page for a good cheat sheet: http://markevans.github.io/dragonfly/image
265
279
 
266
280
  - utilize thread local variable for found subdomain in #subdomain
267
281
 
282
+ - page previews?
283
+
284
+ - configure uuid or integer pk/fk
285
+
286
+ - note about migration versions on old rails installs
287
+
268
288
  1. Sitemap
269
289
 
270
290
  1. Installer `rails generater simplec:install`
@@ -279,6 +299,8 @@ See this page for a good cheat sheet: http://markevans.github.io/dragonfly/image
279
299
 
280
300
  1. Remove as many dependencies as possible.
281
301
 
302
+ 1. github-markdown for markup?
303
+
282
304
  ## Contributing
283
305
  1. Use it and file create issues. Somethings are core, other things will be
284
306
  relegated to 3rd party extensions.
@@ -304,6 +326,11 @@ See this page for a good cheat sheet: http://markevans.github.io/dragonfly/image
304
326
 
305
327
  rake db:migrate
306
328
 
329
+ 4. Run the documentation server
330
+
331
+ gem install yard
332
+ yard server -r --no-cache --no-save --verbose --debug --backtrace
333
+
307
334
 
308
335
  ## Contributors
309
336
 
@@ -3,10 +3,18 @@ require_dependency "simplec/page_action_helpers"
3
3
 
4
4
  module Simplec
5
5
  class PagesController < ApplicationController
6
+ include Simplec::ActionController::Extensions
6
7
  include Simplec::PageActionHelpers
7
8
 
8
9
  def show
9
- render_path params[:path] || ''
10
+ begin
11
+ render_path params[:path] || ''
12
+ rescue ActiveRecord::SubclassNotFound => e
13
+ # TODO add proc config for error notification, airbrake, etc
14
+ #
15
+ Rails.logger.info e
16
+ render status: 404
17
+ end
10
18
  end
11
19
 
12
20
  end
@@ -0,0 +1,10 @@
1
+ module Simplec
2
+ module Admin
3
+ class Page < Simplec::Page
4
+ # ignore type column for instatiation in admin pages,
5
+ # which can cause errors if a model class is deleted
6
+ self.inheritance_column = nil
7
+ end
8
+ end
9
+ end
10
+
@@ -4,20 +4,26 @@ module Simplec
4
4
  #
5
5
  # == Model and Template Relationship.
6
6
  #
7
- # Each page has a class located in:
8
- # app/models/page/NAME.rb
7
+ # This is a para with `code`. WTF
9
8
  #
10
- # Each page has a partial template in:
11
- # app/views/pages/_NAME.html.erb
9
+ # Each page has:
12
10
  #
13
- # Where NAME is the demodulized, snake-case name of the Page Subclasss. For
14
- # example:
11
+ # - a class located in: `app/models/page/NAME.rb`
15
12
  #
16
- # class Page::Home < Page
17
- # field :h1
18
- # end
13
+ # - a partial template in: +app/views/pages/_NAME.html.erb+
19
14
  #
20
- # Would have a have a template in `app/views/pages/_home.html.erb`.
15
+ # Where NAME is the demodulized, snake-case name of the Page Subclass.
16
+ #
17
+ # @example Class and template
18
+ #
19
+ # # app/models/page/home.rb
20
+ # class Page::Home < Page
21
+ # field :h1
22
+ # end
23
+ #
24
+ # <!-- app/views/pages/_home.html.erb -->
25
+ # <h1>My Application</h1>
26
+ # <h2><%= @page.tagline %></h2>
21
27
  #
22
28
  # @!visibility public
23
29
  class Page < ApplicationRecord
@@ -8,11 +8,26 @@ module Simplec
8
8
 
9
9
  private
10
10
 
11
- def render_path(path)
11
+ # Render the template and layout for a path.
12
+ #
13
+ # @param path [String] a path without a leading /
14
+ # @param options [Hash] passed through to underlying `render`
15
+ #
16
+ # @!visibility public
17
+ def render_path(path, options={})
12
18
  @page = page(path)
13
- render template: 'simplec/pages/show', layout: layout(@page)
19
+ render options.merge(
20
+ template: 'simplec/pages/show',
21
+ layout: layout(@page)
22
+ )
14
23
  end
15
24
 
25
+ # Determine the layout for a page.
26
+ #
27
+ # @param page [Simplec::Page]
28
+ #
29
+ # @return [String] layout name
30
+ # @!visibility public
16
31
  def layout(page)
17
32
  # TODO allow config for public
18
33
  [page.layout, page.subdomain.default_layout, 'public'].
@@ -21,6 +36,7 @@ module Simplec
21
36
 
22
37
  end
23
38
 
39
+ # @!visibility private
24
40
  def self.included(receiver)
25
41
  receiver.extend ClassMethods
26
42
  receiver.send :include, InstanceMethods
@@ -1,3 +1,3 @@
1
1
  module Simplec
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-17 00:00:00.000000000 Z
11
+ date: 2017-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: redcarpet
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  description: A CMS that doesn't take over an application.
98
112
  email:
99
113
  - matt@nearapogee.com
@@ -120,6 +134,7 @@ files:
120
134
  - app/helpers/simplec/application_helper.rb
121
135
  - app/jobs/simplec/application_job.rb
122
136
  - app/mailers/simplec/application_mailer.rb
137
+ - app/models/simplec/admin/page.rb
123
138
  - app/models/simplec/application_record.rb
124
139
  - app/models/simplec/document.rb
125
140
  - app/models/simplec/document_set.rb