-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
36 lines (32 loc) · 994 Bytes
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require 'rake'
require 'dotenv'
require 'dotenv/tasks'
require 'httparty'
Dotenv.load
def run_ftp_command
login = ENV['LOGIN']
password = ENV['PASSWORD']
ftp_host = ENV['FTP_HOST']
port = ENV['PORT']
deploy_to = ENV['DEPLOY_TO']
commando = "curl -v --ftp-ssl -T \"output/stylesheets/test.css\" ftp://#{login}:#{password}@#{ftp_host}:#{port}#{deploy_to}"
# puts commando
puts `#{commando}`
end
task :deploy_frontpage do
run_ftp_command
end
namespace :roqua do
desc 'Downloads build from Circle CI'
task download_build: :dotenv do
zipfile = './builds/master.zip'
`rm -rf ./builds/output #{zipfile}`
api_url = "https://circleci.com/api/v1.1/project/github/roqua/roqua_frontpage/latest/artifacts?circle-token=#{ENV['CIRCLECI_API_TOKEN']}&branch=master"
response = HTTParty.get api_url
artifacts = JSON.parse(response.body)
if artifacts.any?
`curl -v #{artifacts[0]['url']} > #{zipfile}`
`unzip #{zipfile} -d ./builds`
end
end
end