usmu 0.2.1 → 0.2.2
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/.travis.yml +18 -22
- data/CHANGELOG.md +82 -0
- data/README.md +0 -8
- data/Rakefile +32 -0
- data/bin/usmu +1 -5
- data/lib/usmu.rb +5 -3
- data/lib/usmu/configuration.rb +13 -1
- data/lib/usmu/plugin/core.rb +35 -1
- data/lib/usmu/site_generator.rb +13 -13
- data/lib/usmu/template/helpers.rb +19 -0
- data/lib/usmu/template/include.rb +87 -0
- data/lib/usmu/template/layout.rb +198 -0
- data/lib/usmu/template/page.rb +22 -0
- data/lib/usmu/template/static_file.rb +50 -0
- data/lib/usmu/version.rb +1 -1
- data/share/init-site/.gitignore +2 -0
- data/share/init-site/Gemfile +6 -0
- data/share/init-site/layouts/html.slim +8 -0
- data/share/init-site/source/index.md +3 -0
- data/share/init-site/usmu.yml +3 -0
- data/test/expected-site/.dotfiletest.txt +1 -0
- data/test/expected-site/default.html +4 -0
- data/test/expected-site/embedded.html +7 -0
- data/test/expected-site/index.html +4 -0
- data/test/site/content/.dotfiletest.txt +1 -0
- data/test/site/includes/footer.meta.yml +2 -0
- data/test/site/includes/footer.slim +1 -0
- data/test/site/layouts/embedded.slim +2 -0
- data/test/site/layouts/html.slim +2 -0
- data/test/spec/acceptance/full_site_build.feature +7 -2
- data/test/spec/acceptance/steps/full_site_build_steps.rb +9 -4
- data/test/spec/configuration_spec.rb +35 -14
- data/test/spec/site_generator_spec.rb +2 -2
- data/test/spec/{layout_spec.rb → template/layout_spec.rb} +4 -4
- data/test/spec/{page_spec.rb → template/page_spec.rb} +4 -4
- data/test/spec/{static_file_spec.rb → template/static_file_spec.rb} +5 -5
- data/usmu-jruby.gemspec +1 -1
- data/usmu.gemspec +1 -1
- metadata +29 -13
- data/lib/usmu/layout.rb +0 -189
- data/lib/usmu/page.rb +0 -20
- data/lib/usmu/static_file.rb +0 -48
data/lib/usmu/static_file.rb
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'usmu/configuration'
|
2
|
-
|
3
|
-
module Usmu
|
4
|
-
# Represents a static file which should be transferred to the destination unchanged. This also acts as the base
|
5
|
-
# class for all layouts and page types. The basic interface defined here is used to process all types of files.
|
6
|
-
class StaticFile
|
7
|
-
@log = Logging.logger[self]
|
8
|
-
|
9
|
-
# @!attribute [r] name
|
10
|
-
# @return [String] the name of the file in the source directory
|
11
|
-
attr_reader :name
|
12
|
-
|
13
|
-
# @param configuration [Usmu::Configuration] The configuration for the website we're generating.
|
14
|
-
# @param name [String] The name of the file in the source directory.
|
15
|
-
# @param type [String] The type of template to use with the file. Not used for StaticFile.
|
16
|
-
# Used for testing purposes.
|
17
|
-
# @param content [String] The content of the file. Used for testing purposes.
|
18
|
-
# @param metadata [String] The metadata for the file. Used for testing purposes.
|
19
|
-
def initialize(configuration, name, type = nil, content = nil, metadata = nil)
|
20
|
-
@configuration = configuration
|
21
|
-
@name = name
|
22
|
-
@type = type
|
23
|
-
@content = content
|
24
|
-
end
|
25
|
-
|
26
|
-
# Renders the file with any templating language required and returns the result
|
27
|
-
#
|
28
|
-
# @param variables [Hash] Variables to be used in the template.
|
29
|
-
# @return [String] The rendered file
|
30
|
-
def render(variables = {})
|
31
|
-
@content || File.read(input_path)
|
32
|
-
end
|
33
|
-
|
34
|
-
# @!attribute [r] input_path
|
35
|
-
# @return [String] the full path to the file in the source directory
|
36
|
-
def input_path
|
37
|
-
File.join(@configuration.source_path, @name)
|
38
|
-
end
|
39
|
-
|
40
|
-
# @!attribute [r] output_filename
|
41
|
-
# @return [String] the filename to use in the output directory.
|
42
|
-
#
|
43
|
-
# Returns the filename to use for the output directory with any modifications to the input filename required.
|
44
|
-
def output_filename
|
45
|
-
@name
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|