Class: Octopress::Docs::Commands
- Inherits:
-
Command
- Object
- Command
- Octopress::Docs::Commands
- Defined in:
- lib/octopress-docs/command.rb
Class Method Summary collapse
Class Method Details
.init_with_program(p) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/octopress-docs/command.rb', line 4 def self.init_with_program(p) p.command(:docs) do |c| c.syntax 'octopress docs' c.description "Launch local server with docs for Octopress v#{Octopress::VERSION} and Octopress plugins." c.option 'port', '-P', '--port [PORT]', 'Port to listen on' c.option 'host', '-H', '--host [HOST]', 'Host to bind to' if ENV['OCTODEV'] c.option 'watch', '--watch', 'Watch docs site for changes and rebuild. (For docs development)' end c.action do |args, | serve_docs() end end end |
.serve_docs(options) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/octopress-docs/command.rb', line 21 def self.serve_docs() # Tell the world, we're serving the docs site # ENV['OCTOPRESS_DOCS'] = 'true' # Activate dependencies for serving docs. # require "octopress-docs/jekyll/convertible" require "octopress-docs/jekyll/page" require "octopress-docs/liquid_filters" require "octopress-hooks" require "octopress-docs/doc" require "octopress-docs/hooks" # Look at the local site and require all of its plugins # Ensuring their documentation is loaded into the docs site # site = Octopress.read_site({'config'=>['config']}) site.plugin_manager.conscientious_require # Require escape code last to set Octopress hook priority. # require "octopress-escape-code" = Docs.site.config.merge() Jekyll.logger.log_level = :error Jekyll::Commands::Build.process() url = "http://#{options['host']}:#{options['port']}" puts "Serving Docs site: #{url}" puts " press ctrl-c to stop." Jekyll::Commands::Serve.process() Jekyll.logger.log_level = :info end |