Skip to content

Commit 0e4e9c2

Browse files
committed
Build using the atlassian tools.
1 parent e9ce56b commit 0e4e9c2

File tree

4 files changed

+27
-18
lines changed

4 files changed

+27
-18
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ language: java
22
install:
33
- bundle install --path vendor/bundle
44
#script:
5-
#- bundle exec rake --trace
5+
- bundle exec rake --trace
66
before_deploy:
77
- bundle exec rake after_build --trace
88
deploy:

Gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
source 'https://rubygems.org' do
22
gem 'rake'
3+
gem 'rest-client'
34
gem 'travis-build-tools'
45
end

Gemfile.lock

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ PLATFORMS
3434

3535
DEPENDENCIES
3636
rake!
37+
rest-client!
3738
travis-build-tools!
3839

3940
BUNDLED WITH

rakefile.rb

+24-17
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
require 'rake/clean'
55
require 'json'
66
require 'net/http'
7+
require 'rest-client'
78
require 'travis-build-tools'
89

910
#Constants
@@ -37,28 +38,34 @@
3738
task :clobber => [:clean]
3839
CLOBBER.include(TARGET_DIR, AMPS_DIR)
3940

40-
ATLASSIAN_TOOLS = File.join(PWD, 'atlassian-tools')
41-
directory ATLASSIAN_TOOLS
42-
task :setup => [ATLASSIAN_TOOLS] do
41+
ATLASSIAN_TOOLS_DIR = File.join(PWD, 'atlassian-tools')
42+
file ATLASSIAN_TOOLS_DIR do
43+
FileUtils.mkdir_p(ATLASSIAN_TOOLS_DIR)
4344
remote_location = 'https://marketplace.atlassian.com/download/plugins/atlassian-plugin-sdk-tgz'
44-
local_path = File.join(ATLASSIAN_TOOLS, 'atlassian.tgz')
45-
uri = URI(remote_location)
46-
Net::HTTP.start(uri.host, uri.port) do |http|
47-
request = Net::HTTP::Get.new(uri.request_uri)
48-
http.request(request) do |response|
49-
fileTotalSize = response["content-length"]
50-
open(local_path, 'wb') do |streamFile|
51-
response.read_body do |chunk|
52-
streamFile.write chunk
53-
print ((File.size(streamFile).to_f / fileTotalSize.to_f) * 100).round(2).to_s + " % \r"
54-
end
55-
end
56-
end
45+
atlassian_tools = File.join(ATLASSIAN_TOOLS_DIR, 'atlassian.tgz')
46+
download_file(atlassian_tools, remote_location)
47+
Dir.chdir(ATLASSIAN_TOOLS_DIR) do
48+
puts %x[tar -xzvf #{File.basename(atlassian_tools)}]
49+
end
50+
end
51+
task :setup => [ATLASSIAN_TOOLS_DIR]
52+
53+
def download_file(local_path, remote_location)
54+
url = URI::encode(remote_location)
55+
begin
56+
response = RestClient.get(url)
57+
58+
FileUtils.mkdir_p(File.dirname(local_path))
59+
File.open(local_path, 'wb'){|file| file.write(response.body)}
60+
rescue Exception => exception
61+
puts "Failed to download #{url}:"
62+
raise
5763
end
5864
end
5965

6066
task :build do
61-
67+
script = Dir[File.join(ATLASSIAN_TOOLS_DIR, "**", 'atlas-package')].first
68+
puts %x[#{script}]
6269
end
6370

6471
publish_git_tag :publish_git_tag do |t, args|

0 commit comments

Comments
 (0)