Sha256: 4d63e513a197767691e1ad491dc8df79f7b2a9494bb76c26b8c486d682d9a376

Contents?: true

Size: 803 Bytes

Versions: 2

Compression:

Stored size: 803 Bytes

Contents

module Amp
  module Core
    module RepositoryLoading
      def self.included(klass)
        klass.__send__(:extend, ClassMethods)
        klass.__send__(:include, InstanceMethods)
      end
      module ClassMethods

      end
      module InstanceMethods
        DEFAULT_OPTS = {:create => false}
        def repository(repo_opts=DEFAULT_OPTS)
          repo_opts = DEFAULT_OPTS.merge(repo_opts)
          path = options[:repository]
          # pick a repo based on this
          return Repositories.pick(options, path, repo_opts[:create])
        end
      end
    end
  end

  module Command
    class Base
      def self.has_repo
        include Core::RepositoryLoading
        opt :repository, "The path to the repository to use", :short => "-R", :default => Dir.pwd
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
amp-core-0.2.0 lib/amp-core/command_ext/repository_loading.rb
amp-core-0.1.0 lib/amp-core/command_ext/repository_loading.rb