omnibus 3.1.1 → 3.2.0.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +71 -0
- data/Gemfile +0 -7
- data/README.md +108 -36
- data/Rakefile +1 -5
- data/docs/omnibus-build-cache.md +5 -5
- data/features/commands/_deprecated.feature +21 -3
- data/features/step_definitions/generator_steps.rb +7 -7
- data/lib/omnibus.rb +232 -171
- data/lib/omnibus/build_version.rb +2 -2
- data/lib/omnibus/builder.rb +38 -19
- data/lib/omnibus/cleaner.rb +5 -5
- data/lib/omnibus/cleanroom.rb +141 -0
- data/lib/omnibus/cli.rb +6 -9
- data/lib/omnibus/cli/base.rb +2 -1
- data/lib/omnibus/cli/cache.rb +15 -21
- data/lib/omnibus/cli/deprecated.rb +40 -4
- data/lib/omnibus/cli/publish.rb +61 -0
- data/lib/omnibus/config.rb +350 -189
- data/lib/omnibus/digestable.rb +131 -0
- data/lib/omnibus/exceptions.rb +163 -83
- data/lib/omnibus/fetcher.rb +1 -1
- data/lib/omnibus/fetchers/net_fetcher.rb +19 -13
- data/lib/omnibus/fetchers/path_fetcher.rb +8 -1
- data/lib/omnibus/fetchers/s3_cache_fetcher.rb +16 -7
- data/lib/omnibus/generator.rb +2 -2
- data/lib/omnibus/generator_files/Gemfile.erb +4 -1
- data/lib/omnibus/generator_files/README.md.erb +10 -0
- data/lib/omnibus/generator_files/{omnibus.rb.example.erb → omnibus.rb.erb} +20 -11
- data/lib/omnibus/generator_files/package_scripts/makeselfinst.erb +1 -1
- data/lib/omnibus/generator_files/project.rb.erb +2 -2
- data/lib/omnibus/generator_files/windows_msi/localization-en-us.wxl.erb +3 -3
- data/lib/omnibus/git_cache.rb +192 -0
- data/lib/omnibus/health_check.rb +171 -116
- data/lib/omnibus/library.rb +4 -2
- data/lib/omnibus/logger.rb +60 -1
- data/lib/omnibus/null_argumentable.rb +51 -0
- data/lib/omnibus/ohai.rb +29 -8
- data/lib/omnibus/package.rb +240 -0
- data/lib/omnibus/packagers/base.rb +21 -42
- data/lib/omnibus/packagers/mac_dmg.rb +5 -5
- data/lib/omnibus/packagers/mac_pkg.rb +20 -19
- data/lib/omnibus/packagers/windows_msi.rb +7 -7
- data/lib/omnibus/project.rb +969 -486
- data/lib/omnibus/publisher.rb +76 -0
- data/lib/omnibus/publishers/artifactory_publisher.rb +168 -0
- data/lib/omnibus/publishers/null_publisher.rb +23 -0
- data/lib/omnibus/publishers/s3_publisher.rb +99 -0
- data/lib/omnibus/s3_cache.rb +150 -63
- data/lib/omnibus/software.rb +749 -321
- data/lib/omnibus/{sugar.rb → sugarable.rb} +11 -6
- data/lib/omnibus/version.rb +1 -1
- data/omnibus.gemspec +8 -8
- data/spec/data/complicated/config/projects/angrychef.rb +1 -1
- data/spec/data/complicated/config/projects/chef-windows.rb +1 -1
- data/spec/data/complicated/config/projects/chef.rb +1 -1
- data/spec/data/complicated/config/projects/chefdk-windows.rb +1 -1
- data/spec/data/complicated/config/projects/chefdk.rb +1 -1
- data/spec/data/complicated/config/software/cacerts.rb +1 -1
- data/spec/data/complicated/config/software/chef-client-msi.rb +1 -1
- data/spec/data/complicated/config/software/libgcc.rb +1 -1
- data/spec/data/complicated/config/software/libiconv.rb +0 -11
- data/spec/data/complicated/config/software/libpng.rb +2 -2
- data/spec/data/complicated/config/software/openssl.rb +1 -1
- data/spec/data/complicated/config/software/ruby.rb +1 -1
- data/spec/data/complicated/config/software/runit.rb +4 -4
- data/spec/data/projects/chefdk.rb +1 -1
- data/spec/data/projects/sample.rb +1 -1
- data/spec/data/software/erchef.rb +3 -1
- data/spec/functional/packagers/mac_spec.rb +25 -24
- data/spec/functional/packagers/windows_spec.rb +21 -20
- data/spec/spec_helper.rb +43 -4
- data/spec/unit/build_version_spec.rb +14 -16
- data/spec/unit/cleanroom_spec.rb +63 -0
- data/spec/unit/config_spec.rb +36 -30
- data/spec/unit/digestable_spec.rb +38 -0
- data/spec/unit/fetchers/net_fetcher_spec.rb +98 -87
- data/spec/unit/{install_path_cache_spec.rb → git_cache_spec.rb} +67 -56
- data/spec/unit/health_check_spec.rb +73 -0
- data/spec/unit/library_spec.rb +166 -159
- data/spec/unit/ohai_spec.rb +19 -0
- data/spec/unit/omnibus_spec.rb +43 -41
- data/spec/unit/package_spec.rb +178 -0
- data/spec/unit/packagers/base_spec.rb +17 -47
- data/spec/unit/packagers/mac_pkg_spec.rb +104 -126
- data/spec/unit/project_spec.rb +176 -25
- data/spec/unit/publisher_spec.rb +49 -0
- data/spec/unit/publishers/artifactory_publisher_spec.rb +80 -0
- data/spec/unit/publishers/s3_publisher_spec.rb +120 -0
- data/spec/unit/s3_cacher_spec.rb +84 -19
- data/spec/unit/software_spec.rb +397 -170
- data/spec/unit/sugarable_spec.rb +43 -0
- metadata +62 -50
- data/Guardfile +0 -10
- data/lib/omnibus/artifact.rb +0 -165
- data/lib/omnibus/cli/release.rb +0 -40
- data/lib/omnibus/generator_files/Vagrantfile.erb +0 -75
- data/lib/omnibus/install_path_cache.rb +0 -105
- data/lib/omnibus/overrides.rb +0 -88
- data/lib/omnibus/package_release.rb +0 -154
- data/lib/omnibus/software_s3_urls.rb +0 -50
- data/spec/unit/artifact_spec.rb +0 -91
- data/spec/unit/overrides_spec.rb +0 -102
- data/spec/unit/package_release_spec.rb +0 -180
- data/spec/unit/sugar_spec.rb +0 -17
data/lib/omnibus/cli/release.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright 2013-2014 Chef Software, Inc.
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
#
|
16
|
-
|
17
|
-
module Omnibus
|
18
|
-
class Command::Release < Command::Base
|
19
|
-
namespace :release
|
20
|
-
|
21
|
-
class_option :target,
|
22
|
-
aliases: '-t',
|
23
|
-
desc: 'The target backend to release the package',
|
24
|
-
default: 'S3'
|
25
|
-
|
26
|
-
method_option :public,
|
27
|
-
type: :boolean,
|
28
|
-
desc: 'Make S3 object publicly readable',
|
29
|
-
default: false
|
30
|
-
desc 'package PATH', 'Upload a single package to S3'
|
31
|
-
def package(path)
|
32
|
-
access_policy = options[:public] ? :public_read : :private
|
33
|
-
|
34
|
-
uploader = PackageRelease.new(path, access: access_policy) do |uploaded_item|
|
35
|
-
say("Uploaded #{uploaded_item}", :green)
|
36
|
-
end
|
37
|
-
uploader.release
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,75 +0,0 @@
|
|
1
|
-
# -*- mode: ruby -*-
|
2
|
-
# vi: set ft=ruby :
|
3
|
-
|
4
|
-
require 'vagrant'
|
5
|
-
|
6
|
-
if Vagrant::VERSION < '1.2.1'
|
7
|
-
raise 'The Omnibus Build Lab is only compatible with Vagrant 1.2.1+'
|
8
|
-
end
|
9
|
-
|
10
|
-
host_project_path = File.expand_path('..', __FILE__)
|
11
|
-
guest_project_path = "/home/vagrant/#{File.basename(host_project_path)}"
|
12
|
-
project_name = '<%= config[:name] %>'
|
13
|
-
|
14
|
-
Vagrant.configure('2') do |config|
|
15
|
-
|
16
|
-
config.vm.hostname = "#{project_name}-omnibus-build-lab"
|
17
|
-
|
18
|
-
%w{
|
19
|
-
ubuntu-10.04
|
20
|
-
ubuntu-11.04
|
21
|
-
ubuntu-12.04
|
22
|
-
centos-5.10
|
23
|
-
centos-6.5
|
24
|
-
}.each do |platform|
|
25
|
-
|
26
|
-
config.vm.define platform do |c|
|
27
|
-
c.vm.box = "opscode-#{platform}"
|
28
|
-
c.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_#{platform}_chef-provisionerless.box"
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
config.vm.provider :virtualbox do |vb|
|
34
|
-
# Give enough horsepower to build without taking all day.
|
35
|
-
vb.customize [
|
36
|
-
'modifyvm', :id,
|
37
|
-
'--memory', '1536',
|
38
|
-
'--cpus', '2'
|
39
|
-
]
|
40
|
-
end
|
41
|
-
|
42
|
-
# Ensure a recent version of the Chef Omnibus packages are installed
|
43
|
-
config.omnibus.chef_version = '11.6.2'
|
44
|
-
|
45
|
-
# Enable the berkshelf-vagrant plugin
|
46
|
-
config.berkshelf.enabled = true
|
47
|
-
config.ssh.forward_agent = true
|
48
|
-
|
49
|
-
host_project_path = File.expand_path('..', __FILE__)
|
50
|
-
guest_project_path = "/home/vagrant/#{File.basename(host_project_path)}"
|
51
|
-
|
52
|
-
config.vm.synced_folder host_project_path, guest_project_path
|
53
|
-
|
54
|
-
# prepare VM to be an Omnibus builder
|
55
|
-
config.vm.provision :chef_solo do |chef|
|
56
|
-
chef.json = {
|
57
|
-
'omnibus' => {
|
58
|
-
'build_user' => 'vagrant',
|
59
|
-
'build_dir' => guest_project_path,
|
60
|
-
'install_dir' => "/opt/#{project_name}"
|
61
|
-
}
|
62
|
-
}
|
63
|
-
|
64
|
-
chef.run_list = [
|
65
|
-
'recipe[omnibus::default]'
|
66
|
-
]
|
67
|
-
end
|
68
|
-
|
69
|
-
config.vm.provision :shell, :inline => <<-OMNIBUS_BUILD
|
70
|
-
export PATH=/usr/local/bin:$PATH
|
71
|
-
cd #{guest_project_path}
|
72
|
-
su vagrant -c "bundle install --binstubs"
|
73
|
-
su vagrant -c "bin/omnibus build project #{project_name}"
|
74
|
-
OMNIBUS_BUILD
|
75
|
-
end
|
@@ -1,105 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright 2014 Chef Software, Inc.
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
#
|
16
|
-
|
17
|
-
require 'fileutils'
|
18
|
-
require 'digest'
|
19
|
-
|
20
|
-
module Omnibus
|
21
|
-
class InstallPathCache
|
22
|
-
include Util
|
23
|
-
|
24
|
-
def initialize(install_path, software)
|
25
|
-
@install_path = install_path.sub(/^([A-Za-z]:)/, '') # strip drive letter on Windows
|
26
|
-
@software = software
|
27
|
-
end
|
28
|
-
|
29
|
-
# The path to the full install_path cache for the project
|
30
|
-
def cache_path
|
31
|
-
File.join(Omnibus::Config.install_path_cache_dir, @install_path)
|
32
|
-
end
|
33
|
-
|
34
|
-
# Whether the cache_path above exists
|
35
|
-
def cache_path_exists?
|
36
|
-
File.directory?(cache_path)
|
37
|
-
end
|
38
|
-
|
39
|
-
# Creates the full path if it does not exist already
|
40
|
-
def create_cache_path
|
41
|
-
FileUtils.mkdir_p(File.dirname(cache_path))
|
42
|
-
shellout!("git --git-dir=#{cache_path} init -q") unless cache_path_exists?
|
43
|
-
true
|
44
|
-
end
|
45
|
-
|
46
|
-
# Computes the tag for this cache entry
|
47
|
-
def tag
|
48
|
-
name = @software.name
|
49
|
-
|
50
|
-
# Accumulate an array of all the software projects that come before
|
51
|
-
# the name and version we are tagging. So if you have
|
52
|
-
#
|
53
|
-
# build_order = [ 1, 2, 3, 4, 5 ]
|
54
|
-
#
|
55
|
-
# And we are tagging 3, you would get dep_list = [ 1, 2 ]
|
56
|
-
dep_list = @software.project.library.build_order.take_while do |dep|
|
57
|
-
if dep.name == @software.name && dep.version == @software.version
|
58
|
-
false
|
59
|
-
else
|
60
|
-
true
|
61
|
-
end
|
62
|
-
end
|
63
|
-
dep_string = dep_list.map { |i| "#{i.name}-#{i.version}" }.join('-')
|
64
|
-
# digest the content of the software's config so that changes to
|
65
|
-
# build params invalidate cache.
|
66
|
-
dep_string = IO.read(@software.source_config) + dep_string
|
67
|
-
digest = Digest::SHA256.hexdigest(dep_string)
|
68
|
-
|
69
|
-
version = @software.version_for_cache
|
70
|
-
|
71
|
-
"#{name}-#{version}-#{digest}"
|
72
|
-
end
|
73
|
-
|
74
|
-
# Create an incremental install path cache for the software step
|
75
|
-
def incremental
|
76
|
-
create_cache_path
|
77
|
-
shellout!(%Q(git --git-dir=#{cache_path} --work-tree=#{@install_path} add -A -f))
|
78
|
-
begin
|
79
|
-
shellout!(%Q(git --git-dir=#{cache_path} --work-tree=#{@install_path} commit -q -m "Backup of #{tag}"))
|
80
|
-
rescue Mixlib::ShellOut::ShellCommandFailed => e
|
81
|
-
if e.message !~ /nothing to commit/
|
82
|
-
raise
|
83
|
-
end
|
84
|
-
end
|
85
|
-
shellout!(%Q(git --git-dir=#{cache_path} --work-tree=#{@install_path} tag -f "#{tag}"))
|
86
|
-
end
|
87
|
-
|
88
|
-
def restore
|
89
|
-
create_cache_path
|
90
|
-
cmd = shellout(%Q(git --git-dir=#{cache_path} --work-tree=#{@install_path} tag -l "#{tag}"))
|
91
|
-
|
92
|
-
restore_me = false
|
93
|
-
cmd.stdout.each_line do |line|
|
94
|
-
restore_me = true if tag == line.chomp
|
95
|
-
end
|
96
|
-
|
97
|
-
if restore_me
|
98
|
-
shellout!(%Q(git --git-dir=#{cache_path} --work-tree=#{@install_path} checkout -f "#{tag}"))
|
99
|
-
true
|
100
|
-
else
|
101
|
-
false
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
data/lib/omnibus/overrides.rb
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright 2014 Chef Software, Inc.
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
#
|
16
|
-
|
17
|
-
require 'pp'
|
18
|
-
|
19
|
-
module Omnibus
|
20
|
-
module Overrides
|
21
|
-
include Logging
|
22
|
-
|
23
|
-
DEFAULT_OVERRIDE_FILE_NAME = 'omnibus.overrides'
|
24
|
-
|
25
|
-
class << self
|
26
|
-
# Parses a file of override information into a Hash.
|
27
|
-
#
|
28
|
-
# Each line of the file must be of the form
|
29
|
-
#
|
30
|
-
#
|
31
|
-
# <package_name> <version>
|
32
|
-
#
|
33
|
-
# where the two pieces of data are separated by whitespace.
|
34
|
-
#
|
35
|
-
# @param file [String] the path to an overrides file
|
36
|
-
# @return [Hash, nil]
|
37
|
-
def parse_file(file)
|
38
|
-
if file
|
39
|
-
File.readlines(file).reduce({}) do |acc, line|
|
40
|
-
info = line.split
|
41
|
-
|
42
|
-
unless info.count == 2
|
43
|
-
raise ArgumentError, "Invalid overrides line: '#{line.chomp}'"
|
44
|
-
end
|
45
|
-
|
46
|
-
package, version = info
|
47
|
-
|
48
|
-
if acc[package]
|
49
|
-
raise ArgumentError, "Multiple overrides present for '#{package}' in overrides file #{file}!"
|
50
|
-
end
|
51
|
-
|
52
|
-
acc[package] = version
|
53
|
-
acc
|
54
|
-
end
|
55
|
-
else
|
56
|
-
nil
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
# Return the full path to an overrides file, or +nil+ if no such
|
61
|
-
# file exists.
|
62
|
-
def resolve_override_file
|
63
|
-
file = ENV['OMNIBUS_OVERRIDE_FILE'] || DEFAULT_OVERRIDE_FILE_NAME
|
64
|
-
path = File.expand_path(file)
|
65
|
-
File.exist?(path) ? path : nil
|
66
|
-
end
|
67
|
-
|
68
|
-
# Return a hash of override information. If no such information
|
69
|
-
# can be found, the hash will be empty
|
70
|
-
#
|
71
|
-
# @return [Hash]
|
72
|
-
def overrides
|
73
|
-
file = resolve_override_file
|
74
|
-
overrides = parse_file(file)
|
75
|
-
|
76
|
-
if overrides
|
77
|
-
log.info(log_key) do
|
78
|
-
out = "Using overrides from #{resolve_override_file}\n"
|
79
|
-
out << overrides.pretty_inspect
|
80
|
-
out
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
overrides || {}
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
@@ -1,154 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright 2012-2014 Chef Software, Inc.
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
#
|
16
|
-
|
17
|
-
require 'json'
|
18
|
-
require 'uber-s3'
|
19
|
-
|
20
|
-
module Omnibus
|
21
|
-
class PackageRelease
|
22
|
-
attr_reader :package_path
|
23
|
-
attr_reader :access_policy
|
24
|
-
|
25
|
-
# @param package_path [String] file system path to the package artifact
|
26
|
-
# @option opts [:private, :public_read] :access specifies access control on
|
27
|
-
# uploaded files
|
28
|
-
# @yield callback triggered by successful upload. Allows users of this
|
29
|
-
# class to add UI feedback.
|
30
|
-
# @yieldparam s3_object_key [String] the S3 key of the uploaded object.
|
31
|
-
def initialize(package_path, opts = { access: :private }, &block)
|
32
|
-
@package_path = package_path
|
33
|
-
@metadata = nil
|
34
|
-
@s3_client = nil
|
35
|
-
|
36
|
-
@after_upload = if block_given?
|
37
|
-
block
|
38
|
-
else
|
39
|
-
->(_) { nil }
|
40
|
-
end
|
41
|
-
|
42
|
-
# sets @access_policy
|
43
|
-
handle_opts(opts)
|
44
|
-
end
|
45
|
-
|
46
|
-
# Primary API for this class. Validates S3 configuration and package files,
|
47
|
-
# then runs the upload.
|
48
|
-
# @return [void]
|
49
|
-
# @raise [NoPackageFile, NoPackageMetadataFile] when the package or
|
50
|
-
# associated metadata file do not exist.
|
51
|
-
# @raise [InvalidS3ReleaseConfiguration] when the Omnibus configuration is
|
52
|
-
# missing required settings.
|
53
|
-
# @raise Also may raise errors from uber-s3 or net/http.
|
54
|
-
def release
|
55
|
-
validate_config!
|
56
|
-
validate_package!
|
57
|
-
s3_client.store(metadata_key, metadata_json, access: access_policy)
|
58
|
-
uploaded(metadata_key)
|
59
|
-
s3_client.store(package_key, package_content, access: access_policy, content_md5: md5)
|
60
|
-
uploaded(package_key)
|
61
|
-
end
|
62
|
-
|
63
|
-
def uploaded(key)
|
64
|
-
@after_upload.call(key)
|
65
|
-
end
|
66
|
-
|
67
|
-
def package_key
|
68
|
-
File.join(platform_path, File.basename(package_path))
|
69
|
-
end
|
70
|
-
|
71
|
-
def metadata_key
|
72
|
-
File.join(platform_path, File.basename(package_metadata_path))
|
73
|
-
end
|
74
|
-
|
75
|
-
def platform_path
|
76
|
-
File.join(metadata['platform'], metadata['platform_version'], metadata['arch'])
|
77
|
-
end
|
78
|
-
|
79
|
-
def md5
|
80
|
-
metadata['md5']
|
81
|
-
end
|
82
|
-
|
83
|
-
def metadata
|
84
|
-
@metadata ||= JSON.parse(metadata_json)
|
85
|
-
end
|
86
|
-
|
87
|
-
def metadata_json
|
88
|
-
IO.read(package_metadata_path)
|
89
|
-
end
|
90
|
-
|
91
|
-
def package_content
|
92
|
-
IO.read(package_path)
|
93
|
-
end
|
94
|
-
|
95
|
-
def package_metadata_path
|
96
|
-
"#{package_path}.metadata.json"
|
97
|
-
end
|
98
|
-
|
99
|
-
def validate_package!
|
100
|
-
if !File.exist?(package_path)
|
101
|
-
raise NoPackageFile.new(package_path)
|
102
|
-
elsif !File.exist?(package_metadata_path)
|
103
|
-
raise NoPackageMetadataFile.new(package_metadata_path)
|
104
|
-
else
|
105
|
-
true
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
def validate_config!
|
110
|
-
if s3_access_key && s3_secret_key && s3_bucket
|
111
|
-
true
|
112
|
-
else
|
113
|
-
err = InvalidS3ReleaseConfiguration.new(s3_bucket, s3_access_key, s3_secret_key)
|
114
|
-
raise err
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
def s3_client
|
119
|
-
@s3_client ||= UberS3.new(
|
120
|
-
access_key: s3_access_key,
|
121
|
-
secret_access_key: s3_secret_key,
|
122
|
-
bucket: s3_bucket,
|
123
|
-
adaper: :net_http,
|
124
|
-
)
|
125
|
-
end
|
126
|
-
|
127
|
-
def s3_access_key
|
128
|
-
config[:release_s3_access_key]
|
129
|
-
end
|
130
|
-
|
131
|
-
def s3_secret_key
|
132
|
-
config[:release_s3_secret_key]
|
133
|
-
end
|
134
|
-
|
135
|
-
def s3_bucket
|
136
|
-
config[:release_s3_bucket]
|
137
|
-
end
|
138
|
-
|
139
|
-
def config
|
140
|
-
Omnibus.config
|
141
|
-
end
|
142
|
-
|
143
|
-
def handle_opts(opts)
|
144
|
-
access_policy = opts[:access]
|
145
|
-
if access_policy.nil?
|
146
|
-
raise ArgumentError, "options to #{self.class} must specify `:access' (given: #{opts.inspect})"
|
147
|
-
elsif ![:private, :public_read].include?(access_policy)
|
148
|
-
raise ArgumentError, "option `:access' must be one of `[:private, :public_read]' (given: #{access_policy.inspect})"
|
149
|
-
else
|
150
|
-
@access_policy = access_policy
|
151
|
-
end
|
152
|
-
end
|
153
|
-
end
|
154
|
-
end
|