usmu 0.4.0 → 1.0.0
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: 64d4047c5c82c4c4854d5842938e233ee36cdf20
|
4
|
+
data.tar.gz: e7ce74410b8b2f7a4f0445dc1fc9564340344504
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c2e2b38dc4bd4943d07d618ccc10ac8b338a5135f9d32ece9f0b8e4e8076fa7f02a606bf8e80101bc80f271c728236be7ce4b8df30dbd37b9d403553ec65d1a
|
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: ruby
|
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
|
@@ -277,10 +277,12 @@ files:
|
|
277
277
|
- Rakefile
|
278
278
|
- bin/usmu
|
279
279
|
- lib/usmu.rb
|
280
|
+
- lib/usmu/collections.rb
|
280
281
|
- lib/usmu/configuration.rb
|
281
282
|
- lib/usmu/deployment.rb
|
282
283
|
- lib/usmu/deployment/directory_diff.rb
|
283
284
|
- lib/usmu/deployment/remote_file_interface.rb
|
285
|
+
- lib/usmu/helpers/indexer.rb
|
284
286
|
- lib/usmu/metadata_service.rb
|
285
287
|
- lib/usmu/plugin.rb
|
286
288
|
- lib/usmu/plugin/core.rb
|
@@ -299,24 +301,26 @@ files:
|
|
299
301
|
- share/init-site/Gemfile
|
300
302
|
- share/init-site/layouts/html.slim
|
301
303
|
- share/init-site/source/index.md
|
304
|
+
- share/init-site/source/index.meta.yml
|
302
305
|
- share/init-site/usmu.yml
|
303
306
|
- spec/acceptance/full_site_build.feature
|
304
307
|
- spec/acceptance/steps/full_site_build_steps.rb
|
305
|
-
- spec/configuration_spec.rb
|
306
|
-
- spec/deployment/directory_diff_spec.rb
|
307
|
-
- spec/metadata_service_spec.rb
|
308
308
|
- spec/mock/usmu/mock_plugin.rb
|
309
309
|
- spec/mock/usmu/mock_remote_files.rb
|
310
|
-
- spec/plugin/core_spec.rb
|
311
|
-
- spec/plugin_spec.rb
|
312
|
-
- spec/site_generator_spec.rb
|
313
310
|
- spec/spec_helper.rb
|
314
311
|
- spec/support/shared_layout.rb
|
315
|
-
- spec/
|
316
|
-
- spec/
|
317
|
-
- spec/
|
318
|
-
- spec/
|
312
|
+
- spec/usmu/configuration_spec.rb
|
313
|
+
- spec/usmu/deployment/directory_diff_spec.rb
|
314
|
+
- spec/usmu/metadata_service_spec.rb
|
315
|
+
- spec/usmu/plugin/core_spec.rb
|
316
|
+
- spec/usmu/plugin_spec.rb
|
317
|
+
- spec/usmu/site_generator_spec.rb
|
318
|
+
- spec/usmu/template/layout_spec.rb
|
319
|
+
- spec/usmu/template/page_spec.rb
|
320
|
+
- spec/usmu/template/static_file_spec.rb
|
321
|
+
- spec/usmu/ui/console_spec.rb
|
319
322
|
- test-site/content/.dotfiletest.txt
|
323
|
+
- test-site/content/archive.slim
|
320
324
|
- test-site/content/assets/external.scss
|
321
325
|
- test-site/content/assets/meta.yml
|
322
326
|
- test-site/content/css/_partial.scss
|
@@ -326,21 +330,29 @@ files:
|
|
326
330
|
- test-site/content/embedded.meta.yml
|
327
331
|
- test-site/content/index.md
|
328
332
|
- test-site/content/index.meta.yml
|
333
|
+
- test-site/content/posts/meta.yml
|
334
|
+
- test-site/content/posts/second-post.md
|
335
|
+
- test-site/content/posts/second-post.meta.yml
|
329
336
|
- test-site/content/posts/test-post.md
|
337
|
+
- test-site/content/posts/test-post.meta.yml
|
330
338
|
- test-site/content/robots.txt
|
331
339
|
- test-site/expected-site/.dotfiletest.txt
|
340
|
+
- test-site/expected-site/2015/01/second-post.html
|
341
|
+
- test-site/expected-site/2015/01/test-post.html
|
342
|
+
- test-site/expected-site/archive.html
|
332
343
|
- test-site/expected-site/assets/external.scss
|
333
344
|
- test-site/expected-site/css/app.css
|
334
345
|
- test-site/expected-site/default.html
|
335
346
|
- test-site/expected-site/embedded.html
|
336
347
|
- test-site/expected-site/index.html
|
337
|
-
- test-site/expected-site/posts/test-post.html
|
338
348
|
- test-site/expected-site/robots.txt
|
339
349
|
- test-site/includes/footer.meta.yml
|
340
350
|
- test-site/includes/footer.slim
|
341
351
|
- test-site/layouts/embedded.meta.yml
|
342
352
|
- test-site/layouts/embedded.slim
|
343
353
|
- test-site/layouts/html.slim
|
354
|
+
- test-site/layouts/post.meta.yml
|
355
|
+
- test-site/layouts/post.slim
|
344
356
|
- test-site/usmu.yml
|
345
357
|
- usmu.gemspec
|
346
358
|
homepage: https://github.com/usmu/usmu
|
@@ -370,21 +382,22 @@ summary: A static site generator with a web-based frontend for editing.
|
|
370
382
|
test_files:
|
371
383
|
- spec/acceptance/full_site_build.feature
|
372
384
|
- spec/acceptance/steps/full_site_build_steps.rb
|
373
|
-
- spec/configuration_spec.rb
|
374
|
-
- spec/deployment/directory_diff_spec.rb
|
375
|
-
- spec/metadata_service_spec.rb
|
376
385
|
- spec/mock/usmu/mock_plugin.rb
|
377
386
|
- spec/mock/usmu/mock_remote_files.rb
|
378
|
-
- spec/plugin/core_spec.rb
|
379
|
-
- spec/plugin_spec.rb
|
380
|
-
- spec/site_generator_spec.rb
|
381
387
|
- spec/spec_helper.rb
|
382
388
|
- spec/support/shared_layout.rb
|
383
|
-
- spec/
|
384
|
-
- spec/
|
385
|
-
- spec/
|
386
|
-
- spec/
|
389
|
+
- spec/usmu/configuration_spec.rb
|
390
|
+
- spec/usmu/deployment/directory_diff_spec.rb
|
391
|
+
- spec/usmu/metadata_service_spec.rb
|
392
|
+
- spec/usmu/plugin/core_spec.rb
|
393
|
+
- spec/usmu/plugin_spec.rb
|
394
|
+
- spec/usmu/site_generator_spec.rb
|
395
|
+
- spec/usmu/template/layout_spec.rb
|
396
|
+
- spec/usmu/template/page_spec.rb
|
397
|
+
- spec/usmu/template/static_file_spec.rb
|
398
|
+
- spec/usmu/ui/console_spec.rb
|
387
399
|
- test-site/content/.dotfiletest.txt
|
400
|
+
- test-site/content/archive.slim
|
388
401
|
- test-site/content/assets/external.scss
|
389
402
|
- test-site/content/assets/meta.yml
|
390
403
|
- test-site/content/css/_partial.scss
|
@@ -394,20 +407,28 @@ test_files:
|
|
394
407
|
- test-site/content/embedded.meta.yml
|
395
408
|
- test-site/content/index.md
|
396
409
|
- test-site/content/index.meta.yml
|
410
|
+
- test-site/content/posts/meta.yml
|
411
|
+
- test-site/content/posts/second-post.md
|
412
|
+
- test-site/content/posts/second-post.meta.yml
|
397
413
|
- test-site/content/posts/test-post.md
|
414
|
+
- test-site/content/posts/test-post.meta.yml
|
398
415
|
- test-site/content/robots.txt
|
399
416
|
- test-site/expected-site/.dotfiletest.txt
|
417
|
+
- test-site/expected-site/2015/01/second-post.html
|
418
|
+
- test-site/expected-site/2015/01/test-post.html
|
419
|
+
- test-site/expected-site/archive.html
|
400
420
|
- test-site/expected-site/assets/external.scss
|
401
421
|
- test-site/expected-site/css/app.css
|
402
422
|
- test-site/expected-site/default.html
|
403
423
|
- test-site/expected-site/embedded.html
|
404
424
|
- test-site/expected-site/index.html
|
405
|
-
- test-site/expected-site/posts/test-post.html
|
406
425
|
- test-site/expected-site/robots.txt
|
407
426
|
- test-site/includes/footer.meta.yml
|
408
427
|
- test-site/includes/footer.slim
|
409
428
|
- test-site/layouts/embedded.meta.yml
|
410
429
|
- test-site/layouts/embedded.slim
|
411
430
|
- test-site/layouts/html.slim
|
431
|
+
- test-site/layouts/post.meta.yml
|
432
|
+
- test-site/layouts/post.slim
|
412
433
|
- test-site/usmu.yml
|
413
434
|
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>
|