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-1.9.8.1 plugins/pushes/heroku/config.rb
vagrant-unbundled-1.9.7.1 plugins/pushes/heroku/config.rb
vagrant-aws-mkubenka-0.7.2.pre.14 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/plugins/pushes/heroku/config.rb
vagrant-aws-mkubenka-0.7.2.pre.11 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/plugins/pushes/heroku/config.rb
vagrant-aws-mkubenka-0.7.2.pre.10 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/plugins/pushes/heroku/config.rb
vagrant-aws-mkubenka-0.7.2.pre.9 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/plugins/pushes/heroku/config.rb
vagrant-unbundled-1.9.5.1 plugins/pushes/heroku/config.rb
vagrant-unbundled-1.9.1.1 plugins/pushes/heroku/config.rb
vagrant-compose-yaml-0.1.3 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/plugins/pushes/heroku/config.rb
vagrant-compose-yaml-0.1.2 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/plugins/pushes/heroku/config.rb
vagrant-compose-yaml-0.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/plugins/pushes/heroku/config.rb
vagrant-compose-yaml-0.1.0 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/plugins/pushes/heroku/config.rb
vagrant-unbundled-1.8.5.2 plugins/pushes/heroku/config.rb
vagrant-unbundled-1.8.5.1 plugins/pushes/heroku/config.rb
vagrant-unbundled-1.8.4.2 plugins/pushes/heroku/config.rb
vagrant-unbundled-1.8.4.1 plugins/pushes/heroku/config.rb
vagrant-unbundled-1.8.1.2 plugins/pushes/heroku/config.rb
vagrant-unbundled-1.8.1.1 plugins/pushes/heroku/config.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-1cf2a8db4ccb/plugins/pushes/heroku/config.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-b421af58e8b3/plugins/pushes/heroku/config.rb