Sha256: c41bba6c3563aba7f780d5263fe383aa5c66200f6fcab24dc999916c4d2f8609

Contents?: true

Size: 1.95 KB

Versions: 62

Compression:

Stored size: 1.95 KB

Contents

module VagrantPlugins
  module HerokuPush
    class Config < Vagrant.plugin("2", :config)
      # The name of the Heroku application to push to.
      # @return [String]
      attr_accessor :app

      # The base directory with file contents to upload. By default this
      # is the same directory as the Vagrantfile, but you can specify this
      # if you have a `src` folder or `bin` folder or some other folder
      # you want to upload. This directory must be a git repository.
      # @return [String]
      attr_accessor :dir

      # The path to the git binary to shell out to. This usually is only set for
      # debugging/development. If not set, the git bin will be searched for
      # in the PATH.
      # @return [String]
      attr_accessor :git_bin

      # The Git remote to push to (default: "heroku").
      # @return [String]
      attr_accessor :remote

      def initialize
        @app = UNSET_VALUE
        @dir = UNSET_VALUE

        @git_bin = UNSET_VALUE
        @remote = UNSET_VALUE
      end

      def finalize!
        @app = nil if @app == UNSET_VALUE
        @dir = "." if @dir == UNSET_VALUE

        @git_bin = "git" if @git_bin == UNSET_VALUE
        @remote = "heroku" if @remote == UNSET_VALUE
      end

      def validate(machine)
        errors = _detected_errors

        if missing?(@dir)
          errors << I18n.t("heroku_push.errors.missing_attribute",
            attribute: "dir",
          )
        end

        if missing?(@git_bin)
          errors << I18n.t("heroku_push.errors.missing_attribute",
            attribute: "git_bin",
          )
        end

        if missing?(@remote)
          errors << I18n.t("heroku_push.errors.missing_attribute",
            attribute: "remote",
          )
        end

        { "Heroku push" => errors }
      end

      private

      # Determine if the given string is "missing" (blank)
      # @return [true, false]
      def missing?(obj)
        obj.to_s.strip.empty?
      end
    end
  end
end

Version data entries

62 entries across 55 versions & 7 rubygems

Version Path
vagrant-unbundled-2.3.6.0 plugins/pushes/heroku/config.rb
tamtam-vagrant-reload-1.2.1 vendor/cache/vagrant-2092df529ae7/plugins/pushes/heroku/config.rb
vagrant-unbundled-2.3.3.0 plugins/pushes/heroku/config.rb
vagrant-unbundled-2.3.2.0 plugins/pushes/heroku/config.rb
vagrant-unbundled-2.2.19.0 plugins/pushes/heroku/config.rb
vagrant-unbundled-2.2.18.0 plugins/pushes/heroku/config.rb
vagrant-unbundled-2.2.16.0 plugins/pushes/heroku/config.rb
vagrant-unbundled-2.2.14.0 plugins/pushes/heroku/config.rb
vagrant-aws-mkubenka-0.7.2.pre.24 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-22795b161bf6/plugins/pushes/heroku/config.rb
vagrant-unbundled-2.2.10.0 plugins/pushes/heroku/config.rb
vagrant-unbundled-2.2.9.0 plugins/pushes/heroku/config.rb
vagrant-unbundled-2.2.8.0 plugins/pushes/heroku/config.rb
vagrant-unbundled-2.2.7.0 plugins/pushes/heroku/config.rb
vagrant-unbundled-2.2.6.2 plugins/pushes/heroku/config.rb
vagrant-unbundled-2.2.6.1 plugins/pushes/heroku/config.rb
vagrant-unbundled-2.2.6.0 plugins/pushes/heroku/config.rb
vagrant-unbundled-2.2.5.0 plugins/pushes/heroku/config.rb
vagrant-unbundled-2.2.4.0 plugins/pushes/heroku/config.rb
vagrant-unbundled-2.2.3.0 plugins/pushes/heroku/config.rb
vagrant-unbundled-2.2.2.0 plugins/pushes/heroku/config.rb