Sha256: 96ba7f1315c8997b656e793983699a039a974076bab43088233e56fce158e7b9

Contents?: true

Size: 1.26 KB

Versions: 10

Compression:

Stored size: 1.26 KB

Contents

module Dpl
  module Providers
    class Datica < Provider
      status :dev

      register :datica, :catalyze

      description sq(<<-str)
        tbd
      str

      env :datica, :catalyze

      opt '--target TARGET', 'The git remote repository to deploy to', required: true
      opt '--path PATH', 'Path to files to deploy', default: '.'

      needs :git

      cmds checkout: 'git checkout HEAD',
           add:      'git add %{path} --all --force',
           commit:   'git commit -m "%{message}" --quiet',
           push:     'git push --force %{target} HEAD:master'

      msgs commit:   'Committing build files for deployment',
           push:     'Deploying to Datica: %{target}'

      def setup
        commit if git_dirty? && !cleanup?
      end

      def deploy
        shell :push
      end

      private

        def commit
          info :commit
          shell :checkout
          shell :add
          shell :commit
        end

        def message
          vars.empty? ? 'Local build' : 'Build #%s (%s) of %s@%s' % vars
        end

        VARS = %w(
          TRAVIS_BUILD_NUMBER
          TRAVIS_COMMIT
          TRAVIS_REPO_SLUG
          TRAVIS_BRANCH
        )

        def vars
          @vars ||= ENV.values_at(*VARS).compact
        end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
dpl-2.0.0.alpha.14 lib/dpl/providers/datica.rb
dpl-2.0.0.alpha.13 lib/dpl/providers/datica.rb
dpl-2.0.0.alpha.12 lib/dpl/providers/datica.rb
dpl-2.0.0.alpha.11 lib/dpl/providers/datica.rb
dpl-2.0.0.alpha.10 lib/dpl/providers/datica.rb
dpl-2.0.0.alpha.9 lib/dpl/providers/datica.rb
dpl-2.0.0.alpha.8 lib/dpl/providers/datica.rb
dpl-2.0.0.alpha.7 lib/dpl/providers/datica.rb
dpl-2.0.0.alpha.6 lib/dpl/providers/datica.rb
dpl-2.0.0.alpha.5 lib/dpl/providers/datica.rb