Sha256: 38bef25458f6da9d9f0a3abb8853ca64577183bbed11f871aae84d47f262da01

Contents?: true

Size: 1.25 KB

Versions: 23

Compression:

Stored size: 1.25 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)

        if defined? Octopress::Ink
          Octopress::Ink.load_plugin_assets = false
        end

        
        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

23 entries across 23 versions & 1 rubygems

Version Path
octopress-3.0.12.pre.1 lib/octopress/commands/docs.rb
octopress-3.0.11 lib/octopress/commands/docs.rb
octopress-3.0.10 lib/octopress/commands/docs.rb
octopress-3.0.9 lib/octopress/commands/docs.rb
octopress-3.0.8 lib/octopress/commands/docs.rb
octopress-3.0.7 lib/octopress/commands/docs.rb
octopress-3.0.6 lib/octopress/commands/docs.rb
octopress-3.0.5 lib/octopress/commands/docs.rb
octopress-3.0.4 lib/octopress/commands/docs.rb
octopress-3.0.3.alpha.2 lib/octopress/commands/docs.rb
octopress-3.0.3.alpha.1 lib/octopress/commands/docs.rb
octopress-3.0.3.alpha.0 lib/octopress/commands/docs.rb
octopress-3.0.2 lib/octopress/commands/docs.rb
octopress-3.0.1 lib/octopress/commands/docs.rb
octopress-3.0.0 lib/octopress/commands/docs.rb
octopress-3.0.0.rc.37 lib/octopress/commands/docs.rb
octopress-3.0.0.rc.36 lib/octopress/commands/docs.rb
octopress-3.0.0.rc.35 lib/octopress/commands/docs.rb
octopress-3.0.0.rc.34 lib/octopress/commands/docs.rb
octopress-3.0.0.rc.33 lib/octopress/commands/docs.rb