omnibus 3.2.2 → 4.0.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +140 -10
- data/CHANGELOG.md +181 -8
- data/README.md +63 -35
- data/Rakefile +1 -1
- data/docs/omnibus-build-cache.md b/data/docs/Build → Cache.md +0 -0
- data/docs/Building on Debian.md +59 -0
- data/docs/Building on OSX.md +61 -35
- data/docs/Building on RHEL.md +74 -0
- data/docs/Building on Windows.md +40 -81
- data/features/commands/build.feature +1 -2
- data/features/commands/clean.feature +1 -1
- data/lib/omnibus.rb +111 -204
- data/lib/omnibus/build_version.rb +3 -20
- data/lib/omnibus/build_version_dsl.rb +2 -3
- data/lib/omnibus/builder.rb +103 -211
- data/lib/omnibus/cleaner.rb +5 -7
- data/lib/omnibus/cli.rb +1 -4
- data/lib/omnibus/cli/base.rb +9 -16
- data/lib/omnibus/compressor.rb +60 -0
- data/{spec/data/complicated/config/software/version-manifest.rb → lib/omnibus/compressors/base.rb} +17 -12
- data/lib/omnibus/compressors/dmg.rb +312 -0
- data/lib/omnibus/{null_builder.rb → compressors/null.rb} +10 -4
- data/lib/omnibus/compressors/tgz.rb +141 -0
- data/lib/omnibus/config.rb +89 -83
- data/lib/omnibus/core_extensions.rb +1 -0
- data/lib/omnibus/core_extensions/open_uri.rb +58 -0
- data/lib/omnibus/digestable.rb +9 -3
- data/lib/omnibus/exceptions.rb +116 -175
- data/lib/omnibus/fetcher.rb +97 -138
- data/lib/omnibus/fetchers/git_fetcher.rb +130 -165
- data/lib/omnibus/fetchers/net_fetcher.rb +205 -164
- data/lib/omnibus/fetchers/{s3_cache_fetcher.rb → null_fetcher.rb} +27 -17
- data/lib/omnibus/fetchers/path_fetcher.rb +74 -32
- data/lib/omnibus/file_syncer.rb +149 -0
- data/lib/omnibus/generator.rb +103 -32
- data/lib/omnibus/generator_files/.kitchen.yml.erb +5 -1
- data/lib/omnibus/generator_files/Gemfile.erb +13 -7
- data/lib/omnibus/generator_files/config/projects/project.rb.erb +28 -0
- data/lib/omnibus/generator_files/config/software/zlib.rb.erb +55 -0
- data/lib/omnibus/generator_files/omnibus.rb.erb +5 -7
- data/lib/omnibus/git_cache.rb +11 -13
- data/lib/omnibus/logger.rb +76 -22
- data/lib/omnibus/logging.rb +1 -1
- data/lib/omnibus/metadata.rb +264 -0
- data/lib/omnibus/ohai.rb +0 -51
- data/lib/omnibus/package.rb +4 -228
- data/lib/omnibus/packager.rb +71 -0
- data/lib/omnibus/packagers/base.rb +118 -176
- data/lib/omnibus/packagers/bff.rb +136 -0
- data/lib/omnibus/packagers/deb.rb +389 -0
- data/lib/omnibus/packagers/makeself.rb +114 -0
- data/lib/omnibus/packagers/msi.rb +346 -0
- data/lib/omnibus/packagers/pkg.rb +278 -0
- data/lib/omnibus/packagers/rpm.rb +438 -0
- data/lib/omnibus/packagers/solaris.rb +110 -0
- data/lib/omnibus/project.rb +263 -666
- data/lib/omnibus/publisher.rb +3 -3
- data/lib/omnibus/s3_cache.rb +21 -30
- data/lib/omnibus/software.rb +132 -271
- data/lib/omnibus/templating.rb +66 -0
- data/lib/omnibus/thread_pool.rb +109 -0
- data/lib/omnibus/util.rb +137 -15
- data/lib/omnibus/version.rb +1 -1
- data/omnibus.gemspec +2 -2
- data/resources/bff/gen.template.erb +22 -0
- data/resources/bff/postinstall.sh +0 -0
- data/resources/bff/unpostinstall.sh +0 -0
- data/resources/deb/conffiles.erb +3 -0
- data/resources/deb/control.erb +25 -0
- data/resources/deb/md5sums.erb +3 -0
- data/{lib/omnibus/generator_files/mac_dmg → resources/dmg}/background.png +0 -0
- data/resources/dmg/create_dmg.osascript.erb +17 -0
- data/{lib/omnibus/generator_files/mac_dmg → resources/dmg}/icon.png +0 -0
- data/{bin → resources/makeself}/makeself-header.sh +0 -0
- data/{bin → resources/makeself}/makeself.sh +0 -0
- data/{lib/omnibus/generator_files/package_scripts/makeselfinst.erb → resources/makeself/post_extract.sh.erb} +4 -4
- data/{lib/omnibus/generator_files/windows_msi → resources/msi}/assets/LICENSE.rtf +0 -0
- data/{lib/omnibus/generator_files/windows_msi → resources/msi}/assets/banner_background.bmp +0 -0
- data/{lib/omnibus/generator_files/windows_msi → resources/msi}/assets/dialog_background.bmp +0 -0
- data/{lib/omnibus/generator_files/windows_msi → resources/msi}/assets/project.ico +0 -0
- data/{lib/omnibus/generator_files/windows_msi → resources/msi}/assets/project_16x16.ico +0 -0
- data/{lib/omnibus/generator_files/windows_msi → resources/msi}/assets/project_32x32.ico +0 -0
- data/{spec/fixtures/sample/files/windows_msi/Resources/localization-en-us.wxl → resources/msi/localization-en-us.wxl.erb} +3 -4
- data/resources/msi/parameters.wxi.erb +9 -0
- data/{lib/omnibus/generator_files/windows_msi → resources/msi}/source.wxs.erb +14 -15
- data/{lib/omnibus/generator_files/mac_pkg → resources/pkg}/background.png +0 -0
- data/resources/pkg/distribution.xml.erb +21 -0
- data/resources/pkg/license.html.erb +3 -0
- data/resources/pkg/welcome.html.erb +7 -0
- data/resources/rpm/rpmmacros.erb +3 -0
- data/resources/rpm/signing.erb +40 -0
- data/resources/rpm/spec.erb +70 -0
- data/spec/functional/builder_spec.rb +90 -111
- data/spec/functional/fetchers/git_fetcher_spec.rb +130 -0
- data/spec/functional/fetchers/net_fetcher_spec.rb +110 -0
- data/spec/functional/fetchers/path_fetcher_spec.rb +97 -0
- data/spec/functional/file_syncer_spec.rb +206 -0
- data/spec/functional/templating_spec.rb +73 -0
- data/spec/spec_helper.rb +31 -94
- data/spec/support/env_helpers.rb +20 -0
- data/spec/support/examples.rb +56 -0
- data/spec/support/file_helpers.rb +46 -0
- data/spec/support/git_helpers.rb +107 -0
- data/spec/support/logging_helpers.rb +33 -0
- data/spec/support/matchers.rb +36 -0
- data/spec/support/ohai_helpers.rb +22 -0
- data/spec/support/path_helpers.rb +19 -0
- data/spec/support/shell_helpers.rb +14 -0
- data/spec/unit/build_version_dsl_spec.rb +0 -17
- data/spec/unit/build_version_spec.rb +1 -19
- data/spec/unit/builder_spec.rb +158 -46
- data/spec/unit/compressor_spec.rb +45 -0
- data/spec/unit/compressors/base_spec.rb +26 -0
- data/spec/unit/compressors/dmg_spec.rb +291 -0
- data/spec/unit/compressors/null_spec.rb +23 -0
- data/spec/unit/compressors/tgz_spec.rb +67 -0
- data/spec/unit/config_spec.rb +27 -34
- data/spec/unit/digestable_spec.rb +4 -4
- data/spec/unit/fetchers/git_fetcher_spec.rb +110 -39
- data/spec/unit/fetchers/net_fetcher_spec.rb +182 -72
- data/spec/unit/fetchers/path_fetcher_spec.rb +111 -0
- data/spec/unit/generator_spec.rb +137 -0
- data/spec/unit/git_cache_spec.rb +24 -34
- data/spec/unit/library_spec.rb +21 -82
- data/spec/unit/metadata_spec.rb +207 -0
- data/spec/unit/ohai_spec.rb +0 -7
- data/spec/unit/omnibus_spec.rb +41 -36
- data/spec/unit/package_spec.rb +1 -216
- data/spec/unit/packagers/base_spec.rb +76 -190
- data/spec/unit/packagers/bff_spec.rb +160 -0
- data/spec/unit/packagers/deb_spec.rb +324 -0
- data/spec/unit/packagers/makeself_spec.rb +80 -0
- data/spec/unit/packagers/msi_spec.rb +267 -0
- data/spec/unit/packagers/pkg_spec.rb +219 -0
- data/spec/unit/packagers/rpm_spec.rb +328 -0
- data/spec/unit/project_spec.rb +217 -80
- data/spec/unit/publisher_spec.rb +6 -2
- data/spec/unit/publishers/artifactory_publisher_spec.rb +1 -1
- data/spec/unit/publishers/s3_publisher_spec.rb +1 -1
- data/spec/unit/s3_cacher_spec.rb +22 -5
- data/spec/unit/software_spec.rb +89 -232
- data/spec/unit/util_spec.rb +188 -0
- metadata +159 -402
- data/features/commands/_deprecated.feature +0 -84
- data/lib/omnibus/cleanroom.rb +0 -141
- data/lib/omnibus/cli/deprecated.rb +0 -132
- data/lib/omnibus/generator_files/mac_pkg/license.html.erb +0 -1
- data/lib/omnibus/generator_files/mac_pkg/welcome.html.erb +0 -9
- data/lib/omnibus/generator_files/project.rb.erb +0 -20
- data/lib/omnibus/generator_files/software/c-example.rb.erb +0 -42
- data/lib/omnibus/generator_files/software/erlang-example.rb.erb +0 -38
- data/lib/omnibus/generator_files/software/ruby-example.rb.erb +0 -24
- data/lib/omnibus/generator_files/windows_msi/localization-en-us.wxl.erb +0 -20
- data/lib/omnibus/generator_files/windows_msi/parameters.wxi.erb +0 -9
- data/lib/omnibus/packagers/mac_dmg.rb +0 -235
- data/lib/omnibus/packagers/mac_pkg.rb +0 -176
- data/lib/omnibus/packagers/windows_msi.rb +0 -109
- data/spec/data/complicated/config/patches/bzip2/makefile_take_env_vars.patch +0 -15
- data/spec/data/complicated/config/patches/couchdb/patch_for_couchjs_stack.patch +0 -19
- data/spec/data/complicated/config/patches/gd/gd-2.0.33-configure-libpng.patch +0 -100
- data/spec/data/complicated/config/patches/keepalived/keepalived-1.2.9_opscode_centos_5.patch +0 -15
- data/spec/data/complicated/config/patches/libedit/freebsd-vi-fix.patch +0 -24
- data/spec/data/complicated/config/patches/libiconv/libiconv-1.14_srclib_stdio.in.h-remove-gets-declarations.patch +0 -29
- data/spec/data/complicated/config/patches/libwrap/tcp_wrappers-7.6-makefile-dest-fix.patch +0 -35
- data/spec/data/complicated/config/patches/libwrap/tcp_wrappers-7.6-malloc-fix.patch +0 -13
- data/spec/data/complicated/config/patches/libwrap/tcp_wrappers-7.6-shared_lib_plus_plus-1.patch +0 -1035
- data/spec/data/complicated/config/patches/logrotate/logrotate_basedir_override.patch +0 -12
- data/spec/data/complicated/config/patches/ncurses/ncurses-5.9-solaris-xopen_source_extended-detection.patch +0 -11
- data/spec/data/complicated/config/patches/ncurses/ncurses-clang.patch +0 -42
- data/spec/data/complicated/config/patches/ncurses/patch-aa +0 -23
- data/spec/data/complicated/config/patches/ncurses/patch-ab +0 -44
- data/spec/data/complicated/config/patches/ncurses/patch-ac +0 -40
- data/spec/data/complicated/config/patches/ncurses/patch-ad +0 -12
- data/spec/data/complicated/config/patches/ncurses/patch-aix-configure +0 -23
- data/spec/data/complicated/config/patches/ncurses/patch-cxx_cursesf.h +0 -22
- data/spec/data/complicated/config/patches/ncurses/patch-cxx_cursesm.h +0 -22
- data/spec/data/complicated/config/patches/nrpe/fix_for_runit.patch +0 -64
- data/spec/data/complicated/config/patches/openssl/openssl-1.0.1f-do-not-build-docs.patch +0 -101
- data/spec/data/complicated/config/patches/postgresql/postgresql-9.1.2-configure-ncurses-fix.patch +0 -12
- data/spec/data/complicated/config/patches/ruby/patch-configure +0 -103
- data/spec/data/complicated/config/patches/ruby/ruby-aix-configure.patch +0 -10
- data/spec/data/complicated/config/patches/ruby/ruby-openssl-1.0.1c.patch +0 -42
- data/spec/data/complicated/config/patches/ruby/ruby_aix_1_9_3_448_ssl_EAGAIN.patch +0 -57
- data/spec/data/complicated/config/patches/ruby/rvm-cflags.patch +0 -27
- data/spec/data/complicated/config/projects/angrychef.rb +0 -32
- data/spec/data/complicated/config/projects/chef-windows.rb +0 -32
- data/spec/data/complicated/config/projects/chef.rb +0 -32
- data/spec/data/complicated/config/projects/chefdk-windows.rb +0 -41
- data/spec/data/complicated/config/projects/chefdk.rb +0 -44
- data/spec/data/complicated/config/software/appbundler.rb +0 -25
- data/spec/data/complicated/config/software/autoconf.rb +0 -35
- data/spec/data/complicated/config/software/automake.rb +0 -39
- data/spec/data/complicated/config/software/berkshelf.rb +0 -44
- data/spec/data/complicated/config/software/bundler.rb +0 -25
- data/spec/data/complicated/config/software/bzip2.rb +0 -46
- data/spec/data/complicated/config/software/cacerts.rb +0 -44
- data/spec/data/complicated/config/software/chef-client-msi.rb +0 -87
- data/spec/data/complicated/config/software/chef-gem.rb +0 -26
- data/spec/data/complicated/config/software/chef-vault.rb +0 -43
- data/spec/data/complicated/config/software/chef-windows.rb +0 -158
- data/spec/data/complicated/config/software/chef.rb +0 -170
- data/spec/data/complicated/config/software/chefdk.rb +0 -103
- data/spec/data/complicated/config/software/couchdb.rb +0 -53
- data/spec/data/complicated/config/software/curl.rb +0 -48
- data/spec/data/complicated/config/software/erlang.rb +0 -65
- data/spec/data/complicated/config/software/expat.rb +0 -21
- data/spec/data/complicated/config/software/fcgi.rb +0 -56
- data/spec/data/complicated/config/software/fcgiwrap.rb +0 -41
- data/spec/data/complicated/config/software/gd.rb +0 -56
- data/spec/data/complicated/config/software/gdbm.rb +0 -40
- data/spec/data/complicated/config/software/gecode.rb +0 -48
- data/spec/data/complicated/config/software/git.rb +0 -40
- data/spec/data/complicated/config/software/help2man.rb +0 -30
- data/spec/data/complicated/config/software/icu.rb +0 -40
- data/spec/data/complicated/config/software/jre.rb +0 -48
- data/spec/data/complicated/config/software/keepalived.rb +0 -43
- data/spec/data/complicated/config/software/libarchive.rb +0 -50
- data/spec/data/complicated/config/software/libedit.rb +0 -69
- data/spec/data/complicated/config/software/libffi.rb +0 -71
- data/spec/data/complicated/config/software/libgcc.rb +0 -39
- data/spec/data/complicated/config/software/libiconv.rb +0 -55
- data/spec/data/complicated/config/software/libjpeg.rb +0 -39
- data/spec/data/complicated/config/software/libpng.rb +0 -38
- data/spec/data/complicated/config/software/libtool.rb +0 -52
- data/spec/data/complicated/config/software/libwrap.rb +0 -50
- data/spec/data/complicated/config/software/libxml2.rb +0 -51
- data/spec/data/complicated/config/software/libxslt.rb +0 -52
- data/spec/data/complicated/config/software/libyaml-windows.rb +0 -43
- data/spec/data/complicated/config/software/libyaml.rb +0 -62
- data/spec/data/complicated/config/software/logrotate.rb +0 -41
- data/spec/data/complicated/config/software/makedepend.rb +0 -73
- data/spec/data/complicated/config/software/mysql2.rb +0 -42
- data/spec/data/complicated/config/software/nagios-plugins.rb +0 -53
- data/spec/data/complicated/config/software/nagios.rb +0 -66
- data/spec/data/complicated/config/software/ncurses.rb +0 -149
- data/spec/data/complicated/config/software/nginx.rb +0 -40
- data/spec/data/complicated/config/software/nodejs.rb +0 -44
- data/spec/data/complicated/config/software/nokogiri.rb +0 -55
- data/spec/data/complicated/config/software/nrpe.rb +0 -61
- data/spec/data/complicated/config/software/ohai.rb +0 -64
- data/spec/data/complicated/config/software/omnibus-ctl.rb +0 -34
- data/spec/data/complicated/config/software/openresty.rb +0 -67
- data/spec/data/complicated/config/software/openssl.rb +0 -158
- data/spec/data/complicated/config/software/pcre.rb +0 -42
- data/spec/data/complicated/config/software/perl-extutils-embed.rb +0 -15
- data/spec/data/complicated/config/software/perl-extutils-makemaker.rb +0 -15
- data/spec/data/complicated/config/software/perl.rb +0 -48
- data/spec/data/complicated/config/software/perl_pg_driver.rb +0 -12
- data/spec/data/complicated/config/software/php.rb +0 -41
- data/spec/data/complicated/config/software/pip.rb +0 -30
- data/spec/data/complicated/config/software/pkg-config.rb +0 -66
- data/spec/data/complicated/config/software/popt.rb +0 -47
- data/spec/data/complicated/config/software/postgresql.rb +0 -51
- data/spec/data/complicated/config/software/preparation.rb +0 -30
- data/spec/data/complicated/config/software/pygments.rb +0 -25
- data/spec/data/complicated/config/software/python.rb +0 -49
- data/spec/data/complicated/config/software/rabbitmq.rb +0 -36
- data/spec/data/complicated/config/software/rebar.rb +0 -36
- data/spec/data/complicated/config/software/redis.rb +0 -33
- data/spec/data/complicated/config/software/rsync.rb +0 -48
- data/spec/data/complicated/config/software/ruby-windows-devkit.rb +0 -30
- data/spec/data/complicated/config/software/ruby-windows.rb +0 -30
- data/spec/data/complicated/config/software/ruby.rb +0 -162
- data/spec/data/complicated/config/software/rubygems-customization.rb +0 -57
- data/spec/data/complicated/config/software/rubygems.rb +0 -37
- data/spec/data/complicated/config/software/runit.rb +0 -118
- data/spec/data/complicated/config/software/server-jre.rb +0 -46
- data/spec/data/complicated/config/software/setuptools.rb +0 -30
- data/spec/data/complicated/config/software/spawn-fcgi.rb +0 -40
- data/spec/data/complicated/config/software/sphinx.rb +0 -26
- data/spec/data/complicated/config/software/spidermonkey.rb +0 -60
- data/spec/data/complicated/config/software/sqitch.rb +0 -24
- data/spec/data/complicated/config/software/test-kitchen.rb +0 -39
- data/spec/data/complicated/config/software/unicorn.rb +0 -27
- data/spec/data/complicated/config/software/util-macros.rb +0 -46
- data/spec/data/complicated/config/software/xproto.rb +0 -46
- data/spec/data/complicated/config/software/yajl.rb +0 -30
- data/spec/data/complicated/config/software/zlib.rb +0 -67
- data/spec/data/overrides/bad_line.overrides +0 -3
- data/spec/data/overrides/good.overrides +0 -5
- data/spec/data/overrides/with_dupes.overrides +0 -4
- data/spec/data/projects/chefdk.rb +0 -41
- data/spec/data/projects/sample.rb +0 -13
- data/spec/data/software/erchef.rb +0 -42
- data/spec/data/software/zlib.rb +0 -67
- data/spec/fixtures/sample/files/mac_dmg/Resources/background.png +0 -0
- data/spec/fixtures/sample/files/mac_dmg/Resources/icon.png +0 -0
- data/spec/fixtures/sample/files/mac_pkg/Resources/background.png +0 -0
- data/spec/fixtures/sample/files/mac_pkg/Resources/license.html +0 -1
- data/spec/fixtures/sample/files/mac_pkg/Resources/welcome.html +0 -9
- data/spec/fixtures/sample/files/windows_msi/Resources/assets/LICENSE.rtf +0 -8
- 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/parameters.wxi.erb +0 -9
- data/spec/fixtures/sample/files/windows_msi/Resources/source.wxs +0 -74
- data/spec/integration/packagers/mac_spec.rb +0 -58
- data/spec/integration/packagers/windows_spec.rb +0 -70
- data/spec/unit/packagers/mac_pkg_spec.rb +0 -151
data/Rakefile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
2
|
|
3
3
|
require 'rspec/core/rake_task'
|
4
|
-
[:unit, :functional
|
4
|
+
[:unit, :functional].each do |type|
|
5
5
|
RSpec::Core::RakeTask.new(type) do |t|
|
6
6
|
t.pattern = "spec/#{type}/**/*_spec.rb"
|
7
7
|
t.rspec_opts = [].tap do |a|
|
File without changes
|
@@ -0,0 +1,59 @@
|
|
1
|
+
Building Omnibus Packages for Debian
|
2
|
+
====================================
|
3
|
+
This document details the steps and configurables for building DEB packages with Omnibus.
|
4
|
+
|
5
|
+
|
6
|
+
Building a .deb
|
7
|
+
---------------
|
8
|
+
### Requirements
|
9
|
+
Omnibus assumes the existence of the `fakeroot` and `dpkg-deb` command on the build system. The [omnibus cookbook](https://supermarket.getchef.com/cookbooks/omnibus) automatically handles this installation. If you are not using the Omnibus cookbook, you must install these packages manually or using another tool.
|
10
|
+
|
11
|
+
### Configurables
|
12
|
+
A number of project configuration values are taken into consideration for building Debian packages. These options are further described in the [`Project` documentation](http://rubydoc.info/github/opscode/omnibus/Omnibus/Project).
|
13
|
+
|
14
|
+
These values are interpolated and evaluated using Omnibus' internal DEB templates. For 99% of users, these templates should be satisfactory. If you encounter an instance where Omnibus' ERB templates do not satisfy a use case, please open an issue.
|
15
|
+
|
16
|
+
Because of the unlikelihood of their necessity, Omnibus does not generate deb-related assets. If you find yourself in a situation where you need to generate highly-customized DEB assets, run the Omnibus generator command with the `--deb-assets` flag:
|
17
|
+
|
18
|
+
$ omnibus generate NAME --deb-assets
|
19
|
+
|
20
|
+
**If this is an existing project, be sure to answer "NO" when asked if you want to overwrite existing files!**
|
21
|
+
|
22
|
+
With the `--deb-assets` flag, Omnibus will generate the following "stock" resources in `resources/NAME/deb`:
|
23
|
+
|
24
|
+
- `conffiles.erb` - the list of configuration files
|
25
|
+
- `control.erb` - the Debian spec file
|
26
|
+
- `md5sums.erb` - the ERB for generating the list of file checksums
|
27
|
+
|
28
|
+
**You should only generate the DEB assets if you cannot set values using attributes!**
|
29
|
+
|
30
|
+
### DSL
|
31
|
+
You can further customize the behavior of the packager using the `package` DSL command in your project definition:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
# project.rb
|
35
|
+
name 'hamlet'
|
36
|
+
|
37
|
+
package :deb do
|
38
|
+
vendor 'Company <company@example.com>'
|
39
|
+
license 'Apache 2.0'
|
40
|
+
priority 'extra'
|
41
|
+
section 'databases'
|
42
|
+
end
|
43
|
+
```
|
44
|
+
|
45
|
+
Some DSL methods available include:
|
46
|
+
|
47
|
+
| DSL Method | Description |
|
48
|
+
| :------------------: | --------------------------------------------|
|
49
|
+
| `vendor` | The name of the package producer |
|
50
|
+
| `license` | The default license for the package |
|
51
|
+
| `priority` | The priority for the package |
|
52
|
+
| `section` | The section for this package |
|
53
|
+
|
54
|
+
If you are unfamilar with any of these terms, you should just accept the defaults. For more information on the purpose of any of these configuration options, please see the DEB spec.
|
55
|
+
|
56
|
+
For more information, please see the [`Packager::DEB` documentation](http://rubydoc.info/github/opscode/omnibus/Omnibus/Packager/DEB).
|
57
|
+
|
58
|
+
### Notes on DEB-signing
|
59
|
+
At this time, signing Debian packages is not supported.
|
data/docs/Building on OSX.md
CHANGED
@@ -1,45 +1,65 @@
|
|
1
|
-
Building Omnibus Packages for Mac
|
2
|
-
|
3
|
-
This document details the steps and configurables for building omnibus packages
|
4
|
-
on Mac OSX. Unlike Linux-based systems, the process for building a `.pkg` and
|
5
|
-
a `.dmg` requires some manual preparation of assets.
|
1
|
+
Building Omnibus Packages for Mac OS X
|
2
|
+
======================================
|
3
|
+
This document details the steps and configurables for building omnibus packages on Mac OS X. Unlike Linux-based systems, the process for building a `.pkg` (and compressing with `.dmg`) may involve the customization of some assets.
|
6
4
|
|
7
5
|
|
8
6
|
Building a .pkg
|
9
7
|
---------------
|
10
|
-
In Mac
|
11
|
-
contains the set of instructions for installating a piece of software on a
|
12
|
-
target system.
|
8
|
+
In Mac OS X, a `.pkg` is a special file that is read by Installer.app that contains the set of instructions for installating a piece of software on a target system.
|
13
9
|
|
14
10
|
### Requirements
|
15
|
-
|
11
|
+
By default, Omnibus does not generate pkg-related assets. To generate the pkg assets, run the Omnibus generator command with the `--pkg-assets` flag:
|
12
|
+
|
13
|
+
$ omnibus generate NAME --pkg-assets
|
14
|
+
|
15
|
+
**If this is an existing project, be sure to answer "NO" when asked if you want to overwrite existing files!**
|
16
|
+
|
17
|
+
With the `--pkg-assets` flag, Omnibus will generate the following "stock" resources in `resources/NAME/pkg`:
|
16
18
|
|
17
19
|
- `background.png` - the background image for the installer. We recommend this
|
18
20
|
image has a light background color (otherwise, the text will be difficult to
|
19
21
|
read).
|
20
|
-
- `
|
21
|
-
- `
|
22
|
+
- `distribution.xml.erb` - the XML file for use during the `productbuild` command
|
23
|
+
- `license.html.erb` - the full HTML document for the license
|
24
|
+
- `welcome.html.erb` - the full HTML document for the welcome screen
|
25
|
+
|
26
|
+
You should use these stock files and templates as a starting point for building your custom pkg.
|
27
|
+
|
28
|
+
### DSL
|
29
|
+
By default, Omnibus will try to build a pkg package when executed on a Mac OS X operating system. You can further customize the behavior of the packager using the `package` DSL command in your project definition:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
# project.rb
|
33
|
+
name 'hamlet'
|
34
|
+
|
35
|
+
package :pkg do
|
36
|
+
identifier 'com.getchef.hamlet'
|
37
|
+
signing_identity 'acbd1234'
|
38
|
+
end
|
39
|
+
```
|
22
40
|
|
23
|
-
|
24
|
-
|
41
|
+
Some DSL methods available include:
|
42
|
+
|
43
|
+
| DSL Method | Description |
|
44
|
+
| :----------------: | --------------------------------------------|
|
45
|
+
| `identifier` | The `com.whatever` id for the package |
|
46
|
+
| `signing_identity` | The key to sign the PKG with |
|
47
|
+
|
48
|
+
For more information, please see the [`Packager::PKG` documentation](http://rubydoc.info/github/opscode/omnibus/Omnibus/Packager/PKG).
|
25
49
|
|
26
50
|
|
27
51
|
Building a .dmg
|
28
52
|
---------------
|
29
|
-
In Mac OSX, a `.dmg` is a compressed wrapper around a collection of resources,
|
30
|
-
often including a `.pkg`. The possibilities for creating and customizing a DMG
|
31
|
-
are endless, but Omnibus provides a "basic" starter case that will generate a
|
32
|
-
pretty DMG that contains the `.pkg` file it creates.
|
53
|
+
In Mac OSX, a `.dmg` is a compressed wrapper around a collection of resources, often including a `.pkg`. The possibilities for creating and customizing a DMG are endless, but Omnibus provides a"basic starter case that will generate a pretty DMG that contains the `.pkg` file it creates.
|
33
54
|
|
34
|
-
|
55
|
+
### Requirements
|
56
|
+
By default, Omnibus does not generate dmg-related assets. To generate the dmg assets, run the Omnibus generator with the `--dmg-assets` flag:
|
35
57
|
|
36
|
-
|
37
|
-
DMG
|
38
|
-
- `dmg_pkg_position` - the (x,y) coordinate for the `.pkg` file inside the
|
39
|
-
opened DMG window
|
58
|
+
$ omnibus generate NAME --dmg-assets
|
40
59
|
|
41
|
-
|
42
|
-
|
60
|
+
**If this is an existing project, be sure to answer "NO" when asked if you want to overwrite existing files!**
|
61
|
+
|
62
|
+
With the `--dmg-assets` flag, Omnibus will generate the following "stock" resources in `resources/NAME/dmg`:
|
43
63
|
|
44
64
|
- `background.png` - the background image to use for the DMG. We recommend using
|
45
65
|
a high-resolution image that is slightly larger than the final length of your
|
@@ -47,20 +67,26 @@ window (as determined by the `dmg_window_bounds`)
|
|
47
67
|
- `icon.png` - a 1024x1024 @ 300 icon to use for the DMG. We will automatically
|
48
68
|
create an icns and scale to smaller sizes
|
49
69
|
|
50
|
-
You should use these stock files and templates as a starting point for building
|
51
|
-
your custom dmg.
|
70
|
+
You should use these stock files and templates as a starting point for building your custom dmg.
|
52
71
|
|
53
|
-
###
|
54
|
-
|
55
|
-
the `build_dmg` omnibus configuration option to false:
|
72
|
+
### DSL
|
73
|
+
By default, Omnibus will **not** try to build a compressed dmg. You can enable this compression using the `compress` DSL command in your project definition:
|
56
74
|
|
57
75
|
```ruby
|
58
|
-
#
|
59
|
-
|
76
|
+
# project.rb
|
77
|
+
name 'hamlet'
|
78
|
+
|
79
|
+
compress :dmg do
|
80
|
+
window_bounds '200, 200, 750, 600'
|
81
|
+
pkg_position '10, 10'
|
82
|
+
end
|
60
83
|
```
|
61
84
|
|
62
|
-
|
85
|
+
Some DSL methods available include:
|
63
86
|
|
64
|
-
|
65
|
-
|
66
|
-
|
87
|
+
| DSL Method | Description |
|
88
|
+
| :----------------: | --------------------------------------------|
|
89
|
+
| `window_bounds` | The size and location of the DMG window |
|
90
|
+
| `pkg_position` | The position of the pkg inside the DMG |
|
91
|
+
|
92
|
+
For more information, please see the [`Compressor::DMG` documentation](http://rubydoc.info/github/opscode/omnibus/Omnibus/Compressor/DMG).
|
@@ -0,0 +1,74 @@
|
|
1
|
+
Building Omnibus Packages for RHEL
|
2
|
+
==================================
|
3
|
+
This document details the steps and configurables for building RPM packages with Omnibus.
|
4
|
+
|
5
|
+
|
6
|
+
Building a .rpm
|
7
|
+
---------------
|
8
|
+
### Requirements
|
9
|
+
Omnibus assumes the existence of the `rpmbuild` command on the build system. The [omnibus cookbook](https://supermarket.getchef.com/cookbooks/omnibus) automatically handles this installation. If you are not using the Omnibus cookbook, you must install the package manually or using another tool.
|
10
|
+
|
11
|
+
### Configurables
|
12
|
+
The following Project values are taken into consideration when building RPMs:
|
13
|
+
|
14
|
+
- `build_version`
|
15
|
+
- `config_file`
|
16
|
+
- `conflicts`
|
17
|
+
- `description`
|
18
|
+
- `exclude`
|
19
|
+
- `extra_package_files`
|
20
|
+
- `iteration`
|
21
|
+
- `maintainer`
|
22
|
+
- `package_user`
|
23
|
+
- `package_group`
|
24
|
+
- `package_scripts_path`
|
25
|
+
- `replaces`
|
26
|
+
- `runtime_dependency`
|
27
|
+
- `url`
|
28
|
+
|
29
|
+
These options are further described in the [`Project` documentation](http://rubydoc.info/github/opscode/omnibus/Omnibus/Project).
|
30
|
+
|
31
|
+
These values are interpolated and evaluated using Omnibus' internal RPM templates. For 99% of users, these templates should be satisfactory. If you encounter an instance where Omnibus' RPM templates do not satisfy a use case, please open an issue.
|
32
|
+
|
33
|
+
Because of the unlikelihood of their necessity, Omnibus does not generate rpm-related assets. If you find yourself in a situation where you need to generate highly-customized RPM assets, run the Omnibus generator command with the `--rpm-assets` flag:
|
34
|
+
|
35
|
+
$ omnibus generate NAME --rpm-assets
|
36
|
+
|
37
|
+
**If this is an existing project, be sure to answer "NO" when asked if you want to overwrite existing files!**
|
38
|
+
|
39
|
+
With the `--rpm-assets` flag, Omnibus will generate the following "stock" resources in `resources/NAME/rpm`:
|
40
|
+
|
41
|
+
- `rpmmacros.erb` - the macros file
|
42
|
+
- `signing.erb` - a Ruby script for signing RPMs
|
43
|
+
- `spec.erb` - the ERB for generating the spec
|
44
|
+
|
45
|
+
**You should only generate the RPM assets if you cannot set values using attributes!**
|
46
|
+
|
47
|
+
### DSL
|
48
|
+
You can further customize the behavior of the packager using the `package` DSL command in your project definition:
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
# project.rb
|
52
|
+
name 'hamlet'
|
53
|
+
|
54
|
+
package :rpm do
|
55
|
+
signing_passphrase 'acbd1234'
|
56
|
+
end
|
57
|
+
```
|
58
|
+
|
59
|
+
Some DSL methods available include:
|
60
|
+
|
61
|
+
| DSL Method | Description |
|
62
|
+
| :------------------: | --------------------------------------------|
|
63
|
+
| `signing_passphrase` | The passphrase to sign the RPM with |
|
64
|
+
| `vendor` | The name of the package producer |
|
65
|
+
| `license` | The default license for the package |
|
66
|
+
| `priority` | The priority for the package |
|
67
|
+
| `catetory` | The catetory for this package |
|
68
|
+
|
69
|
+
If you are unfamilar with any of these terms, you should just accept the defaults. For more information on the purpose of any of these configuration options, please see the RPM spec.
|
70
|
+
|
71
|
+
For more information, please see the [`Packager::RPM` documentation](http://rubydoc.info/github/opscode/omnibus/Omnibus/Packager/RPM).
|
72
|
+
|
73
|
+
### Notes on RPM-signing
|
74
|
+
To sign an RPM, you will need a GPG keypair. You can [create your own signing key](http://www.madboa.com/geek/gpg-quickstart/) or [import an existing one](http://irtfweb.ifa.hawaii.edu/~lockhart/gpg/gpg-cs.html). Omnibus automatically generates an `.rpmmacros` config file for `rpmbuild` that assumes that the real name associated to the GPG key is the same as the name of the project maintainer as specified in your Omnibus config. You can override this by creating your own `.rpmmacros` using the steps above.
|
data/docs/Building on Windows.md
CHANGED
@@ -1,98 +1,57 @@
|
|
1
1
|
Building Omnibus Packages for Windows
|
2
2
|
=====================================
|
3
|
-
This document
|
4
|
-
omnibus packages on Windows. Omnibus builds MSI packages on Windows systems.
|
3
|
+
This document details the steps and configurables for building omnibus packages on Windows. Unlike Linux-based systems, the process for building an `.msi` may involve the customization of some assets.
|
5
4
|
|
6
|
-
Requirements
|
7
|
-
------------
|
8
|
-
In order to build an omnibus package on Windows you need:
|
9
5
|
|
10
|
-
|
11
|
-
* In order to use built in semantic versioning:
|
12
|
-
[Git for Windows](http://msysgit.github.io/)
|
13
|
-
|
14
|
-
MSI Source Files
|
6
|
+
Building an .msi
|
15
7
|
----------------
|
16
|
-
In
|
17
|
-
can be used by WIX toolset to be able to build the MSI. Omnibus creates some
|
18
|
-
skeletal MSI source files for you to help you get started.
|
8
|
+
In Windows, an `.msi` is a special executable that contains the set of instructions for installating a piece of software on a target system. Please note, Omnibus does not support the creation of `.exe` files.
|
19
9
|
|
20
|
-
|
21
|
-
|
10
|
+
### Requirements
|
11
|
+
By default, Omnibus does not generate msi-related assets. To generate the msi assets, run the Omnibus generator command with the `--msi-assets` flag:
|
22
12
|
|
23
|
-
|
24
|
-
C:\> omnibus project demo
|
25
|
-
...
|
26
|
-
create omnibus-demo/files/windows_msi/Resources/localization-en-us.wxl.erb
|
27
|
-
create omnibus-demo/files/windows_msi/Resources/parameters.wxi.erb
|
28
|
-
create omnibus-demo/files/windows_msi/Resources/source.wxs
|
29
|
-
create omnibus-demo/files/windows_msi/Resources/assets/LICENSE.rtf
|
30
|
-
create omnibus-demo/files/windows_msi/Resources/assets/banner_background.bmp
|
31
|
-
create omnibus-demo/files/windows_msi/Resources/assets/dialog_background.bmp
|
32
|
-
create omnibus-demo/files/windows_msi/Resources/assets/project.ico
|
33
|
-
create omnibus-demo/files/windows_msi/Resources/assets/project_16x16.ico
|
34
|
-
create omnibus-demo/files/windows_msi/Resources/assets/project_32x32.ico
|
35
|
-
...
|
36
|
-
```
|
37
|
-
- `localization-en-us.wxl.erb` => File that contains the strings that are being
|
38
|
-
used in the MSI user interface.
|
39
|
-
- `parameters.wxi.erb` => File that contains the dynamic information needed for
|
40
|
-
the MSI e.g. version numbers.
|
41
|
-
- `assets/LICENSE.rtf` => License text in Rich Text Format that is displayed
|
42
|
-
during MSI installation.
|
43
|
-
- `assets/*.bmp` => Bitmaps that are displayed during installation.
|
44
|
-
- `assets/*.ico` => Icons that are used in the system for your application.
|
45
|
-
|
46
|
-
Omnibus requires `wxl`, `wxs` and `wxi` files to be present on the system in
|
47
|
-
order to build an MSI. You can also create these files as erb templates and
|
48
|
-
omnibus will render them before starting building the MSI.
|
49
|
-
|
50
|
-
These files are XML files that are created based on Windows WIX Schema. By
|
51
|
-
default they will package the files under configured `install_dir` and present
|
52
|
-
a UI that lets users to choose an installation location for the packaged files.
|
53
|
-
You can modify these XML files based on the documentation
|
54
|
-
[here](http://wixtoolset.org/documentation/manual/v3/xsd/).
|
55
|
-
|
56
|
-
Configurables
|
57
|
-
-------------
|
58
|
-
You can use `msi_parameters` DSL option in your Omnibus project files to pass
|
59
|
-
dynamic information to your MSI source templates. You can specify a hash or a
|
60
|
-
block for this option. When block is specified, it is executed at the time of
|
61
|
-
rendering and it is expected to return a hash. Here is an example:
|
13
|
+
$ omnibus generate NAME --msi-assets
|
62
14
|
|
63
|
-
|
64
|
-
# config/projects/my_project.rb
|
65
|
-
name 'my_project'
|
15
|
+
**If this is an existing project, be sure to answer "NO" when asked if you want to overwrite existing files!**
|
66
16
|
|
67
|
-
|
17
|
+
With the `--msi-assets` flag, Omnibus will generate the following "stock" resources in `resources/NAME/msi`:
|
68
18
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
19
|
+
- `localization-en-us.wxl.erb` => File that contains the strings that are being used in the MSI user interface
|
20
|
+
- `parameters.wxi.erb` => File that contains the dynamic information needed for the MSI e.g. version numbers
|
21
|
+
- `assets/LICENSE.rtf` => License text in Rich Text Format that is displayed during MSI installation
|
22
|
+
- `assets/*.bmp` => Bitmaps that are displayed during installation
|
23
|
+
- `assets/*.ico` => Icons that are used in the system for your application
|
24
|
+
|
25
|
+
You should use these stock files and templates as a starting point for building your custom msi.
|
76
26
|
|
77
|
-
|
78
|
-
<!-- files/windows_msi/Resources/parameters.wxi.erb -->
|
27
|
+
These files are XML files that are created based on Windows WIX Schema. By default they will package the files under configured `install_dir` and present a UI that lets users to choose an installation location for the packaged files. You can modify these XML files based on the [WIX documentation](http://wixtoolset.org/documentation/manual/v3/xsd/).
|
79
28
|
|
80
|
-
|
81
|
-
|
82
|
-
<!--
|
83
|
-
Versioning. These have to be changed for upgrades.
|
84
|
-
-->
|
85
|
-
<?define VersionNumber="<%= @msi_version %>" ?>
|
86
|
-
<?define DisplayVersionNumber="<%= @msi_display_version %>" ?>
|
29
|
+
### DSL
|
30
|
+
By default, Omnibus will try to build an msi package when executed on a Windows operating system. You can further customize the behavior of the packager using the `package` DSL command in your project definition:
|
87
31
|
|
88
|
-
|
89
|
-
|
32
|
+
```ruby
|
33
|
+
# project.rb
|
34
|
+
name 'hamlet'
|
35
|
+
|
36
|
+
package :msi do
|
37
|
+
upgrade_code '2CD7259C-776D-4DDB-A4C8-6E544E580AA1'
|
38
|
+
parameters {
|
39
|
+
'KeyThing' => 'ValueThing'
|
40
|
+
}
|
41
|
+
end
|
90
42
|
```
|
91
43
|
|
92
|
-
|
93
|
-
------------
|
94
|
-
To create an MSI you would normally run:
|
44
|
+
Note that `upgrade_code` is **required** and will raise an exception if not defined! Once set, this value must persist for all future versions of your package. To generate a GUID in Ruby, run the following command:
|
95
45
|
|
46
|
+
```bash
|
47
|
+
ruby -r securerandom -e "puts SecureRandom.uuid"
|
96
48
|
```
|
97
|
-
|
98
|
-
|
49
|
+
|
50
|
+
Some DSL methods available include:
|
51
|
+
|
52
|
+
| DSL Method | Description |
|
53
|
+
| :----------------: | ------------------------------------------------|
|
54
|
+
| **`upgrade_code`** | The unique GUID for this package |
|
55
|
+
| `parameters` | And arbirtary list of key-value pairs to render |
|
56
|
+
|
57
|
+
For more information, please see the [`Packager::MSI` documentation](http://rubydoc.info/github/opscode/omnibus/Omnibus/Packager/MSI).
|
data/lib/omnibus.rb
CHANGED
@@ -14,6 +14,9 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
+
require 'omnibus/core_extensions'
|
18
|
+
|
19
|
+
require 'cleanroom'
|
17
20
|
require 'pathname'
|
18
21
|
require 'json'
|
19
22
|
|
@@ -32,11 +35,12 @@ module Omnibus
|
|
32
35
|
autoload :BuildVersion, 'omnibus/build_version'
|
33
36
|
autoload :BuildVersionDSL, 'omnibus/build_version_dsl'
|
34
37
|
autoload :Cleaner, 'omnibus/cleaner'
|
35
|
-
autoload :
|
38
|
+
autoload :Compressor, 'omnibus/compressor'
|
36
39
|
autoload :Config, 'omnibus/config'
|
37
40
|
autoload :Digestable, 'omnibus/digestable'
|
38
41
|
autoload :Error, 'omnibus/exceptions'
|
39
42
|
autoload :Fetcher, 'omnibus/fetcher'
|
43
|
+
autoload :FileSyncer, 'omnibus/file_syncer'
|
40
44
|
autoload :Generator, 'omnibus/generator'
|
41
45
|
autoload :GitCache, 'omnibus/git_cache'
|
42
46
|
autoload :HealthCheck, 'omnibus/health_check'
|
@@ -44,25 +48,25 @@ module Omnibus
|
|
44
48
|
autoload :Library, 'omnibus/library'
|
45
49
|
autoload :Logger, 'omnibus/logger'
|
46
50
|
autoload :Logging, 'omnibus/logging'
|
51
|
+
autoload :Metadata, 'omnibus/metadata'
|
47
52
|
autoload :NullArgumentable, 'omnibus/null_argumentable'
|
48
|
-
autoload :NullBuilder, 'omnibus/null_builder'
|
49
53
|
autoload :Ohai, 'omnibus/ohai'
|
50
54
|
autoload :Package, 'omnibus/package'
|
55
|
+
autoload :Packager, 'omnibus/packager'
|
51
56
|
autoload :Project, 'omnibus/project'
|
52
57
|
autoload :Publisher, 'omnibus/publisher'
|
53
58
|
autoload :Reports, 'omnibus/reports'
|
54
59
|
autoload :S3Cache, 'omnibus/s3_cache'
|
55
60
|
autoload :Software, 'omnibus/software'
|
56
61
|
autoload :Sugarable, 'omnibus/sugarable'
|
62
|
+
autoload :Templating, 'omnibus/templating'
|
63
|
+
autoload :ThreadPool, 'omnibus/thread_pool'
|
57
64
|
autoload :Util, 'omnibus/util'
|
58
65
|
|
59
|
-
|
60
|
-
autoload :
|
61
|
-
|
62
|
-
autoload :
|
63
|
-
autoload :NetFetcher, 'omnibus/fetchers/net_fetcher'
|
64
|
-
autoload :PathFetcher, 'omnibus/fetchers/path_fetcher'
|
65
|
-
autoload :S3CacheFetcher, 'omnibus/fetchers/s3_cache_fetcher'
|
66
|
+
autoload :GitFetcher, 'omnibus/fetchers/git_fetcher'
|
67
|
+
autoload :NetFetcher, 'omnibus/fetchers/net_fetcher'
|
68
|
+
autoload :NullFetcher, 'omnibus/fetchers/null_fetcher'
|
69
|
+
autoload :PathFetcher, 'omnibus/fetchers/path_fetcher'
|
66
70
|
|
67
71
|
autoload :ArtifactoryPublisher, 'omnibus/publishers/artifactory_publisher'
|
68
72
|
autoload :NullPublisher, 'omnibus/publishers/null_publisher'
|
@@ -74,13 +78,6 @@ module Omnibus
|
|
74
78
|
autoload :Publish, 'omnibus/cli/publish'
|
75
79
|
end
|
76
80
|
|
77
|
-
module Packager
|
78
|
-
autoload :Base, 'omnibus/packagers/base'
|
79
|
-
autoload :MacDmg, 'omnibus/packagers/mac_dmg'
|
80
|
-
autoload :MacPkg, 'omnibus/packagers/mac_pkg'
|
81
|
-
autoload :WindowsMsi, 'omnibus/packagers/windows_msi'
|
82
|
-
end
|
83
|
-
|
84
81
|
class << self
|
85
82
|
#
|
86
83
|
# Reset the current Omnibus configuration. This is primary an internal API
|
@@ -138,36 +135,34 @@ module Omnibus
|
|
138
135
|
@ui ||= Thor::Base.shell.new
|
139
136
|
end
|
140
137
|
|
141
|
-
# Convenience method for access to the {Config} object.
|
142
|
-
# Provided for backward compatibility.
|
143
138
|
#
|
144
|
-
# @return [Config]
|
145
|
-
#
|
146
|
-
# @deprecated Just refer to {Config} directly.
|
147
|
-
def config
|
148
|
-
Omnibus.logger.deprecated('Omnibus') do
|
149
|
-
'Omnibus.config. Please use Config.(thing) instead.'
|
150
|
-
end
|
151
|
-
|
152
|
-
Config
|
153
|
-
end
|
154
|
-
|
155
139
|
# Load in an Omnibus configuration file. Values will be merged with
|
156
140
|
# and override the defaults defined in {Config}.
|
157
141
|
#
|
158
142
|
# @param [String] file path to a configuration file to load
|
159
143
|
#
|
160
144
|
# @return [void]
|
145
|
+
#
|
161
146
|
def load_configuration(file)
|
162
147
|
Config.load(file)
|
163
148
|
end
|
164
149
|
|
165
|
-
# Processes the configuration to construct the dependency tree of
|
166
|
-
# projects and software.
|
167
150
|
#
|
168
|
-
#
|
169
|
-
|
170
|
-
|
151
|
+
# Locate an executable in the current $PATH.
|
152
|
+
#
|
153
|
+
# @return [String, nil]
|
154
|
+
# the path to the executable, or +nil+ if not present
|
155
|
+
#
|
156
|
+
def which(executable)
|
157
|
+
if File.file?(executable) && File.executable?(executable)
|
158
|
+
executable
|
159
|
+
elsif ENV['PATH']
|
160
|
+
path = ENV['PATH'].split(File::PATH_SEPARATOR).find do |path|
|
161
|
+
File.executable?(File.join(path, executable))
|
162
|
+
end
|
163
|
+
|
164
|
+
path && File.expand_path(executable, path)
|
165
|
+
end
|
171
166
|
end
|
172
167
|
|
173
168
|
#
|
@@ -176,7 +171,9 @@ module Omnibus
|
|
176
171
|
# @return [Array<:Project>]
|
177
172
|
#
|
178
173
|
def projects
|
179
|
-
|
174
|
+
project_map.map do |name, _|
|
175
|
+
Project.load(name)
|
176
|
+
end
|
180
177
|
end
|
181
178
|
|
182
179
|
#
|
@@ -188,165 +185,122 @@ module Omnibus
|
|
188
185
|
# @return [Project]
|
189
186
|
#
|
190
187
|
def project(name)
|
191
|
-
|
188
|
+
Project.load(name)
|
192
189
|
end
|
193
190
|
|
194
191
|
#
|
195
|
-
# The
|
196
|
-
#
|
197
|
-
# @deprecated Use {Config.project_root} instead.
|
192
|
+
# The source root is the path to the root directory of the `omnibus` gem.
|
198
193
|
#
|
199
|
-
# @return [
|
194
|
+
# @return [Pathname]
|
200
195
|
#
|
201
|
-
def
|
202
|
-
|
203
|
-
'Omnibus.project_root. Please use Config.project_root instead.'
|
204
|
-
end
|
205
|
-
|
206
|
-
Config.project_root
|
196
|
+
def source_root
|
197
|
+
@source_root ||= Pathname.new(File.expand_path('../..', __FILE__))
|
207
198
|
end
|
208
199
|
|
209
200
|
#
|
210
|
-
#
|
201
|
+
# The preferred filepath to a project with the given name on disk.
|
211
202
|
#
|
212
|
-
# @
|
203
|
+
# @return [String, nil]
|
213
204
|
#
|
214
|
-
|
215
|
-
|
216
|
-
def root
|
217
|
-
Omnibus.logger.deprecated('Omnibus') do
|
218
|
-
'Omnibus.root. Please use Omnibus.project_root instead.'
|
219
|
-
end
|
220
|
-
|
221
|
-
Config.project_root
|
205
|
+
def project_path(name)
|
206
|
+
project_map[name.to_s]
|
222
207
|
end
|
223
208
|
|
224
209
|
#
|
225
|
-
# The
|
226
|
-
#
|
227
|
-
# @return [Pathname]
|
210
|
+
# The preferred filepath to a software with the given name on disk.
|
228
211
|
#
|
229
|
-
|
230
|
-
@source_root ||= Pathname.new(File.expand_path('../..', __FILE__))
|
231
|
-
end
|
232
|
-
|
233
|
-
# Processes all configured {Omnibus::Project} and
|
234
|
-
# {Omnibus::Software} DSL files.
|
212
|
+
# @return [String, nil]
|
235
213
|
#
|
236
|
-
|
237
|
-
|
238
|
-
expand_software
|
214
|
+
def software_path(name)
|
215
|
+
software_map[name.to_s]
|
239
216
|
end
|
240
217
|
|
241
218
|
#
|
242
|
-
# The list of directories to search for
|
243
|
-
# returned **in order** of
|
219
|
+
# The list of directories to search for the given +path+. These paths are
|
220
|
+
# returned **in order** of specificity.
|
244
221
|
#
|
245
|
-
# @
|
246
|
-
#
|
247
|
-
# @see (Config#software_gems)
|
248
|
-
# @see (Config#local_software_dirs)
|
222
|
+
# @param [String] path
|
223
|
+
# the subpath to search for
|
249
224
|
#
|
250
225
|
# @return [Array<String>]
|
251
226
|
#
|
252
|
-
def
|
253
|
-
|
254
|
-
|
255
|
-
directories = [
|
227
|
+
def possible_paths_for(path)
|
228
|
+
possible_paths[path] ||= [
|
256
229
|
paths_from_project_root,
|
257
230
|
paths_from_local_software_dirs,
|
258
231
|
paths_from_software_gems,
|
259
|
-
].flatten
|
260
|
-
|
261
|
-
@software_dirs = directories.inject([]) do |array, directory|
|
262
|
-
softwares_path = File.join(directory, Config.software_dir)
|
232
|
+
].flatten.inject([]) do |array, directory|
|
233
|
+
destination = File.join(directory, path)
|
263
234
|
|
264
|
-
if File.directory?(
|
265
|
-
array <<
|
266
|
-
else
|
267
|
-
Omnibus.logger.warn('Omnibus') do
|
268
|
-
"`#{directory}' does not contain a valid directory structure. " \
|
269
|
-
"Does it contain a folder at `#{Config.software_dir}'?"
|
270
|
-
end
|
235
|
+
if File.directory?(destination)
|
236
|
+
array << destination
|
271
237
|
end
|
272
238
|
|
273
239
|
array
|
274
240
|
end
|
241
|
+
end
|
275
242
|
|
276
|
-
|
243
|
+
private
|
244
|
+
|
245
|
+
#
|
246
|
+
# The list of possible paths, cached as a hash for quick lookup.
|
247
|
+
#
|
248
|
+
# @see {Omnibus.possible_paths_for}
|
249
|
+
#
|
250
|
+
# @return [Hash]
|
251
|
+
#
|
252
|
+
def possible_paths
|
253
|
+
@possible_paths ||= {}
|
277
254
|
end
|
278
255
|
|
279
256
|
#
|
280
|
-
#
|
281
|
-
#
|
282
|
-
# occurrence of the software in the list. If the same software is
|
283
|
-
# encountered a second time, it will be skipped.
|
257
|
+
# Map the given file paths to the basename of their file, with the +.rb+
|
258
|
+
# extension removed.
|
284
259
|
#
|
285
260
|
# @example
|
286
|
-
# { '
|
261
|
+
# { 'foo' => '/path/to/foo' }
|
287
262
|
#
|
288
263
|
# @return [Hash<String, String>]
|
289
264
|
#
|
290
|
-
def
|
291
|
-
|
292
|
-
|
293
|
-
@software_map = software_dirs.inject({}) do |hash, directory|
|
265
|
+
def basename_map(paths)
|
266
|
+
paths.inject({}) do |hash, directory|
|
294
267
|
Dir.glob("#{directory}/*.rb").each do |path|
|
295
268
|
name = File.basename(path, '.rb')
|
296
|
-
|
297
|
-
if hash[name].nil?
|
298
|
-
Omnibus.logger.debug('Omnibus#software_map') do
|
299
|
-
"Using software `#{name}' from `#{path}'."
|
300
|
-
end
|
301
|
-
|
302
|
-
hash[name] = path
|
303
|
-
else
|
304
|
-
Omnibus.logger.debug('Omnibus#software_map') do
|
305
|
-
"Skipping software `#{name}' because it was loaded from an " \
|
306
|
-
"earlier path."
|
307
|
-
end
|
308
|
-
end
|
269
|
+
hash[name] ||= path
|
309
270
|
end
|
310
271
|
|
311
272
|
hash
|
312
273
|
end
|
313
|
-
|
314
|
-
@software_map
|
315
274
|
end
|
316
275
|
|
317
|
-
private
|
318
|
-
|
319
276
|
#
|
320
|
-
#
|
277
|
+
# A hash of all softwares (by name) and their respective path on disk. These
|
278
|
+
# files are **in order**, meaning the software path is the **first**
|
279
|
+
# occurrence of the software in the list. If the same software is
|
280
|
+
# encountered a second time, it will be skipped.
|
321
281
|
#
|
322
|
-
#
|
323
|
-
#
|
282
|
+
# @example
|
283
|
+
# { 'preparation' => '/home/omnibus/project/config/software/preparation.rb' }
|
324
284
|
#
|
325
|
-
# @return [Hash<String,
|
285
|
+
# @return [Hash<String, String>]
|
326
286
|
#
|
327
|
-
def
|
328
|
-
|
329
|
-
|
330
|
-
path = File.expand_path(Config.project_dir, Config.project_root)
|
331
|
-
@_projects = Dir.glob("#{path}/*.rb").inject({}) do |hash, path|
|
332
|
-
name = File.basename(path, '.rb')
|
333
|
-
|
334
|
-
if hash[name].nil?
|
335
|
-
Omnibus.logger.debug('Omnibus#projects') do
|
336
|
-
"Using project `#{name}' from `#{path}'."
|
337
|
-
end
|
338
|
-
|
339
|
-
hash[name] = Project.load(path)
|
340
|
-
else
|
341
|
-
Omnibus.logger.debug('Omnibus#projects') do
|
342
|
-
"Skipping project `#{name}' because it was already loaded."
|
343
|
-
end
|
344
|
-
end
|
345
|
-
|
346
|
-
hash
|
347
|
-
end
|
287
|
+
def software_map
|
288
|
+
@software_map ||= basename_map(possible_paths_for(Config.software_dir))
|
289
|
+
end
|
348
290
|
|
349
|
-
|
291
|
+
#
|
292
|
+
# A hash of all projects (by name) and their respective path on disk. These
|
293
|
+
# files are **in order**, meaning the project path is the **first**
|
294
|
+
# occurrence of the project in the list. If the same project is
|
295
|
+
# encountered a second time, it will be skipped.
|
296
|
+
#
|
297
|
+
# @example
|
298
|
+
# { 'chefdk' => '/home/omnibus/project/config/projects/chefdk.rb' }
|
299
|
+
#
|
300
|
+
# @return [Hash<String, String>]
|
301
|
+
#
|
302
|
+
def project_map
|
303
|
+
@project_map ||= basename_map(possible_paths_for(Config.project_dir))
|
350
304
|
end
|
351
305
|
|
352
306
|
#
|
@@ -360,7 +314,8 @@ module Omnibus
|
|
360
314
|
# @return [Array<String>]
|
361
315
|
#
|
362
316
|
def paths_from_project_root
|
363
|
-
|
317
|
+
@paths_from_project_root ||=
|
318
|
+
[Config.project_root]
|
364
319
|
end
|
365
320
|
|
366
321
|
#
|
@@ -372,19 +327,16 @@ module Omnibus
|
|
372
327
|
# @return [Array<String>]
|
373
328
|
#
|
374
329
|
def paths_from_local_software_dirs
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
Omnibus.logger.warn('Omnibus') do
|
382
|
-
"Could not load softwares from path `#{fullpath}'. Does it exist?"
|
330
|
+
@paths_from_local_software_dirs ||=
|
331
|
+
Array(Config.local_software_dirs).inject([]) do |array, path|
|
332
|
+
fullpath = File.expand_path(path, Config.project_root)
|
333
|
+
|
334
|
+
if File.directory?(fullpath)
|
335
|
+
array << fullpath
|
383
336
|
end
|
384
|
-
end
|
385
337
|
|
386
|
-
|
387
|
-
|
338
|
+
array
|
339
|
+
end
|
388
340
|
end
|
389
341
|
|
390
342
|
#
|
@@ -398,59 +350,14 @@ module Omnibus
|
|
398
350
|
# @return [Array<String>]
|
399
351
|
#
|
400
352
|
def paths_from_software_gems
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
Omnibus.logger.warn('Omnibus') do
|
406
|
-
"Could not load softwares from gem `#{name}'. Is it installed?"
|
353
|
+
@paths_from_software_gems ||=
|
354
|
+
Array(Config.software_gems).inject([]) do |array, name|
|
355
|
+
if (spec = Gem::Specification.find_all_by_name(name).first)
|
356
|
+
array << File.expand_path(spec.gem_dir)
|
407
357
|
end
|
408
|
-
end
|
409
|
-
|
410
|
-
array
|
411
|
-
end
|
412
|
-
end
|
413
358
|
|
414
|
-
|
415
|
-
# Generate {Software} objects for all software DSL files in
|
416
|
-
# +software_specs+.
|
417
|
-
#
|
418
|
-
# @return [void]
|
419
|
-
#
|
420
|
-
def expand_software
|
421
|
-
Omnibus.projects.each do |project|
|
422
|
-
project.dependencies.each do |dependency|
|
423
|
-
recursively_load_dependency(dependency, project)
|
359
|
+
array
|
424
360
|
end
|
425
|
-
end
|
426
|
-
end
|
427
|
-
|
428
|
-
#
|
429
|
-
# Loads a project's dependencies recursively, ensuring all transitive
|
430
|
-
# dependencies are also loaded in the correct order.
|
431
|
-
#
|
432
|
-
# @param [String] dependency
|
433
|
-
# the name of the dependency
|
434
|
-
# @param [Project] project
|
435
|
-
# the project that loaded the software
|
436
|
-
#
|
437
|
-
# @return [void]
|
438
|
-
#
|
439
|
-
def recursively_load_dependency(dependency, project)
|
440
|
-
filepath = software_map[dependency]
|
441
|
-
|
442
|
-
if filepath.nil?
|
443
|
-
raise MissingProjectDependency.new(dependency, software_dirs)
|
444
|
-
end
|
445
|
-
|
446
|
-
software = Software.load(project, filepath)
|
447
|
-
|
448
|
-
# load any transitive deps for the component into the library also
|
449
|
-
software.dependencies.each do |transitive_dependency|
|
450
|
-
recursively_load_dependency(transitive_dependency, project)
|
451
|
-
end
|
452
|
-
|
453
|
-
project.library.component_added(software)
|
454
361
|
end
|
455
362
|
end
|
456
363
|
end
|