Sha256: 8128cff3d8bd92e291492f0306cd33364af40e08cf4ba2fd48db4419353b8506

Contents?: true

Size: 696 Bytes

Versions: 2

Compression:

Stored size: 696 Bytes

Contents

require 'typhoeus'
module Stan
  class Deployer
    def self.deploy(source, name, keep: false)
      url = ENV.fetch('STAN_SERVER') 
      puts "Going to deploy `#{name}` to #{url}"
      res = Typhoeus.post(
              "#{url}/upload",
              body: {
                name: name,
                file: File.open(source, 'r')
              },
              followlocation: true
            )
      if res.success?
        puts "Successfully deployed `#{name}`"
	puts "Your site should be reachable at `#{url}/#{name}`"
      else
        puts "Something went wrong. (#{res.response_code})"
	puts res.inspect if Stan::CI
      end
      FileUtils.rm(source) unless keep
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stan-0.2.4 lib/stan/deployer.rb
stan-0.2.3 lib/stan/deployer.rb