bunto 3.0.0 → 3.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +124 -76
  3. data/README.markdown +49 -12
  4. data/{bin → exe}/bunto +18 -14
  5. data/lib/bunto.rb +83 -78
  6. data/lib/bunto/cleaner.rb +10 -8
  7. data/lib/bunto/collection.rb +33 -17
  8. data/lib/bunto/command.rb +19 -13
  9. data/lib/bunto/commands/build.rb +22 -14
  10. data/lib/bunto/commands/clean.rb +9 -8
  11. data/lib/bunto/commands/doctor.rb +10 -8
  12. data/lib/bunto/commands/help.rb +4 -3
  13. data/lib/bunto/commands/new.rb +30 -21
  14. data/lib/bunto/commands/new_theme.rb +36 -0
  15. data/lib/bunto/commands/serve.rb +26 -20
  16. data/lib/bunto/commands/serve/servlet.rb +4 -5
  17. data/lib/bunto/configuration.rb +187 -125
  18. data/lib/bunto/converters/markdown.rb +19 -9
  19. data/lib/bunto/converters/markdown/kramdown_parser.rb +12 -5
  20. data/lib/bunto/converters/markdown/rdiscount_parser.rb +4 -4
  21. data/lib/bunto/converters/markdown/redcarpet_parser.rb +90 -84
  22. data/lib/bunto/convertible.rb +38 -25
  23. data/lib/bunto/deprecator.rb +11 -6
  24. data/lib/bunto/desktop.ini +2 -0
  25. data/lib/bunto/document.rb +53 -51
  26. data/lib/bunto/drops/bunto_drop.rb +12 -0
  27. data/lib/bunto/drops/document_drop.rb +40 -5
  28. data/lib/bunto/drops/drop.rb +49 -10
  29. data/lib/bunto/drops/excerpt_drop.rb +15 -0
  30. data/lib/bunto/drops/site_drop.rb +4 -2
  31. data/lib/bunto/drops/url_drop.rb +4 -4
  32. data/lib/bunto/entry_filter.rb +64 -19
  33. data/lib/bunto/errors.rb +6 -3
  34. data/lib/bunto/excerpt.rb +4 -6
  35. data/lib/bunto/external.rb +4 -4
  36. data/lib/bunto/filters.rb +72 -39
  37. data/lib/bunto/frontmatter_defaults.rb +45 -38
  38. data/lib/bunto/hooks.rb +21 -21
  39. data/lib/bunto/layout.rb +4 -8
  40. data/lib/bunto/liquid_renderer.rb +14 -3
  41. data/lib/bunto/liquid_renderer/file.rb +5 -1
  42. data/lib/bunto/liquid_renderer/table.rb +11 -11
  43. data/lib/bunto/log_adapter.rb +2 -2
  44. data/lib/bunto/page.rb +10 -10
  45. data/lib/bunto/plugin.rb +5 -5
  46. data/lib/bunto/plugin_manager.rb +12 -8
  47. data/lib/bunto/publisher.rb +1 -1
  48. data/lib/bunto/reader.rb +11 -7
  49. data/lib/bunto/readers/data_reader.rb +9 -9
  50. data/lib/bunto/readers/layout_reader.rb +7 -7
  51. data/lib/bunto/readers/page_reader.rb +3 -1
  52. data/lib/bunto/readers/post_reader.rb +9 -10
  53. data/lib/bunto/readers/static_file_reader.rb +3 -1
  54. data/lib/bunto/regenerator.rb +50 -28
  55. data/lib/bunto/related_posts.rb +1 -1
  56. data/lib/bunto/renderer.rb +33 -23
  57. data/lib/bunto/site.rb +94 -51
  58. data/lib/bunto/static_file.rb +33 -26
  59. data/lib/bunto/stevenson.rb +6 -5
  60. data/lib/bunto/tags/highlight.rb +50 -35
  61. data/lib/bunto/tags/include.rb +42 -31
  62. data/lib/bunto/tags/link.rb +11 -4
  63. data/lib/bunto/tags/post_url.rb +8 -7
  64. data/lib/bunto/theme.rb +10 -8
  65. data/lib/bunto/theme_builder.rb +117 -0
  66. data/lib/bunto/url.rb +21 -14
  67. data/lib/bunto/utils.rb +57 -28
  68. data/lib/bunto/utils/ansi.rb +9 -9
  69. data/lib/bunto/utils/platforms.rb +2 -2
  70. data/lib/bunto/version.rb +1 -1
  71. data/lib/site_template/_config.yml +3 -1
  72. data/lib/site_template/_posts/0000-00-00-welcome-to-bunto.markdown.erb +3 -3
  73. data/lib/site_template/about.md +3 -3
  74. data/lib/site_template/css/main.scss +3 -17
  75. data/lib/theme_template/CODE_OF_CONDUCT.md.erb +74 -0
  76. data/lib/theme_template/Gemfile +2 -0
  77. data/lib/theme_template/LICENSE.txt.erb +21 -0
  78. data/lib/theme_template/README.md.erb +48 -0
  79. data/lib/theme_template/_layouts/default.html +1 -0
  80. data/lib/theme_template/_layouts/page.html +5 -0
  81. data/lib/theme_template/_layouts/post.html +5 -0
  82. data/lib/theme_template/example/_config.yml.erb +1 -0
  83. data/lib/theme_template/example/_post.md +12 -0
  84. data/lib/theme_template/example/index.html +14 -0
  85. data/lib/theme_template/example/style.scss +7 -0
  86. data/lib/theme_template/gitignore.erb +4 -0
  87. data/lib/theme_template/theme.gemspec.erb +18 -0
  88. metadata +40 -19
  89. data/lib/site_template/_includes/footer.html +0 -38
  90. data/lib/site_template/_includes/head.html +0 -12
  91. data/lib/site_template/_includes/header.html +0 -27
  92. data/lib/site_template/_includes/icon-github.html +0 -1
  93. data/lib/site_template/_includes/icon-github.svg +0 -1
  94. data/lib/site_template/_includes/icon-twitter.html +0 -1
  95. data/lib/site_template/_includes/icon-twitter.svg +0 -1
  96. data/lib/site_template/_layouts/default.html +0 -20
  97. data/lib/site_template/_layouts/page.html +0 -14
  98. data/lib/site_template/_layouts/post.html +0 -15
  99. data/lib/site_template/_sass/_base.scss +0 -200
  100. data/lib/site_template/_sass/_layout.scss +0 -242
  101. data/lib/site_template/_sass/_syntax-highlighting.scss +0 -71
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9de6fb07519634f73190a49c592225c580a2a425
4
- data.tar.gz: 664cbdea09c133ee304b92e081c692210cef9eca
3
+ metadata.gz: 6b6a72b2c296e0ff7b771f3c59f5323253e692a4
4
+ data.tar.gz: 74867fde8fc979a13b377bffdd737c9587eada07
5
5
  SHA512:
6
- metadata.gz: 50bf9c96a0002bbc1de8dd52e07265ea3f74e73589be1880b8e2e24363b752aedb2fcff624b17b7ab659311b1b847606edc6355c624293e7382fd25482936a80
7
- data.tar.gz: 503f2595ad58b8fd63b9a11f4ec6ef03bd7d4f80d9d2de0804681f3de87dac4de8f04c4f8b19ee36bbee2d61acc85601db497561d8b9fd3b5db55fec507aec4a
6
+ metadata.gz: 139c2359381a93813449163d1858c9a1647dfa3ea11d60d6681e57a1915c641c57ac0b1406762e2ab55afa0bb5082be60aa139ab6414578eabb0db1bc5264329
7
+ data.tar.gz: a2bc45dc264572fe426cfd5cf1d2cd12342c12e2ae162a5a93b8cde1c9e2ce2480cbd7b2634fc707da10876313dc1f09ebecdf93b7495ee76463311a595a8bd6
@@ -1,80 +1,128 @@
1
- Metrics/MethodLength: { Max: 24 }
2
- Metrics/ClassLength: { Max: 240 }
3
- Metrics/ModuleLength: { Max: 240 }
4
- Metrics/LineLength: { Max: 112 }
5
- Metrics/CyclomaticComplexity: { Max: 8 }
6
- Metrics/PerceivedComplexity: { Max: 8 }
7
- Metrics/ParameterLists: { Max: 4 }
8
- Metrics/MethodLength: { Max: 24 }
9
- Metrics/AbcSize: { Max: 20 }
10
-
11
- Style/IndentHash: { EnforcedStyle: consistent }
12
- Style/HashSyntax: { EnforcedStyle: hash_rockets }
13
- Style/SignalException: { EnforcedStyle: only_raise }
14
- Style/AlignParameters: { EnforcedStyle: with_fixed_indentation }
15
- Style/StringLiteralsInInterpolation: { EnforcedStyle: double_quotes }
16
- Style/MultilineMethodCallIndentation: { EnforcedStyle: indented }
17
- Style/MultilineOperationIndentation: { EnforcedStyle: indented }
18
- Style/FirstParameterIndentation: { EnforcedStyle: consistent }
19
- Style/StringLiterals: { EnforcedStyle: double_quotes }
20
- Style/RegexpLiteral: { EnforcedStyle: slashes }
21
- Style/IndentArray: { EnforcedStyle: consistent }
22
- Style/ExtraSpacing: { AllowForAlignment: true }
23
-
24
- Style/PercentLiteralDelimiters:
25
- PreferredDelimiters:
26
- '%q': '{}'
27
- '%Q': '{}'
28
- '%r': '!!'
29
- '%s': '()'
30
- '%w': '()'
31
- '%W': '()'
32
- '%x': '()'
33
-
34
- Style/AlignArray: { Enabled: false }
35
- Style/StringLiterals: { Enabled: false }
36
- Style/Documentation: { Enabled: false }
37
- Style/DoubleNegation: { Enabled: false }
38
- Style/UnneededCapitalW: { Enabled: false }
39
- Style/EmptyLinesAroundModuleBody: { Enabled: false }
40
- Style/EmptyLinesAroundAccessModifier: { Enabled: false }
41
- Style/BracesAroundHashParameters: { Enabled: false }
42
- Style/SpaceInsideBrackets: { Enabled: false }
43
- Style/IfUnlessModifier: { Enabled: false }
44
- Style/ModuleFunction: { Enabled: false }
45
- Style/RescueModifier: { Enabled: false }
46
- Style/GuardClause: { Enabled: false }
47
- Style/FileName: { Enabled: false }
48
- Lint/UselessAccessModifier: { Enabled: false }
49
- Style/SpaceAroundOperators: { Enabled: false }
50
- Style/RedundantReturn: { Enabled: false }
51
- Style/SingleLineMethods: { Enabled: false }
52
-
1
+ ---
53
2
  AllCops:
54
3
  TargetRubyVersion: 2.0
55
4
  Include:
56
- - lib/**/*.rb
57
-
5
+ - lib/**/*.rb
6
+ Exclude:
7
+ - lib/bunto/convertible.rb
8
+ - lib/bunto/document.rb
9
+ - lib/bunto/renderer.rb
10
+ - bin/**/*
11
+ - benchmark/**/*
12
+ - script/**/*
13
+ - vendor/**/*
14
+ Lint/EndAlignment:
15
+ Severity: error
16
+ Lint/UnreachableCode:
17
+ Severity: error
18
+ Lint/UselessAccessModifier:
19
+ Enabled: false
20
+ Metrics/AbcSize:
21
+ Max: 20
22
+ Metrics/ClassLength:
23
+ Exclude:
24
+ - !ruby/regexp /features\/.*.rb$/
25
+ - !ruby/regexp /test\/.*.rb$/
26
+ Max: 300
27
+ Metrics/CyclomaticComplexity:
28
+ Max: 8
29
+ Metrics/LineLength:
58
30
  Exclude:
59
- - .rubocop.yml
60
- - .codeclimate.yml
61
- - .travis.yml
62
- - .gitignore
63
- - .rspec
64
-
65
- - Gemfile.lock
66
- - CHANGELOG.{md,markdown,txt,textile}
67
- - CONTRIBUTING.{md,markdown,txt,textile}
68
- - readme.{md,markdown,txt,textile}
69
- - README.{md,markdown,txt,textile}
70
- - Readme.{md,markdown,txt,textile}
71
- - ReadMe.{md,markdown,txt,textile}
72
- - COPYING
73
- - LICENSE
74
-
75
- - site/**/*
76
- - test/**/*
77
- - vendor/**/*
78
- - features/**/*
79
- - script/**/*
80
- - spec/**/*
31
+ - !ruby/regexp /features\/.*.rb/
32
+ Max: 90
33
+ Severity: warning
34
+ Metrics/MethodLength:
35
+ CountComments: false
36
+ Max: 20
37
+ Severity: error
38
+ Metrics/ModuleLength:
39
+ Max: 240
40
+ Metrics/ParameterLists:
41
+ Max: 4
42
+ Metrics/PerceivedComplexity:
43
+ Max: 8
44
+ Style/Alias:
45
+ Enabled: false
46
+ Style/AlignArray:
47
+ Enabled: false
48
+ Style/AlignHash:
49
+ EnforcedHashRocketStyle: table
50
+ Style/AlignParameters:
51
+ Enabled: false
52
+ EnforcedStyle: with_fixed_indentation
53
+ Style/AndOr:
54
+ Severity: error
55
+ Style/Attr:
56
+ Enabled: false
57
+ Style/BracesAroundHashParameters:
58
+ Enabled: false
59
+ Style/ClassAndModuleChildren:
60
+ Enabled: false
61
+ Style/Documentation:
62
+ Enabled: false
63
+ Exclude:
64
+ - !ruby/regexp /features\/.*.rb$/
65
+ Style/DoubleNegation:
66
+ Enabled: false
67
+ Style/EmptyLinesAroundAccessModifier:
68
+ Enabled: false
69
+ Style/EmptyLinesAroundModuleBody:
70
+ Enabled: false
71
+ Style/ExtraSpacing:
72
+ AllowForAlignment: true
73
+ Style/FileName:
74
+ Enabled: false
75
+ Style/FirstParameterIndentation:
76
+ EnforcedStyle: consistent
77
+ Style/GuardClause:
78
+ Enabled: false
79
+ Style/HashSyntax:
80
+ EnforcedStyle: hash_rockets
81
+ Severity: error
82
+ Style/IfUnlessModifier:
83
+ Enabled: false
84
+ Style/IndentArray:
85
+ EnforcedStyle: consistent
86
+ Style/IndentHash:
87
+ EnforcedStyle: consistent
88
+ Style/IndentationWidth:
89
+ Severity: error
90
+ Style/ModuleFunction:
91
+ Enabled: false
92
+ Style/MultilineMethodCallIndentation:
93
+ EnforcedStyle: indented
94
+ Style/MultilineOperationIndentation:
95
+ EnforcedStyle: indented
96
+ Style/MultilineTernaryOperator:
97
+ Severity: error
98
+ Style/PercentLiteralDelimiters:
99
+ PreferredDelimiters:
100
+ "%q": "{}"
101
+ "%Q": "{}"
102
+ "%r": "!!"
103
+ "%s": "()"
104
+ "%w": "()"
105
+ "%W": "()"
106
+ "%x": "()"
107
+ Style/RedundantReturn:
108
+ Enabled: false
109
+ Style/RedundantSelf:
110
+ Enabled: false
111
+ Style/RegexpLiteral:
112
+ EnforcedStyle: percent_r
113
+ Style/RescueModifier:
114
+ Enabled: false
115
+ Style/SignalException:
116
+ EnforcedStyle: only_raise
117
+ Style/SingleLineMethods:
118
+ Enabled: false
119
+ Style/SpaceAroundOperators:
120
+ Enabled: false
121
+ Style/SpaceInsideBrackets:
122
+ Enabled: false
123
+ Style/StringLiterals:
124
+ EnforcedStyle: double_quotes
125
+ Style/StringLiteralsInInterpolation:
126
+ EnforcedStyle: double_quotes
127
+ Style/UnneededCapitalW:
128
+ Enabled: false
@@ -1,16 +1,41 @@
1
1
  # ![Bunto](https://cloud.githubusercontent.com/assets/5073946/9288138/f4335fee-4337-11e5-9a28-068900097035.png)
2
2
  > **Bunto** is a Web Application Framework which can be used as a simple, static site generator for personal, project, or organization sites.
3
3
 
4
- [![Gem Version](https://img.shields.io/gem/v/bunto.svg)][ruby-gems]
5
- [![Build Status](https://travis-ci.org/bunto/bunto.svg?branch=ruby)][travis]
6
- [![Security](https://hakiri.io/github/bunto/bunto/ruby.svg)][hakiri]
7
- [![Join the chat at https://gitter.im/bunto/bunto](https://badges.gitter.im/bunto/bunto.svg)](https://gitter.im/bunto/bunto?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
8
- [![IRC - #bunto on freenode WebChat](https://img.shields.io/badge/freenode-bunto-yellowgreen.svg?style=flat)][freenode]
9
-
10
- [ruby-gems]: https://rubygems.org/gems/bunto
11
- [hakiri]: https://hakiri.io/github/bunto/bunto/ruby
12
- [travis]: https://travis-ci.org/bunto/bunto
13
- [freenode]: http://webchat.freenode.net/?channels=bunto
4
+ <table>
5
+ <thead>
6
+ <tr>
7
+ <th>Linux</th>
8
+ <th>OS X</th>
9
+ <th>Windows</th>
10
+ <th>Hakiri</th>
11
+ <th>CodeShip</th>
12
+ <th>RubyGems</th>
13
+ <th>Gemnasium</th>
14
+ </tr>
15
+ </thead>
16
+ <tbody>
17
+ <tr>
18
+ <td colspan="2" align="center">
19
+ <a href="https://travis-ci.org/bunto/bunto"><img src="https://travis-ci.org/bunto/bunto.svg?branch=master" alt="Travis CI Build Status"></a>
20
+ </td>
21
+ <td align="center">
22
+ <a href="https://ci.appveyor.com/project/SuriyaaKudoIsc/bunto"><img src="https://ci.appveyor.com/api/projects/status/ek5i61t9t85e5kbg?svg=true" alt="AppVeyor CI Status"></a>
23
+ </td>
24
+ <td align="center">
25
+ <a href="https://hakiri.io/github/bunto/bunto/master"><img src="https://hakiri.io/github/bunto/bunto/master.svg" alt="Hakiri Status"></a>
26
+ </td>
27
+ <td align="center">
28
+ <a href="https://codeship.com/projects/129378"><img src="https://codeship.com/projects/08e147e0-a427-0133-caa4-324d11c03594/status?branch=master" alt="CodeShip Status"></a>
29
+ </td>
30
+ <td align="center">
31
+ <a href="https://rubygems.org/gems/bunto"><img src="https://img.shields.io/gem/v/bunto.svg" alt="Gem Version"></a>
32
+ </td>
33
+ <td align="center">
34
+ <a href="https://gemnasium.com/bunto/bunto"><img src="https://gemnasium.com/bunto/bunto.svg" alt="Dependency Status"></a>
35
+ </td>
36
+ </tr>
37
+ </tbody>
38
+ </table>
14
39
 
15
40
  By Suriyaa Kudo, Tom Preston-Werner, Parker Moore and many [awesome contributors](https://github.com/bunto/bunto/graphs/contributors)!
16
41
 
@@ -18,10 +43,17 @@ Bunto is a Web Application Framework and can be used as a static site generator
18
43
 
19
44
  ## Philosophy
20
45
 
21
- Bunto does what you tell it to do — no more, no less. It doesn't try to outsmart users by making bold assumptions, nor does it burden them with needless complexity and configuration. Put simply, Bunto gets out of your way and allows you to concentrate on what truly matters: your content.
46
+ Bunto does what you tell it to do — no more, no less. It doesn't try to outsmart users by making bold assumptions, nor does it burden them with needless complexity and configuration. Put simply, Bunto gets out of your way and allows you to concentrate on what truly matters: your content.
22
47
 
23
48
  ## Getting Started
24
49
 
50
+ Bunto will work on most systems out-of-the-box. You need only to install [RubyGems](https://rubygems.org/pages/download) on your system.
51
+ After that run in your command line program this command:
52
+
53
+ ``` bash
54
+ gem install bunto
55
+ ```
56
+
25
57
  * [Install](https://bunto.github.io/docs/installation/) the gem
26
58
  * Read up about its [Usage](https://bunto.github.io/docs/usage/) and [Configuration](https://bunto.github.io/docs/configuration/)
27
59
  * Take a gander at some existing [Sites](https://wiki.github.com/bunto/bunto/sites)
@@ -37,7 +69,7 @@ conduct.
37
69
  Please adhere to this code of conduct in any interactions you have in the
38
70
  Bunto community. It is strictly enforced on all official Bunto
39
71
  repositories, websites, and resources. If you encounter someone violating
40
- these terms, please let a maintainer ([@SuriyaaKudoIsc](https://github.com/SuriyaaKudoIsc) know
72
+ these terms, please let a maintainer ([@SuriyaaKudoIsc](https://github.com/SuriyaaKudoIsc)) know
41
73
  and we will address it as soon as possible.
42
74
 
43
75
  ## Diving In
@@ -49,6 +81,11 @@ and we will address it as soon as possible.
49
81
  * Use the built-in [Liquid Extensions](https://bunto.github.io/docs/templates/) to make your life easier
50
82
  * Use custom [Plugins](https://bunto.github.io/docs/plugins/) to generate content specific to your site
51
83
 
84
+ ## Have a problem? Come chat with us!
85
+ [![Join the chat at https://gitter.im/bunto/bunto](https://badges.gitter.im/bunto/bunto.svg)](https://gitter.im/bunto/bunto?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
86
+ [![IRC - #bunto on freenode WebChat](https://img.shields.io/badge/freenode-bunto-yellowgreen.svg?style=flat)](http://webchat.freenode.net/?channels=bunto)
87
+ [<img src="https://upload.wikimedia.org/wikipedia/commons/0/06/Facebook.svg" width="60">](https://www.facebook.com/groups/BuntoWAF)
88
+
52
89
  ## License
53
90
 
54
91
  See the [LICENSE](https://github.com/bunto/bunto/blob/master/LICENSE) file.
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
  STDOUT.sync = true
3
3
 
4
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w( .. lib ))
4
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), *%w(.. lib)))
5
5
 
6
- require 'bunto'
7
- require 'mercenary'
6
+ require "bunto"
7
+ require "mercenary"
8
8
 
9
9
  Bunto::PluginManager.require_from_bundler
10
10
 
@@ -12,22 +12,26 @@ Bunto::Deprecator.process(ARGV)
12
12
 
13
13
  Mercenary.program(:bunto) do |p|
14
14
  p.version Bunto::VERSION
15
- p.description 'Bunto is a static site generator and web application framework in Ruby'
16
- p.syntax 'bunto <subcommand> [options]'
17
-
18
- p.option 'source', '-s', '--source [DIR]', 'Source directory (defaults to ./)'
19
- p.option 'destination', '-d', '--destination [DIR]', 'Destination directory (defaults to ./_site)'
20
- p.option 'safe', '--safe', 'Safe mode (defaults to false)'
21
- p.option 'plugins_dir', '-p', '--plugins PLUGINS_DIR1[,PLUGINS_DIR2[,...]]', Array, 'Plugins directory (defaults to ./_plugins)'
22
- p.option 'layouts_dir', '--layouts DIR', String, 'Layouts directory (defaults to ./_layouts)'
23
- p.option 'profile', '--profile', 'Generate a Liquid rendering profile'
15
+ p.description "Bunto is a blog-aware, static site generator in Ruby"
16
+ p.syntax "bunto <subcommand> [options]"
17
+
18
+ p.option "source", "-s", "--source [DIR]", "Source directory (defaults to ./)"
19
+ p.option "destination", "-d", "--destination [DIR]",
20
+ "Destination directory (defaults to ./_site)"
21
+ p.option "safe", "--safe", "Safe mode (defaults to false)"
22
+ p.option "plugins_dir", "-p", "--plugins PLUGINS_DIR1[,PLUGINS_DIR2[,...]]", Array,
23
+ "Plugins directory (defaults to ./_plugins)"
24
+ p.option "layouts_dir", "--layouts DIR", String,
25
+ "Layouts directory (defaults to ./_layouts)"
26
+ p.option "profile", "--profile", "Generate a Liquid rendering profile"
24
27
 
25
28
  Bunto::External.require_if_present(Bunto::External.blessed_gems) do |g|
26
- cmd = g.split('-').last
29
+ cmd = g.split("-").last
27
30
  p.command(cmd.to_sym) do |c|
28
31
  c.syntax cmd
29
32
  c.action do
30
- Bunto.logger.abort_with "You must install the '#{g}' gem to use the 'bunto #{cmd}' command."
33
+ Bunto.logger.abort_with "You must install the '#{g}' gem" \
34
+ " to use the 'bunto #{cmd}' command."
31
35
  end
32
36
  end
33
37
  end
@@ -6,77 +6,79 @@ $LOAD_PATH.unshift File.dirname(__FILE__) # For use/testing when no gem is insta
6
6
  #
7
7
  # Returns nothing.
8
8
  def require_all(path)
9
- glob = File.join(File.dirname(__FILE__), path, '*.rb')
10
- Dir[glob].each do |f|
9
+ glob = File.join(File.dirname(__FILE__), path, "*.rb")
10
+ Dir[glob].sort.each do |f|
11
11
  require f
12
12
  end
13
13
  end
14
14
 
15
15
  # rubygems
16
- require 'rubygems'
16
+ require "rubygems"
17
17
 
18
18
  # stdlib
19
- require 'forwardable'
20
- require 'fileutils'
21
- require 'time'
22
- require 'English'
23
- require 'pathname'
24
- require 'logger'
25
- require 'set'
19
+ require "pathutil"
20
+ require "forwardable"
21
+ require "fileutils"
22
+ require "time"
23
+ require "English"
24
+ require "pathname"
25
+ require "logger"
26
+ require "set"
26
27
 
27
28
  # 3rd party
28
- require 'safe_yaml/load'
29
- require 'liquid'
30
- require 'kramdown'
31
- require 'colorator'
29
+ require "safe_yaml/load"
30
+ require "liquid"
31
+ require "kramdown"
32
+ require "colorator"
32
33
 
33
34
  SafeYAML::OPTIONS[:suppress_warnings] = true
34
35
 
35
36
  module Bunto
36
37
  # internal requires
37
- autoload :Cleaner, 'bunto/cleaner'
38
- autoload :Collection, 'bunto/collection'
39
- autoload :Configuration, 'bunto/configuration'
40
- autoload :Convertible, 'bunto/convertible'
41
- autoload :Deprecator, 'bunto/deprecator'
42
- autoload :Document, 'bunto/document'
43
- autoload :Draft, 'bunto/draft'
44
- autoload :EntryFilter, 'bunto/entry_filter'
45
- autoload :Errors, 'bunto/errors'
46
- autoload :Excerpt, 'bunto/excerpt'
47
- autoload :External, 'bunto/external'
48
- autoload :FrontmatterDefaults, 'bunto/frontmatter_defaults'
49
- autoload :Hooks, 'bunto/hooks'
50
- autoload :Layout, 'bunto/layout'
51
- autoload :CollectionReader, 'bunto/readers/collection_reader'
52
- autoload :DataReader, 'bunto/readers/data_reader'
53
- autoload :LayoutReader, 'bunto/readers/layout_reader'
54
- autoload :PostReader, 'bunto/readers/post_reader'
55
- autoload :PageReader, 'bunto/readers/page_reader'
56
- autoload :StaticFileReader, 'bunto/readers/static_file_reader'
57
- autoload :LogAdapter, 'bunto/log_adapter'
58
- autoload :Page, 'bunto/page'
59
- autoload :PluginManager, 'bunto/plugin_manager'
60
- autoload :Publisher, 'bunto/publisher'
61
- autoload :Reader, 'bunto/reader'
62
- autoload :Regenerator, 'bunto/regenerator'
63
- autoload :RelatedPosts, 'bunto/related_posts'
64
- autoload :Renderer, 'bunto/renderer'
65
- autoload :LiquidRenderer, 'bunto/liquid_renderer'
66
- autoload :Site, 'bunto/site'
67
- autoload :StaticFile, 'bunto/static_file'
68
- autoload :Stevenson, 'bunto/stevenson'
69
- autoload :Theme, 'bunto/theme'
70
- autoload :URL, 'bunto/url'
71
- autoload :Utils, 'bunto/utils'
72
- autoload :VERSION, 'bunto/version'
38
+ autoload :Cleaner, "bunto/cleaner"
39
+ autoload :Collection, "bunto/collection"
40
+ autoload :Configuration, "bunto/configuration"
41
+ autoload :Convertible, "bunto/convertible"
42
+ autoload :Deprecator, "bunto/deprecator"
43
+ autoload :Document, "bunto/document"
44
+ autoload :Draft, "bunto/draft"
45
+ autoload :EntryFilter, "bunto/entry_filter"
46
+ autoload :Errors, "bunto/errors"
47
+ autoload :Excerpt, "bunto/excerpt"
48
+ autoload :External, "bunto/external"
49
+ autoload :FrontmatterDefaults, "bunto/frontmatter_defaults"
50
+ autoload :Hooks, "bunto/hooks"
51
+ autoload :Layout, "bunto/layout"
52
+ autoload :CollectionReader, "bunto/readers/collection_reader"
53
+ autoload :DataReader, "bunto/readers/data_reader"
54
+ autoload :LayoutReader, "bunto/readers/layout_reader"
55
+ autoload :PostReader, "bunto/readers/post_reader"
56
+ autoload :PageReader, "bunto/readers/page_reader"
57
+ autoload :StaticFileReader, "bunto/readers/static_file_reader"
58
+ autoload :LogAdapter, "bunto/log_adapter"
59
+ autoload :Page, "bunto/page"
60
+ autoload :PluginManager, "bunto/plugin_manager"
61
+ autoload :Publisher, "bunto/publisher"
62
+ autoload :Reader, "bunto/reader"
63
+ autoload :Regenerator, "bunto/regenerator"
64
+ autoload :RelatedPosts, "bunto/related_posts"
65
+ autoload :Renderer, "bunto/renderer"
66
+ autoload :LiquidRenderer, "bunto/liquid_renderer"
67
+ autoload :Site, "bunto/site"
68
+ autoload :StaticFile, "bunto/static_file"
69
+ autoload :Stevenson, "bunto/stevenson"
70
+ autoload :Theme, "bunto/theme"
71
+ autoload :ThemeBuilder, "bunto/theme_builder"
72
+ autoload :URL, "bunto/url"
73
+ autoload :Utils, "bunto/utils"
74
+ autoload :VERSION, "bunto/version"
73
75
 
74
76
  # extensions
75
- require 'bunto/plugin'
76
- require 'bunto/converter'
77
- require 'bunto/generator'
78
- require 'bunto/command'
79
- require 'bunto/liquid_extensions'
77
+ require "bunto/plugin"
78
+ require "bunto/converter"
79
+ require "bunto/generator"
80
+ require "bunto/command"
81
+ require "bunto/liquid_extensions"
80
82
  require "bunto/filters"
81
83
 
82
84
  class << self
@@ -85,29 +87,29 @@ module Bunto
85
87
  # images and allows you to skip that when working in development.
86
88
 
87
89
  def env
88
- ENV["JEKYLL_ENV"] || "development"
90
+ ENV["BUNTO_ENV"] || "development"
89
91
  end
90
92
 
91
93
  # Public: Generate a Bunto configuration Hash by merging the default
92
94
  # options with anything in _config.yml, and adding the given options on top.
93
95
  #
94
96
  # override - A Hash of config directives that override any options in both
95
- # the defaults and the config file. See Bunto::Configuration::DEFAULTS for a
97
+ # the defaults and the config file.
98
+ # See Bunto::Configuration::DEFAULTS for a
96
99
  # list of option names and their defaults.
97
100
  #
98
101
  # Returns the final configuration Hash.
99
102
  def configuration(override = {})
100
- config = Configuration[Configuration::DEFAULTS]
103
+ config = Configuration.new
101
104
  override = Configuration[override].stringify_keys
102
- unless override.delete('skip_config_files')
105
+ unless override.delete("skip_config_files")
103
106
  config = config.read_config_files(config.config_files(override))
104
107
  end
105
108
 
106
109
  # Merge DEFAULTS < _config.yml < override
107
- config = Utils.deep_merge_hashes(config, override).stringify_keys
108
- set_timezone(config['timezone']) if config['timezone']
109
-
110
- config
110
+ Configuration.from(Utils.deep_merge_hashes(config, override)).tap do |obj|
111
+ set_timezone(obj["timezone"]) if obj["timezone"]
112
+ end
111
113
  end
112
114
 
113
115
  # Public: Set the TZ environment variable to use the timezone specified
@@ -115,15 +117,17 @@ module Bunto
115
117
  # timezone - the IANA Time Zone
116
118
  #
117
119
  # Returns nothing
120
+ # rubocop:disable Style/AccessorMethodName
118
121
  def set_timezone(timezone)
119
- ENV['TZ'] = timezone
122
+ ENV["TZ"] = timezone
120
123
  end
124
+ # rubocop:enable Style/AccessorMethodName
121
125
 
122
126
  # Public: Fetch the logger instance for this Bunto process.
123
127
  #
124
128
  # Returns the LogAdapter instance.
125
129
  def logger
126
- @logger ||= LogAdapter.new(Stevenson.new, (ENV["JEKYLL_LOG_LEVEL"] || :info).to_sym)
130
+ @logger ||= LogAdapter.new(Stevenson.new, (ENV["BUNTO_LOG_LEVEL"] || :info).to_sym)
127
131
  end
128
132
 
129
133
  # Public: Set the log writer.
@@ -134,7 +138,7 @@ module Bunto
134
138
  #
135
139
  # Returns the new logger.
136
140
  def logger=(writer)
137
- @logger = LogAdapter.new(writer, (ENV["JEKYLL_LOG_LEVEL"] || :info).to_sym)
141
+ @logger = LogAdapter.new(writer, (ENV["BUNTO_LOG_LEVEL"] || :info).to_sym)
138
142
  end
139
143
 
140
144
  # Public: An array of sites
@@ -154,11 +158,11 @@ module Bunto
154
158
  def sanitized_path(base_directory, questionable_path)
155
159
  return base_directory if base_directory.eql?(questionable_path)
156
160
 
157
- questionable_path.insert(0, '/') if questionable_path.start_with?('~')
161
+ questionable_path.insert(0, "/") if questionable_path.start_with?("~")
158
162
  clean_path = File.expand_path(questionable_path, "/")
159
- clean_path.sub!(/\A\w\:\//, '/')
163
+ clean_path.sub!(%r!\A\w:/!, "/")
160
164
 
161
- if clean_path.start_with?(base_directory.sub(/\A\w\:\//, '/'))
165
+ if clean_path.start_with?(base_directory.sub(%r!\A\w:/!, "/"))
162
166
  clean_path
163
167
  else
164
168
  File.join(base_directory, clean_path)
@@ -166,16 +170,17 @@ module Bunto
166
170
  end
167
171
 
168
172
  # Conditional optimizations
169
- Bunto::External.require_if_present('liquid-c')
173
+ Bunto::External.require_if_present("liquid-c")
170
174
  end
171
175
  end
172
176
 
173
177
  require "bunto/drops/drop"
174
- require_all 'bunto/commands'
175
- require_all 'bunto/converters'
176
- require_all 'bunto/converters/markdown'
177
- require_all 'bunto/drops'
178
- require_all 'bunto/generators'
179
- require_all 'bunto/tags'
180
-
181
- require 'bunto-sass-converter'
178
+ require "bunto/drops/document_drop"
179
+ require_all "bunto/commands"
180
+ require_all "bunto/converters"
181
+ require_all "bunto/converters/markdown"
182
+ require_all "bunto/drops"
183
+ require_all "bunto/generators"
184
+ require_all "bunto/tags"
185
+
186
+ require "bunto-sass-converter"