omnibus 1.3.0 → 2.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -1
  3. data/.rubocop.yml +30 -0
  4. data/.travis.yml +14 -3
  5. data/CHANGELOG.md +72 -49
  6. data/Gemfile +8 -5
  7. data/NOTICE +2 -2
  8. data/README.md +65 -7
  9. data/Rakefile +12 -3
  10. data/bin/makeself-header.sh +1 -1
  11. data/bin/makeself.sh +2 -2
  12. data/bin/omnibus +2 -2
  13. data/functional/fixtures/mac_pkg/files/mac_pkg/Resources/background.png +0 -0
  14. data/functional/fixtures/mac_pkg/files/mac_pkg/Resources/license.html +1 -0
  15. data/functional/fixtures/mac_pkg/files/mac_pkg/Resources/welcome.html +1 -0
  16. data/functional/fixtures/mac_pkg/package-scripts/functional-test-project/postinstall +4 -0
  17. data/functional/packagers/mac_pkg_spec.rb +72 -0
  18. data/lib/omnibus/artifact.rb +11 -13
  19. data/lib/omnibus/build_version.rb +18 -21
  20. data/lib/omnibus/builder.rb +37 -48
  21. data/lib/omnibus/clean_tasks.rb +3 -5
  22. data/lib/omnibus/cli/application.rb +46 -53
  23. data/lib/omnibus/cli/base.rb +16 -19
  24. data/lib/omnibus/cli/build.rb +13 -13
  25. data/lib/omnibus/cli/cache.rb +13 -15
  26. data/lib/omnibus/cli/release.rb +4 -9
  27. data/lib/omnibus/cli.rb +2 -4
  28. data/lib/omnibus/config.rb +43 -23
  29. data/lib/omnibus/exceptions.rb +35 -1
  30. data/lib/omnibus/fetcher.rb +9 -13
  31. data/lib/omnibus/fetchers/git_fetcher.rb +15 -19
  32. data/lib/omnibus/fetchers/net_fetcher.rb +34 -38
  33. data/lib/omnibus/fetchers/path_fetcher.rb +7 -9
  34. data/lib/omnibus/fetchers/s3_cache_fetcher.rb +3 -4
  35. data/lib/omnibus/fetchers.rb +3 -3
  36. data/lib/omnibus/health_check.rb +126 -127
  37. data/lib/omnibus/library.rb +11 -12
  38. data/lib/omnibus/overrides.rb +6 -8
  39. data/lib/omnibus/package_release.rb +20 -22
  40. data/lib/omnibus/packagers/mac_pkg.rb +285 -0
  41. data/lib/omnibus/project.rb +215 -110
  42. data/lib/omnibus/reports.rb +16 -24
  43. data/lib/omnibus/s3_cacher.rb +15 -21
  44. data/lib/omnibus/software.rb +178 -88
  45. data/lib/omnibus/util.rb +25 -13
  46. data/lib/omnibus/version.rb +2 -2
  47. data/lib/omnibus.rb +11 -13
  48. data/omnibus.gemspec +20 -18
  49. data/spec/artifact_spec.rb +55 -52
  50. data/spec/build_version_spec.rb +121 -129
  51. data/spec/config_spec.rb +40 -0
  52. data/spec/data/projects/chefdk.rb +41 -0
  53. data/spec/data/projects/sample.rb +10 -0
  54. data/spec/data/software/erchef.rb +12 -12
  55. data/spec/data/software/zlib.rb +67 -0
  56. data/spec/fetchers/git_fetcher_spec.rb +55 -48
  57. data/spec/fetchers/net_fetcher_spec.rb +72 -78
  58. data/spec/omnibus_spec.rb +59 -0
  59. data/spec/overrides_spec.rb +64 -64
  60. data/spec/package_release_spec.rb +65 -64
  61. data/spec/packagers/mac_pkg_spec.rb +261 -0
  62. data/spec/project_spec.rb +138 -0
  63. data/spec/s3_cacher_spec.rb +9 -10
  64. data/spec/software_spec.rb +71 -50
  65. data/spec/spec_helper.rb +14 -7
  66. metadata +68 -60
  67. data/.rspec +0 -1
  68. data/.yardopts +0 -6
  69. data/spec/software_dirs_spec.rb +0 -34
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3d821a5f79999239bb2350a3ab13b30b3c76e002
4
+ data.tar.gz: b9466b1623251bf432c310d28e3136752de2c8fa
5
+ SHA512:
6
+ metadata.gz: f5702d3ac8776901b5f47bc2dfeb5b2755b7a50b296d0184a8003c8c27c662f16eb74a3b3e4c099760228f042a3449ba8630debbe93d5eeaa28cda1236c8e1a3
7
+ data.tar.gz: cba2accc31f58449f0eac9e4ccee20d1e82b9bf228809ddd9b47c2be21d697d64c924c0087c036a2b481c1f4aa2b5129b9bb11dfb1ed53502b128aeb7c06778d
data/.gitignore CHANGED
@@ -1,9 +1,12 @@
1
1
  *.gem
2
2
  tmp
3
-
3
+ # package file created by functional tests:
4
+ *.pkg
4
5
  # Bundler related
5
6
  Gemfile.lock
6
7
  .bundle/
7
8
  vendor/
9
+ .rspec
8
10
  .yardoc
11
+ .yardopts
9
12
  doc/
data/.rubocop.yml ADDED
@@ -0,0 +1,30 @@
1
+ ClassLength:
2
+ Enabled: false
3
+ CyclomaticComplexity:
4
+ Max: 20
5
+ Documentation:
6
+ Enabled: false
7
+ GlobalVars:
8
+ Enabled: false
9
+ Encoding:
10
+ Enabled: false
11
+ HandleExceptions:
12
+ Enabled: false
13
+ IfUnlessModifier:
14
+ Enabled: false
15
+ LineLength:
16
+ Enabled: false
17
+ MethodLength:
18
+ Enabled: false
19
+ ModuleFunction:
20
+ Enabled: false
21
+ ParameterLists:
22
+ Max: 6
23
+ RaiseArgs:
24
+ Enabled: false
25
+ RescueException:
26
+ Enabled: false
27
+ TrailingComma:
28
+ EnforcedStyleForMultiline: comma
29
+ TrivialAccessors:
30
+ Enabled: false
data/.travis.yml CHANGED
@@ -1,5 +1,16 @@
1
- language: ruby
2
1
  rvm:
3
- - 1.9.2
4
2
  - 1.9.3
5
- script: rake spec
3
+
4
+ bundler_args: --jobs 7 --without docs
5
+
6
+ branches:
7
+ only:
8
+ - master
9
+
10
+ script: bundle exec rake travis:ci
11
+
12
+ notifications:
13
+ hipchat:
14
+ rooms:
15
+ - secure: JdLOITSPHW5xk8eoFOmH1Js5PT6iFgswUG8fIqNq69ie2Qws2K58hPDR6HW2NBEsBb7dW1S5jT6V9RHhm0ykekvEJVa5AjebO3EsZa+Cu/VahFMg4DL+SGYgKlKrZQosd+EgVQQ3C9gj0dApGtKqf2Ej7RNESwCPY8SOduTC6d8= # Build Statuses
16
+ - secure: PmOaqp2DFyy79VpCuvSYILblK6tP0eDa9fDG9X2j+wggoosBkmlGfnSxp3A2TXlUyK62mr6/B89dRkL2aDWTJ/gqaZ34Elx2rV5S2A5YJIx9stA2+4iXeSlOF2YMNKGwBVmF/kp/nNoG2FqUkUBrRurWAOXZnwxKIhQ7+kLVb/0= # Release Engineering
data/CHANGELOG.md CHANGED
@@ -1,135 +1,158 @@
1
+ Omnibus Ruby CHANGELOG
2
+ ======================
3
+
4
+ v2.0.0 (Unreleased)
5
+ -------------------
6
+ Major changes:
7
+ - `version` is now `default_version`
8
+ - Added support for multiple software versions and version overrides
9
+ - Added support for project-specific overrides
10
+ - Added Mac DMG packaging functionality
11
+ - Require Mixlib::Config 2.0
12
+
13
+ Minor changes:
14
+ - Added a new CI pipeline on Travis
15
+ - Switch to Ruby 1.9 hash syntaxes
16
+
17
+ Tiny changes that probably won't affect you:
18
+ - `.yardopts` are no longer committed
19
+ - `.rspec` is no longer committed
20
+ - Updated copyrights to new company name
21
+ - Improved test coverage
22
+ - Miscellaneous bug fixes
23
+
1
24
  ## 1.3.0 (December 6, 2013)
2
25
 
3
26
  FEATURES:
4
27
 
5
- * Add `build_retries` global config value (still 3 by default). ([@fujin][], [#63][])
6
- * Add support for pre-install scripts. ([@christophermaier][])
7
- * Add support for `*.tar.xz` files. ([@jf647][], [#71][])
8
- * Add `erb` builder command. ([@ohlol][], [#79][])
9
- * Add `package_user`, `package_group` to project definitions for setting
28
+ - Add `build_retries` global config value (still 3 by default). ([@fujin][], [#63][])
29
+ - Add support for pre-install scripts. ([@christophermaier][])
30
+ - Add support for `*.tar.xz` files. ([@jf647][], [#71][])
31
+ - Add `erb` builder command. ([@ohlol][], [#79][])
32
+ - Add `package_user`, `package_group` to project definitions for setting
10
33
  user and group ownership for of deb/rpm/solaris packages. ([@ohlol][], [#80][])
11
- * Add `config_file` to project definitions for passing `--config-files`
34
+ - Add `config_file` to project definitions for passing `--config-files`
12
35
  options to the `fpm` builder commands. ([@christophergeers][], [#85][])
13
36
 
14
37
  IMPROVEMENTS:
15
38
 
16
- * Bump default cpus to get better throughput when Ohai is wrong. ([@lamont-granquist][])
17
- * Whitelist `libnsl` on Arch Linux. ([@sl4mmy][], [#67][])
18
- * Switch to using pkgmk for Solaris. ([@lamont-granquist][], [#72][])
19
- * Remove make install from c-example. ([@johntdyer][], [#73][])
20
- * Update Vagrantfile template to use provisionerless base boxes. ([@schisamo][], [#74][])
21
- * Allow access to `Omnibus.project_root` in builder blocks. ([@ohlol][], [#78][])
22
- * Refactor how we handle loading dirs for software files. ([@benjaminws][], [#82][])
23
- * Update depdencies: ([@schisamo][], [#86][])
24
- * fpm 1.0.0
25
- * mixlib-config 2.1.0
26
- * mixlib-shellout 1.3.0
39
+ - Bump default cpus to get better throughput when Ohai is wrong. ([@lamont-granquist][])
40
+ - Whitelist `libnsl` on Arch Linux. ([@sl4mmy][], [#67][])
41
+ - Switch to using pkgmk for Solaris. ([@lamont-granquist][], [#72][])
42
+ - Remove make install from c-example. ([@johntdyer][], [#73][])
43
+ - Update Vagrantfile template to use provisionerless base boxes. ([@schisamo][], [#74][])
44
+ - Allow access to `Omnibus.project_root` in builder blocks. ([@ohlol][], [#78][])
45
+ - Refactor how we handle loading dirs for software files. ([@benjaminws][], [#82][])
46
+ - Update depdencies: ([@schisamo][], [#86][])
47
+ - fpm 1.0.0
48
+ - mixlib-config 2.1.0
49
+ - mixlib-shellout 1.3.0
27
50
 
28
51
  BUG FIXES:
29
52
 
30
- * Properly handle `HTTP_PROXY_USER` and `HTTP_PROXY_PASS`. ([@databus23][], [#77][])
31
- * Fix the incorrect error message logged when the Git fetcher failed to
53
+ - Properly handle `HTTP_PROXY_USER` and `HTTP_PROXY_PASS`. ([@databus23][], [#77][])
54
+ - Fix the incorrect error message logged when the Git fetcher failed to
32
55
  resolve refs to commits. ([@mumoshu][], [#81][])
33
- * Removin unsupported `config.ssh.max_tries` and `config.ssh.timeout`
56
+ - Removin unsupported `config.ssh.max_tries` and `config.ssh.timeout`
34
57
  from Vagrantfile template. ([@totally][], [#83][])
35
- * Mention the required Vagrant plugins. ([@jacobvosmaer][], [#70][])
58
+ - Mention the required Vagrant plugins. ([@jacobvosmaer][], [#70][])
36
59
 
37
60
  ## 1.2.0 (July 12, 2013)
38
61
 
39
62
  FEATURES:
40
63
 
41
- * Add `whitelist_file` to software DSL. This allows an individual software
64
+ - Add `whitelist_file` to software DSL. This allows an individual software
42
65
  definition to declare files that should be ignored during health checking.
43
66
 
44
67
  IMPROVEMENTS:
45
68
 
46
- * Raise an exception if a project's dependency is not found.
69
+ - Raise an exception if a project's dependency is not found.
47
70
 
48
71
  BUG FIXES:
49
72
 
50
- * Properly load a project's transitive dependencies.
51
- * Ensure a component is only added to a library one time.
73
+ - Properly load a project's transitive dependencies.
74
+ - Ensure a component is only added to a library one time.
52
75
 
53
76
  ## 1.1.1 (July 2, 2013)
54
77
 
55
78
  BUG FIXES:
56
79
 
57
- * Raise an exception if a patch file is not found.
58
- * Be more explicit about types in CPU computation.
59
- * Include pkg version, iteration, arch for solaris packages.
60
- * Fix assorted typos in CLI output.
80
+ - Raise an exception if a patch file is not found.
81
+ - Be more explicit about types in CPU computation.
82
+ - Include pkg version, iteration, arch for solaris packages.
83
+ - Fix assorted typos in CLI output.
61
84
 
62
85
  ## 1.1.0 (June 12, 2013)
63
86
 
64
87
  FEATURES:
65
88
 
66
- * AIX health check whitelist support
67
- * AIX Backup-File Format (BFF) package support
89
+ - AIX health check whitelist support
90
+ - AIX Backup-File Format (BFF) package support
68
91
 
69
92
  IMPROVEMENTS:
70
93
 
71
- * Add libstdc++ to SmartOS whitelist libs - this allows the health check pass when
94
+ - Add libstdc++ to SmartOS whitelist libs - this allows the health check pass when
72
95
  depending on C++ libs.
73
96
 
74
97
  BUG FIXES:
75
98
 
76
- * [CHEF-4246] - omnibus cache populate failing
99
+ - [CHEF-4246] - omnibus cache populate failing
77
100
 
78
101
  ## 1.0.4 (May 23, 2013)
79
102
 
80
103
  FEATURES:
81
104
 
82
- * Add `release package` command which releases a single package with associated
105
+ - Add `release package` command which releases a single package with associated
83
106
  metadata file to a single S3 bucket.
84
- * Arch Linux health check whitelist support
107
+ - Arch Linux health check whitelist support
85
108
 
86
109
  IMPROVEMENTS:
87
110
 
88
- * Add libstdc++ to Mac whitelist libs - this allows the health check pass when
111
+ - Add libstdc++ to Mac whitelist libs - this allows the health check pass when
89
112
  depending on C++ libs.
90
- * Change scope of `Omnibus::Library` instance from global to project.
113
+ - Change scope of `Omnibus::Library` instance from global to project.
91
114
 
92
115
  BUG FIXES:
93
116
 
94
- * [CHEF-4214] - projects in multi-project omnibus repositories share dependency scope
117
+ - [CHEF-4214] - projects in multi-project omnibus repositories share dependency scope
95
118
 
96
119
  ## 1.0.3 (May 2, 2013)
97
120
 
98
121
  FEATURES:
99
122
 
100
- * [CHEF-2576] - SmartOS health check whitelist support
101
- * [CHEF-4141] - FreeBSD health check whitelist support
102
- * [CHEF-3990] - Add support to uncompress zip file
123
+ - [CHEF-2576] - SmartOS health check whitelist support
124
+ - [CHEF-4141] - FreeBSD health check whitelist support
125
+ - [CHEF-3990] - Add support to uncompress zip file
103
126
 
104
127
  BUG FIXES:
105
128
 
106
- * Fix project homepage in gemspec
107
- * Proper Thor 0.16.0, 0.17.0 suppport - Thor 0.18.0 renamed current_task to
129
+ - Fix project homepage in gemspec
130
+ - Proper Thor 0.16.0, 0.17.0 suppport - Thor 0.18.0 renamed current_task to
108
131
  current_command
109
132
 
110
133
  ## 1.0.2 (April 23, 2013)
111
134
 
112
135
  IMPROVEMENTS:
113
136
 
114
- * Travis CI support
137
+ - Travis CI support
115
138
 
116
139
  BUG FIXES:
117
140
 
118
- * [CHEF-4112] `omnibus build project` command does not respect the
141
+ - [CHEF-4112] `omnibus build project` command does not respect the
119
142
  `--no-timestamp` flag
120
143
 
121
144
  ## 1.0.1 (April 21, 2013)
122
145
 
123
146
  BUG FIXES:
124
147
 
125
- * Vagrant and Berkshelf Vagrant plugin version updates in generated project's
148
+ - Vagrant and Berkshelf Vagrant plugin version updates in generated project's
126
149
  README.md. Current requirements for the virtualized build lab are:
127
- * Vagrant 1.2.1+
128
- * `vagrant-berkshelf` plugin (this was renamed from `berkshelf-vagrant`)
150
+ - Vagrant 1.2.1+
151
+ - `vagrant-berkshelf` plugin (this was renamed from `berkshelf-vagrant`)
129
152
 
130
153
  ## 1.0.0 (April 21, 2013)
131
154
 
132
- * The initial release.
155
+ - The initial release.
133
156
 
134
157
  <!--- The following link definition list is generated by PimpMyChangelog --->
135
158
  [#63]: https://github.com/opscode/omnibus-ruby/issues/63
data/Gemfile CHANGED
@@ -1,9 +1,12 @@
1
- source "https://rubygems.org"
2
-
1
+ source 'https://rubygems.org'
3
2
  gemspec
4
3
 
5
4
  group :docs do
6
- gem "yard", "~> 0.8.5"
7
- gem "redcarpet", "~> 2.2.2"
8
- gem "github-markup", "~> 0.7.5"
5
+ gem 'yard', '~> 0.8'
6
+ gem 'redcarpet', '~> 2.2.2'
7
+ gem 'github-markup', '~> 0.7'
8
+ end
9
+
10
+ group :test do
11
+ gem 'fauxhai'
9
12
  end
data/NOTICE CHANGED
@@ -1,9 +1,9 @@
1
1
  omnibus-ruby NOTICE
2
2
  ===================
3
3
 
4
- Developed at Opscode (http://www.opscode.com).
4
+ Developed at Chef Software, Inc (http://www.getchef.com).
5
5
 
6
6
  Contributors and Copyright holders:
7
7
 
8
- * Copyright 2012, Opscode, Inc. <legal@opscode.com>
8
+ * Copyright 2012-2014, Chef Software, Inc. <legal@getchef.com>
9
9
 
data/README.md CHANGED
@@ -12,6 +12,8 @@ Building a Full-Stack Installer with Omnibus**
12
12
  ([video](http://www.youtube.com/watch?v=q8iJAntXCNY),
13
13
  [slides](https://speakerdeck.com/schisamo/eat-the-whole-bowl-building-a-full-stack-installer-with-omnibus)).
14
14
 
15
+ This project is managed by the CHEF Release Engineering team. For more information on the Release Engineering team's contribution, triage, and release process, please consult the [CHEF Release Engineering OSS Management Guide](https://docs.google.com/a/opscode.com/document/d/1oJB0vZb_3bl7_ZU2YMDBkMFdL-EWplW1BJv_FXTUOzg/edit).
16
+
15
17
  ## Prerequisites
16
18
 
17
19
  Omnibus is designed to run with a minimal set of prerequisites. You'll
@@ -90,10 +92,10 @@ anything from the `omnibus-software` repository.)
90
92
  An example:
91
93
 
92
94
  ```ruby
93
- name "ruby"
94
- version "1.9.2-p290"
95
- source :url => "http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-#{version}.tar.gz",
96
- :md5 => "604da71839a6ae02b5b5b5e1b792d5eb"
95
+ name "ruby"
96
+ default_version "1.9.2-p290"
97
+ source :url => "http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-#{version}.tar.gz",
98
+ :md5 => "604da71839a6ae02b5b5b5e1b792d5eb"
97
99
 
98
100
  dependency "zlib"
99
101
  dependency "ncurses"
@@ -110,9 +112,9 @@ end
110
112
 
111
113
  Some of the DSL methods available include:
112
114
 
113
- **name**: The name of the software component.
115
+ **name**: The name of the software component (this should come first).
114
116
 
115
- **version**: The version of the software component.
117
+ **default_version**: The version of the software component.
116
118
 
117
119
  **source**: Directions to the location of the source.
118
120
 
@@ -177,11 +179,67 @@ platforms (though Omnibus is not limited to just those!) is created
177
179
  for each project that you generate using `omnibus project
178
180
  $MY_PROJECT_NAME`
179
181
 
182
+ ## Multiple Software Versions and Version Overrides
183
+
184
+ You can support building multiple verisons of the same software in the same
185
+ software definition file:
186
+
187
+ ```ruby
188
+ name "ruby"
189
+ default_version "1.9.2-p290"
190
+
191
+ version "1.9.2-p290" do
192
+ source :url => "http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-#{version}.tar.gz",
193
+ :md5 => "604da71839a6ae02b5b5b5e1b792d5eb"
194
+ end
195
+
196
+ version "2.1.1" do
197
+ source :url => "http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-#{version}.tar.gz",
198
+ :md5 => "e57fdbb8ed56e70c43f39c79da1654b2"
199
+ end
200
+
201
+
202
+ dependency "zlib"
203
+ dependency "ncurses"
204
+ dependency "openssl"
205
+
206
+ relative_path "ruby-#{version}"
207
+
208
+ build do
209
+ command "./configure"
210
+ command "make"
211
+ command "make install"
212
+ end
213
+ ```
214
+
215
+ Since the software definitions are simply ruby code, you can conditionally
216
+ execute anything by wrapping it with pure ruby that tests for the version number.
217
+
218
+ The project definitions can then take advange of this by passing in overrides
219
+ to use the correct version:
220
+
221
+ ```ruby
222
+ name "chef-full"
223
+ maintainer "YOUR NAME"
224
+ homepage "http://yoursite.com"
225
+
226
+ install_path "/opt/chef"
227
+ build_version "0.10.8"
228
+ build_iteration 4
229
+
230
+ override :chef, version: "2.1.1"
231
+
232
+ dependency "chef"
233
+ ```
234
+
235
+ There is no checking that the version override that you supply has been
236
+ provided in a version override block in the software definition.
237
+
180
238
  ## License
181
239
 
182
240
  See the LICENSE and NOTICE files for more information.
183
241
 
184
- Copyright: Copyright (c) 2012--2013 Opscode, Inc.
242
+ Copyright: Copyright (c) 2012--2013-2014 Chef Software, Inc.
185
243
  License: Apache License, Version 2.0
186
244
 
187
245
  Licensed under the Apache License, Version 2.0 (the "License");
data/Rakefile CHANGED
@@ -1,7 +1,16 @@
1
1
  require 'bundler/setup'
2
2
  require 'bundler/gem_tasks'
3
+
3
4
  require 'rspec/core/rake_task'
4
- require 'yard'
5
+ RSpec::Core::RakeTask.new(:unit)
6
+
7
+ require 'rubocop/rake_task'
8
+ desc 'Run Ruby style checks'
9
+ Rubocop::RakeTask.new(:style)
10
+
11
+ namespace :travis do
12
+ desc 'Run tests on Travis'
13
+ task ci: ['style', 'unit']
14
+ end
5
15
 
6
- RSpec::Core::RakeTask.new(:spec)
7
- YARD::Rake::YardocTask.new
16
+ task default: ['travis:ci']
@@ -65,7 +65,7 @@ Makeself version $MS_VERSION
65
65
  \$0 --lsm Print embedded lsm entry (or no LSM)
66
66
  \$0 --list Print the list of files in the archive
67
67
  \$0 --check Checks integrity of the archive
68
-
68
+
69
69
  2) Running \$0 :
70
70
  \$0 [options] [--] [additional arguments to embedded script]
71
71
  with following options (in that order)
data/bin/makeself.sh CHANGED
@@ -22,13 +22,13 @@
22
22
  # support for non-temporary archives. Ideas thanks to Francois Petitjean
23
23
  # - 1.3 : More patches from Bjarni R. Einarsson and Francois Petitjean:
24
24
  # Support for no compression (--nocomp), script is no longer mandatory,
25
- # automatic launch in an xterm, optional verbose output, and -target
25
+ # automatic launch in an xterm, optional verbose output, and -target
26
26
  # archive option to indicate where to extract the files.
27
27
  # - 1.4 : Improved UNIX compatibility (Francois Petitjean)
28
28
  # Automatic integrity checking, support of LSM files (Francois Petitjean)
29
29
  # - 1.5 : Many bugfixes. Optionally disable xterm spawning.
30
30
  # - 1.5.1 : More bugfixes, added archive options -list and -check.
31
- # - 1.5.2 : Cosmetic changes to inform the user of what's going on with big
31
+ # - 1.5.2 : Cosmetic changes to inform the user of what's going on with big
32
32
  # archives (Quake III demo)
33
33
  # - 1.5.3 : Check for validity of the DISPLAY variable before launching an xterm.
34
34
  # More verbosity in xterms and check for embedded command's return value.
data/bin/omnibus CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  # Trap interrupts to quit cleanly. See
4
4
  # https://twitter.com/mitchellh/status/283014103189053442
5
- Signal.trap("INT") { exit 1 }
5
+ Signal.trap('INT') { exit 1 }
6
6
 
7
- $:.unshift File.expand_path("../../lib", __FILE__)
7
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
8
8
 
9
9
  require 'omnibus/cli'
10
10
 
@@ -0,0 +1 @@
1
+ Demonstration package.
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+
3
+ echo "INSTALL WORKED"
4
+ exit 0
@@ -0,0 +1,72 @@
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
+ require 'stringio'
19
+ require 'omnibus/packagers/mac_pkg'
20
+ require 'spec_helper'
21
+
22
+ describe Omnibus::Packagers::MacPkg do
23
+
24
+ let(:mac_pkg_identifier) { 'test.pkg.functional-test-project' }
25
+
26
+ let(:omnibus_root) { File.expand_path('../../fixtures/mac_pkg', __FILE__) }
27
+
28
+ let(:scripts_path) { "#{omnibus_root}/package-scripts" }
29
+
30
+ let(:files_path) { "#{omnibus_root}/files" }
31
+
32
+ let(:package_dir) { Dir.pwd }
33
+
34
+ let(:project) do
35
+
36
+ Omnibus.stub(:project_root).and_return(omnibus_root)
37
+ Omnibus.config.stub(:package_dir).and_return(package_dir)
38
+
39
+ project_file = <<-P
40
+ name "functional-test-project"
41
+ maintainer "YOU"
42
+ homepage "http://www.theonion.com/articles/drunken-man-careens-wildly-across-internet,35249/"
43
+ build_version "23.4.2"
44
+ install_path "/opt/functional-test-project"
45
+ mac_pkg_identifier "#{mac_pkg_identifier}"
46
+ P
47
+ Omnibus::Project.new(project_file, __FILE__)
48
+ end
49
+
50
+ let(:packager) do
51
+ Omnibus::Packagers::MacPkg.new(project)
52
+ end
53
+
54
+ def create_app_dir
55
+ FileUtils.mkdir('/opt/functional-test-project') unless File.directory?('/opt/functional-test-project')
56
+ File.open('/opt/functional-test-project/itworks.txt', 'w+') do |f|
57
+ f.puts 'hello world'
58
+ end
59
+ end
60
+
61
+ # This will run the Omnibus::Packagers::MacPkg code without any stubs to
62
+ # verify it works. In order for this test to run correctly, you have to run
63
+ # as root or manually create the /opt/functional-test-project directory.
64
+ #
65
+ # There is no verification that the package was correctly created, you have
66
+ # to install it yourself to verify.
67
+ it 'builds a package' do
68
+ create_app_dir
69
+ packager.build
70
+ end
71
+
72
+ end
@@ -1,6 +1,5 @@
1
1
  module Omnibus
2
2
  class Artifact
3
-
4
3
  attr_reader :path
5
4
  attr_reader :platforms
6
5
  attr_reader :config
@@ -65,9 +64,9 @@ module Omnibus
65
64
  def add_to_v2_release_manifest!(release_manifest)
66
65
  platforms.each do |distro, version, arch|
67
66
  pkg_info = {
68
- "relpath" => relpath,
69
- "md5" => md5,
70
- "sha256" => sha256
67
+ 'relpath' => relpath,
68
+ 'md5' => md5,
69
+ 'sha256' => sha256,
71
70
  }
72
71
 
73
72
  release_manifest[distro] ||= {}
@@ -92,13 +91,13 @@ module Omnibus
92
91
  def flat_metadata
93
92
  distro, version, arch = build_platform
94
93
  {
95
- "platform" => distro,
96
- "platform_version" => version,
97
- "arch" => arch,
98
- "version" => build_version,
99
- "basename" => File.basename(path),
100
- "md5" => md5,
101
- "sha256" => sha256
94
+ 'platform' => distro,
95
+ 'platform_version' => version,
96
+ 'arch' => arch,
97
+ 'version' => build_version,
98
+ 'basename' => File.basename(path),
99
+ 'md5' => md5,
100
+ 'sha256' => sha256,
102
101
  }
103
102
  end
104
103
 
@@ -140,7 +139,7 @@ module Omnibus
140
139
  def digest(digest_class)
141
140
  digest = digest_class.new
142
141
  File.open(path) do |io|
143
- while chunk = io.read(1024 * 8)
142
+ while (chunk = io.read(1024 * 8))
144
143
  digest.update(chunk)
145
144
  end
146
145
  end
@@ -148,4 +147,3 @@ module Omnibus
148
147
  end
149
148
  end
150
149
  end
151
-