usmu 0.4.0-java → 1.0.0-java
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/CHANGELOG.md +11 -0
- data/Guardfile +1 -1
- data/Rakefile +1 -0
- data/lib/usmu.rb +2 -0
- data/lib/usmu/collections.rb +50 -0
- data/lib/usmu/configuration.rb +10 -35
- data/lib/usmu/helpers/indexer.rb +54 -0
- data/lib/usmu/plugin/core.rb +1 -2
- data/lib/usmu/site_generator.rb +8 -0
- data/lib/usmu/template/helpers.rb +27 -1
- data/lib/usmu/template/layout.rb +2 -8
- data/lib/usmu/template/page.rb +40 -0
- data/lib/usmu/template/static_file.rb +18 -0
- data/lib/usmu/ui/console.rb +0 -4
- data/lib/usmu/ui/rack_server.rb +2 -1
- data/lib/usmu/version.rb +1 -1
- data/share/init-site/source/index.meta.yml +2 -0
- data/share/init-site/usmu.yml +1 -1
- data/spec/{configuration_spec.rb → usmu/configuration_spec.rb} +0 -0
- data/spec/{deployment → usmu/deployment}/directory_diff_spec.rb +0 -0
- data/spec/{metadata_service_spec.rb → usmu/metadata_service_spec.rb} +0 -0
- data/spec/{plugin → usmu/plugin}/core_spec.rb +0 -0
- data/spec/{plugin_spec.rb → usmu/plugin_spec.rb} +0 -0
- data/spec/{site_generator_spec.rb → usmu/site_generator_spec.rb} +3 -3
- data/spec/{template → usmu/template}/layout_spec.rb +0 -0
- data/spec/{template → usmu/template}/page_spec.rb +0 -0
- data/spec/{template → usmu/template}/static_file_spec.rb +0 -0
- data/spec/{ui → usmu/ui}/console_spec.rb +0 -0
- data/test-site/content/archive.slim +13 -0
- data/test-site/content/posts/meta.yml +4 -0
- data/test-site/content/posts/second-post.md +3 -0
- data/test-site/content/posts/second-post.meta.yml +3 -0
- data/test-site/content/posts/test-post.md +2 -2
- data/test-site/content/posts/test-post.meta.yml +3 -0
- data/test-site/expected-site/2015/01/second-post.html +29 -0
- data/test-site/expected-site/2015/01/test-post.html +29 -0
- data/test-site/expected-site/archive.html +37 -0
- data/test-site/layouts/post.meta.yml +2 -0
- data/test-site/layouts/post.slim +10 -0
- metadata +45 -24
- data/test-site/expected-site/posts/test-post.html +0 -18
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 076f6e4f586e0257b024ec579888017278a53b37
|
|
4
|
+
data.tar.gz: e7ce74410b8b2f7a4f0445dc1fc9564340344504
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9dccb1a78e6e9fd7b02d2be250becddf37894f59853a694e22235556ebd7391809941689e175fac09cf3a48e1847ac92b6308b240a17747e6fd773b7132f8f0e
|
|
7
|
+
data.tar.gz: 7ab64019c566d4411ad8f4beac28384e5580841dde0c9a2900908aff82f2d4579ec6a6435bad155331f352121846bf289f5edccc5084e61a1687e553ee84169a
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Usmu Change Log
|
|
2
2
|
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
Matthew Scharley <matt.scharley@gmail.com>
|
|
6
|
+
|
|
7
|
+
* Minor refactor of /spec (d353c8a1f8914dc9fb554770479092cfc1e526bc)
|
|
8
|
+
* Small update to the init site (d86e9a205a3a2f1cc76dec7e66f0540edc9e13c1)
|
|
9
|
+
* [#29] Generalise Configuration#[] into Helpers::Indexer and add to Layout (474b5d778f841595602a4ec7913a646ff5e90106)
|
|
10
|
+
* [#27] Add permalinks (ce190c0d33e84bf38b26cc134fe96bb9a3bb3f22)
|
|
11
|
+
* [#19] Basic functional collection support for paging (de2fa4194fe9db955e09a302a1b87816557e8f3e)
|
|
12
|
+
* [#19] Add enumeration of collections (e6923cf10426e62bc5f35c3649303a1ae65466fd)
|
|
13
|
+
|
|
3
14
|
## 0.4.0
|
|
4
15
|
|
|
5
16
|
Matthew Scharley <matt.scharley@gmail.com>
|
data/Guardfile
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
guard :rspec, cmd: 'rspec', spec_paths: ['spec'] do
|
|
5
5
|
watch(%r{^spec/.+_spec\.rb$})
|
|
6
|
-
watch(%r{^lib/
|
|
6
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
|
7
7
|
watch(%r{^spec/support}) { 'spec' }
|
|
8
8
|
watch('spec/spec_helper.rb') { 'spec' }
|
|
9
9
|
|
data/Rakefile
CHANGED
data/lib/usmu.rb
CHANGED
|
@@ -86,6 +86,7 @@ end
|
|
|
86
86
|
|
|
87
87
|
%W{
|
|
88
88
|
usmu/version
|
|
89
|
+
usmu/collections
|
|
89
90
|
usmu/configuration
|
|
90
91
|
usmu/metadata_service
|
|
91
92
|
usmu/site_generator
|
|
@@ -96,4 +97,5 @@ end
|
|
|
96
97
|
usmu/template/layout
|
|
97
98
|
usmu/template/page
|
|
98
99
|
usmu/template/static_file
|
|
100
|
+
usmu/helpers/indexer
|
|
99
101
|
}.each { |f| require f }
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
|
|
2
|
+
module Usmu
|
|
3
|
+
class Collections
|
|
4
|
+
# @param [Usmu::SiteGenerator] generator
|
|
5
|
+
def initialize(generator)
|
|
6
|
+
@generator = generator
|
|
7
|
+
refresh
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def [](index)
|
|
11
|
+
unless @collections[index]
|
|
12
|
+
files = @generator.renderables.select {|r| r['collection'] == index }.sort_by &:date
|
|
13
|
+
@collections[index] = Collection.new(files)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
@collections[index]
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def refresh
|
|
20
|
+
@collections = {}
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
class Collection
|
|
24
|
+
# @param [Array<Usmu::Template::Page>] pages
|
|
25
|
+
def initialize(pages)
|
|
26
|
+
@pages = pages
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def pages
|
|
30
|
+
@pages.dup
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def each(&block)
|
|
34
|
+
pages.each &block
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def previous_from(file)
|
|
38
|
+
i = @pages.index file
|
|
39
|
+
return unless i
|
|
40
|
+
@pages[(i - 1) % @pages.length]
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def next_from(file)
|
|
44
|
+
i = @pages.index file
|
|
45
|
+
return unless i
|
|
46
|
+
@pages[(i + 1) % @pages.length]
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
data/lib/usmu/configuration.rb
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
require 'yaml'
|
|
2
2
|
require 'usmu/metadata_service'
|
|
3
|
+
require 'usmu/helpers/indexer'
|
|
3
4
|
|
|
4
5
|
module Usmu
|
|
5
6
|
# This class is used to represent a configuration file. This file should be a YAML file and called `usmu.yml`
|
|
6
7
|
# by default.
|
|
7
8
|
class Configuration
|
|
9
|
+
include Usmu::Helpers::Indexer
|
|
10
|
+
|
|
8
11
|
@log = Logging.logger[self]
|
|
9
12
|
|
|
13
|
+
indexer :@config
|
|
14
|
+
|
|
10
15
|
# @!attribute [r] config_file
|
|
11
16
|
# @return [String] the name of the file used to load the configuration.
|
|
12
17
|
attr_reader :config_file
|
|
@@ -84,41 +89,6 @@ module Usmu
|
|
|
84
89
|
@includes_metadata ||= MetadataService.new(includes_path)
|
|
85
90
|
end
|
|
86
91
|
|
|
87
|
-
# An index accessor to directly access the configuration file. It should be noted that `['source']` and
|
|
88
|
-
# `#source_path` and other similar pairs will have different values. `['source']` is the raw value from the
|
|
89
|
-
# configuration file while the latter is a path on the system, potentially altered by the path from the current
|
|
90
|
-
# working directory to the configuration file and other factors. The accessor functions such as `#source_path`
|
|
91
|
-
# should be preferred for most usages.
|
|
92
|
-
#
|
|
93
|
-
# @param [String, Symbol] indices
|
|
94
|
-
# A list of indices to use to find the value to return. Can also include an options hash with the
|
|
95
|
-
# following options:
|
|
96
|
-
#
|
|
97
|
-
# * `:default`: Sets the default value if the value can't be found.
|
|
98
|
-
#
|
|
99
|
-
# @return [Array, Hash, String, Symbol]
|
|
100
|
-
# Returns a value from the hash loaded from YAML. The type of value will ultimately depend on the configuration
|
|
101
|
-
# file and the indices provided.
|
|
102
|
-
def [](*indices)
|
|
103
|
-
if indices.last.instance_of? Hash
|
|
104
|
-
opts = indices.pop
|
|
105
|
-
else
|
|
106
|
-
opts = {}
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
value = @config
|
|
110
|
-
while indices.length > 0
|
|
111
|
-
i = indices.shift
|
|
112
|
-
if value.key? i
|
|
113
|
-
value = value[i]
|
|
114
|
-
else
|
|
115
|
-
return opts[:default]
|
|
116
|
-
end
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
value
|
|
120
|
-
end
|
|
121
|
-
|
|
122
92
|
# Returns an array of exclusions
|
|
123
93
|
#
|
|
124
94
|
# @return [Array]
|
|
@@ -126,6 +96,11 @@ module Usmu
|
|
|
126
96
|
self['exclude'] || []
|
|
127
97
|
end
|
|
128
98
|
|
|
99
|
+
# @return [Usmu::SiteGenerator]
|
|
100
|
+
def generator
|
|
101
|
+
@generator ||= SiteGenerator.new(self)
|
|
102
|
+
end
|
|
103
|
+
|
|
129
104
|
private
|
|
130
105
|
|
|
131
106
|
attr_reader :log
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
|
|
2
|
+
module Usmu
|
|
3
|
+
module Helpers
|
|
4
|
+
module Indexer
|
|
5
|
+
def self.included(base)
|
|
6
|
+
base.extend(ClassMethods)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
module ClassMethods
|
|
10
|
+
def indexer(variable)
|
|
11
|
+
# An index accessor to directly access the configuration file. It should be noted that `['source']` and
|
|
12
|
+
# `#source_path` and other similar pairs will have different values. `['source']` is the raw value from the
|
|
13
|
+
# configuration file while the latter is a path on the system, potentially altered by the path from the current
|
|
14
|
+
# working directory to the configuration file and other factors. The accessor functions such as `#source_path`
|
|
15
|
+
# should be preferred for most usages.
|
|
16
|
+
#
|
|
17
|
+
# @param [String, Symbol] indices
|
|
18
|
+
# A list of indices to use to find the value to return. Can also include an options hash with the
|
|
19
|
+
# following options:
|
|
20
|
+
#
|
|
21
|
+
# * `:default`: Sets the default value if the value can't be found.
|
|
22
|
+
#
|
|
23
|
+
# @return [Array, Hash, String, Symbol]
|
|
24
|
+
# Returns a value from the hash loaded from YAML. The type of value will ultimately depend on the configuration
|
|
25
|
+
# file and the indices provided.
|
|
26
|
+
define_method(:[]) do |*indices|
|
|
27
|
+
if indices.last.instance_of? Hash
|
|
28
|
+
opts = indices.pop
|
|
29
|
+
else
|
|
30
|
+
opts = {}
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
value = variable.to_s[0] == '@' ? instance_variable_get(variable) : send(variable)
|
|
34
|
+
while indices.length > 0
|
|
35
|
+
i = indices.shift
|
|
36
|
+
if value.key? i
|
|
37
|
+
value = value[i]
|
|
38
|
+
else
|
|
39
|
+
return opts[:default]
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
value
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
define_method(:key?) do |index|
|
|
47
|
+
value = variable.to_s[0] == '@' ? instance_variable_get(variable) : send(variable)
|
|
48
|
+
value.key? index
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
data/lib/usmu/plugin/core.rb
CHANGED
|
@@ -41,8 +41,7 @@ module Usmu
|
|
|
41
41
|
# @param [Array<String>] args arguments passed by the user.
|
|
42
42
|
# @param [Hash] options options parsed by Commander
|
|
43
43
|
def command_generate(args, options)
|
|
44
|
-
@
|
|
45
|
-
@site_generator.generate
|
|
44
|
+
@ui.configuration.generator.generate
|
|
46
45
|
end
|
|
47
46
|
|
|
48
47
|
# Command to initialise a new website.
|
data/lib/usmu/site_generator.rb
CHANGED
|
@@ -7,8 +7,9 @@ module Usmu
|
|
|
7
7
|
class Helpers
|
|
8
8
|
# Create a new Helpers instance. These are created on demand as needed by templates, there is not a singleton
|
|
9
9
|
# instance.
|
|
10
|
-
def initialize(configuration)
|
|
10
|
+
def initialize(configuration, layout)
|
|
11
11
|
@configuration = configuration
|
|
12
|
+
@layout = layout
|
|
12
13
|
end
|
|
13
14
|
|
|
14
15
|
# Finds and renders a named include.
|
|
@@ -26,6 +27,31 @@ module Usmu
|
|
|
26
27
|
inc.arguments = args
|
|
27
28
|
inc.render
|
|
28
29
|
end
|
|
30
|
+
|
|
31
|
+
def url(path)
|
|
32
|
+
path = if path.is_a? String
|
|
33
|
+
path
|
|
34
|
+
elsif path.respond_to? :output_filename
|
|
35
|
+
path.output_filename
|
|
36
|
+
else
|
|
37
|
+
path.to_s
|
|
38
|
+
end
|
|
39
|
+
@configuration['base path', default: '/'] + path
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def previous_page
|
|
43
|
+
collection = @layout['page', 'collection', default: @layout['collection', default: '']]
|
|
44
|
+
@configuration.generator.collections[collection].previous_from(@layout)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def next_page
|
|
48
|
+
collection = @layout['page', 'collection', default: @layout['collection', default: '']]
|
|
49
|
+
@configuration.generator.collections[collection].next_from(@layout['page', default: @layout])
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def collection(name)
|
|
53
|
+
@configuration.generator.collections[name]
|
|
54
|
+
end
|
|
29
55
|
end
|
|
30
56
|
end
|
|
31
57
|
end
|
data/lib/usmu/template/layout.rb
CHANGED
|
@@ -2,6 +2,7 @@ require 'tilt'
|
|
|
2
2
|
require 'deep_merge'
|
|
3
3
|
require 'usmu/template/helpers'
|
|
4
4
|
require 'usmu/template/static_file'
|
|
5
|
+
require 'usmu/helpers/indexer'
|
|
5
6
|
|
|
6
7
|
module Usmu
|
|
7
8
|
module Template
|
|
@@ -60,13 +61,6 @@ module Usmu
|
|
|
60
61
|
end
|
|
61
62
|
end
|
|
62
63
|
|
|
63
|
-
# This is a shortcut to accessing metadata.
|
|
64
|
-
#
|
|
65
|
-
# @see #metadata
|
|
66
|
-
def [](index)
|
|
67
|
-
metadata[index]
|
|
68
|
-
end
|
|
69
|
-
|
|
70
64
|
# Renders the file with any templating language required and returns the result
|
|
71
65
|
#
|
|
72
66
|
# @param variables [Hash] Variables to be used in the template.
|
|
@@ -204,7 +198,7 @@ module Usmu
|
|
|
204
198
|
# @!attribute [r] helpers
|
|
205
199
|
# @return [Usmu::Template::Helpers] the Helpers class to use as a scope for templates
|
|
206
200
|
def helpers
|
|
207
|
-
@helpers ||= Usmu::Template::Helpers.new(@configuration)
|
|
201
|
+
@helpers ||= Usmu::Template::Helpers.new(@configuration, self)
|
|
208
202
|
end
|
|
209
203
|
|
|
210
204
|
# Adds defaults for the given generator engine
|
data/lib/usmu/template/page.rb
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
require 'usmu/template/layout'
|
|
2
|
+
require 'time'
|
|
2
3
|
|
|
3
4
|
module Usmu
|
|
4
5
|
module Template
|
|
5
6
|
# Represents a page in the source directory of the website.
|
|
6
7
|
class Page < Layout
|
|
7
8
|
|
|
9
|
+
private
|
|
10
|
+
alias :super_output_filename :output_filename
|
|
11
|
+
|
|
12
|
+
public
|
|
13
|
+
|
|
8
14
|
# @param configuration [Usmu::Configuration] The configuration for the website we're generating.
|
|
9
15
|
# @param name [String] The name of the file in the source directory.
|
|
10
16
|
# @param metadata [Hash] The metadata for the file.
|
|
@@ -21,6 +27,27 @@ module Usmu
|
|
|
21
27
|
end
|
|
22
28
|
end
|
|
23
29
|
|
|
30
|
+
def output_filename
|
|
31
|
+
permalink || super_output_filename
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def date
|
|
35
|
+
date = self['date']
|
|
36
|
+
if date.is_a? Time
|
|
37
|
+
return date
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
if date
|
|
41
|
+
date = Time.parse(date) rescue nil
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
unless date
|
|
45
|
+
date = File.stat(input_path).mtime
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
date
|
|
49
|
+
end
|
|
50
|
+
|
|
24
51
|
protected
|
|
25
52
|
|
|
26
53
|
# @!attribute [r] content_path
|
|
@@ -34,6 +61,19 @@ module Usmu
|
|
|
34
61
|
def content_path
|
|
35
62
|
@configuration.source_path
|
|
36
63
|
end
|
|
64
|
+
|
|
65
|
+
def permalink
|
|
66
|
+
link = self['permalink']
|
|
67
|
+
return nil unless link
|
|
68
|
+
|
|
69
|
+
date = self.date
|
|
70
|
+
|
|
71
|
+
extension = output_extension
|
|
72
|
+
extension = '.' + extension if extension
|
|
73
|
+
|
|
74
|
+
link_tr = link.gsub('%f', File.basename(@name[0..(@name.rindex('.') - 1)]))
|
|
75
|
+
date.strftime(link_tr) + extension
|
|
76
|
+
end
|
|
37
77
|
end
|
|
38
78
|
end
|
|
39
79
|
end
|
|
@@ -5,10 +5,14 @@ module Usmu
|
|
|
5
5
|
# Represents a static file which should be transferred to the destination unchanged. This also acts as the base
|
|
6
6
|
# class for all layouts and page types. The basic interface defined here is used to process all types of files.
|
|
7
7
|
class StaticFile
|
|
8
|
+
include Usmu::Helpers::Indexer
|
|
9
|
+
|
|
8
10
|
# @!attribute [r] name
|
|
9
11
|
# @return [String] the name of the file in the source directory
|
|
10
12
|
attr_reader :name
|
|
11
13
|
|
|
14
|
+
indexer :metadata
|
|
15
|
+
|
|
12
16
|
# @param configuration [Usmu::Configuration] The configuration for the website we're generating.
|
|
13
17
|
# @param name [String] The name of the file in the source directory.
|
|
14
18
|
# @param metadata [Hash] The metadata for the file.
|
|
@@ -40,6 +44,10 @@ module Usmu
|
|
|
40
44
|
File.join(@configuration.source_path, @name)
|
|
41
45
|
end
|
|
42
46
|
|
|
47
|
+
def metadata
|
|
48
|
+
{}
|
|
49
|
+
end
|
|
50
|
+
|
|
43
51
|
# @!attribute [r] output_filename
|
|
44
52
|
# @return [String] the filename to use in the output directory.
|
|
45
53
|
#
|
|
@@ -47,6 +55,16 @@ module Usmu
|
|
|
47
55
|
def output_filename
|
|
48
56
|
@name
|
|
49
57
|
end
|
|
58
|
+
|
|
59
|
+
def inspect
|
|
60
|
+
"\#<#{self.class}:#{'0x%08x' % __id__} #{@name} => #{output_filename}>"
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def ==(other)
|
|
64
|
+
return false unless self.class == other.class
|
|
65
|
+
|
|
66
|
+
self.input_path == other.input_path && self.output_filename == other.output_filename
|
|
67
|
+
end
|
|
50
68
|
end
|
|
51
69
|
end
|
|
52
70
|
end
|
data/lib/usmu/ui/console.rb
CHANGED
|
@@ -5,10 +5,6 @@ module Usmu
|
|
|
5
5
|
module Ui
|
|
6
6
|
# This is the CLI UI controller. This is initialised by the usmu binary to control the generation process.
|
|
7
7
|
class Console
|
|
8
|
-
# @!attribute [r] site_generator
|
|
9
|
-
# @return [Usmu::SiteGenerator]
|
|
10
|
-
attr_reader :site_generator
|
|
11
|
-
|
|
12
8
|
# @!attribute [r] configuration
|
|
13
9
|
# Do not access this till your command starts running, eg. in Hooks#commands, otherwise you may not get the right
|
|
14
10
|
# value for the configuration as option parsing may not have happened yet.
|
data/lib/usmu/ui/rack_server.rb
CHANGED
|
@@ -4,8 +4,8 @@ module Usmu
|
|
|
4
4
|
class RackServer
|
|
5
5
|
def initialize(configuration)
|
|
6
6
|
@log = Logging.logger[self]
|
|
7
|
-
@generator = SiteGenerator.new(configuration)
|
|
8
7
|
@configuration = configuration
|
|
8
|
+
@generator = @configuration.generator
|
|
9
9
|
@index = configuration['serve', 'index', default: 'index.html']
|
|
10
10
|
end
|
|
11
11
|
|
|
@@ -19,6 +19,7 @@ module Usmu
|
|
|
19
19
|
valid = @generator.renderables.select {|r| r.output_filename == path }
|
|
20
20
|
|
|
21
21
|
if valid.length > 0
|
|
22
|
+
@generator.refresh
|
|
22
23
|
page = valid[0]
|
|
23
24
|
type = case page.output_filename[page.output_filename.rindex('.')...page.output_filename.length]
|
|
24
25
|
when '.html', '.php'
|
data/lib/usmu/version.rb
CHANGED
data/share/init-site/usmu.yml
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -6,17 +6,17 @@ RSpec.describe Usmu::SiteGenerator do
|
|
|
6
6
|
|
|
7
7
|
it 'should have layouts' do
|
|
8
8
|
expect(generator.respond_to? :layouts).to eq(true)
|
|
9
|
-
expect(generator.layouts.map {|l| l.name}.sort).to eq(%w{embedded.slim html.slim})
|
|
9
|
+
expect(generator.layouts.map {|l| l.name}.sort).to eq(%w{embedded.slim html.slim post.slim})
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
it 'should have a list of renderable items' do
|
|
13
13
|
expect(generator.respond_to? :renderables).to eq(true)
|
|
14
|
-
expect(generator.renderables.map {|r| r.name}.sort).to eq(%w{.dotfiletest.txt assets/external.scss css/app.scss default.md embedded.md index.md posts/test-post.md robots.txt})
|
|
14
|
+
expect(generator.renderables.map {|r| r.name}.sort).to eq(%w{.dotfiletest.txt archive.slim assets/external.scss css/app.scss default.md embedded.md index.md posts/second-post.md posts/test-post.md robots.txt})
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
it 'should have pages' do
|
|
18
18
|
expect(generator.respond_to? :pages).to eq(true)
|
|
19
|
-
expect(generator.pages.map {|p| p.name}.sort).to eq(%w{css/app.scss default.md embedded.md index.md posts/test-post.md})
|
|
19
|
+
expect(generator.pages.map {|p| p.name}.sort).to eq(%w{archive.slim css/app.scss default.md embedded.md index.md posts/second-post.md posts/test-post.md})
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
it 'should have files' do
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
## Hello world!
|
|
2
2
|
|
|
3
|
-
This is my first post.
|
|
3
|
+
This is my first post.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Second post | Testing website</title>
|
|
5
|
+
</head>
|
|
6
|
+
<body>
|
|
7
|
+
<div id="content">
|
|
8
|
+
<article>
|
|
9
|
+
<h1>
|
|
10
|
+
Second post
|
|
11
|
+
</h1>
|
|
12
|
+
<h2>This is my second post!</h2>
|
|
13
|
+
|
|
14
|
+
<p>Hello again world.</p>
|
|
15
|
+
|
|
16
|
+
</article>
|
|
17
|
+
<nav class="article-nav">
|
|
18
|
+
<div class="next">
|
|
19
|
+
<a href="/2015/01/test-post.html">Test post</a>
|
|
20
|
+
</div>
|
|
21
|
+
</nav>
|
|
22
|
+
|
|
23
|
+
</div>
|
|
24
|
+
<footer>
|
|
25
|
+
Copyright © Testers Inc.
|
|
26
|
+
</footer>
|
|
27
|
+
|
|
28
|
+
</body>
|
|
29
|
+
</html>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Test post | Testing website</title>
|
|
5
|
+
</head>
|
|
6
|
+
<body>
|
|
7
|
+
<div id="content">
|
|
8
|
+
<article>
|
|
9
|
+
<h1>
|
|
10
|
+
Test post
|
|
11
|
+
</h1>
|
|
12
|
+
<h2>Hello world!</h2>
|
|
13
|
+
|
|
14
|
+
<p>This is my first post.</p>
|
|
15
|
+
|
|
16
|
+
</article>
|
|
17
|
+
<nav class="article-nav">
|
|
18
|
+
<div class="next">
|
|
19
|
+
<a href="/2015/01/second-post.html">Second post</a>
|
|
20
|
+
</div>
|
|
21
|
+
</nav>
|
|
22
|
+
|
|
23
|
+
</div>
|
|
24
|
+
<footer>
|
|
25
|
+
Copyright © Testers Inc.
|
|
26
|
+
</footer>
|
|
27
|
+
|
|
28
|
+
</body>
|
|
29
|
+
</html>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Default Title | Testing website</title>
|
|
5
|
+
</head>
|
|
6
|
+
<body>
|
|
7
|
+
<div id="content">
|
|
8
|
+
<p>
|
|
9
|
+
Chronological order:
|
|
10
|
+
</p>
|
|
11
|
+
<ul>
|
|
12
|
+
<li>
|
|
13
|
+
<a href="/2015/01/test-post.html">Test post</a>
|
|
14
|
+
</li>
|
|
15
|
+
<li>
|
|
16
|
+
<a href="/2015/01/second-post.html">Second post</a>
|
|
17
|
+
</li>
|
|
18
|
+
</ul>
|
|
19
|
+
<p>
|
|
20
|
+
Reverse order:
|
|
21
|
+
</p>
|
|
22
|
+
<ul>
|
|
23
|
+
<li>
|
|
24
|
+
<a href="/2015/01/second-post.html">Second post</a>
|
|
25
|
+
</li>
|
|
26
|
+
<li>
|
|
27
|
+
<a href="/2015/01/test-post.html">Test post</a>
|
|
28
|
+
</li>
|
|
29
|
+
</ul>
|
|
30
|
+
|
|
31
|
+
</div>
|
|
32
|
+
<footer>
|
|
33
|
+
Copyright © Testers Inc.
|
|
34
|
+
</footer>
|
|
35
|
+
|
|
36
|
+
</body>
|
|
37
|
+
</html>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
article
|
|
2
|
+
h1 #{page['title']}
|
|
3
|
+
| #{{content}}
|
|
4
|
+
nav.article-nav
|
|
5
|
+
- if previous_page
|
|
6
|
+
.previous
|
|
7
|
+
a href="#{url previous_page.output_filename}" #{previous_page['title']}
|
|
8
|
+
- if next_page
|
|
9
|
+
.next
|
|
10
|
+
a href="#{url next_page.output_filename}" #{next_page['title']}
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: usmu
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: java
|
|
6
6
|
authors:
|
|
7
7
|
- Matthew Scharley
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-01-
|
|
11
|
+
date: 2015-01-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: slim
|
|
@@ -257,10 +257,12 @@ files:
|
|
|
257
257
|
- Rakefile
|
|
258
258
|
- bin/usmu
|
|
259
259
|
- lib/usmu.rb
|
|
260
|
+
- lib/usmu/collections.rb
|
|
260
261
|
- lib/usmu/configuration.rb
|
|
261
262
|
- lib/usmu/deployment.rb
|
|
262
263
|
- lib/usmu/deployment/directory_diff.rb
|
|
263
264
|
- lib/usmu/deployment/remote_file_interface.rb
|
|
265
|
+
- lib/usmu/helpers/indexer.rb
|
|
264
266
|
- lib/usmu/metadata_service.rb
|
|
265
267
|
- lib/usmu/plugin.rb
|
|
266
268
|
- lib/usmu/plugin/core.rb
|
|
@@ -279,24 +281,26 @@ files:
|
|
|
279
281
|
- share/init-site/Gemfile
|
|
280
282
|
- share/init-site/layouts/html.slim
|
|
281
283
|
- share/init-site/source/index.md
|
|
284
|
+
- share/init-site/source/index.meta.yml
|
|
282
285
|
- share/init-site/usmu.yml
|
|
283
286
|
- spec/acceptance/full_site_build.feature
|
|
284
287
|
- spec/acceptance/steps/full_site_build_steps.rb
|
|
285
|
-
- spec/configuration_spec.rb
|
|
286
|
-
- spec/deployment/directory_diff_spec.rb
|
|
287
|
-
- spec/metadata_service_spec.rb
|
|
288
288
|
- spec/mock/usmu/mock_plugin.rb
|
|
289
289
|
- spec/mock/usmu/mock_remote_files.rb
|
|
290
|
-
- spec/plugin/core_spec.rb
|
|
291
|
-
- spec/plugin_spec.rb
|
|
292
|
-
- spec/site_generator_spec.rb
|
|
293
290
|
- spec/spec_helper.rb
|
|
294
291
|
- spec/support/shared_layout.rb
|
|
295
|
-
- spec/
|
|
296
|
-
- spec/
|
|
297
|
-
- spec/
|
|
298
|
-
- spec/
|
|
292
|
+
- spec/usmu/configuration_spec.rb
|
|
293
|
+
- spec/usmu/deployment/directory_diff_spec.rb
|
|
294
|
+
- spec/usmu/metadata_service_spec.rb
|
|
295
|
+
- spec/usmu/plugin/core_spec.rb
|
|
296
|
+
- spec/usmu/plugin_spec.rb
|
|
297
|
+
- spec/usmu/site_generator_spec.rb
|
|
298
|
+
- spec/usmu/template/layout_spec.rb
|
|
299
|
+
- spec/usmu/template/page_spec.rb
|
|
300
|
+
- spec/usmu/template/static_file_spec.rb
|
|
301
|
+
- spec/usmu/ui/console_spec.rb
|
|
299
302
|
- test-site/content/.dotfiletest.txt
|
|
303
|
+
- test-site/content/archive.slim
|
|
300
304
|
- test-site/content/assets/external.scss
|
|
301
305
|
- test-site/content/assets/meta.yml
|
|
302
306
|
- test-site/content/css/_partial.scss
|
|
@@ -306,21 +310,29 @@ files:
|
|
|
306
310
|
- test-site/content/embedded.meta.yml
|
|
307
311
|
- test-site/content/index.md
|
|
308
312
|
- test-site/content/index.meta.yml
|
|
313
|
+
- test-site/content/posts/meta.yml
|
|
314
|
+
- test-site/content/posts/second-post.md
|
|
315
|
+
- test-site/content/posts/second-post.meta.yml
|
|
309
316
|
- test-site/content/posts/test-post.md
|
|
317
|
+
- test-site/content/posts/test-post.meta.yml
|
|
310
318
|
- test-site/content/robots.txt
|
|
311
319
|
- test-site/expected-site/.dotfiletest.txt
|
|
320
|
+
- test-site/expected-site/2015/01/second-post.html
|
|
321
|
+
- test-site/expected-site/2015/01/test-post.html
|
|
322
|
+
- test-site/expected-site/archive.html
|
|
312
323
|
- test-site/expected-site/assets/external.scss
|
|
313
324
|
- test-site/expected-site/css/app.css
|
|
314
325
|
- test-site/expected-site/default.html
|
|
315
326
|
- test-site/expected-site/embedded.html
|
|
316
327
|
- test-site/expected-site/index.html
|
|
317
|
-
- test-site/expected-site/posts/test-post.html
|
|
318
328
|
- test-site/expected-site/robots.txt
|
|
319
329
|
- test-site/includes/footer.meta.yml
|
|
320
330
|
- test-site/includes/footer.slim
|
|
321
331
|
- test-site/layouts/embedded.meta.yml
|
|
322
332
|
- test-site/layouts/embedded.slim
|
|
323
333
|
- test-site/layouts/html.slim
|
|
334
|
+
- test-site/layouts/post.meta.yml
|
|
335
|
+
- test-site/layouts/post.slim
|
|
324
336
|
- test-site/usmu.yml
|
|
325
337
|
- usmu.gemspec
|
|
326
338
|
homepage: https://github.com/usmu/usmu
|
|
@@ -350,21 +362,22 @@ summary: A static site generator with a web-based frontend for editing.
|
|
|
350
362
|
test_files:
|
|
351
363
|
- spec/acceptance/full_site_build.feature
|
|
352
364
|
- spec/acceptance/steps/full_site_build_steps.rb
|
|
353
|
-
- spec/configuration_spec.rb
|
|
354
|
-
- spec/deployment/directory_diff_spec.rb
|
|
355
|
-
- spec/metadata_service_spec.rb
|
|
356
365
|
- spec/mock/usmu/mock_plugin.rb
|
|
357
366
|
- spec/mock/usmu/mock_remote_files.rb
|
|
358
|
-
- spec/plugin/core_spec.rb
|
|
359
|
-
- spec/plugin_spec.rb
|
|
360
|
-
- spec/site_generator_spec.rb
|
|
361
367
|
- spec/spec_helper.rb
|
|
362
368
|
- spec/support/shared_layout.rb
|
|
363
|
-
- spec/
|
|
364
|
-
- spec/
|
|
365
|
-
- spec/
|
|
366
|
-
- spec/
|
|
369
|
+
- spec/usmu/configuration_spec.rb
|
|
370
|
+
- spec/usmu/deployment/directory_diff_spec.rb
|
|
371
|
+
- spec/usmu/metadata_service_spec.rb
|
|
372
|
+
- spec/usmu/plugin/core_spec.rb
|
|
373
|
+
- spec/usmu/plugin_spec.rb
|
|
374
|
+
- spec/usmu/site_generator_spec.rb
|
|
375
|
+
- spec/usmu/template/layout_spec.rb
|
|
376
|
+
- spec/usmu/template/page_spec.rb
|
|
377
|
+
- spec/usmu/template/static_file_spec.rb
|
|
378
|
+
- spec/usmu/ui/console_spec.rb
|
|
367
379
|
- test-site/content/.dotfiletest.txt
|
|
380
|
+
- test-site/content/archive.slim
|
|
368
381
|
- test-site/content/assets/external.scss
|
|
369
382
|
- test-site/content/assets/meta.yml
|
|
370
383
|
- test-site/content/css/_partial.scss
|
|
@@ -374,20 +387,28 @@ test_files:
|
|
|
374
387
|
- test-site/content/embedded.meta.yml
|
|
375
388
|
- test-site/content/index.md
|
|
376
389
|
- test-site/content/index.meta.yml
|
|
390
|
+
- test-site/content/posts/meta.yml
|
|
391
|
+
- test-site/content/posts/second-post.md
|
|
392
|
+
- test-site/content/posts/second-post.meta.yml
|
|
377
393
|
- test-site/content/posts/test-post.md
|
|
394
|
+
- test-site/content/posts/test-post.meta.yml
|
|
378
395
|
- test-site/content/robots.txt
|
|
379
396
|
- test-site/expected-site/.dotfiletest.txt
|
|
397
|
+
- test-site/expected-site/2015/01/second-post.html
|
|
398
|
+
- test-site/expected-site/2015/01/test-post.html
|
|
399
|
+
- test-site/expected-site/archive.html
|
|
380
400
|
- test-site/expected-site/assets/external.scss
|
|
381
401
|
- test-site/expected-site/css/app.css
|
|
382
402
|
- test-site/expected-site/default.html
|
|
383
403
|
- test-site/expected-site/embedded.html
|
|
384
404
|
- test-site/expected-site/index.html
|
|
385
|
-
- test-site/expected-site/posts/test-post.html
|
|
386
405
|
- test-site/expected-site/robots.txt
|
|
387
406
|
- test-site/includes/footer.meta.yml
|
|
388
407
|
- test-site/includes/footer.slim
|
|
389
408
|
- test-site/layouts/embedded.meta.yml
|
|
390
409
|
- test-site/layouts/embedded.slim
|
|
391
410
|
- test-site/layouts/html.slim
|
|
411
|
+
- test-site/layouts/post.meta.yml
|
|
412
|
+
- test-site/layouts/post.slim
|
|
392
413
|
- test-site/usmu.yml
|
|
393
414
|
has_rdoc:
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title>Default Title | Testing website</title>
|
|
5
|
-
</head>
|
|
6
|
-
<body>
|
|
7
|
-
<div id="content">
|
|
8
|
-
<h1>Hello world!</h1>
|
|
9
|
-
|
|
10
|
-
<p>This is my first post.</p>
|
|
11
|
-
|
|
12
|
-
</div>
|
|
13
|
-
<footer>
|
|
14
|
-
Copyright © Testers Inc.
|
|
15
|
-
</footer>
|
|
16
|
-
|
|
17
|
-
</body>
|
|
18
|
-
</html>
|