usmu 0.2.2-java → 0.3.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/.gitignore +2 -0
- data/.travis.yml +1 -0
- data/CHANGELOG.md +63 -3
- data/lib/usmu/configuration.rb +5 -3
- data/lib/usmu/site_generator.rb +2 -0
- data/lib/usmu/template/layout.rb +62 -6
- data/lib/usmu/template/page.rb +17 -0
- data/lib/usmu/template/static_file.rb +3 -2
- data/lib/usmu/ui/console.rb +5 -0
- data/lib/usmu/version.rb +1 -1
- data/share/init-site/usmu.yml +3 -0
- data/test/expected-site/css/app.css +2 -0
- data/test/expected-site/index.html +1 -1
- data/test/expected-site/posts/test-post.html +18 -0
- data/test/site/content/css/_partial.scss +1 -0
- data/test/site/content/css/app.scss +5 -0
- data/test/site/content/posts/test-post.md +3 -0
- data/test/site/layouts/html.slim +1 -1
- data/test/site/usmu.yml +4 -1
- data/test/spec/acceptance/steps/full_site_build_steps.rb +1 -1
- data/test/spec/site_generator_spec.rb +7 -2
- data/test/spec/support/shared_layout.rb +9 -0
- data/test/spec/template/layout_spec.rb +21 -0
- data/test/spec/ui/console_spec.rb +5 -0
- data/usmu.gemspec +3 -0
- metadata +13 -5
- data/test/site/layouts/html.meta.yml +0 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dde61bbb4fa8f559107f82400f0b2b029c730833
|
|
4
|
+
data.tar.gz: 300f0c268563caa186ade7f41d84a12a2d72c4fe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7bdfddce16f66bad2dd2857c1e1c59f4233432c4f5e52eb3d2452aff9dca40c98a00778b49b848b5dda8baba92ffd148a8a47748cd090d68c70ccabd8f199045
|
|
7
|
+
data.tar.gz: b528d3ccb26688545f2c3ea277edfab575abe72d266be8fc361d8fb1a1762c360d30cc905a8842da20232a8b2ab85d530a898f67804f9b8517f3e81527a0ec97
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# Usmu Change Log
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
Matthew Scharley <matt.scharley@gmail.com>
|
|
6
|
+
|
|
7
|
+
* Ignore vendored gems (5ed00eda230ad69d727d61197a2eff6269bcc640)
|
|
8
|
+
* Bump CHANGELOG to 0.2.2 (daea8c79c04acfd7048aa7f801c9e34462e4a06d)
|
|
9
|
+
* Fix a bug with #load_configuration (ab08a884c346fcbca784bf229b42e65bbff2b63a)
|
|
10
|
+
* Enable rvm 2.2 for the latest and greatest (e28532f0fe25f46c03e18fd9e6a2dd05c388647e)
|
|
11
|
+
* [\[\#12\]][GH-12] Fix layout loop issues finally (b3164c5bd0374837c56c1cab6554a2a7b7b207ef)
|
|
12
|
+
* Add libnotify for guard (e51971a22b7d57bcb892e90fa2feb89571b2311b)
|
|
13
|
+
* [\[\#14\]][GH-14] Don't list directories in Configuration#get_files (e56d81d7bfeae9d3312c84f2cfe3d03e268ca738)
|
|
14
|
+
* [\[\#17\]][GH-17] Fix Sass processing (5b00cc3f29e32ce31d8a13c2979d953509b3a334)
|
|
15
|
+
* [\[\#13\]][GH-13] Add page metadata to parent layouts (c2da294e1f19e6404df178ee650c3818cc0f3846)
|
|
16
|
+
* Add a Sass partials exclude to default init site (4f70d5b1b5958b6c56338b8d077711c780c85763)
|
|
17
|
+
|
|
18
|
+
## 0.2.2
|
|
19
|
+
|
|
20
|
+
Matthew Scharley <matt.scharley@gmail.com>
|
|
21
|
+
|
|
22
|
+
* Bump version to 0.3.0.dev for further dev (896cbde8191b8123a280b5a2c96af524d8055d07)
|
|
23
|
+
* Ignore CR's in generated site to tame diff on Windows (839ab4bfea0bea1a1932b569b636540172d3e633)
|
|
24
|
+
* Setup logging properly in Usmu::Plugin::Core (6b4f6cbc133830dc93248d3bc4fb71a2c2aab5a9)
|
|
25
|
+
* Allow --trace from commander to function properly (815bb4f12ef7128cb404fe93745c130b990e073d)
|
|
26
|
+
* [\[GH-8\]][GH-8] Add an init command (feb3fd659c0180b572449dbdc186d4ada5fb6c61)
|
|
27
|
+
* [\[GH-8\]][GH-8] Add tests for the init command (5bbf4031708278b27b7779d170a2a54ca708dd9f)
|
|
28
|
+
* Clean up the tmp folder with `rake clean` (2efe4a713fe75569d292bc17801dcd9b1ea2aa02)
|
|
29
|
+
* Always use --trace with the acceptance tests (cf9cacccb9faef248d52053c90a0be92f60b7704)
|
|
30
|
+
* Fix bug in init command where directories could be uncreated before usage (c53cf247923c48a6d6f84581fdf3e8845ad9d4da)
|
|
31
|
+
* Update Rubinius runs for Travis (688f32a76a08a95f261fa6f35f12bce23a0daa39)
|
|
32
|
+
* Remove the rbx-head exclude (6ded194e282909f9e7672e645f6c7b626f2ebb1c)
|
|
33
|
+
* Remove rbx-2.0 from Travis again - unsupported (de6d536ac04f16352878e92cc7561c0f9a145f54)
|
|
34
|
+
* Allow rbx-2.3 (7de8f4ca7fc27647edf9ac1e59d138ec2cd8ff1e)
|
|
35
|
+
* Add jruby 2.0 runs (e865e35445ccffb91e20aebf5c17a948ab38f336)
|
|
36
|
+
* Fix matrix excludes for jruby (9fa82f64cddb6096e891c418790aadddb00d58a8)
|
|
37
|
+
* Fix matrix excludes (again) (hopefully) (4b3dd6370369310219cdc38d9c2ed1169ee28eca)
|
|
38
|
+
* Last run at fixing the jruby 2.0 stuff (febb399e8cc5facd29cc1d164a0bddf75c953741)
|
|
39
|
+
* Greatly simplify travis.yml using matrix include instead of exclude (5ad500f8ec428be5d86c400006735f8b4cf1c61f)
|
|
40
|
+
* Fix gemfile name because I'm a derp (10e73938565049e8ff323da99fca35d024a34134)
|
|
41
|
+
* Add a changelog (ea82ed9826517920c7e39d73a5e3df167f9512b4)
|
|
42
|
+
* Enable rbx-2.4 build for testing (34fd5415af64ce0fafad3805188b34b99119f37e)
|
|
43
|
+
* Track mruby compatibility (163cd5a5956f39a1e46fdf9c381c961d2d21e52d)
|
|
44
|
+
* Officially support Rubinius 2.3 (2abe1da65e4f65d065d9d8f084bffae607045043)
|
|
45
|
+
* Update compatibility information (1be9e1cee10f3aab20f514195dfbc17deb8138f4)
|
|
46
|
+
* Bump slim to 3.0 (f258e53bb3f04187406a1ba0736c53be4105ee09)
|
|
47
|
+
* Massive refactor to create the Usmu::Template namespace (425956dd04b199e5ac32582ed5856d01b6251e35)
|
|
48
|
+
* Add an irb task to rake (e7506c686696344b506da2df8705d918bf1b0ba0)
|
|
49
|
+
* [\[\#9\]][GH-9] Add tests for includes in slim (95f4c4992e4984fcdd95c0ba66805714da215cfc)
|
|
50
|
+
* [\[\#9\]][GH-9] Implement includes (5a4e69aa8b45fac4a697d56814177023f052c585)
|
|
51
|
+
* Remove RBX 2.3 again. (b8675c07d0fe066c466144c27e690f1863a88888)
|
|
52
|
+
* Release 0.2.2 (986f611b167a0503108d41ac0a115e38d6aac2f9)
|
|
53
|
+
|
|
3
54
|
## 0.2.1
|
|
4
55
|
|
|
5
56
|
Matthew Scharley <matt.scharley@gmail.com>
|
|
@@ -27,10 +78,10 @@ Matthew Scharley <matt.scharley@gmail.com>
|
|
|
27
78
|
* Remove cucumber from the CI task (d4094db005db5205542eb8256e86f01d9cd49d05)
|
|
28
79
|
* Allow the rspec rake task to find it's own spec files (35d6f7e4486f14034544884090b5cccfd7bd82ad)
|
|
29
80
|
* Use Redcarpet 3.2! (5c7a9d34f5ec2c12089b1e045e174f26f34877f2)
|
|
30
|
-
* [GH-7] Allow for excluding files via usmu.conf (da0f1123316ce1cede23a63cea8e6c46c3a17a01)
|
|
81
|
+
* [\[GH-7\]][GH-7] Allow for excluding files via usmu.conf (da0f1123316ce1cede23a63cea8e6c46c3a17a01)
|
|
31
82
|
* Add one more guard test on exclude globs (143460ea5f5427845e01119a8aba039207382a1b)
|
|
32
|
-
* [GH-5] Add an initial pass at a plugin system (73588da4bfaf03fa27a47747b56f6e31d95c8704)
|
|
33
|
-
* [GH-5] Transition to commander instead of trollop and make `generate` an official command (1aaaf43c0884c70980af3b7e6fcaa8ce57f7474c)
|
|
83
|
+
* [\[GH-5\]][GH-5] Add an initial pass at a plugin system (73588da4bfaf03fa27a47747b56f6e31d95c8704)
|
|
84
|
+
* [\[GH-5\]][GH-5] Transition to commander instead of trollop and make `generate` an official command (1aaaf43c0884c70980af3b7e6fcaa8ce57f7474c)
|
|
34
85
|
* 1.9.3 compatibility (cba51ad465576ac542111d200cfcbb62835c097c)
|
|
35
86
|
* Re-enable 1.9.3 CI and add some compat notes to the readme (cf34053aaaf6a85752ec8be70f7c9969a89990d9)
|
|
36
87
|
* Bump to 0.2.0 release (7e7dde04c180b5ae63268db647ba45ef63a6b3f3)
|
|
@@ -80,3 +131,12 @@ Matthew Scharley <matt.scharley@gmail.com>
|
|
|
80
131
|
* Small stylistic change (ae008aa5492b2463774e4e4659d90666059b45e0)
|
|
81
132
|
* Add new custom rake tasks for building gems and fix a few small issues with the specs (5b1a4241cd9f31f39179ffaad49f7155617c0e6f)
|
|
82
133
|
* Bump to full 0.1.0 release (fb91c2b54f79eeaeb615f98f874c990e4cdddfd3)
|
|
134
|
+
|
|
135
|
+
[GH-5]: https://github.com/usmu/usmu/issues/5
|
|
136
|
+
[GH-7]: https://github.com/usmu/usmu/issues/7
|
|
137
|
+
[GH-8]: https://github.com/usmu/usmu/issues/8
|
|
138
|
+
[GH-9]: https://github.com/usmu/usmu/issues/9
|
|
139
|
+
[GH-12]: https://github.com/usmu/usmu/issues/12
|
|
140
|
+
[GH-13]: https://github.com/usmu/usmu/issues/13
|
|
141
|
+
[GH-14]: https://github.com/usmu/usmu/issues/14
|
|
142
|
+
[GH-17]: https://github.com/usmu/usmu/issues/17
|
data/lib/usmu/configuration.rb
CHANGED
|
@@ -126,9 +126,11 @@ module Usmu
|
|
|
126
126
|
# @param [Boolean] layout is this directory a layouts_path
|
|
127
127
|
# @return [Array<Usmu::Layout>, Array<Usmu::StaticFile>] Either an array of Layouts or StaticFiles in the directory
|
|
128
128
|
def get_files(directory)
|
|
129
|
-
Dir["#{directory}/**/{*,.??*}"].
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
Dir["#{directory}/**/{*,.??*}"].
|
|
130
|
+
select {|f| not File.directory? f }.
|
|
131
|
+
select {|f| !f.match(/\.meta.yml$/) }.
|
|
132
|
+
map {|f| f[(directory.length + 1)..f.length] }.
|
|
133
|
+
select {|f| not excluded? f }
|
|
132
134
|
end
|
|
133
135
|
end
|
|
134
136
|
end
|
data/lib/usmu/site_generator.rb
CHANGED
|
@@ -56,9 +56,11 @@ module Usmu
|
|
|
56
56
|
def generate
|
|
57
57
|
@log.info("Source: #{@configuration.source_path}")
|
|
58
58
|
@log.info("Destination: #{@configuration.destination_path}")
|
|
59
|
+
@log.info('')
|
|
59
60
|
|
|
60
61
|
renderables.each do |page|
|
|
61
62
|
@log.success("creating #{page.output_filename}...")
|
|
63
|
+
@log.debug("Rendering #{page.output_filename} from #{page.name}")
|
|
62
64
|
file = File.join(@configuration.destination_path, page.output_filename)
|
|
63
65
|
directory = File.dirname(file)
|
|
64
66
|
|
data/lib/usmu/template/layout.rb
CHANGED
|
@@ -46,6 +46,12 @@ module Usmu
|
|
|
46
46
|
|
|
47
47
|
@parent = nil
|
|
48
48
|
@parent = Layout.find_layout(configuration, self.metadata['layout'])
|
|
49
|
+
|
|
50
|
+
# Don't use the parent if it would result in weirdness
|
|
51
|
+
unless @parent.nil?
|
|
52
|
+
@parent = nil unless
|
|
53
|
+
output_extension == @parent.output_extension || output_extension.nil? || @parent.output_extension.nil?
|
|
54
|
+
end
|
|
49
55
|
end
|
|
50
56
|
|
|
51
57
|
# @!attribute [r] metadata
|
|
@@ -62,13 +68,22 @@ module Usmu
|
|
|
62
68
|
end
|
|
63
69
|
end
|
|
64
70
|
|
|
71
|
+
# This is a shortcut to accessing metadata.
|
|
72
|
+
#
|
|
73
|
+
# @see #metadata
|
|
74
|
+
def [](index)
|
|
75
|
+
metadata[index]
|
|
76
|
+
end
|
|
77
|
+
|
|
65
78
|
# Renders the file with any templating language required and returns the result
|
|
66
79
|
#
|
|
67
80
|
# @param variables [Hash] Variables to be used in the template.
|
|
68
81
|
# @return [String] The rendered file.
|
|
69
82
|
def render(variables = {})
|
|
70
|
-
|
|
83
|
+
template_config = add_template_defaults(@configuration[provider_name] || {}, provider_name)
|
|
84
|
+
content = template_class.new("#{@name}", 1, template_config) { @content }.
|
|
71
85
|
render(helpers, get_variables(variables))
|
|
86
|
+
|
|
72
87
|
has_cr = content.index("\r")
|
|
73
88
|
content += (has_cr ? "\r\n" : "\n") if content[-1] != "\n"
|
|
74
89
|
if @parent.nil?
|
|
@@ -122,19 +137,33 @@ module Usmu
|
|
|
122
137
|
# that name is nilable and can also be passed in as an Usmu::Template::Layout already for testing purposes.
|
|
123
138
|
# @return [Usmu::Layout]
|
|
124
139
|
def self.find_layout(configuration, name)
|
|
125
|
-
if name
|
|
126
|
-
|
|
140
|
+
return nil if name.nil?
|
|
141
|
+
|
|
142
|
+
@layout_history = @layout_history || {}
|
|
143
|
+
@layout_history[configuration] = @layout_history[configuration] || {}
|
|
144
|
+
if @layout_history[configuration][name]
|
|
145
|
+
Logging.logger[self].debug("Layout loop detected. Current loaded layouts: #{@layout_history[configuration].inspect}")
|
|
146
|
+
return nil
|
|
147
|
+
else
|
|
148
|
+
Logging.logger[self].debug("Loading layout '#{name}'")
|
|
149
|
+
@layout_history[configuration][name] = true
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
ret = nil
|
|
153
|
+
if name === 'none' || name.nil?
|
|
127
154
|
elsif name.class.name == 'String'
|
|
128
155
|
Dir["#{configuration.layouts_path}/#{name}.*"].each do |f|
|
|
129
156
|
filename = File.basename(f)
|
|
130
157
|
if filename != "#{name}.meta.yml"
|
|
131
|
-
|
|
158
|
+
ret = new(configuration, f[(configuration.layouts_path.length + 1)..f.length])
|
|
132
159
|
end
|
|
133
160
|
end
|
|
134
|
-
nil
|
|
135
161
|
else
|
|
136
|
-
name
|
|
162
|
+
ret = name
|
|
137
163
|
end
|
|
164
|
+
|
|
165
|
+
@layout_history[configuration][name] = nil
|
|
166
|
+
return ret
|
|
138
167
|
end
|
|
139
168
|
|
|
140
169
|
# Tests if a given file is a valid Tilt template based on the filename.
|
|
@@ -151,6 +180,17 @@ module Usmu
|
|
|
151
180
|
|
|
152
181
|
protected
|
|
153
182
|
|
|
183
|
+
# @!attribute [r] parent
|
|
184
|
+
# @return [Usmu::Template::Layout] The template acting as a wrapper for this template, if any
|
|
185
|
+
attr_reader :parent
|
|
186
|
+
|
|
187
|
+
# Allows for protected level direct access to the metadata store.
|
|
188
|
+
#
|
|
189
|
+
# @see #metadata
|
|
190
|
+
def []=(index, value)
|
|
191
|
+
@metadata[index] = value
|
|
192
|
+
end
|
|
193
|
+
|
|
154
194
|
# @!attribute [r] template_class
|
|
155
195
|
# @return [Tilt::Template] the Tilt template engine for this layout
|
|
156
196
|
def template_class
|
|
@@ -185,6 +225,22 @@ module Usmu
|
|
|
185
225
|
@helpers ||= Usmu::Template::Helpers.new(@configuration)
|
|
186
226
|
end
|
|
187
227
|
|
|
228
|
+
# Adds defaults for the given generator engine
|
|
229
|
+
#
|
|
230
|
+
# @param [Hash] overrides A hash of options provided by the user
|
|
231
|
+
# @param [String] engine The name of the rendering engine
|
|
232
|
+
# @return [Hash] Template options to pass into the engine
|
|
233
|
+
def add_template_defaults(overrides, engine)
|
|
234
|
+
case engine
|
|
235
|
+
when 'sass'
|
|
236
|
+
{
|
|
237
|
+
:load_paths => [@configuration.source_path + '/' + File.dirname(@name)]
|
|
238
|
+
}.deep_merge!(overrides)
|
|
239
|
+
else
|
|
240
|
+
overrides
|
|
241
|
+
end
|
|
242
|
+
end
|
|
243
|
+
|
|
188
244
|
private
|
|
189
245
|
|
|
190
246
|
# Utility function which collates variables to pass to the template engine.
|
data/lib/usmu/template/page.rb
CHANGED
|
@@ -4,6 +4,23 @@ module Usmu
|
|
|
4
4
|
module Template
|
|
5
5
|
# Represents a page in the source directory of the website.
|
|
6
6
|
class Page < Layout
|
|
7
|
+
|
|
8
|
+
# @param configuration [Usmu::Configuration] The configuration for the website we're generating.
|
|
9
|
+
# @param name [String] The name of the file in the source directory.
|
|
10
|
+
# @param type [String] The type of template to use with the file. Used for testing purposes.
|
|
11
|
+
# @param content [String] The content of the file. Used for testing purposes.
|
|
12
|
+
# @param metadata [String] The metadata for the file. Used for testing purposes.
|
|
13
|
+
def initialize(configuration, name, type = nil, content = nil, metadata = nil)
|
|
14
|
+
super(configuration, name, type, content, metadata)
|
|
15
|
+
|
|
16
|
+
current_parent = parent
|
|
17
|
+
until current_parent.nil?
|
|
18
|
+
@log.debug("Injecting page #{name} into #{current_parent.name}")
|
|
19
|
+
current_parent['page'] = self
|
|
20
|
+
current_parent = current_parent.parent
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
7
24
|
protected
|
|
8
25
|
|
|
9
26
|
# @!attribute [r] content_path
|
|
@@ -5,8 +5,6 @@ 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
|
-
@log = Logging.logger[self]
|
|
9
|
-
|
|
10
8
|
# @!attribute [r] name
|
|
11
9
|
# @return [String] the name of the file in the source directory
|
|
12
10
|
attr_reader :name
|
|
@@ -18,6 +16,9 @@ module Usmu
|
|
|
18
16
|
# @param content [String] The content of the file. Used for testing purposes.
|
|
19
17
|
# @param metadata [String] The metadata for the file. Used for testing purposes.
|
|
20
18
|
def initialize(configuration, name, type = nil, content = nil, metadata = nil)
|
|
19
|
+
@log = Logging.logger[self]
|
|
20
|
+
@log.debug("Creating <##{self.class.name} @name=\"#{name}\">")
|
|
21
|
+
|
|
21
22
|
@configuration = configuration
|
|
22
23
|
@name = name
|
|
23
24
|
@type = type
|
data/lib/usmu/ui/console.rb
CHANGED
|
@@ -37,6 +37,10 @@ module Usmu
|
|
|
37
37
|
@commander.run!
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
+
# Load a configuration from a file
|
|
41
|
+
#
|
|
42
|
+
# @param [String] config Name of configuration file to load
|
|
43
|
+
# @return [Usmu::Configuration] the configuration for the site we will generate.
|
|
40
44
|
def load_configuration(config)
|
|
41
45
|
@log.info("Usmu v#{Usmu::VERSION}")
|
|
42
46
|
@log.info('')
|
|
@@ -48,6 +52,7 @@ module Usmu
|
|
|
48
52
|
@log.fatal("Unable to find configuration file at #{config}")
|
|
49
53
|
raise
|
|
50
54
|
end
|
|
55
|
+
@configuration
|
|
51
56
|
end
|
|
52
57
|
end
|
|
53
58
|
end
|
data/lib/usmu/version.rb
CHANGED
data/share/init-site/usmu.yml
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
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>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$color: #000;
|
data/test/site/layouts/html.slim
CHANGED
data/test/site/usmu.yml
CHANGED
|
@@ -15,7 +15,7 @@ step 'I run usmu with the arguments :args' do |args|
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
step 'the directory :destination should match :test_folder' do |destination, test_folder|
|
|
18
|
-
run = %W{diff -
|
|
18
|
+
run = %W{diff -ur --strip-trailing-cr #{test_folder} #{destination}}
|
|
19
19
|
Open3.popen2e(*run) do |i, o, t|
|
|
20
20
|
output = run.join(' ') + "\n" + o.read
|
|
21
21
|
fail output if t.value != 0
|
|
@@ -11,12 +11,12 @@ RSpec.describe Usmu::SiteGenerator do
|
|
|
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 default.md embedded.md index.md robots.txt})
|
|
14
|
+
expect(generator.renderables.map {|r| r.name}.sort).to eq(%w{.dotfiletest.txt css/app.scss default.md embedded.md index.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{default.md embedded.md index.md})
|
|
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})
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
it 'should have files' do
|
|
@@ -24,6 +24,11 @@ RSpec.describe Usmu::SiteGenerator do
|
|
|
24
24
|
expect(generator.files.map {|f| f.name}.sort).to eq(%w{.dotfiletest.txt robots.txt})
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
+
it 'should not list directories' do
|
|
28
|
+
expect(generator.respond_to? :files).to eq(true)
|
|
29
|
+
expect(generator.files.select {|f| f.name == 'posts'}.length).to eq(0)
|
|
30
|
+
end
|
|
31
|
+
|
|
27
32
|
it 'should be able to generate a site' do
|
|
28
33
|
expect(generator.respond_to? :generate).to eq(true)
|
|
29
34
|
end
|
|
@@ -173,6 +173,15 @@ RSpec.shared_examples 'an embeddable layout' do
|
|
|
173
173
|
EOF
|
|
174
174
|
end
|
|
175
175
|
|
|
176
|
+
it 'only uses a wrapper layout if the output types match' do
|
|
177
|
+
parent = described_class.new(empty_configuration, 'html.slim', 'slim', wrapper, {})
|
|
178
|
+
layout = described_class.new(empty_configuration, 'app.scss', 'scss', 'body { color: #000; }', {'layout' => parent})
|
|
179
|
+
expect(layout.render({'content' => ''})).to eq(<<-EOF)
|
|
180
|
+
body {
|
|
181
|
+
color: #000; }
|
|
182
|
+
EOF
|
|
183
|
+
end
|
|
184
|
+
|
|
176
185
|
context 'and prioritises' do
|
|
177
186
|
it 'metadata over parent metadata' do
|
|
178
187
|
parent = described_class.new(empty_configuration, 'html.slim', 'slim', wrapper, {'title' => 'title'})
|
|
@@ -16,4 +16,25 @@ RSpec.describe Usmu::Template::Layout do
|
|
|
16
16
|
expect(layout.respond_to? :input_path).to eq(true)
|
|
17
17
|
expect(layout.input_path).to eq('layouts/html.slim')
|
|
18
18
|
end
|
|
19
|
+
|
|
20
|
+
it 'should not allow circular references with #find_layout' do
|
|
21
|
+
# This will also get tested during the acceptance tests, though we test here explicitly to help aid narrow where
|
|
22
|
+
# the bug actually is.
|
|
23
|
+
configuration = Usmu::Configuration.from_file('test/site/usmu.yml')
|
|
24
|
+
layout = Usmu::Template::Layout.new(configuration, 'html.slim')
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it 'should add a default load_path for sass templates' do
|
|
28
|
+
configuration = Usmu::Configuration.from_hash({'source' => 'src'}, 'test/usmu.yml')
|
|
29
|
+
layout = Usmu::Template::Layout.new(configuration, 'css/app.scss', 'scss', "body{color: #000;}", {})
|
|
30
|
+
defaults = layout.send :add_template_defaults, {}, 'sass'
|
|
31
|
+
expect(defaults[:load_paths]).to eq(['test/src/css'])
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it 'should merge load_path\'s for sass templates' do
|
|
35
|
+
configuration = Usmu::Configuration.from_hash({'source' => 'src'}, 'test/usmu.yml')
|
|
36
|
+
layout = Usmu::Template::Layout.new(configuration, 'css/app.scss', 'scss', "body{color: #000;}", {})
|
|
37
|
+
defaults = layout.send :add_template_defaults, {load_paths: ['test/src/assets/scss']}, 'sass'
|
|
38
|
+
expect(defaults[:load_paths].sort).to eq(['test/src/assets/scss', 'test/src/css'])
|
|
39
|
+
end
|
|
19
40
|
end
|
|
@@ -17,4 +17,9 @@ RSpec.describe Usmu::Ui::Console do
|
|
|
17
17
|
expect(Usmu).to receive(:verbose_logging)
|
|
18
18
|
Usmu::Ui::Console.new(%w{--verbose --config test/site/usmu.yml})
|
|
19
19
|
end
|
|
20
|
+
|
|
21
|
+
it '#load_configuration returns a configuration' do
|
|
22
|
+
config = Usmu::Ui::Console.new(%w{--config test/site/usmu.yml}).load_configuration('test/site/usmu.yml')
|
|
23
|
+
expect(config.class.name).to eq('Usmu::Configuration')
|
|
24
|
+
end
|
|
20
25
|
end
|
data/usmu.gemspec
CHANGED
|
@@ -27,6 +27,7 @@ Gem::Specification.new do |spec|
|
|
|
27
27
|
spec.add_dependency 'deep_merge', '~> 1.0'
|
|
28
28
|
spec.add_dependency 'commander', '~> 4.2'
|
|
29
29
|
spec.add_dependency 'logging', '~> 1.8'
|
|
30
|
+
#spec.add_dependency 'pry'
|
|
30
31
|
|
|
31
32
|
spec.add_development_dependency 'bundler', '~> 1.6'
|
|
32
33
|
spec.add_development_dependency 'rake', '~> 10.0'
|
|
@@ -36,5 +37,7 @@ Gem::Specification.new do |spec|
|
|
|
36
37
|
spec.add_development_dependency 'simplecov', '~> 0.9'
|
|
37
38
|
spec.add_development_dependency 'guard', '~> 2.8'
|
|
38
39
|
spec.add_development_dependency 'guard-rspec', '~> 4.3'
|
|
40
|
+
spec.add_development_dependency 'libnotify', '~> 0.9'
|
|
39
41
|
spec.add_development_dependency 'turnip', '~> 1.2'
|
|
42
|
+
spec.add_development_dependency 'sass', '~> 3.4'
|
|
40
43
|
end
|
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: 0.3.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:
|
|
11
|
+
date: 2015-01-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: slim
|
|
@@ -265,22 +265,26 @@ files:
|
|
|
265
265
|
- share/init-site/source/index.md
|
|
266
266
|
- share/init-site/usmu.yml
|
|
267
267
|
- test/expected-site/.dotfiletest.txt
|
|
268
|
+
- test/expected-site/css/app.css
|
|
268
269
|
- test/expected-site/default.html
|
|
269
270
|
- test/expected-site/embedded.html
|
|
270
271
|
- test/expected-site/index.html
|
|
272
|
+
- test/expected-site/posts/test-post.html
|
|
271
273
|
- test/expected-site/robots.txt
|
|
272
274
|
- test/site/content/.dotfiletest.txt
|
|
275
|
+
- test/site/content/css/_partial.scss
|
|
276
|
+
- test/site/content/css/app.scss
|
|
273
277
|
- test/site/content/default.md
|
|
274
278
|
- test/site/content/embedded.md
|
|
275
279
|
- test/site/content/embedded.meta.yml
|
|
276
280
|
- test/site/content/index.md
|
|
277
281
|
- test/site/content/index.meta.yml
|
|
282
|
+
- test/site/content/posts/test-post.md
|
|
278
283
|
- test/site/content/robots.txt
|
|
279
284
|
- test/site/includes/footer.meta.yml
|
|
280
285
|
- test/site/includes/footer.slim
|
|
281
286
|
- test/site/layouts/embedded.meta.yml
|
|
282
287
|
- test/site/layouts/embedded.slim
|
|
283
|
-
- test/site/layouts/html.meta.yml
|
|
284
288
|
- test/site/layouts/html.slim
|
|
285
289
|
- test/site/usmu.yml
|
|
286
290
|
- test/spec/acceptance/full_site_build.feature
|
|
@@ -318,28 +322,32 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
318
322
|
version: '0'
|
|
319
323
|
requirements: []
|
|
320
324
|
rubyforge_project:
|
|
321
|
-
rubygems_version: 2.
|
|
325
|
+
rubygems_version: 2.2.2
|
|
322
326
|
signing_key:
|
|
323
327
|
specification_version: 4
|
|
324
328
|
summary: A static site generator with a web-based frontend for editing.
|
|
325
329
|
test_files:
|
|
326
330
|
- test/expected-site/.dotfiletest.txt
|
|
331
|
+
- test/expected-site/css/app.css
|
|
327
332
|
- test/expected-site/default.html
|
|
328
333
|
- test/expected-site/embedded.html
|
|
329
334
|
- test/expected-site/index.html
|
|
335
|
+
- test/expected-site/posts/test-post.html
|
|
330
336
|
- test/expected-site/robots.txt
|
|
331
337
|
- test/site/content/.dotfiletest.txt
|
|
338
|
+
- test/site/content/css/_partial.scss
|
|
339
|
+
- test/site/content/css/app.scss
|
|
332
340
|
- test/site/content/default.md
|
|
333
341
|
- test/site/content/embedded.md
|
|
334
342
|
- test/site/content/embedded.meta.yml
|
|
335
343
|
- test/site/content/index.md
|
|
336
344
|
- test/site/content/index.meta.yml
|
|
345
|
+
- test/site/content/posts/test-post.md
|
|
337
346
|
- test/site/content/robots.txt
|
|
338
347
|
- test/site/includes/footer.meta.yml
|
|
339
348
|
- test/site/includes/footer.slim
|
|
340
349
|
- test/site/layouts/embedded.meta.yml
|
|
341
350
|
- test/site/layouts/embedded.slim
|
|
342
|
-
- test/site/layouts/html.meta.yml
|
|
343
351
|
- test/site/layouts/html.slim
|
|
344
352
|
- test/site/usmu.yml
|
|
345
353
|
- test/spec/acceptance/full_site_build.feature
|