travis-build-tools 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/lib/travis-build-tools/build.rb +15 -0
- data/lib/travis-build-tools/dsl.rb +11 -0
- data/lib/travis-build-tools/zip_file_generator.rb +55 -0
- data/lib/travis-build-tools.rb +8 -0
- metadata +91 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NmY4ZGMzYzUzZjU4NTI5MTA2OGU2YmI2YWU0OTJhNmJmNmYyYjBhYg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NDNhMmM0YzNkMDc1ODcxMTkzODliZGY2OWE1NWJkZGI3NmM4MGVlMw==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YzhlN2YzNDE2OWY4MDk1NzYwYzBiYWNhZWJlNmEwNWE2NzFhMWRmN2ZlY2Mx
|
10
|
+
Y2NmMDY4NWRmNjBhZDlmZjFjNzFlZjMwZDFjNDIwOGI3M2JkMWUyM2FiYThj
|
11
|
+
YzFlZGFjYjgyYjEwZTc0ZjFkMTEyNTUxODMyYTFkNGY5NzY1OTM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NjNjMDg3MGIxNWVlZDU0N2E1YTM2NjE5NWJhYWRkMDYzNWE1MTQ0NjdmZWVj
|
14
|
+
N2NiZTJhYWJiYzU2MzcwZDRlNGExMjQzMTdiYTA0Y2ZkZTc3MDJhMGZjMzAy
|
15
|
+
ODhlODMyYTI2MTRkMmM2OTFkYTNmZjA5MWJkMWU1OWY2NmFmOGQ=
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module TravisBuildTools
|
2
|
+
module Build
|
3
|
+
RELEASE_VERSION = case
|
4
|
+
#Builds of pull requests
|
5
|
+
when ['TRAVIS_PULL_REQUEST'] && !ENV['TRAVIS_PULL_REQUEST'].match(/false/i) then "0.#{ENV['TRAVIS_PULL_REQUEST']}"
|
6
|
+
#Builds of branches that aren't master or release
|
7
|
+
when !ENV['TRAVIS_BRANCH'] || !ENV['TRAVIS_BRANCH'].match(/^release[\/-]/i) then '0.0'
|
8
|
+
#Builds of release branches (or locally or on server)
|
9
|
+
else ENV['TRAVIS_BRANCH'].match(/^release[\/-](\d+\.\d+)$/i)[1]
|
10
|
+
end
|
11
|
+
now = Time.now.to_a
|
12
|
+
VERSION = Gem::Version.new("#{RELEASE_VERSION}.#{ENV['TRAVIS_BUILD_NUMBER'] || '0'}")
|
13
|
+
PULL_REQUEST = ENV['TRAVIS_PULL_REQUEST'].match(/false/i) ? nil : ENV['TRAVIS_PULL_REQUEST']
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'zip'
|
2
|
+
# From https://github.com/rubyzip/rubyzip
|
3
|
+
# This is a simple example which uses rubyzip to
|
4
|
+
# recursively generate a zip file from the contents of
|
5
|
+
# a specified directory. The directory itself is not
|
6
|
+
# included in the archive, rather just its contents.
|
7
|
+
#
|
8
|
+
# Usage:
|
9
|
+
# directoryToZip = "/tmp/input"
|
10
|
+
# outputFile = "/tmp/out.zip"
|
11
|
+
# zf = ZipFileGenerator.new()
|
12
|
+
# zf.write(directoryToZip, outputFile)
|
13
|
+
module TravisBuildTools
|
14
|
+
class ZipFileGenerator
|
15
|
+
# Initialize with the directory to zip and the location of the output archive.
|
16
|
+
def initialize()
|
17
|
+
end
|
18
|
+
|
19
|
+
# Zip the input directory.
|
20
|
+
def write(inputDir, outputFile)
|
21
|
+
entries = Dir.entries(inputDir); entries.delete("."); entries.delete("..")
|
22
|
+
io = Zip::File.open(outputFile, Zip::File::CREATE);
|
23
|
+
|
24
|
+
writeEntries(entries, "", io, inputDir)
|
25
|
+
io.close();
|
26
|
+
end
|
27
|
+
|
28
|
+
def unzip_file(file, directory)
|
29
|
+
Zip::File.open(file) do |zip_file|
|
30
|
+
zip_file.each do |f|
|
31
|
+
extraction_location = File.join(directory, f.name)
|
32
|
+
FileUtils.mkdir_p(directory)
|
33
|
+
zip_file.extract(f, extraction_location)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# A helper method to make the recursion work.
|
39
|
+
private
|
40
|
+
def writeEntries(entries, path, io, inputDir)
|
41
|
+
entries.each { |e|
|
42
|
+
zipFilePath = path == "" ? e : File.join(path, e)
|
43
|
+
diskFilePath = File.join(inputDir, zipFilePath)
|
44
|
+
puts "Deflating " + diskFilePath
|
45
|
+
if File.directory?(diskFilePath)
|
46
|
+
io.mkdir(zipFilePath)
|
47
|
+
subdir =Dir.entries(diskFilePath); subdir.delete("."); subdir.delete("..")
|
48
|
+
writeEntries(subdir, zipFilePath, io, inputDir)
|
49
|
+
else
|
50
|
+
io.get_output_stream(zipFilePath) { |f| f.puts(File.open(diskFilePath, "rb").read())}
|
51
|
+
end
|
52
|
+
}
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: travis-build-tools
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.8
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Warren Parad
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-07-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rest-client
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.8'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.8'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubyzip
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.1'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.1'
|
55
|
+
description: travis-build-tools allows you to easily create ruby-build packages using
|
56
|
+
Travis CI.
|
57
|
+
email:
|
58
|
+
- wparad@gmail.com
|
59
|
+
executables: []
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- lib/travis-build-tools.rb
|
64
|
+
- lib/travis-build-tools/build.rb
|
65
|
+
- lib/travis-build-tools/dsl.rb
|
66
|
+
- lib/travis-build-tools/zip_file_generator.rb
|
67
|
+
homepage: https://github.com/wparad/Travis-Build-Tools
|
68
|
+
licenses:
|
69
|
+
- BSD-3-Clause
|
70
|
+
metadata: {}
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options: []
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ! '>='
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
requirements: []
|
86
|
+
rubyforge_project:
|
87
|
+
rubygems_version: 2.4.5
|
88
|
+
signing_key:
|
89
|
+
specification_version: 4
|
90
|
+
summary: A lightweight build and deployment tool wrapper
|
91
|
+
test_files: []
|