4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/stan/deployer.rb', line 4
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
exit 1
end
FileUtils.rm(source) unless keep
end
|