usmu 0.2.1-java → 0.2.2-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +18 -22
  3. data/CHANGELOG.md +82 -0
  4. data/README.md +0 -8
  5. data/Rakefile +32 -0
  6. data/bin/usmu +1 -5
  7. data/lib/usmu.rb +5 -3
  8. data/lib/usmu/configuration.rb +13 -1
  9. data/lib/usmu/plugin/core.rb +35 -1
  10. data/lib/usmu/site_generator.rb +13 -13
  11. data/lib/usmu/template/helpers.rb +19 -0
  12. data/lib/usmu/template/include.rb +87 -0
  13. data/lib/usmu/template/layout.rb +198 -0
  14. data/lib/usmu/template/page.rb +22 -0
  15. data/lib/usmu/template/static_file.rb +50 -0
  16. data/lib/usmu/version.rb +1 -1
  17. data/share/init-site/.gitignore +2 -0
  18. data/share/init-site/Gemfile +6 -0
  19. data/share/init-site/layouts/html.slim +8 -0
  20. data/share/init-site/source/index.md +3 -0
  21. data/share/init-site/usmu.yml +3 -0
  22. data/test/expected-site/.dotfiletest.txt +1 -0
  23. data/test/expected-site/default.html +4 -0
  24. data/test/expected-site/embedded.html +7 -0
  25. data/test/expected-site/index.html +4 -0
  26. data/test/site/content/.dotfiletest.txt +1 -0
  27. data/test/site/includes/footer.meta.yml +2 -0
  28. data/test/site/includes/footer.slim +1 -0
  29. data/test/site/layouts/embedded.slim +2 -0
  30. data/test/site/layouts/html.slim +2 -0
  31. data/test/spec/acceptance/full_site_build.feature +7 -2
  32. data/test/spec/acceptance/steps/full_site_build_steps.rb +9 -4
  33. data/test/spec/configuration_spec.rb +35 -14
  34. data/test/spec/site_generator_spec.rb +2 -2
  35. data/test/spec/{layout_spec.rb → template/layout_spec.rb} +4 -4
  36. data/test/spec/{page_spec.rb → template/page_spec.rb} +4 -4
  37. data/test/spec/{static_file_spec.rb → template/static_file_spec.rb} +5 -5
  38. data/usmu-jruby.gemspec +1 -1
  39. data/usmu.gemspec +1 -1
  40. metadata +29 -13
  41. data/lib/usmu/layout.rb +0 -189
  42. data/lib/usmu/page.rb +0 -20
  43. data/lib/usmu/static_file.rb +0 -48
@@ -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