Sha256: 4b164e7a097eeb8aa5335dc4eed00e836a3d47fa023d20fd054097cc602d29c4

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

require 'docman/version'
require 'yaml'
require 'pathname'
require 'fileutils'
require 'docman/git_util'
require 'docman/docroot_config'
require 'docman/docroot_controller'
require 'docman/exec'
require 'singleton'

module Docman
  class Application

    attr_reader :config, :options
    attr_accessor :deploy_target

    include Singleton

    def initialize
      # TODO: Define workspace properly
      @workspace_dir = Dir.pwd
      @config = YAML::load_file(File.join(Pathname(__FILE__).dirname.parent, 'config', 'config.yaml'))
    end

    def init(name, repo)
      `mkdir #{name} && cd #{name} && git clone #{repo} config`
    end

    def build(deploy_target, state, options = false)
      @options = options
      DocrootController.new(@workspace_dir, deploy_target).build(state)
    end

    def deploy(deploy_target, name, type, version, options = false)
      @options = options
      DocrootController.new(@workspace_dir, deploy_target).deploy(name, type, version)
    end

    def state(name, type, version)
      DocrootController.new(@workspace_dir, deploy_target).state(name, type, version)
    end

    def self.root
      Pathname(__FILE__).dirname.parent
    end

    def self.bin
      File.join root, 'bin'
    end

    def self.lib
      File.join root, 'lib'
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
docman-0.0.5 lib/application.rb