Sha256: 54b8c2da937d208f0423bdc6de97ad4ced6ba167475a8ca76130f6e6ea36ba9c

Contents?: true

Size: 1.03 KB

Versions: 84

Compression:

Stored size: 1.03 KB

Contents

module Softcover
  module Commands
    module Deployment
      include Softcover::Utils
      extend self

      # Deploy a book by building and publishing it.
      # The deploy steps can be customized using `.softcover-publish`
      # in the book project's home directory.
      def deploy!
        if File.exist?('.softcover-deploy') && !custom_commands.empty?
          execute custom_commands
        else
          execute default_commands
        end
      end

      # Returns the default commands.
      def default_commands
        if article?
          commands(['softcover build:all', 'softcover publish'])
        else
          commands(['softcover build:all', 'softcover build:preview',
                    'softcover publish'])
        end
      end

      # Returns custom commands (if any).
      def custom_commands
        commands(File.readlines(deploy_config).map(&:strip))
      end

      # Returns the filename for configuring `softcover deploy`.
      def deploy_config
        '.softcover-deploy'
      end
    end
  end
end

Version data entries

84 entries across 84 versions & 1 rubygems

Version Path
softcover-1.10.4 lib/softcover/commands/deployment.rb
softcover-1.10.3 lib/softcover/commands/deployment.rb
softcover-1.10.2 lib/softcover/commands/deployment.rb
softcover-1.10.1 lib/softcover/commands/deployment.rb
softcover-1.10.0 lib/softcover/commands/deployment.rb
softcover-1.9.1 lib/softcover/commands/deployment.rb
softcover-1.9.0 lib/softcover/commands/deployment.rb
softcover-1.8.3 lib/softcover/commands/deployment.rb
softcover-1.8.2 lib/softcover/commands/deployment.rb
softcover-1.8.1 lib/softcover/commands/deployment.rb
softcover-1.8.0 lib/softcover/commands/deployment.rb
softcover-1.7.5 lib/softcover/commands/deployment.rb
softcover-1.7.4 lib/softcover/commands/deployment.rb
softcover-1.7.3 lib/softcover/commands/deployment.rb
softcover-1.7.2 lib/softcover/commands/deployment.rb
softcover-1.7.1 lib/softcover/commands/deployment.rb
softcover-1.7.0 lib/softcover/commands/deployment.rb
softcover-1.6.5 lib/softcover/commands/deployment.rb
softcover-1.6.4 lib/softcover/commands/deployment.rb
softcover-1.6.3 lib/softcover/commands/deployment.rb