Sha256: 9dfac619b8209053db0a04a0a75a4ded679c737faf76e48f9ee1526915a17f6a

Contents?: true

Size: 1.06 KB

Versions: 315

Compression:

Stored size: 1.06 KB

Contents

module DPL
  class Provider
    class Surge < Provider
      npm_g 'surge'

      def project
        File.expand_path( (context.env['TRAVIS_BUILD_DIR'] || '.' ) + "/" + (options[:project] || '') )
      end

      def domain
        options[:domain] || ''
      end

      def check_auth
        if ! context.env['SURGE_TOKEN'] then raise Error, "Please add SURGE_TOKEN in Travis settings (get your token with 'surge token')" end
        if ! context.env['SURGE_LOGIN'] then raise Error, "Please add SURGE_LOGIN in Travis settings (its your email)" end
      end

      def check_app
      	if ! File.directory?(project) then raise Error, "Please set a valid project folder path in .travis.yml under deploy: project: myPath" end
      	if domain.empty? && ! File.exist?("#{project}/CNAME") then raise Error, "Please set domain in .travis.yml under deploy: project: myDomain (or in a CNAME file in the repo project folder)" end
      end

      def needs_key?
        false
      end

      def push_app
        context.shell "surge #{project} #{domain}"
      end
    end
  end
end

Version data entries

315 entries across 315 versions & 3 rubygems

Version Path
dpl-surge-1.10.17.travis.6637.6 lib/dpl/provider/surge.rb
dpl-surge-1.10.16 lib/dpl/provider/surge.rb
dpl-surge-1.10.16.travis.6625.6 lib/dpl/provider/surge.rb
dpl-surge-1.10.16.travis.6619.6 lib/dpl/provider/surge.rb
dpl-surge-1.10.16.travis.5961.5 lib/dpl/provider/surge.rb
dpl-surge-1.10.15 lib/dpl/provider/surge.rb
dpl-surge-1.10.15.travis.5877.5 lib/dpl/provider/surge.rb
dpl-surge-1.10.14 lib/dpl/provider/surge.rb
dpl-surge-1.10.13 lib/dpl/provider/surge.rb
dpl-surge-1.10.13.travis.4159.5 lib/dpl/provider/surge.rb
dpl-surge-1.10.13.travis.4141.5 lib/dpl/provider/surge.rb
dpl-surge-1.10.13.travis.4040.5 lib/dpl/provider/surge.rb
dpl-surge-1.10.13.travis.4033.5 lib/dpl/provider/surge.rb
dpl-surge-1.10.12 lib/dpl/provider/surge.rb
dpl-surge-1.10.12.travis.4032.5 lib/dpl/provider/surge.rb
dpl-surge-1.10.12.travis.3794.5 lib/dpl/provider/surge.rb
dpl-surge-1.10.12.travis.3506.5 lib/dpl/provider/surge.rb
dpl-surge-1.10.11.travis.3504.5 lib/dpl/provider/surge.rb
dpl-surge-1.10.11 lib/dpl/provider/surge.rb
dpl-surge-1.10.11.travis.3499.5 lib/dpl/provider/surge.rb