Sha256: 7015fedf43275b4480f54e2b467ecf946d937b29e9da5e82e42a2c89965943ba

Contents?: true

Size: 1.21 KB

Versions: 6

Compression:

Stored size: 1.21 KB

Contents

module Octopress
  module Docs
    class Commands < Octopress::Command
      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, options|
            serve_docs(options)
          end
        end
      end

      def self.serve_docs(options)

        # Activate dependencies for serving docs.
        #
        options = Docs.load_docs(options)
        Octopress::Ink.load_plugin_assets = false

        
        Jekyll.logger.log_level = :error
        Jekyll::Commands::Build.process(options)
        url = "http://#{options['host']}:#{options['port']}"
        puts "Serving Docs site: #{url}"
        puts "  press ctrl-c to stop."
        Jekyll::Commands::Serve.process(options)
        Jekyll.logger.log_level = :info
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
octopress-3.0.0.rc.29 lib/octopress/commands/docs.rb
octopress-3.0.0.rc.28 lib/octopress/commands/docs.rb
octopress-3.0.0.rc.27 lib/octopress/commands/docs.rb
octopress-3.0.0.rc.26 lib/octopress/commands/docs.rb
octopress-3.0.0.rc.25 lib/octopress/commands/docs.rb
octopress-3.0.0.rc.24 lib/octopress/commands/docs.rb