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
data/spec/unit/library_spec.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require 'omnibus/library'
|
3
|
-
require 'omnibus/project'
|
4
2
|
|
5
3
|
describe Omnibus::Library do
|
6
4
|
let(:project) { Omnibus::Project.load(project_path('chefdk')) }
|
@@ -8,6 +6,15 @@ describe Omnibus::Library do
|
|
8
6
|
let(:erchef) { Omnibus::Software.load(software_path('erchef'), project) }
|
9
7
|
let(:zlib) { Omnibus::Software.load(software_path('zlib'), project) }
|
10
8
|
|
9
|
+
def gen_software(name, deps)
|
10
|
+
software = Omnibus::Software.new('', "#{name}.rb", 'chef-server')
|
11
|
+
software.name(name.to_s)
|
12
|
+
deps.each do |dep|
|
13
|
+
software.dependency(dep)
|
14
|
+
end
|
15
|
+
software
|
16
|
+
end
|
17
|
+
|
11
18
|
describe '#component_added' do
|
12
19
|
it 'adds the software to the component list' do
|
13
20
|
library.component_added(erchef)
|
@@ -31,6 +38,7 @@ maintainer 'Chef Software, Inc'
|
|
31
38
|
homepage 'http://getchef.com'
|
32
39
|
dependency 'preparation'
|
33
40
|
dependency 'erchef'
|
41
|
+
dependency 'postgresql'
|
34
42
|
dependency 'chef'
|
35
43
|
EOH
|
36
44
|
Omnibus::Project.new(raw_project, 'chef-server.rb')
|
@@ -40,6 +48,7 @@ EOH
|
|
40
48
|
library = Omnibus::Library.new(project)
|
41
49
|
library.component_added(preparation)
|
42
50
|
library.component_added(erlang)
|
51
|
+
library.component_added(postgresql) # as a skitch trans dep
|
43
52
|
library.component_added(skitch)
|
44
53
|
library.component_added(erchef)
|
45
54
|
library.component_added(ruby)
|
@@ -47,7 +56,7 @@ EOH
|
|
47
56
|
library
|
48
57
|
end
|
49
58
|
|
50
|
-
project_deps = [:preparation, :erchef, :chef]
|
59
|
+
project_deps = [:preparation, :erchef, :postgresql, :chef]
|
51
60
|
erchef_deps = [:erlang, :skitch]
|
52
61
|
chef_deps = [:ruby]
|
53
62
|
|
@@ -55,12 +64,123 @@ EOH
|
|
55
64
|
let(dep) do
|
56
65
|
software = Omnibus::Software.new('', "#{dep}.rb", 'chef-server')
|
57
66
|
software.name(dep.to_s)
|
67
|
+
software.dependency('postgresql') if dep == :skitch
|
58
68
|
software
|
59
69
|
end
|
60
70
|
end
|
61
71
|
|
62
|
-
it 'returns an array of software descriptions, with all
|
63
|
-
|
72
|
+
it 'returns an array of software descriptions, with all top level deps first, assuming they are not themselves transitive deps' do
|
73
|
+
library.build_order.map { |m| m.name.to_s }
|
74
|
+
expect(library.build_order).to eql([preparation, erlang, postgresql, skitch, ruby, erchef, chef])
|
75
|
+
end
|
76
|
+
|
77
|
+
context 'with a complex dep tree' do
|
78
|
+
# rubocop:disable all
|
79
|
+
[
|
80
|
+
['preparation', []],
|
81
|
+
['erchef', ['erlang', 'skitch']],
|
82
|
+
['postgresql', []],
|
83
|
+
['erlang', []],
|
84
|
+
['skitch', ['postgresql']],
|
85
|
+
['chef', ['ruby', 'bundler', 'ohai']],
|
86
|
+
['ohai', ['ruby']],
|
87
|
+
['bundler', ['ruby']],
|
88
|
+
['ruby', []],
|
89
|
+
['chefdk', ['ruby', 'bundler']],
|
90
|
+
].each do |item|
|
91
|
+
name = item[0]
|
92
|
+
deps = item[1]
|
93
|
+
let(name) do
|
94
|
+
gen_software(name, deps)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
let(:project) do
|
99
|
+
raw_project = <<-EOH
|
100
|
+
name "chef-dk"
|
101
|
+
install_path "/opt/chefdk"
|
102
|
+
build_version "1.0.0"
|
103
|
+
maintainer 'Chef Software, Inc'
|
104
|
+
homepage 'http://getchef.com'
|
105
|
+
dependency 'preparation'
|
106
|
+
dependency 'erchef'
|
107
|
+
dependency 'postgresql'
|
108
|
+
dependency 'ruby'
|
109
|
+
dependency 'chef'
|
110
|
+
dependency 'chefdk'
|
111
|
+
EOH
|
112
|
+
Omnibus::Project.new(raw_project, 'chefdk.rb')
|
113
|
+
end
|
114
|
+
|
115
|
+
let(:library) do
|
116
|
+
# This is the LOAD ORDER
|
117
|
+
library = Omnibus::Library.new(project)
|
118
|
+
library.component_added(preparation) # via project
|
119
|
+
library.component_added(erlang) # via erchef
|
120
|
+
library.component_added(postgresql) # via skitch
|
121
|
+
library.component_added(skitch) # via erchef
|
122
|
+
library.component_added(erchef) # erchef
|
123
|
+
library.component_added(ruby) # via project
|
124
|
+
library.component_added(bundler) # via chef
|
125
|
+
library.component_added(ohai) # via chef
|
126
|
+
library.component_added(chef) # via project
|
127
|
+
library.component_added(chefdk) # via project
|
128
|
+
library
|
129
|
+
end
|
130
|
+
|
131
|
+
it 'returns an array of software descriptions, with all top level deps first, assuming they are not themselves transitive deps' do
|
132
|
+
expect(library.build_order).to eql(
|
133
|
+
[
|
134
|
+
preparation, # first
|
135
|
+
erlang, # via erchef project
|
136
|
+
postgresql, # via skitch transitive
|
137
|
+
skitch, # via erchef project
|
138
|
+
ruby, # via bundler transitive
|
139
|
+
bundler, # via chef
|
140
|
+
ohai, # via chef
|
141
|
+
erchef, # project dep
|
142
|
+
chef, # project dep
|
143
|
+
chefdk, # project dep
|
144
|
+
])
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
context 'with real data' do
|
149
|
+
before do
|
150
|
+
Omnibus.stub(:project_root).and_return(complicated_path)
|
151
|
+
|
152
|
+
# Ohai stuff
|
153
|
+
stub_const('File::ALT_SEPARATOR', '\\')
|
154
|
+
stub_ohai(platform: 'windows')
|
155
|
+
|
156
|
+
Omnibus.process_dsl_files
|
157
|
+
end
|
158
|
+
|
159
|
+
after { Omnibus.reset! }
|
160
|
+
|
161
|
+
let(:chefdk_windows) do
|
162
|
+
Omnibus.projects.find { |p| p.name.to_s == 'chefdk-windows' }
|
163
|
+
end
|
164
|
+
|
165
|
+
it 'has the right build order for chefdk-windows on windows' do
|
166
|
+
names = chefdk_windows.library.build_order.map { |m| m.name.to_s }
|
167
|
+
expect(names).to eql([
|
168
|
+
'preparation', # via project dep
|
169
|
+
'ruby-windows', # via libyaml-windows trans dep
|
170
|
+
'libyaml-windows', # via ruby-windows trans
|
171
|
+
'ruby-windows-devkit', # via trans dep from chef-windows
|
172
|
+
'bundler', # via trans dep from chef-windows
|
173
|
+
'cacerts', # via chef-windows
|
174
|
+
'chef-windows', # via transitive dep from chefdk
|
175
|
+
'nokogiri', # via test-kitchen
|
176
|
+
'test-kitchen', # via chefdk
|
177
|
+
'appbundler', # via chefdk
|
178
|
+
'berkshelf', # via chefdk
|
179
|
+
'chef-vault', # via chefdk
|
180
|
+
'chefdk', # via project dep
|
181
|
+
'chef-client-msi', # via top level dep
|
182
|
+
])
|
183
|
+
end
|
64
184
|
end
|
65
185
|
end
|
66
186
|
|
data/spec/unit/omnibus_spec.rb
CHANGED
@@ -3,15 +3,8 @@ require 'spec_helper'
|
|
3
3
|
|
4
4
|
describe Omnibus do
|
5
5
|
# evil class variables
|
6
|
-
before
|
7
|
-
|
8
|
-
Omnibus.class_eval { @software_dirs = nil }
|
9
|
-
end
|
10
|
-
|
11
|
-
after :each do
|
12
|
-
Omnibus.class_eval { @omnibus_software_root = nil }
|
13
|
-
Omnibus.class_eval { @software_dirs = nil }
|
14
|
-
end
|
6
|
+
before { Omnibus.reset! }
|
7
|
+
after { Omnibus.reset! }
|
15
8
|
|
16
9
|
describe '::omnibus_software_root' do
|
17
10
|
it 'reads the software_gem out of Omnibus::Config.software_gem' do
|
@@ -56,4 +49,27 @@ describe Omnibus do
|
|
56
49
|
end
|
57
50
|
end
|
58
51
|
end
|
52
|
+
|
53
|
+
describe '#process_dsl_files' do
|
54
|
+
before do
|
55
|
+
Omnibus.stub(:project_root).and_return(complicated_path)
|
56
|
+
stub_ohai(platform: 'linux')
|
57
|
+
end
|
58
|
+
|
59
|
+
after { Omnibus.reset! }
|
60
|
+
|
61
|
+
it 'populates the 5 projects' do
|
62
|
+
Omnibus.process_dsl_files
|
63
|
+
|
64
|
+
expect(Omnibus.projects.size).to eq(5)
|
65
|
+
|
66
|
+
names = Omnibus.projects.map(&:name)
|
67
|
+
expect(names).to include('angrychef')
|
68
|
+
expect(names).to include('chef-windows')
|
69
|
+
expect(names).to include('chef')
|
70
|
+
expect(names).to include('chefdk-windows')
|
71
|
+
expect(names).to include('chefdk')
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
59
75
|
end
|
data/spec/unit/overrides_spec.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'omnibus/overrides'
|
2
1
|
require 'spec_helper'
|
3
2
|
|
4
3
|
describe Omnibus::Overrides do
|
@@ -41,20 +40,9 @@ describe Omnibus::Overrides do
|
|
41
40
|
end # parse_file
|
42
41
|
|
43
42
|
describe '#resolve_override_file' do
|
44
|
-
before :each do
|
45
|
-
@original = ENV['OMNIBUS_OVERRIDE_FILE']
|
46
|
-
ENV['OMNIBUS_OVERRIDE_FILE'] = env_override_file
|
47
|
-
end
|
48
|
-
|
49
|
-
after :each do
|
50
|
-
ENV['OMNIBUS_OVERRIDE_FILE'] = @original
|
51
|
-
end
|
52
|
-
|
53
43
|
subject { Omnibus::Overrides.resolve_override_file }
|
54
44
|
|
55
45
|
context 'with no environment variable set' do
|
56
|
-
let(:env_override_file) { nil }
|
57
|
-
|
58
46
|
before :each do
|
59
47
|
stub_const('Omnibus::Overrides::DEFAULT_OVERRIDE_FILE_NAME', new_default_file)
|
60
48
|
end
|
@@ -72,6 +60,8 @@ describe Omnibus::Overrides do
|
|
72
60
|
end # no environment variable
|
73
61
|
|
74
62
|
context 'with OMNIBUS_OVERRIDE_FILE environment variable set' do
|
63
|
+
before { stub_env('OMNIBUS_OVERRIDE_FILE', env_override_file) }
|
64
|
+
|
75
65
|
context 'to an existing file' do
|
76
66
|
let(:path) { overrides_path('good') }
|
77
67
|
let(:env_override_file) { path }
|
@@ -91,8 +81,6 @@ describe Omnibus::Overrides do
|
|
91
81
|
stub_const('Omnibus::Overrides::DEFAULT_OVERRIDE_FILE_NAME', new_default_file)
|
92
82
|
|
93
83
|
expect(File.exist?(Omnibus::Overrides::DEFAULT_OVERRIDE_FILE_NAME)).to be_true
|
94
|
-
expect(ENV['OMNIBUS_OVERRIDE_FILE']).to_not be_nil
|
95
|
-
|
96
84
|
expect(subject).to be_nil
|
97
85
|
end
|
98
86
|
end
|
@@ -1,21 +1,3 @@
|
|
1
|
-
#
|
2
|
-
# Copyright:: Copyright (c) 2012-2014 Chef Software, Inc.
|
3
|
-
# License:: Apache License, Version 2.0
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
#
|
17
|
-
|
18
|
-
require 'omnibus/package_release'
|
19
1
|
require 'spec_helper'
|
20
2
|
|
21
3
|
describe Omnibus::PackageRelease do
|
@@ -1,19 +1,4 @@
|
|
1
|
-
|
2
|
-
# Copyright:: Copyright (c) 2014 Chef Software, Inc.
|
3
|
-
# License:: Apache License, Version 2.0
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
#
|
1
|
+
require 'stringio'
|
17
2
|
|
18
3
|
module Omnibus
|
19
4
|
describe Packager::Base do
|
@@ -28,6 +13,8 @@ module Omnibus
|
|
28
13
|
files_path: 'files',
|
29
14
|
package_dir: 'pkg',
|
30
15
|
package_tmp: 'pkg-tmp',
|
16
|
+
resources_path: nil,
|
17
|
+
friendly_name: 'HAMLET',
|
31
18
|
)
|
32
19
|
end
|
33
20
|
|
@@ -41,6 +28,10 @@ module Omnibus
|
|
41
28
|
expect(subject.name).to eq(project.name)
|
42
29
|
end
|
43
30
|
|
31
|
+
it 'delegates #friendly_name to @project' do
|
32
|
+
expect(subject.friendly_name).to eq(project.friendly_name)
|
33
|
+
end
|
34
|
+
|
44
35
|
it 'delegates #version to @project' do
|
45
36
|
expect(subject.version).to eq(project.build_version)
|
46
37
|
end
|
@@ -154,6 +145,61 @@ module Omnibus
|
|
154
145
|
end
|
155
146
|
end
|
156
147
|
|
148
|
+
describe '#copy_directory' do
|
149
|
+
before do
|
150
|
+
FileUtils.stub(:cp_r)
|
151
|
+
Dir.stub(:[]).and_return(['baz/file'])
|
152
|
+
end
|
153
|
+
|
154
|
+
it 'copies the directory' do
|
155
|
+
expect(FileUtils).to receive(:cp_r).with(['baz/file'], 'bar')
|
156
|
+
subject.copy_directory('baz', 'bar')
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
describe '#render_template' do
|
161
|
+
it 'return when source is not an erb template' do
|
162
|
+
expect(File).not_to receive(:open)
|
163
|
+
subject.render_template('source.txt')
|
164
|
+
end
|
165
|
+
|
166
|
+
shared_examples_for 'render_template' do
|
167
|
+
let(:output) { StringIO.new }
|
168
|
+
|
169
|
+
before do
|
170
|
+
input = StringIO.new
|
171
|
+
input.write('<%= friendly_name %>')
|
172
|
+
input.rewind
|
173
|
+
|
174
|
+
File.stub(:open).with(source_path).and_yield(input)
|
175
|
+
File.stub(:open).with(expected_destination_path, 'w').and_yield(output)
|
176
|
+
|
177
|
+
expect(subject).to receive(:remove_file).with(source_path)
|
178
|
+
end
|
179
|
+
|
180
|
+
it 'should render correctly' do
|
181
|
+
subject.render_template(source_path, destination_path)
|
182
|
+
expect(output.string).to eq('HAMLET')
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
context 'when destination is specified' do
|
187
|
+
let(:source_path) { 'source.txt.erb' }
|
188
|
+
let(:destination_path) { 'destination.txt' }
|
189
|
+
let(:expected_destination_path) { destination_path }
|
190
|
+
|
191
|
+
include_examples 'render_template'
|
192
|
+
end
|
193
|
+
|
194
|
+
context 'when destination is not specified' do
|
195
|
+
let(:source_path) { 'source.txt.erb' }
|
196
|
+
let(:destination_path) { nil }
|
197
|
+
let(:expected_destination_path) { 'source.txt' }
|
198
|
+
|
199
|
+
include_examples 'render_template'
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
157
203
|
describe '#remove_file' do
|
158
204
|
before { FileUtils.stub(:rm_f) }
|
159
205
|
|
@@ -189,8 +235,8 @@ module Omnibus
|
|
189
235
|
end
|
190
236
|
|
191
237
|
it 'calls the methods in order' do
|
192
|
-
expect(described_class).to receive(:validate).ordered
|
193
238
|
expect(described_class).to receive(:setup).ordered
|
239
|
+
expect(described_class).to receive(:validate).ordered
|
194
240
|
expect(described_class).to receive(:build).ordered
|
195
241
|
expect(described_class).to receive(:clean).ordered
|
196
242
|
subject.run!
|
@@ -204,17 +250,34 @@ module Omnibus
|
|
204
250
|
end
|
205
251
|
end
|
206
252
|
|
253
|
+
describe '#staging_resources_path' do
|
254
|
+
it 'is base/Resources under package temp' do
|
255
|
+
name = "#{project.package_tmp}/base/Resources"
|
256
|
+
expect(subject.send(:staging_resources_path)).to eq(File.expand_path(name))
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
207
260
|
describe '#resource' do
|
208
261
|
it 'prefixes to the resources_path' do
|
209
|
-
path = '
|
262
|
+
path = 'pkg-tmp/base/Resources/icon.png'
|
210
263
|
expect(subject.send(:resource, 'icon.png')).to eq(File.expand_path(path))
|
211
264
|
end
|
212
265
|
end
|
213
266
|
|
214
267
|
describe '#resoures_path' do
|
215
|
-
|
216
|
-
|
217
|
-
|
268
|
+
context 'when project does not define resources_path' do
|
269
|
+
it 'is the files_path, underscored_name, and Resources' do
|
270
|
+
path = "#{project.files_path}/base/Resources"
|
271
|
+
expect(subject.send(:resources_path)).to eq(File.expand_path(path))
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
context 'when project defines resources_path' do
|
276
|
+
before { project.stub(:resources_path).and_return('project/specific') }
|
277
|
+
it 'is the project resources_path, underscored_name, and Resources' do
|
278
|
+
path = 'project/specific/base/Resources'
|
279
|
+
expect(subject.send(:resources_path)).to eq(File.expand_path(path))
|
280
|
+
end
|
218
281
|
end
|
219
282
|
end
|
220
283
|
end
|
@@ -1,20 +1,3 @@
|
|
1
|
-
#
|
2
|
-
# Copyright:: Copyright (c) 2014 Chef Software, Inc.
|
3
|
-
# License:: Apache License, Version 2.0
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
#
|
17
|
-
|
18
1
|
require 'stringio'
|
19
2
|
require 'spec_helper'
|
20
3
|
|
@@ -62,6 +45,13 @@ EOH
|
|
62
45
|
|
63
46
|
let(:expected_distribution_path) { '/var/cache/omnibus/pkg-tmp/mac_pkg/Distribution' }
|
64
47
|
|
48
|
+
let(:pkg_signing_config) do
|
49
|
+
{
|
50
|
+
sign_pkg: false,
|
51
|
+
signing_identity: nil,
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
65
55
|
let(:project) do
|
66
56
|
double Omnibus::Project,
|
67
57
|
name: project_name,
|
@@ -73,7 +63,9 @@ EOH
|
|
73
63
|
files_path: files_path,
|
74
64
|
package_dir: package_dir,
|
75
65
|
package_tmp: package_tmp,
|
76
|
-
mac_pkg_identifier: mac_pkg_identifier
|
66
|
+
mac_pkg_identifier: mac_pkg_identifier,
|
67
|
+
config: pkg_signing_config,
|
68
|
+
friendly_name: 'Myproject'
|
77
69
|
end
|
78
70
|
|
79
71
|
let(:packager) do
|
@@ -142,12 +134,30 @@ EOH
|
|
142
134
|
|
143
135
|
describe 'building the product package' do
|
144
136
|
it 'generates the distribution and runs productbuild' do
|
145
|
-
expect(packager).to receive(:execute).with
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
137
|
+
expect(packager).to receive(:execute).with ['productbuild',
|
138
|
+
%Q(--distribution "/var/cache/omnibus/pkg-tmp/mac_pkg/Distribution"),
|
139
|
+
%Q(--resources "/var/cache/omnibus/pkg-tmp/mac_pkg/Resources"),
|
140
|
+
'/home/someuser/omnibus-myproject/pkg/myproject-23.4.2-4.pkg',
|
141
|
+
].join(' ')
|
142
|
+
packager.build_product_pkg
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
context 'when pkg signing is enabled' do
|
147
|
+
let(:pkg_signing_config) do
|
148
|
+
{
|
149
|
+
sign_pkg: true,
|
150
|
+
signing_identity: 'My Special Identity',
|
151
|
+
}
|
152
|
+
end
|
153
|
+
|
154
|
+
it 'includes the signing parameters in the product build command' do
|
155
|
+
expect(packager).to receive(:execute).with ['productbuild',
|
156
|
+
%Q(--distribution "/var/cache/omnibus/pkg-tmp/mac_pkg/Distribution"),
|
157
|
+
%Q(--resources "/var/cache/omnibus/pkg-tmp/mac_pkg/Resources"),
|
158
|
+
%Q(--sign "My Special Identity"),
|
159
|
+
'/home/someuser/omnibus-myproject/pkg/myproject-23.4.2-4.pkg',
|
160
|
+
].join(' ')
|
151
161
|
packager.build_product_pkg
|
152
162
|
end
|
153
163
|
end
|