omnibus 3.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +17 -1
- data/.travis.yml +11 -3
- data/CHANGELOG.md +39 -1
- data/Gemfile +0 -4
- data/README.md +10 -8
- data/Rakefile +18 -7
- data/bin/omnibus +3 -3
- data/docs/Building on Windows.md +98 -0
- data/features/commands/_deprecated.feature +46 -0
- data/features/commands/build.feature +9 -0
- data/features/commands/clean.feature +21 -0
- data/features/commands/list.feature +16 -0
- data/features/commands/new.feature +8 -0
- data/features/commands/version.feature +12 -0
- data/features/step_definitions/generator_steps.rb +28 -0
- data/features/support/env.rb +13 -0
- data/lib/omnibus.rb +319 -240
- data/lib/omnibus/artifact.rb +16 -0
- data/lib/omnibus/build_version.rb +39 -20
- data/lib/omnibus/build_version_dsl.rb +136 -0
- data/lib/omnibus/builder.rb +28 -23
- data/lib/omnibus/cleaner.rb +72 -0
- data/lib/omnibus/cli.rb +115 -11
- data/lib/omnibus/cli/base.rb +82 -81
- data/lib/omnibus/cli/cache.rb +80 -32
- data/lib/omnibus/cli/deprecated.rb +79 -0
- data/lib/omnibus/cli/release.rb +17 -21
- data/lib/omnibus/config.rb +38 -13
- data/lib/omnibus/exceptions.rb +70 -18
- data/lib/omnibus/fetcher.rb +18 -11
- data/lib/omnibus/fetchers/git_fetcher.rb +48 -53
- data/lib/omnibus/fetchers/net_fetcher.rb +29 -27
- data/lib/omnibus/fetchers/path_fetcher.rb +9 -12
- data/lib/omnibus/fetchers/s3_cache_fetcher.rb +5 -8
- data/lib/omnibus/generator.rb +131 -0
- data/lib/omnibus/{templates → generator_files}/.kitchen.local.yml.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/.kitchen.yml.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/Berksfile.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/Gemfile.erb +2 -2
- data/lib/omnibus/{templates → generator_files}/README.md.erb +6 -7
- data/lib/omnibus/{templates → generator_files}/Vagrantfile.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/gitignore.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/mac_dmg/background.png +0 -0
- data/lib/omnibus/{templates → generator_files}/mac_dmg/icon.png +0 -0
- data/lib/omnibus/{templates → generator_files}/mac_pkg/background.png +0 -0
- data/lib/omnibus/{templates → generator_files}/mac_pkg/license.html.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/mac_pkg/welcome.html.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/omnibus.rb.example.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/package_scripts/makeselfinst.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/package_scripts/postinst.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/package_scripts/postrm.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/package_scripts/preinst.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/package_scripts/prerm.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/project.rb.erb +0 -1
- data/lib/omnibus/{templates → generator_files}/software/c-example.rb.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/software/erlang-example.rb.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/software/ruby-example.rb.erb +0 -0
- data/lib/omnibus/generator_files/windows_msi/assets/LICENSE.rtf +8 -0
- data/lib/omnibus/generator_files/windows_msi/assets/banner_background.bmp +0 -0
- data/lib/omnibus/generator_files/windows_msi/assets/dialog_background.bmp +0 -0
- data/lib/omnibus/generator_files/windows_msi/assets/project.ico +0 -0
- data/lib/omnibus/generator_files/windows_msi/assets/project_16x16.ico +0 -0
- data/lib/omnibus/generator_files/windows_msi/assets/project_32x32.ico +0 -0
- data/lib/omnibus/generator_files/windows_msi/localization-en-us.wxl.erb +20 -0
- data/lib/omnibus/generator_files/windows_msi/parameters.wxi.erb +9 -0
- data/lib/omnibus/generator_files/windows_msi/source.wxs.erb +74 -0
- data/lib/omnibus/health_check.rb +80 -40
- data/lib/omnibus/install_path_cache.rb +11 -12
- data/lib/omnibus/library.rb +30 -3
- data/lib/omnibus/logger.rb +47 -0
- data/lib/omnibus/logging.rb +60 -0
- data/lib/omnibus/null_builder.rb +23 -0
- data/lib/omnibus/ohai.rb +70 -0
- data/lib/omnibus/overrides.rb +69 -48
- data/lib/omnibus/package_release.rb +7 -14
- data/lib/omnibus/packagers/base.rb +66 -13
- data/lib/omnibus/packagers/mac_dmg.rb +23 -3
- data/lib/omnibus/packagers/mac_pkg.rb +20 -10
- data/lib/omnibus/packagers/windows_msi.rb +109 -0
- data/lib/omnibus/project.rb +136 -79
- data/lib/omnibus/reports.rb +1 -2
- data/lib/omnibus/{s3_cacher.rb → s3_cache.rb} +15 -37
- data/lib/omnibus/software.rb +77 -27
- data/lib/omnibus/software_s3_urls.rb +50 -0
- data/lib/omnibus/sugar.rb +1 -3
- data/lib/omnibus/util.rb +45 -18
- data/lib/omnibus/version.rb +2 -3
- data/omnibus.gemspec +5 -3
- data/spec/data/complicated/config/patches/bzip2/makefile_take_env_vars.patch +15 -0
- data/spec/data/complicated/config/patches/couchdb/patch_for_couchjs_stack.patch +19 -0
- data/spec/data/complicated/config/patches/gd/gd-2.0.33-configure-libpng.patch +100 -0
- data/spec/data/complicated/config/patches/keepalived/keepalived-1.2.9_opscode_centos_5.patch +15 -0
- data/spec/data/complicated/config/patches/libedit/freebsd-vi-fix.patch +24 -0
- data/spec/data/complicated/config/patches/libiconv/libiconv-1.14_srclib_stdio.in.h-remove-gets-declarations.patch +29 -0
- data/spec/data/complicated/config/patches/libwrap/tcp_wrappers-7.6-makefile-dest-fix.patch +35 -0
- data/spec/data/complicated/config/patches/libwrap/tcp_wrappers-7.6-malloc-fix.patch +13 -0
- data/spec/data/complicated/config/patches/libwrap/tcp_wrappers-7.6-shared_lib_plus_plus-1.patch +1035 -0
- data/spec/data/complicated/config/patches/logrotate/logrotate_basedir_override.patch +12 -0
- data/spec/data/complicated/config/patches/ncurses/ncurses-5.9-solaris-xopen_source_extended-detection.patch +11 -0
- data/spec/data/complicated/config/patches/ncurses/ncurses-clang.patch +42 -0
- data/spec/data/complicated/config/patches/ncurses/patch-aa +23 -0
- data/spec/data/complicated/config/patches/ncurses/patch-ab +44 -0
- data/spec/data/complicated/config/patches/ncurses/patch-ac +40 -0
- data/spec/data/complicated/config/patches/ncurses/patch-ad +12 -0
- data/spec/data/complicated/config/patches/ncurses/patch-aix-configure +23 -0
- data/spec/data/complicated/config/patches/ncurses/patch-cxx_cursesf.h +22 -0
- data/spec/data/complicated/config/patches/ncurses/patch-cxx_cursesm.h +22 -0
- data/spec/data/complicated/config/patches/nrpe/fix_for_runit.patch +64 -0
- data/spec/data/complicated/config/patches/openssl/openssl-1.0.1f-do-not-build-docs.patch +101 -0
- data/spec/data/complicated/config/patches/postgresql/postgresql-9.1.2-configure-ncurses-fix.patch +12 -0
- data/spec/data/complicated/config/patches/ruby/patch-configure +103 -0
- data/spec/data/complicated/config/patches/ruby/ruby-aix-configure.patch +10 -0
- data/spec/data/complicated/config/patches/ruby/ruby-openssl-1.0.1c.patch +42 -0
- data/spec/data/complicated/config/patches/ruby/ruby_aix_1_9_3_448_ssl_EAGAIN.patch +57 -0
- data/spec/data/complicated/config/patches/ruby/rvm-cflags.patch +27 -0
- data/spec/data/complicated/config/projects/angrychef.rb +32 -0
- data/spec/data/complicated/config/projects/chef-windows.rb +32 -0
- data/spec/data/complicated/config/projects/chef.rb +32 -0
- data/spec/data/complicated/config/projects/chefdk-windows.rb +41 -0
- data/spec/data/complicated/config/projects/chefdk.rb +44 -0
- data/spec/data/complicated/config/software/appbundler.rb +25 -0
- data/spec/data/complicated/config/software/autoconf.rb +35 -0
- data/spec/data/complicated/config/software/automake.rb +39 -0
- data/spec/data/complicated/config/software/berkshelf.rb +44 -0
- data/{lib/omnibus/fetchers.rb → spec/data/complicated/config/software/bundler.rb} +8 -5
- data/spec/data/complicated/config/software/bzip2.rb +46 -0
- data/spec/data/complicated/config/software/cacerts.rb +44 -0
- data/spec/data/complicated/config/software/chef-client-msi.rb +88 -0
- data/spec/data/complicated/config/software/chef-gem.rb +26 -0
- data/spec/data/complicated/config/software/chef-vault.rb +43 -0
- data/spec/data/complicated/config/software/chef-windows.rb +158 -0
- data/spec/data/complicated/config/software/chef.rb +170 -0
- data/spec/data/complicated/config/software/chefdk.rb +103 -0
- data/spec/data/complicated/config/software/couchdb.rb +53 -0
- data/spec/data/complicated/config/software/curl.rb +48 -0
- data/spec/data/complicated/config/software/erlang.rb +65 -0
- data/spec/data/complicated/config/software/expat.rb +21 -0
- data/spec/data/complicated/config/software/fcgi.rb +56 -0
- data/spec/data/complicated/config/software/fcgiwrap.rb +41 -0
- data/spec/data/complicated/config/software/gd.rb +56 -0
- data/spec/data/complicated/config/software/gdbm.rb +40 -0
- data/spec/data/complicated/config/software/gecode.rb +48 -0
- data/spec/data/complicated/config/software/git.rb +40 -0
- data/spec/data/complicated/config/software/help2man.rb +30 -0
- data/spec/data/complicated/config/software/icu.rb +40 -0
- data/spec/data/complicated/config/software/jre.rb +48 -0
- data/spec/data/complicated/config/software/keepalived.rb +43 -0
- data/spec/data/complicated/config/software/libarchive.rb +50 -0
- data/spec/data/complicated/config/software/libedit.rb +69 -0
- data/spec/data/complicated/config/software/libffi.rb +71 -0
- data/spec/data/complicated/config/software/libgcc.rb +39 -0
- data/spec/data/complicated/config/software/libiconv.rb +66 -0
- data/spec/data/complicated/config/software/libjpeg.rb +39 -0
- data/spec/data/complicated/config/software/libpng.rb +38 -0
- data/spec/data/complicated/config/software/libtool.rb +52 -0
- data/spec/data/complicated/config/software/libwrap.rb +50 -0
- data/spec/data/complicated/config/software/libxml2.rb +51 -0
- data/spec/data/complicated/config/software/libxslt.rb +52 -0
- data/spec/data/complicated/config/software/libyaml-windows.rb +43 -0
- data/spec/data/complicated/config/software/libyaml.rb +62 -0
- data/spec/data/complicated/config/software/logrotate.rb +41 -0
- data/spec/data/complicated/config/software/makedepend.rb +73 -0
- data/spec/data/complicated/config/software/mysql2.rb +42 -0
- data/spec/data/complicated/config/software/nagios-plugins.rb +53 -0
- data/spec/data/complicated/config/software/nagios.rb +66 -0
- data/spec/data/complicated/config/software/ncurses.rb +149 -0
- data/spec/data/complicated/config/software/nginx.rb +40 -0
- data/spec/data/complicated/config/software/nodejs.rb +44 -0
- data/spec/data/complicated/config/software/nokogiri.rb +55 -0
- data/spec/data/complicated/config/software/nrpe.rb +61 -0
- data/spec/data/complicated/config/software/ohai.rb +64 -0
- data/spec/data/complicated/config/software/omnibus-ctl.rb +34 -0
- data/spec/data/complicated/config/software/openresty.rb +67 -0
- data/spec/data/complicated/config/software/openssl.rb +158 -0
- data/spec/data/complicated/config/software/pcre.rb +42 -0
- data/spec/data/complicated/config/software/perl-extutils-embed.rb +15 -0
- data/spec/data/complicated/config/software/perl-extutils-makemaker.rb +15 -0
- data/spec/data/complicated/config/software/perl.rb +48 -0
- data/spec/data/complicated/config/software/perl_pg_driver.rb +12 -0
- data/spec/data/complicated/config/software/php.rb +41 -0
- data/spec/data/complicated/config/software/pip.rb +30 -0
- data/spec/data/complicated/config/software/pkg-config.rb +66 -0
- data/spec/data/complicated/config/software/popt.rb +47 -0
- data/spec/data/complicated/config/software/postgresql.rb +51 -0
- data/spec/data/complicated/config/software/preparation.rb +30 -0
- data/spec/data/complicated/config/software/pygments.rb +25 -0
- data/spec/data/complicated/config/software/python.rb +49 -0
- data/spec/data/complicated/config/software/rabbitmq.rb +36 -0
- data/spec/data/complicated/config/software/rebar.rb +36 -0
- data/spec/data/complicated/config/software/redis.rb +33 -0
- data/spec/data/complicated/config/software/rsync.rb +48 -0
- data/spec/data/complicated/config/software/ruby-windows-devkit.rb +30 -0
- data/spec/data/complicated/config/software/ruby-windows.rb +30 -0
- data/spec/data/complicated/config/software/ruby.rb +162 -0
- data/spec/data/complicated/config/software/rubygems-customization.rb +57 -0
- data/spec/data/complicated/config/software/rubygems.rb +37 -0
- data/spec/data/complicated/config/software/runit.rb +118 -0
- data/spec/data/complicated/config/software/server-jre.rb +46 -0
- data/spec/data/complicated/config/software/setuptools.rb +30 -0
- data/spec/data/complicated/config/software/spawn-fcgi.rb +40 -0
- data/spec/data/complicated/config/software/sphinx.rb +26 -0
- data/spec/data/complicated/config/software/spidermonkey.rb +60 -0
- data/spec/data/complicated/config/software/sqitch.rb +24 -0
- data/spec/data/complicated/config/software/test-kitchen.rb +39 -0
- data/spec/data/complicated/config/software/unicorn.rb +27 -0
- data/spec/data/complicated/config/software/util-macros.rb +46 -0
- data/spec/data/complicated/config/software/version-manifest.rb +32 -0
- data/spec/data/complicated/config/software/xproto.rb +46 -0
- data/spec/data/complicated/config/software/yajl.rb +30 -0
- data/spec/data/complicated/config/software/zlib.rb +67 -0
- data/spec/data/projects/chefdk.rb +4 -4
- data/spec/data/projects/sample.rb +3 -0
- data/spec/data/software/erchef.rb +1 -1
- data/spec/fixtures/sample/files/windows_msi/Resources/assets/LICENSE.rtf +8 -0
- data/spec/fixtures/sample/files/windows_msi/Resources/assets/banner_background.bmp +0 -0
- data/spec/fixtures/sample/files/windows_msi/Resources/assets/dialog_background.bmp +0 -0
- data/spec/fixtures/sample/files/windows_msi/Resources/assets/project.ico +0 -0
- data/spec/fixtures/sample/files/windows_msi/Resources/assets/project_16x16.ico +0 -0
- data/spec/fixtures/sample/files/windows_msi/Resources/assets/project_32x32.ico +0 -0
- data/spec/fixtures/sample/files/windows_msi/Resources/localization-en-us.wxl +20 -0
- data/spec/fixtures/sample/files/windows_msi/Resources/parameters.wxi.erb +9 -0
- data/spec/fixtures/sample/files/windows_msi/Resources/source.wxs +74 -0
- data/spec/functional/packagers/mac_spec.rb +3 -20
- data/spec/functional/packagers/windows_spec.rb +69 -0
- data/spec/spec_helper.rb +79 -1
- data/spec/unit/artifact_spec.rb +0 -18
- data/spec/unit/build_version_dsl_spec.rb +136 -0
- data/spec/unit/build_version_spec.rb +185 -198
- data/spec/unit/config_spec.rb +18 -1
- data/spec/unit/fetchers/git_fetcher_spec.rb +55 -80
- data/spec/unit/fetchers/net_fetcher_spec.rb +11 -21
- data/spec/unit/install_path_cache_spec.rb +164 -136
- data/spec/unit/library_spec.rb +125 -5
- data/spec/unit/omnibus_spec.rb +25 -9
- data/spec/unit/overrides_spec.rb +2 -14
- data/spec/unit/package_release_spec.rb +0 -18
- data/spec/unit/packagers/base_spec.rb +84 -21
- data/spec/unit/packagers/mac_pkg_spec.rb +34 -24
- data/spec/unit/project_spec.rb +100 -102
- data/spec/unit/s3_cacher_spec.rb +0 -18
- data/spec/unit/software_spec.rb +152 -6
- data/spec/{sugar_spec.rb → unit/sugar_spec.rb} +0 -3
- metadata +365 -38
- data/lib/omnibus/cli/application.rb +0 -147
- data/lib/omnibus/cli/build.rb +0 -64
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'aruba/api'
|
2
|
+
|
3
|
+
Given(/^I have an omnibus project named "(.+)"$/) do |name|
|
4
|
+
create_dir(name)
|
5
|
+
cd(name)
|
6
|
+
|
7
|
+
write_file("config/projects/#{name}.rb", <<-EOH.gsub(/^ {4}/, ''))
|
8
|
+
name '#{name}'
|
9
|
+
maintainer 'Mrs. Maintainer'
|
10
|
+
homepage 'https://example.com'
|
11
|
+
install_path './local/build/#{name}'
|
12
|
+
|
13
|
+
build_version '1.0.0'
|
14
|
+
|
15
|
+
exclude '\.git*'
|
16
|
+
exclude 'bundler\/git'
|
17
|
+
EOH
|
18
|
+
|
19
|
+
write_file('omnibus.rb', <<-EOH.gsub(/^ {4}/, ''))
|
20
|
+
# Build configuration
|
21
|
+
cache_dir './local/omnibus/cache'
|
22
|
+
install_path_cache_dir './local/omnibus/cache/install_path'
|
23
|
+
source_dir './local/omnibus/src'
|
24
|
+
build_dir './local/omnibus/build'
|
25
|
+
package_dir './local/omnibus/pkg'
|
26
|
+
package_tmp './local/omnibus/pkg-tmp'
|
27
|
+
EOH
|
28
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'aruba'
|
2
|
+
require 'aruba/cucumber'
|
3
|
+
require 'aruba/in_process'
|
4
|
+
|
5
|
+
require 'omnibus/cli'
|
6
|
+
|
7
|
+
Before do
|
8
|
+
# Reset anything that might have been cached in the Omnibus project
|
9
|
+
Omnibus.reset!(true)
|
10
|
+
|
11
|
+
Aruba::InProcess.main_class = Omnibus::CLI::Runner
|
12
|
+
Aruba.process = Aruba::InProcess
|
13
|
+
end
|
data/lib/omnibus.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright
|
3
|
-
# License:: Apache License, Version 2.0
|
2
|
+
# Copyright 2012-2014 Chef Software, Inc.
|
4
3
|
#
|
5
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
5
|
# you may not use this file except in compliance with the License.
|
@@ -15,293 +14,373 @@
|
|
15
14
|
# limitations under the License.
|
16
15
|
#
|
17
16
|
|
18
|
-
require '
|
19
|
-
|
20
|
-
o.require_plugin('os')
|
21
|
-
o.require_plugin('platform')
|
22
|
-
o.require_plugin('linux/cpu') if o.os == 'linux'
|
23
|
-
o.require_plugin('kernel')
|
24
|
-
OHAI = o
|
25
|
-
|
26
|
-
require 'omnibus/library'
|
27
|
-
require 'omnibus/reports'
|
28
|
-
require 'omnibus/config'
|
17
|
+
require 'pathname'
|
18
|
+
|
29
19
|
require 'omnibus/exceptions'
|
30
|
-
require 'omnibus/software'
|
31
|
-
require 'omnibus/project'
|
32
|
-
require 'omnibus/fetchers'
|
33
|
-
require 'omnibus/health_check'
|
34
|
-
require 'omnibus/build_version'
|
35
|
-
require 'omnibus/sugar'
|
36
|
-
require 'omnibus/overrides'
|
37
20
|
require 'omnibus/version'
|
38
21
|
|
39
|
-
require 'pathname'
|
40
|
-
|
41
22
|
module Omnibus
|
42
|
-
DEFAULT_CONFIG_FILENAME = 'omnibus.rb'.freeze
|
43
|
-
|
44
|
-
module Packager
|
45
|
-
autoload :Base, 'omnibus/packagers/base'
|
46
|
-
autoload :MacDmg, 'omnibus/packagers/mac_dmg'
|
47
|
-
autoload :MacPkg, 'omnibus/packagers/mac_pkg'
|
48
|
-
end
|
49
|
-
|
50
|
-
# Configure Omnibus.
|
51
23
|
#
|
52
|
-
#
|
53
|
-
# available as `Omnibus.config`.
|
24
|
+
# The path to the default configuration file.
|
54
25
|
#
|
55
|
-
# @return [
|
26
|
+
# @return [String]
|
56
27
|
#
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
28
|
+
DEFAULT_CONFIG = 'omnibus.rb'
|
29
|
+
|
30
|
+
autoload :Artifact, 'omnibus/artifact'
|
31
|
+
autoload :Builder, 'omnibus/builder'
|
32
|
+
autoload :BuildVersion, 'omnibus/build_version'
|
33
|
+
autoload :BuildVersionDSL, 'omnibus/build_version_dsl'
|
34
|
+
autoload :Cleaner, 'omnibus/cleaner'
|
35
|
+
autoload :Config, 'omnibus/config'
|
36
|
+
autoload :Error, 'omnibus/exceptions'
|
37
|
+
autoload :Fetcher, 'omnibus/fetcher'
|
38
|
+
autoload :Generator, 'omnibus/generator'
|
39
|
+
autoload :HealthCheck, 'omnibus/health_check'
|
40
|
+
autoload :InstallPathCache, 'omnibus/install_path_cache'
|
41
|
+
autoload :Library, 'omnibus/library'
|
42
|
+
autoload :Logger, 'omnibus/logger'
|
43
|
+
autoload :Logging, 'omnibus/logging'
|
44
|
+
autoload :NullBuilder, 'omnibus/null_builder'
|
45
|
+
autoload :Ohai, 'omnibus/ohai'
|
46
|
+
autoload :Overrides, 'omnibus/overrides'
|
47
|
+
autoload :PackageRelease, 'omnibus/package_release'
|
48
|
+
autoload :Project, 'omnibus/project'
|
49
|
+
autoload :Reports, 'omnibus/reports'
|
50
|
+
autoload :S3Cache, 'omnibus/s3_cache'
|
51
|
+
autoload :Software, 'omnibus/software'
|
52
|
+
autoload :SoftwareS3URLs, 'omnibus/software_s3_urls'
|
53
|
+
autoload :Util, 'omnibus/util'
|
54
|
+
|
55
|
+
# @todo Remove this in the next major release
|
56
|
+
autoload :OHAI, 'omnibus/ohai'
|
57
|
+
|
58
|
+
# @todo Refactor these under a +Fetcher module
|
59
|
+
autoload :GitFetcher, 'omnibus/fetchers/git_fetcher'
|
60
|
+
autoload :NetFetcher, 'omnibus/fetchers/net_fetcher'
|
61
|
+
autoload :PathFetcher, 'omnibus/fetchers/path_fetcher'
|
62
|
+
autoload :S3CacheFetcher, 'omnibus/fetchers/s3_cache_fetcher'
|
63
|
+
|
64
|
+
module Command
|
65
|
+
autoload :Base, 'omnibus/cli/base'
|
66
|
+
autoload :Cache, 'omnibus/cli/cache'
|
67
|
+
autoload :Release, 'omnibus/cli/release'
|
62
68
|
end
|
63
69
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
# @deprecated Just refer to {Omnibus::Config} directly.
|
70
|
-
def self.config
|
71
|
-
Config
|
70
|
+
module Packager
|
71
|
+
autoload :Base, 'omnibus/packagers/base'
|
72
|
+
autoload :MacDmg, 'omnibus/packagers/mac_dmg'
|
73
|
+
autoload :MacPkg, 'omnibus/packagers/mac_pkg'
|
74
|
+
autoload :WindowsMsi, 'omnibus/packagers/windows_msi'
|
72
75
|
end
|
73
76
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
77
|
+
class << self
|
78
|
+
#
|
79
|
+
# Reset the current Omnibus configuration. This is primary an internal API
|
80
|
+
# used in testing, but it can also be useful when Omnibus is used as a
|
81
|
+
# library.
|
82
|
+
#
|
83
|
+
# Note - this persists the +Logger+ object by default.
|
84
|
+
#
|
85
|
+
# @param [true, false] include_logger
|
86
|
+
# whether the logger object should be cleared as well
|
87
|
+
#
|
88
|
+
# @return [void]
|
89
|
+
#
|
90
|
+
def reset!(include_logger = false)
|
91
|
+
instance_variables.each do |instance_variable|
|
92
|
+
unless include_logger
|
93
|
+
next if instance_variable == :@logger
|
94
|
+
end
|
95
|
+
|
96
|
+
remove_instance_variable(instance_variable)
|
97
|
+
end
|
85
98
|
|
86
|
-
|
87
|
-
|
88
|
-
#
|
89
|
-
# @return [void]
|
90
|
-
def self.process_configuration
|
91
|
-
Config.validate
|
92
|
-
process_dsl_files
|
93
|
-
end
|
99
|
+
Config.reset!
|
100
|
+
end
|
94
101
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
102
|
+
#
|
103
|
+
# The logger for this Omnibus instance.
|
104
|
+
#
|
105
|
+
# @example
|
106
|
+
# Omnibus.logger.debug { 'This is a message!' }
|
107
|
+
#
|
108
|
+
# @return [Logger]
|
109
|
+
#
|
110
|
+
def logger
|
111
|
+
@logger ||= Logger.new
|
112
|
+
end
|
101
113
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
def self.project_names
|
106
|
-
projects.map { |p| p.name }
|
107
|
-
end
|
114
|
+
def logger=(logger)
|
115
|
+
@logger = logger
|
116
|
+
end
|
108
117
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
# @return {Omnibus::Project}
|
113
|
-
def self.project(name)
|
114
|
-
projects.find { |p| p.name == name }
|
115
|
-
end
|
118
|
+
def ui
|
119
|
+
@ui ||= Thor::Base.shell.new
|
120
|
+
end
|
116
121
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
122
|
+
# Configure Omnibus.
|
123
|
+
#
|
124
|
+
# After this has been called, the {Omnibus::Config} object is
|
125
|
+
# available as `Omnibus.config`.
|
126
|
+
#
|
127
|
+
# @return [void]
|
128
|
+
#
|
129
|
+
# @deprecated Use {#load_configuration} if you need to process a
|
130
|
+
# config file, followed by {#process_configuration} to act upon it.
|
131
|
+
def configure
|
132
|
+
load_configuration
|
133
|
+
process_configuration
|
134
|
+
end
|
126
135
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
136
|
+
# Convenience method for access to the Omnibus::Config object.
|
137
|
+
# Provided for backward compatibility.
|
138
|
+
#
|
139
|
+
# @ return [Omnibus::Config]
|
140
|
+
#
|
141
|
+
# @deprecated Just refer to {Omnibus::Config} directly.
|
142
|
+
def config
|
143
|
+
Config
|
144
|
+
end
|
133
145
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
@
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
nil
|
146
|
+
# Load in an Omnibus configuration file. Values will be merged with
|
147
|
+
# and override the defaults defined in {Omnibus::Config}.
|
148
|
+
#
|
149
|
+
# @param file [String] path to a configuration file to load
|
150
|
+
#
|
151
|
+
# @return [void]
|
152
|
+
def load_configuration(file = nil)
|
153
|
+
if file
|
154
|
+
Config.from_file(file)
|
144
155
|
end
|
145
156
|
end
|
146
|
-
end
|
147
157
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
158
|
+
# Processes the configuration to construct the dependency tree of
|
159
|
+
# projects and software.
|
160
|
+
#
|
161
|
+
# @return [void]
|
162
|
+
def process_configuration
|
163
|
+
Config.validate
|
164
|
+
process_dsl_files
|
165
|
+
end
|
154
166
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
167
|
+
# All {Omnibus::Project} instances that have been created.
|
168
|
+
#
|
169
|
+
# @return [Array<Omnibus::Project>]
|
170
|
+
def projects
|
171
|
+
@projects ||= []
|
172
|
+
end
|
161
173
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
software_dirs = [File.join(project_root, Config.software_dir)]
|
168
|
-
software_dirs << File.join(omnibus_software_root, 'config', 'software') if omnibus_software_root
|
169
|
-
software_dirs
|
174
|
+
# Names of all the {Omnibus::Project} instances that have been created.
|
175
|
+
#
|
176
|
+
# @return [Array<String>]
|
177
|
+
def project_names
|
178
|
+
projects.map { |p| p.name }
|
170
179
|
end
|
171
|
-
end
|
172
180
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
181
|
+
# Load the {Omnibus::Project} instance with the given name.
|
182
|
+
#
|
183
|
+
# @param name [String]
|
184
|
+
# @return {Omnibus::Project}
|
185
|
+
def project(name)
|
186
|
+
projects.find { |p| p.name == name }
|
187
|
+
end
|
179
188
|
|
180
|
-
|
189
|
+
# The absolute path to the Omnibus project/repository directory.
|
190
|
+
#
|
191
|
+
# @return [String]
|
192
|
+
def project_root
|
193
|
+
Config.project_root
|
194
|
+
end
|
181
195
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
#
|
188
|
-
# @see Omnibus::Project
|
189
|
-
def self.expand_projects
|
190
|
-
project_files.each do |spec|
|
191
|
-
Omnibus.projects << Omnibus::Project.load(spec)
|
196
|
+
# The source root is the path to the root directory of the `omnibus` gem.
|
197
|
+
#
|
198
|
+
# @return [Pathname]
|
199
|
+
def source_root
|
200
|
+
@source_root ||= Pathname.new(File.expand_path('../..', __FILE__))
|
192
201
|
end
|
193
|
-
end
|
194
202
|
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
203
|
+
# The source root is the path to the root directory of the `omnibus-software`
|
204
|
+
# gem.
|
205
|
+
#
|
206
|
+
# @return [Pathname]
|
207
|
+
def omnibus_software_root
|
208
|
+
@omnibus_software_root ||= begin
|
209
|
+
if (spec = Gem::Specification.find_all_by_name(Config.software_gem).first)
|
210
|
+
Pathname.new(spec.gem_dir)
|
211
|
+
else
|
212
|
+
nil
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
# Return paths to all configured {Omnibus::Project} DSL files.
|
218
|
+
#
|
219
|
+
# @return [Array<String>]
|
220
|
+
def project_files
|
221
|
+
ruby_files(File.join(project_root, Config.project_dir))
|
206
222
|
end
|
207
223
|
|
208
|
-
Omnibus
|
209
|
-
|
210
|
-
|
224
|
+
# Return paths to all configured {Omnibus::Software} DSL files.
|
225
|
+
#
|
226
|
+
# @return [Array<String>]
|
227
|
+
def software_files
|
228
|
+
ruby_files(File.join(project_root, Config.software_dir))
|
229
|
+
end
|
230
|
+
|
231
|
+
# Return directories to search for {Omnibus::Software} DSL files.
|
232
|
+
#
|
233
|
+
# @return [Array<String>]
|
234
|
+
def software_dirs
|
235
|
+
@software_dirs ||= begin
|
236
|
+
software_dirs = [File.join(project_root, Config.software_dir)]
|
237
|
+
software_dirs << File.join(omnibus_software_root, 'config', 'software') if omnibus_software_root
|
238
|
+
software_dirs
|
211
239
|
end
|
212
240
|
end
|
213
|
-
end
|
214
241
|
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
242
|
+
# Backward compat alias
|
243
|
+
#
|
244
|
+
# @todo Remve this in the next major release (4.0)
|
245
|
+
#
|
246
|
+
# @see (Omnibus.project_root)
|
247
|
+
def root
|
248
|
+
Omnibus.logger.deprecated('Omnibus') do
|
249
|
+
'Omnibus.root. Please use Omnibus.project_root instead.'
|
250
|
+
end
|
222
251
|
|
223
|
-
|
224
|
-
|
252
|
+
project_root
|
253
|
+
end
|
225
254
|
|
226
|
-
|
255
|
+
# Processes all configured {Omnibus::Project} and
|
256
|
+
# {Omnibus::Software} DSL files.
|
257
|
+
#
|
258
|
+
# @return [void]
|
259
|
+
def process_dsl_files
|
260
|
+
# Do projects first
|
261
|
+
expand_projects
|
227
262
|
|
228
|
-
|
229
|
-
|
263
|
+
# Then do software
|
264
|
+
final_software_map = prefer_local_software(omnibus_software_files, software_files)
|
230
265
|
|
231
|
-
|
232
|
-
# extension) in the given directory
|
233
|
-
#
|
234
|
-
# @param dir [String]
|
235
|
-
# @return [Array<String>]
|
236
|
-
def self.ruby_files(dir)
|
237
|
-
Dir.glob("#{dir}/*.rb")
|
238
|
-
end
|
266
|
+
overrides = Config.override_file ? Omnibus::Overrides.overrides : {}
|
239
267
|
|
240
|
-
|
241
|
-
# file bundled in the {https://github.com/opscode/omnibus-software omnibus-software} gem.
|
242
|
-
#
|
243
|
-
# @return [Array<String>] the list of paths. Will be empty if the
|
244
|
-
# `omnibus-software` gem is not in the gem path.
|
245
|
-
def self.omnibus_software_files
|
246
|
-
if omnibus_software_root
|
247
|
-
Dir.glob(File.join(omnibus_software_root, 'config', 'software', '*.rb'))
|
248
|
-
else
|
249
|
-
[]
|
268
|
+
expand_software(overrides, final_software_map)
|
250
269
|
end
|
251
|
-
end
|
252
270
|
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
base.merge(local)
|
268
|
-
end
|
271
|
+
private
|
272
|
+
|
273
|
+
# Generates {Omnibus::Project}s for each project DSL file in
|
274
|
+
# `project_specs`. All projects are then accessible at
|
275
|
+
# {Omnibus#projects}
|
276
|
+
#
|
277
|
+
# @return [void]
|
278
|
+
#
|
279
|
+
# @see Omnibus::Project
|
280
|
+
def expand_projects
|
281
|
+
project_files.each do |spec|
|
282
|
+
Omnibus.projects << Omnibus::Project.load(spec)
|
283
|
+
end
|
284
|
+
end
|
269
285
|
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
286
|
+
# Generate {Omnibus::Software} objects for all software DSL files in
|
287
|
+
# `software_specs`.
|
288
|
+
#
|
289
|
+
# @param overrides [Hash] a hash of version override information.
|
290
|
+
# @param software_files [Array<String>]
|
291
|
+
# @return [void]
|
292
|
+
#
|
293
|
+
# @see Omnibus::Overrides#overrides
|
294
|
+
def expand_software(overrides, software_map)
|
295
|
+
unless overrides.is_a? Hash
|
296
|
+
raise ArgumentError, "Overrides argument must be a hash! You passed #{overrides.inspect}."
|
297
|
+
end
|
298
|
+
|
299
|
+
Omnibus.projects.each do |project|
|
300
|
+
project.dependencies.each do |dependency|
|
301
|
+
recursively_load_dependency(dependency, project, overrides, software_map)
|
302
|
+
end
|
303
|
+
end
|
279
304
|
end
|
280
|
-
end
|
281
305
|
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
# @return [void]
|
291
|
-
def self.recursively_load_dependency(dependency_name, project, overrides, software_map)
|
292
|
-
dep_file = software_map[dependency_name]
|
306
|
+
# Return a list of all the Ruby files (i.e., those with an "rb"
|
307
|
+
# extension) in the given directory
|
308
|
+
#
|
309
|
+
# @param dir [String]
|
310
|
+
# @return [Array<String>]
|
311
|
+
def ruby_files(dir)
|
312
|
+
Dir.glob("#{dir}/*.rb")
|
313
|
+
end
|
293
314
|
|
294
|
-
|
295
|
-
|
315
|
+
# Retrieve the fully-qualified paths to every software definition
|
316
|
+
# file bundled in the {https://github.com/opscode/omnibus-software omnibus-software} gem.
|
317
|
+
#
|
318
|
+
# @return [Array<String>] the list of paths. Will be empty if the
|
319
|
+
# `omnibus-software` gem is not in the gem path.
|
320
|
+
def omnibus_software_files
|
321
|
+
if omnibus_software_root
|
322
|
+
Dir.glob(File.join(omnibus_software_root, 'config', 'software', '*.rb'))
|
323
|
+
else
|
324
|
+
[]
|
325
|
+
end
|
296
326
|
end
|
297
327
|
|
298
|
-
|
328
|
+
# Given a list of software definitions from `omnibus-software` itself, and a
|
329
|
+
# list of software files local to the current project, create a
|
330
|
+
# single list of software definitions. If the software was defined
|
331
|
+
# in both sets, the locally-defined one ends up in the final list.
|
332
|
+
#
|
333
|
+
# The base name of the software file determines what software it
|
334
|
+
# defines.
|
335
|
+
#
|
336
|
+
# @param omnibus_files [Array<String>]
|
337
|
+
# @param local_files [Array<String>]
|
338
|
+
# @return [Array<String>]
|
339
|
+
def prefer_local_software(omnibus_files, local_files)
|
340
|
+
base = software_map(omnibus_files)
|
341
|
+
local = software_map(local_files)
|
342
|
+
base.merge(local)
|
343
|
+
end
|
299
344
|
|
300
|
-
#
|
301
|
-
|
302
|
-
|
345
|
+
# Given a list of file paths, create a map of the basename (without
|
346
|
+
# extension) to the complete path.
|
347
|
+
#
|
348
|
+
# @param files [Array<String>]
|
349
|
+
# @return [Hash<String, String>]
|
350
|
+
def software_map(files)
|
351
|
+
files.each_with_object({}) do |file, collection|
|
352
|
+
software_name = File.basename(file, '.*')
|
353
|
+
collection[software_name] = file
|
354
|
+
end
|
303
355
|
end
|
304
356
|
|
305
|
-
project
|
357
|
+
# Loads a project's dependency recursively, ensuring all transitive dependencies
|
358
|
+
# are also loaded.
|
359
|
+
#
|
360
|
+
# @param dependency_name [String]
|
361
|
+
# @param project [Omnibus::Project]
|
362
|
+
# @param overrides [Hash] a hash of version override information.
|
363
|
+
# @param software_map [Hash<String, String>]
|
364
|
+
#
|
365
|
+
# @return [void]
|
366
|
+
def recursively_load_dependency(dependency_name, project, overrides, software_map)
|
367
|
+
dep_file = software_map[dependency_name]
|
368
|
+
|
369
|
+
unless dep_file
|
370
|
+
raise MissingProjectDependency.new(dependency_name, software_dirs)
|
371
|
+
end
|
372
|
+
|
373
|
+
dep_software = Omnibus::Software.load(dep_file, project, overrides)
|
374
|
+
|
375
|
+
# load any transitive deps for the component into the library also
|
376
|
+
dep_software.dependencies.each do |dep|
|
377
|
+
recursively_load_dependency(dep, project, overrides, software_map)
|
378
|
+
end
|
379
|
+
|
380
|
+
project.library.component_added(dep_software)
|
381
|
+
end
|
306
382
|
end
|
307
383
|
end
|
384
|
+
|
385
|
+
# Sugars must be loaded after everything else has been registered
|
386
|
+
require 'omnibus/sugar'
|