middleman-dev-cms 0.2.1 → 0.2.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 +6 -1
- data/lib/middleman-dev-cms.rb +1 -1
- data/lib/middleman/dev/cms/api_server.rb +3 -1
- data/lib/middleman/dev/cms/extension.rb +0 -31
- data/lib/middleman/dev/cms/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9869516a24f91d108bf721423a9c51268024732a
|
4
|
+
data.tar.gz: 53e3013ddbb45202568da413247da1756d82e777
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1311ebc77e58e8a8e0f1a78f36ed354193a55f8557b19189adf12b24c6d40021056261a95bc5c45e3c43033e140de8b7f0976f01340ceac029b26fcf3e23e84e
|
7
|
+
data.tar.gz: 109596cf529bc1d6ae66c1cc32c168e48395174ef8c36337f36ef91103de854017dc911ffe0dd5ec714a440c69377555b40ac09713c29ceae85421eb58672cdf
|
data/README.md
CHANGED
@@ -7,7 +7,12 @@ based on the the `middleman-blog-ui` gem
|
|
7
7
|
## Installation
|
8
8
|
|
9
9
|
1. Add `middleman-dev-cms` in your `Gemfile`.
|
10
|
-
2. Add
|
10
|
+
2. Add to config.rb
|
11
|
+
```
|
12
|
+
ready do
|
13
|
+
activate :dev_cms
|
14
|
+
end
|
15
|
+
```
|
11
16
|
3. Start `middleman server`
|
12
17
|
4. visit `/cms` + a page, such as [http://localhost:4567/cms/any/page/to/edit.html](http://localhost:4567/cms/any/page/to/edit.html) and you can create, update, move, rename and delete files from the middleman server
|
13
18
|
|
data/lib/middleman-dev-cms.rb
CHANGED
@@ -5,7 +5,7 @@ require 'middleman-core'
|
|
5
5
|
::Middleman::Extensions.register(:dev_cms) do
|
6
6
|
require 'middleman/dev/cms/extension'
|
7
7
|
module Middleman::Dev::Cms
|
8
|
-
SOURCE_DIR ||=
|
8
|
+
SOURCE_DIR ||= Dir.pwd + "/source"
|
9
9
|
end
|
10
10
|
|
11
11
|
::Middleman::Dev::Cms::Extension
|
@@ -23,7 +23,7 @@ module Middleman
|
|
23
23
|
filepath += ".erb"
|
24
24
|
content = %Q(
|
25
25
|
---
|
26
|
-
title:
|
26
|
+
title: New Page
|
27
27
|
description: So I know what im looking at
|
28
28
|
---
|
29
29
|
|
@@ -31,6 +31,8 @@ description: So I know what im looking at
|
|
31
31
|
end
|
32
32
|
erb :index, locals: {content: content, filepath: (filepath)}
|
33
33
|
end
|
34
|
+
|
35
|
+
|
34
36
|
# if filepath matches new and doesnt exist, create it recursivly
|
35
37
|
# if they dont match, user edited field
|
36
38
|
# if newfilepath does not match filepath, perform move
|
@@ -13,39 +13,8 @@ module Middleman
|
|
13
13
|
app.map "/cms" do
|
14
14
|
run ApiServer
|
15
15
|
end
|
16
|
-
|
17
|
-
#::Sprockets.register_preprocessor 'application/javascript', ::Sprockets::CoffeeReact
|
18
|
-
end
|
19
|
-
|
20
|
-
def after_configuration
|
21
|
-
end
|
22
|
-
|
23
|
-
def manipulate_resource_list(resources)
|
24
|
-
# p "manipulate_resource_list"
|
25
|
-
Dir.glob( "#{SOURCE_DIR}/**/*" ).each do |path|
|
26
|
-
unless File.directory? path
|
27
|
-
resources << make_template( path, path.gsub( /#{SOURCE_DIR}\//, "" ) )
|
28
|
-
end
|
29
|
-
end
|
30
|
-
# resources << make_template( "#{SOURCE_DIR}/stylesheets/admin.css.scss", "stylesheets/admin.css" )
|
31
|
-
resources
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
35
|
-
def register_extension_templates
|
36
|
-
# We call reload_path to register the templates directory with Middleman.
|
37
|
-
# The path given to app.files must be relative to the Middleman site's root.
|
38
|
-
#templates_dir_relative_from_root = Pathname(SOURCE_DIR).relative_path_from(Pathname(app.root))
|
39
|
-
#app.files.reload_path(templates_dir_relative_from_root)
|
40
16
|
end
|
41
17
|
|
42
|
-
def make_template( file, name )
|
43
|
-
name = name.gsub( /.erb/, "" ).gsub( /.haml/, "" ).gsub( /.coffee/, "" ).gsub( /.scss/, "" )
|
44
|
-
# puts "Adding #{name}"
|
45
|
-
Middleman::Sitemap::Resource.new(app.sitemap, name, file).tap do |resource|
|
46
|
-
resource.add_metadata(options: { layout: false }, locals: {})
|
47
|
-
end
|
48
|
-
end
|
49
18
|
end
|
50
19
|
end
|
51
20
|
end
|