bunto 2.0.0.pre → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +80 -0
  3. data/README.markdown +15 -19
  4. data/bin/bunto +1 -1
  5. data/lib/bunto.rb +7 -5
  6. data/lib/bunto/cleaner.rb +3 -2
  7. data/lib/bunto/collection.rb +3 -3
  8. data/lib/bunto/commands/clean.rb +10 -12
  9. data/lib/bunto/commands/doctor.rb +1 -1
  10. data/lib/bunto/commands/new.rb +29 -0
  11. data/lib/bunto/commands/serve.rb +17 -15
  12. data/lib/bunto/configuration.rb +4 -3
  13. data/lib/bunto/converter.rb +6 -2
  14. data/lib/bunto/converters/markdown.rb +1 -1
  15. data/lib/bunto/converters/markdown/kramdown_parser.rb +1 -0
  16. data/lib/bunto/convertible.rb +5 -5
  17. data/lib/bunto/deprecator.rb +1 -1
  18. data/lib/bunto/document.rb +11 -4
  19. data/lib/bunto/drops/document_drop.rb +7 -0
  20. data/lib/bunto/entry_filter.rb +6 -2
  21. data/lib/bunto/errors.rb +4 -0
  22. data/lib/bunto/external.rb +1 -1
  23. data/lib/bunto/filters.rb +49 -8
  24. data/lib/bunto/frontmatter_defaults.rb +2 -2
  25. data/lib/bunto/hooks.rb +1 -0
  26. data/lib/bunto/layout.rb +16 -1
  27. data/lib/bunto/mime.types +1 -1
  28. data/lib/bunto/page.rb +1 -0
  29. data/lib/bunto/plugin.rb +1 -1
  30. data/lib/bunto/plugin_manager.rb +4 -4
  31. data/lib/bunto/publisher.rb +4 -4
  32. data/lib/bunto/readers/data_reader.rb +3 -2
  33. data/lib/bunto/readers/layout_reader.rb +19 -3
  34. data/lib/bunto/readers/post_reader.rb +5 -1
  35. data/lib/bunto/regenerator.rb +5 -3
  36. data/lib/bunto/renderer.rb +3 -2
  37. data/lib/bunto/site.rb +47 -17
  38. data/lib/bunto/static_file.rb +5 -1
  39. data/lib/bunto/tags/include.rb +33 -31
  40. data/lib/bunto/tags/link.rb +26 -0
  41. data/lib/bunto/tags/post_url.rb +18 -8
  42. data/lib/bunto/theme.rb +56 -0
  43. data/lib/bunto/utils.rb +3 -2
  44. data/lib/bunto/version.rb +1 -1
  45. data/lib/site_template/_config.yml +8 -2
  46. data/lib/site_template/_includes/footer.html +3 -3
  47. data/lib/site_template/_includes/head.html +2 -2
  48. data/lib/site_template/_includes/header.html +3 -3
  49. data/lib/site_template/_layouts/default.html +2 -2
  50. data/lib/site_template/_layouts/page.html +1 -1
  51. data/lib/site_template/_layouts/post.html +1 -1
  52. data/lib/site_template/_posts/0000-00-00-welcome-to-bunto.markdown.erb +1 -1
  53. data/lib/site_template/_sass/_base.scss +11 -17
  54. data/lib/site_template/about.md +5 -1
  55. data/lib/site_template/index.html +1 -1
  56. metadata +32 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a35757459d1fb37d6fd83479cd61dd9ece4b5cf1
4
- data.tar.gz: 914345bc95069ad5982a3141674b94b55a7bb011
3
+ metadata.gz: 9de6fb07519634f73190a49c592225c580a2a425
4
+ data.tar.gz: 664cbdea09c133ee304b92e081c692210cef9eca
5
5
  SHA512:
6
- metadata.gz: 480427bb9fbb1a4dc7f5d3401375011083bf4866ed47138986a916476cdc7b75534236549639ecac598b7f529007115c7eea1df4583cf16dd2db36e8f64b5ab7
7
- data.tar.gz: 959bb7e751224b8bfb9d164801f5b394e9440f401a28a74db5f267e7242909a5e30ec092accddcc7aca806ce977090b0acc08ef083168cfee37c8d91f249e9b4
6
+ metadata.gz: 50bf9c96a0002bbc1de8dd52e07265ea3f74e73589be1880b8e2e24363b752aedb2fcff624b17b7ab659311b1b847606edc6355c624293e7382fd25482936a80
7
+ data.tar.gz: 503f2595ad58b8fd63b9a11f4ec6ef03bd7d4f80d9d2de0804681f3de87dac4de8f04c4f8b19ee36bbee2d61acc85601db497561d8b9fd3b5db55fec507aec4a
@@ -0,0 +1,80 @@
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
+
53
+ AllCops:
54
+ TargetRubyVersion: 2.0
55
+ Include:
56
+ - lib/**/*.rb
57
+
58
+ 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/**/*
@@ -3,50 +3,46 @@
3
3
 
4
4
  [![Gem Version](https://img.shields.io/gem/v/bunto.svg)][ruby-gems]
5
5
  [![Build Status](https://travis-ci.org/bunto/bunto.svg?branch=ruby)][travis]
6
- [![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)
7
- <!--
8
- [![Test Coverage](https://codeclimate.com/github/bunto/bunto/badges/coverage.svg)][coverage]
9
- [![Code Climate](https://codeclimate.com/github/bunto/bunto/badges/gpa.svg)][codeclimate]
10
- [![Dependency Status](https://gemnasium.com/bunto/bunto.svg)][gemnasium]
11
6
  [![Security](https://hakiri.io/github/bunto/bunto/ruby.svg)][hakiri]
12
- -->
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]
13
9
 
14
10
  [ruby-gems]: https://rubygems.org/gems/bunto
15
- <!--
16
- [gemnasium]: https://gemnasium.com/bunto/bunto
17
- [codeclimate]: https://codeclimate.com/github/bunto/bunto
18
- [coverage]: https://codeclimate.com/github/bunto/bunto/coverage
19
11
  [hakiri]: https://hakiri.io/github/bunto/bunto/ruby
20
- -->
21
12
  [travis]: https://travis-ci.org/bunto/bunto
13
+ [freenode]: http://webchat.freenode.net/?channels=bunto
14
+
15
+ By Suriyaa Kudo, Tom Preston-Werner, Parker Moore and many [awesome contributors](https://github.com/bunto/bunto/graphs/contributors)!
16
+
17
+ Bunto is a Web Application Framework and can be used as a static site generator perfect for personal, project, or organization sites. Think of it like a file-based CMS, without all the complexity. Bunto takes your content, renders HTML and CSS templates, and spits out a complete, static website ready to be served by Apache, hostSE, Nginx or another web server. Bunto is the engine behind [GitHub Pages](https://pages.github.com), which you can use to host sites right from your GitHub repositories.
22
18
 
23
- By Suriyaa Kudo, Tom Preston-Werner and many [awesome contributors](https://github.com/bunto/bunto/graphs/contributors)!
19
+ ## Philosophy
24
20
 
25
- Bunto is a Web Application Framework and can be used as a static site generator perfect for personal, project, or organization sites. Think of it like a file-based CMS, without all the complexity. Bunto takes your content, renders HTML and CSS templates, and spits out a complete, static website ready to be served by Apache, hostSE, Nginx or another web server. Bunto is the engine behind [GitHub Pages](http://pages.github.com), which you can use to host sites right from your GitHub repositories.
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.
26
22
 
27
23
  ## Getting Started
28
24
 
29
- * [Install](https://bunto.github.io/bunto/docs/installation/) the gem
25
+ * [Install](https://bunto.github.io/docs/installation/) the gem
30
26
  * Read up about its [Usage](https://bunto.github.io/docs/usage/) and [Configuration](https://bunto.github.io/docs/configuration/)
31
27
  * Take a gander at some existing [Sites](https://wiki.github.com/bunto/bunto/sites)
32
- * Fork and [Contribute](https://bunto.github.io/docs/contributing/) your own modifications
28
+ * [Fork](https://github.com/bunto/bunto/fork) and [Contribute](https://bunto.github.io/docs/contributing/) your own modifications
33
29
  * Have questions? Check out our official forum community [Bunto Talk](https://bunto.github.io/talk/) or [`#bunto` on irc.freenode.net](https://botbot.me/freenode/bunto/)
34
30
 
35
31
  ## Code of Conduct
36
32
 
37
33
  In order to have a more open and welcoming community, Bunto adheres to a
38
- [code of conduct](CONDUCT.md) adapted from the Ruby on Rails code of
34
+ [code of conduct](CONDUCT.markdown) adapted from the Ruby on Rails code of
39
35
  conduct.
40
36
 
41
37
  Please adhere to this code of conduct in any interactions you have in the
42
38
  Bunto community. It is strictly enforced on all official Bunto
43
39
  repositories, websites, and resources. If you encounter someone violating
44
- these terms, please let a maintainer (@SuriyaaKudoIsc) know
40
+ these terms, please let a maintainer ([@SuriyaaKudoIsc](https://github.com/SuriyaaKudoIsc) know
45
41
  and we will address it as soon as possible.
46
42
 
47
43
  ## Diving In
48
44
 
49
- * [Migrate](http://bunto.github.io/import/docs/home/) from your previous system
45
+ * [Migrate](https://bunto-import.tk/docs/home/) from your previous system
50
46
  * Learn how the [YAML Front Matter](https://bunto.github.io/docs/frontmatter/) works
51
47
  * Put information on your site with [Variables](https://bunto.github.io/docs/variables/)
52
48
  * Customize the [Permalinks](https://bunto.github.io/docs/permalinks/) your posts are generated with
@@ -55,4 +51,4 @@ and we will address it as soon as possible.
55
51
 
56
52
  ## License
57
53
 
58
- See the [LICENSE](https://github.com/bunto/bunto/blob/master/LICENSE) file.
54
+ See the [LICENSE](https://github.com/bunto/bunto/blob/master/LICENSE) file.
data/bin/bunto CHANGED
@@ -12,7 +12,7 @@ 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 in Ruby'
15
+ p.description 'Bunto is a static site generator and web application framework in Ruby'
16
16
  p.syntax 'bunto <subcommand> [options]'
17
17
 
18
18
  p.option 'source', '-s', '--source [DIR]', 'Source directory (defaults to ./)'
@@ -45,7 +45,6 @@ module Bunto
45
45
  autoload :Errors, 'bunto/errors'
46
46
  autoload :Excerpt, 'bunto/excerpt'
47
47
  autoload :External, 'bunto/external'
48
- autoload :Filters, 'bunto/filters'
49
48
  autoload :FrontmatterDefaults, 'bunto/frontmatter_defaults'
50
49
  autoload :Hooks, 'bunto/hooks'
51
50
  autoload :Layout, 'bunto/layout'
@@ -67,6 +66,7 @@ module Bunto
67
66
  autoload :Site, 'bunto/site'
68
67
  autoload :StaticFile, 'bunto/static_file'
69
68
  autoload :Stevenson, 'bunto/stevenson'
69
+ autoload :Theme, 'bunto/theme'
70
70
  autoload :URL, 'bunto/url'
71
71
  autoload :Utils, 'bunto/utils'
72
72
  autoload :VERSION, 'bunto/version'
@@ -77,6 +77,7 @@ module Bunto
77
77
  require 'bunto/generator'
78
78
  require 'bunto/command'
79
79
  require 'bunto/liquid_extensions'
80
+ require "bunto/filters"
80
81
 
81
82
  class << self
82
83
  # Public: Tells you which Bunto environment you are building in so you can skip tasks
@@ -84,7 +85,7 @@ module Bunto
84
85
  # images and allows you to skip that when working in development.
85
86
 
86
87
  def env
87
- ENV["BUNTO_ENV"] || "development"
88
+ ENV["JEKYLL_ENV"] || "development"
88
89
  end
89
90
 
90
91
  # Public: Generate a Bunto configuration Hash by merging the default
@@ -122,7 +123,7 @@ module Bunto
122
123
  #
123
124
  # Returns the LogAdapter instance.
124
125
  def logger
125
- @logger ||= LogAdapter.new(Stevenson.new, (ENV["BUNTO_LOG_LEVEL"] || :info).to_sym)
126
+ @logger ||= LogAdapter.new(Stevenson.new, (ENV["JEKYLL_LOG_LEVEL"] || :info).to_sym)
126
127
  end
127
128
 
128
129
  # Public: Set the log writer.
@@ -133,7 +134,7 @@ module Bunto
133
134
  #
134
135
  # Returns the new logger.
135
136
  def logger=(writer)
136
- @logger = LogAdapter.new(writer, (ENV["BUNTO_LOG_LEVEL"] || :info).to_sym)
137
+ @logger = LogAdapter.new(writer, (ENV["JEKYLL_LOG_LEVEL"] || :info).to_sym)
137
138
  end
138
139
 
139
140
  # Public: An array of sites
@@ -153,8 +154,9 @@ module Bunto
153
154
  def sanitized_path(base_directory, questionable_path)
154
155
  return base_directory if base_directory.eql?(questionable_path)
155
156
 
157
+ questionable_path.insert(0, '/') if questionable_path.start_with?('~')
156
158
  clean_path = File.expand_path(questionable_path, "/")
157
- clean_path = clean_path.sub(/\A\w\:\//, '/')
159
+ clean_path.sub!(/\A\w\:\//, '/')
158
160
 
159
161
  if clean_path.start_with?(base_directory.sub(/\A\w\:\//, '/'))
160
162
  clean_path
@@ -95,11 +95,12 @@ module Bunto
95
95
  # Private: Creates a regular expression from the config's keep_files array
96
96
  #
97
97
  # Examples
98
- # ['.git','.svn'] creates the following regex: /\/(\.git|\/.svn)/
98
+ # ['.git','.svn'] with site.dest "/myblog/_site" creates
99
+ # the following regex: /\A\/myblog\/_site\/(\.git|\/.svn)/
99
100
  #
100
101
  # Returns the regular expression
101
102
  def keep_file_regex
102
- Regexp.union(site.keep_files)
103
+ /\A#{Regexp.quote(site.dest)}\/(#{Regexp.union(site.keep_files).source})/
103
104
  end
104
105
  end
105
106
  end
@@ -78,7 +78,7 @@ module Bunto
78
78
  def entries
79
79
  return [] unless exists?
80
80
  @entries ||=
81
- Utils.safe_glob(collection_dir, ["**", "*.*"]).map do |entry|
81
+ Utils.safe_glob(collection_dir, ["**", "*"]).map do |entry|
82
82
  entry["#{collection_dir}/"] = ''
83
83
  entry
84
84
  end
@@ -94,7 +94,7 @@ module Bunto
94
94
  Dir.chdir(directory) do
95
95
  entry_filter.filter(entries).reject do |f|
96
96
  path = collection_dir(f)
97
- File.directory?(path) || (File.symlink?(f) && site.safe)
97
+ File.directory?(path) || entry_filter.symlink?(f)
98
98
  end
99
99
  end
100
100
  end
@@ -135,7 +135,7 @@ module Bunto
135
135
  # Returns false if the directory doesn't exist or if it's a symlink
136
136
  # and we're in safe mode.
137
137
  def exists?
138
- File.directory?(directory) && !(File.symlink?(directory) && site.safe)
138
+ File.directory?(directory) && !entry_filter.symlink?(directory)
139
139
  end
140
140
 
141
141
  # The entry filter for this collection.
@@ -19,21 +19,19 @@ module Bunto
19
19
  options = configuration_from_options(options)
20
20
  destination = options['destination']
21
21
  metadata_file = File.join(options['source'], '.bunto-metadata')
22
+ sass_cache = File.join(options['source'], '.sass-cache')
22
23
 
23
- if File.directory? destination
24
- Bunto.logger.info "Cleaning #{destination}..."
25
- FileUtils.rm_rf(destination)
26
- Bunto.logger.info "", "done."
27
- else
28
- Bunto.logger.info "Nothing to do for #{destination}."
29
- end
24
+ remove(destination, checker_func: :directory?)
25
+ remove(metadata_file, checker_func: :file?)
26
+ remove(sass_cache, checker_func: :directory?)
27
+ end
30
28
 
31
- if File.file? metadata_file
32
- Bunto.logger.info "Removing #{metadata_file}..."
33
- FileUtils.rm_rf(metadata_file)
34
- Bunto.logger.info "", "done."
29
+ def remove(filename, checker_func: :file?)
30
+ if File.public_send(checker_func, filename)
31
+ Bunto.logger.info "Cleaner:", "Removing #{filename}..."
32
+ FileUtils.rm_rf(filename)
35
33
  else
36
- Bunto.logger.info "Nothing to do for #{metadata_file}."
34
+ Bunto.logger.info "Cleaner:", "Nothing to do for #{filename}."
37
35
  end
38
36
  end
39
37
  end
@@ -8,7 +8,7 @@ module Bunto
8
8
  c.description 'Search site and print specific deprecation warnings'
9
9
  c.alias(:hyde)
10
10
 
11
- c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
11
+ c.option 'config', '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
12
12
 
13
13
  c.action do |_, options|
14
14
  Bunto::Commands::Doctor.process(options)
@@ -35,6 +35,10 @@ module Bunto
35
35
  File.open(File.expand_path(initialized_post_name, new_blog_path), "w") do |f|
36
36
  f.write(scaffold_post_content)
37
37
  end
38
+
39
+ File.open(File.expand_path("Gemfile", new_blog_path), "w") do |f|
40
+ f.write(gemfile_contents)
41
+ end
38
42
  end
39
43
 
40
44
  Bunto.logger.info "New bunto site installed in #{new_blog_path}."
@@ -59,6 +63,31 @@ module Bunto
59
63
  end
60
64
 
61
65
  private
66
+
67
+ def gemfile_contents
68
+ <<-RUBY
69
+ source "https://rubygems.org"
70
+
71
+ # Hello! This is where you manage which Bunto version is used to run.
72
+ # When you want to use a different version, change it below, save the
73
+ # file and run `bundle install`. Run Bunto with `bundle exec`, like so:
74
+ #
75
+ # bundle exec bunto serve
76
+ #
77
+ # This will help ensure the proper Bunto version is running.
78
+ # Happy Buntoing!
79
+ gem "bunto", "#{Bunto::VERSION}"
80
+
81
+ # If you want to use GitHub Pages, remove the "gem "bunto"" above and
82
+ # uncomment the line below. To upgrade, run `bundle update github-pages`.
83
+ # gem "github-pages", group: :bunto_plugins
84
+
85
+ # If you have any plugins, put them here!
86
+ # group :bunto_plugins do
87
+ # gem "bunto-github-metadata", "~> 1.0"
88
+ # end
89
+ RUBY
90
+ end
62
91
 
63
92
  def preserve_source_location?(path, options)
64
93
  !options["force"] && !Dir["#{path}/**/*"].empty?
@@ -10,6 +10,8 @@ module Bunto
10
10
  "ssl_key" => ["--ssl-key [KEY]", "X.509 (SSL) Private Key."],
11
11
  "port" => ["-P", "--port [PORT]", "Port to listen on"],
12
12
  "baseurl" => ["-b", "--baseurl [URL]", "Base URL"],
13
+ "show_dir_listing" => ["--show-dir-listing",
14
+ "Show a directory listing instead of loading your index file."],
13
15
  "skip_initial_build" => ["skip_initial_build", "--skip-initial-build",
14
16
  "Skips the initial site build which occurs before the server is started."]
15
17
  }
@@ -91,6 +93,8 @@ module Bunto
91
93
  )
92
94
  }
93
95
 
96
+ opts[:DirectoryIndex] = [] if opts[:BuntoOptions]['show_dir_listing']
97
+
94
98
  enable_ssl(opts)
95
99
  enable_logging(opts)
96
100
  opts
@@ -112,26 +116,24 @@ module Bunto
112
116
 
113
117
  private
114
118
  def server_address(server, opts)
115
- address = server.config[:BindAddress]
116
- baseurl = "#{opts["baseurl"]}/" if opts["baseurl"]
117
- port = server.config[:Port]
118
-
119
- "http://#{address}:#{port}#{baseurl}"
119
+ "%{prefix}://%{address}:%{port}%{baseurl}" % {
120
+ :prefix => server.config[:SSLEnable] ? "https" : "http",
121
+ :baseurl => opts["baseurl"] ? "#{opts["baseurl"]}/" : "",
122
+ :address => server.config[:BindAddress],
123
+ :port => server.config[:Port]
124
+ }
120
125
  end
121
126
 
122
127
  #
123
128
 
124
129
  private
125
130
  def launch_browser(server, opts)
126
- command =
127
- if Utils::Platforms.windows?
128
- "start"
129
- elsif Utils::Platforms.osx?
130
- "open"
131
- else
132
- "xdg-open"
133
- end
134
- system command, server_address(server, opts)
131
+ address = server_address(server, opts)
132
+ return system "start", address if Utils::Platforms.windows?
133
+ return system "xdg-open", address if Utils::Platforms.linux?
134
+ return system "open", address if Utils::Platforms.osx?
135
+ Bunto.logger.error "Refusing to launch browser; " \
136
+ "Platform launcher unknown."
135
137
  end
136
138
 
137
139
  # Keep in our area with a thread or detach the server as requested
@@ -181,7 +183,7 @@ module Bunto
181
183
  source_certificate = Bunto.sanitized_path(opts[:BuntoOptions]["source"], opts[:BuntoOptions]["ssl_cert"])
182
184
  opts[:SSLCertificate] = OpenSSL::X509::Certificate.new(File.read(source_certificate))
183
185
  opts[:SSLPrivateKey ] = OpenSSL::PKey::RSA.new(File.read(source_key))
184
- opts[:EnableSSL] = true
186
+ opts[:SSLEnable] = true
185
187
  end
186
188
 
187
189
  private
@@ -44,6 +44,7 @@ module Bunto
44
44
  'port' => '4000',
45
45
  'host' => '127.0.0.1',
46
46
  'baseurl' => '',
47
+ 'show_dir_listing' => false,
47
48
 
48
49
  # Output Configuration
49
50
  'permalink' => 'date',
@@ -148,7 +149,7 @@ module Bunto
148
149
  Bunto.logger.info "Configuration file:", file
149
150
  next_config
150
151
  rescue SystemCallError
151
- if @default_config_file
152
+ if @default_config_file ||= nil
152
153
  Bunto.logger.warn "Configuration file:", "none"
153
154
  {}
154
155
  else
@@ -285,8 +286,8 @@ module Bunto
285
286
  def renamed_key(old, new, config, _ = nil)
286
287
  if config.key?(old)
287
288
  Bunto::Deprecator.deprecation_message "The '#{old}' configuration" \
288
- "option has been renamed to '#{new}'. Please update your config " \
289
- "file accordingly."
289
+ " option has been renamed to '#{new}'. Please update your config" \
290
+ " file accordingly."
290
291
  config[new] = config.delete(old)
291
292
  end
292
293
  end