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.6.2 lib/softcover/commands/deployment.rb
softcover-1.6.1 lib/softcover/commands/deployment.rb
softcover-1.6.0 lib/softcover/commands/deployment.rb
softcover-1.5.11 lib/softcover/commands/deployment.rb
softcover-1.5.10 lib/softcover/commands/deployment.rb
softcover-1.5.9 lib/softcover/commands/deployment.rb
softcover-1.5.8 lib/softcover/commands/deployment.rb
softcover-1.5.7 lib/softcover/commands/deployment.rb
softcover-1.5.6 lib/softcover/commands/deployment.rb
softcover-1.5.5 lib/softcover/commands/deployment.rb
softcover-1.5.4 lib/softcover/commands/deployment.rb
softcover-1.5.3 lib/softcover/commands/deployment.rb
softcover-1.5.2 lib/softcover/commands/deployment.rb
softcover-1.5.1 lib/softcover/commands/deployment.rb
softcover-1.5.0 lib/softcover/commands/deployment.rb
softcover-1.4.9 lib/softcover/commands/deployment.rb
softcover-1.4.8 lib/softcover/commands/deployment.rb
softcover-1.4.7 lib/softcover/commands/deployment.rb
softcover-1.4.6 lib/softcover/commands/deployment.rb
softcover-1.4.5 lib/softcover/commands/deployment.rb