omnibus 4.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +8 -0
  3. data/.travis.yml +3 -11
  4. data/CHANGELOG.md +50 -0
  5. data/MAINTAINERS.md +26 -0
  6. data/README.md +61 -4
  7. data/appveyor.yml +35 -0
  8. data/docs/Build Cache.md +28 -3
  9. data/docs/Building on RHEL.md +1 -1
  10. data/features/commands/publish.feature +4 -9
  11. data/features/step_definitions/generator_steps.rb +14 -1
  12. data/features/support/env.rb +5 -3
  13. data/lib/omnibus.rb +10 -0
  14. data/lib/omnibus/build_version.rb +34 -25
  15. data/lib/omnibus/build_version_dsl.rb +43 -4
  16. data/lib/omnibus/builder.rb +30 -11
  17. data/lib/omnibus/changelog.rb +52 -0
  18. data/lib/omnibus/changelog_printer.rb +77 -0
  19. data/lib/omnibus/cli.rb +37 -2
  20. data/lib/omnibus/cli/changelog.rb +149 -0
  21. data/lib/omnibus/cli/publish.rb +30 -10
  22. data/lib/omnibus/config.rb +41 -2
  23. data/lib/omnibus/digestable.rb +6 -1
  24. data/lib/omnibus/exceptions.rb +15 -1
  25. data/lib/omnibus/fetcher.rb +78 -34
  26. data/lib/omnibus/fetchers/git_fetcher.rb +84 -42
  27. data/lib/omnibus/fetchers/net_fetcher.rb +64 -13
  28. data/lib/omnibus/fetchers/null_fetcher.rb +8 -1
  29. data/lib/omnibus/fetchers/path_fetcher.rb +24 -1
  30. data/lib/omnibus/file_syncer.rb +52 -1
  31. data/lib/omnibus/generator.rb +22 -21
  32. data/lib/omnibus/generator_files/.kitchen.yml.erb +8 -12
  33. data/lib/omnibus/generator_files/Berksfile.erb +4 -4
  34. data/lib/omnibus/generator_files/Gemfile.erb +3 -3
  35. data/lib/omnibus/generator_files/README.md.erb +17 -0
  36. data/lib/omnibus/generator_files/omnibus.rb.erb +6 -0
  37. data/lib/omnibus/git_repository.rb +43 -0
  38. data/lib/omnibus/health_check.rb +5 -1
  39. data/lib/omnibus/manifest.rb +134 -0
  40. data/lib/omnibus/manifest_diff.rb +88 -0
  41. data/lib/omnibus/manifest_entry.rb +43 -0
  42. data/lib/omnibus/metadata.rb +19 -1
  43. data/lib/omnibus/package.rb +9 -0
  44. data/lib/omnibus/packagers/base.rb +1 -1
  45. data/lib/omnibus/packagers/bff.rb +5 -5
  46. data/lib/omnibus/packagers/deb.rb +11 -4
  47. data/lib/omnibus/packagers/msi.rb +243 -2
  48. data/lib/omnibus/packagers/rpm.rb +68 -14
  49. data/lib/omnibus/packagers/solaris.rb +17 -23
  50. data/lib/omnibus/project.rb +129 -16
  51. data/lib/omnibus/publisher.rb +62 -49
  52. data/lib/omnibus/publishers/artifactory_publisher.rb +96 -5
  53. data/lib/omnibus/publishers/s3_publisher.rb +20 -25
  54. data/lib/omnibus/s3_cache.rb +13 -34
  55. data/lib/omnibus/s3_helpers.rb +119 -0
  56. data/lib/omnibus/semantic_version.rb +57 -0
  57. data/lib/omnibus/software.rb +87 -28
  58. data/lib/omnibus/sugarable.rb +18 -0
  59. data/lib/omnibus/templating.rb +8 -1
  60. data/lib/omnibus/version.rb +1 -1
  61. data/omnibus.gemspec +10 -7
  62. data/resources/bff/gen.template.erb +1 -1
  63. data/resources/msi/bundle.wxs.erb +17 -0
  64. data/resources/msi/localization-en-us.wxl.erb +1 -1
  65. data/resources/rpm/spec.erb +1 -1
  66. data/spec/functional/builder_spec.rb +15 -7
  67. data/spec/functional/fetchers/git_fetcher_spec.rb +44 -12
  68. data/spec/functional/fetchers/net_fetcher_spec.rb +171 -20
  69. data/spec/functional/fetchers/path_fetcher_spec.rb +16 -1
  70. data/spec/functional/file_syncer_spec.rb +58 -5
  71. data/spec/functional/templating_spec.rb +17 -6
  72. data/spec/spec_helper.rb +17 -0
  73. data/spec/support/file_helpers.rb +12 -2
  74. data/spec/support/git_helpers.rb +23 -18
  75. data/spec/support/matchers.rb +22 -0
  76. data/spec/support/output_helpers.rb +29 -0
  77. data/spec/unit/build_version_dsl_spec.rb +31 -4
  78. data/spec/unit/build_version_spec.rb +11 -4
  79. data/spec/unit/builder_spec.rb +33 -0
  80. data/spec/unit/changelog_spec.rb +55 -0
  81. data/spec/unit/cleanroom_spec.rb +1 -1
  82. data/spec/unit/compressors/dmg_spec.rb +3 -3
  83. data/spec/unit/compressors/tgz_spec.rb +3 -3
  84. data/spec/unit/config_spec.rb +3 -1
  85. data/spec/unit/fetcher_spec.rb +35 -0
  86. data/spec/unit/fetchers/git_fetcher_spec.rb +28 -14
  87. data/spec/unit/fetchers/net_fetcher_spec.rb +178 -24
  88. data/spec/unit/fetchers/path_fetcher_spec.rb +8 -7
  89. data/spec/unit/generator_spec.rb +22 -21
  90. data/spec/unit/git_repository_spec.rb +60 -0
  91. data/spec/unit/manifest_diff_spec.rb +75 -0
  92. data/spec/unit/manifest_spec.rb +116 -0
  93. data/spec/unit/metadata_spec.rb +11 -0
  94. data/spec/unit/omnibus_spec.rb +9 -6
  95. data/spec/unit/package_spec.rb +1 -1
  96. data/spec/unit/packagers/base_spec.rb +8 -18
  97. data/spec/unit/packagers/bff_spec.rb +9 -5
  98. data/spec/unit/packagers/deb_spec.rb +44 -12
  99. data/spec/unit/packagers/makeself_spec.rb +4 -4
  100. data/spec/unit/packagers/msi_spec.rb +122 -6
  101. data/spec/unit/packagers/pkg_spec.rb +3 -3
  102. data/spec/unit/packagers/rpm_spec.rb +37 -12
  103. data/spec/unit/project_spec.rb +18 -1
  104. data/spec/unit/publisher_spec.rb +65 -0
  105. data/spec/unit/publishers/artifactory_publisher_spec.rb +26 -20
  106. data/spec/unit/publishers/s3_publisher_spec.rb +14 -30
  107. data/spec/unit/s3_cacher_spec.rb +1 -1
  108. data/spec/unit/s3_helpers_spec.rb +32 -0
  109. data/spec/unit/semantic_version_spec.rb +55 -0
  110. data/spec/unit/software_spec.rb +112 -4
  111. metadata +86 -16
@@ -4,16 +4,17 @@ module Omnibus
4
4
  describe PathFetcher do
5
5
  let(:source_path) { '/local/path' }
6
6
  let(:project_dir) { '/project/dir' }
7
+ let(:build_dir) { '/build/dir' }
7
8
 
8
- let(:software) do
9
- double(Software,
9
+ let(:manifest_entry) do
10
+ double(ManifestEntry,
10
11
  name: 'software',
11
- source: { path: source_path },
12
- project_dir: project_dir,
13
- )
12
+ locked_version: nil,
13
+ described_version: nil,
14
+ locked_source: { path: source_path })
14
15
  end
15
16
 
16
- subject { described_class.new(software) }
17
+ subject { described_class.new(manifest_entry, project_dir, build_dir) }
17
18
 
18
19
  describe '#fetch_required?' do
19
20
  context 'when the SHAs match' do
@@ -89,7 +90,7 @@ module Omnibus
89
90
  end
90
91
 
91
92
  it 'copies the new files over' do
92
- expect(FileSyncer).to receive(:sync).with(source_path, project_dir)
93
+ expect(FileSyncer).to receive(:sync).with(source_path, project_dir, {})
93
94
  subject.fetch
94
95
  end
95
96
  end
@@ -52,7 +52,7 @@ module Omnibus
52
52
  Generator.new(['name'], path: tmp_path, bff_assets: true).invoke_all
53
53
 
54
54
  expect(structure).to include(*%w(
55
- omnibus-name/resources/bff/gen.template.erb
55
+ omnibus-name/resources/name/bff/gen.template.erb
56
56
  ))
57
57
  end
58
58
  end
@@ -62,9 +62,9 @@ module Omnibus
62
62
  Generator.new(['name'], path: tmp_path, deb_assets: true).invoke_all
63
63
 
64
64
  expect(structure).to include(*%w(
65
- omnibus-name/resources/deb/conffiles.erb
66
- omnibus-name/resources/deb/control.erb
67
- omnibus-name/resources/deb/md5sums.erb
65
+ omnibus-name/resources/name/deb/conffiles.erb
66
+ omnibus-name/resources/name/deb/control.erb
67
+ omnibus-name/resources/name/deb/md5sums.erb
68
68
  ))
69
69
  end
70
70
  end
@@ -74,8 +74,8 @@ module Omnibus
74
74
  Generator.new(['name'], path: tmp_path, dmg_assets: true).invoke_all
75
75
 
76
76
  expect(structure).to include(*%w(
77
- omnibus-name/resources/dmg/background.png
78
- omnibus-name/resources/dmg/icon.png
77
+ omnibus-name/resources/name/dmg/background.png
78
+ omnibus-name/resources/name/dmg/icon.png
79
79
  ))
80
80
  end
81
81
  end
@@ -85,15 +85,15 @@ module Omnibus
85
85
  Generator.new(['name'], path: tmp_path, msi_assets: true).invoke_all
86
86
 
87
87
  expect(structure).to include(*%w(
88
- omnibus-name/resources/msi/assets/LICENSE.rtf
89
- omnibus-name/resources/msi/assets/banner_background.bmp
90
- omnibus-name/resources/msi/assets/dialog_background.bmp
91
- omnibus-name/resources/msi/assets/project.ico
92
- omnibus-name/resources/msi/assets/project_16x16.ico
93
- omnibus-name/resources/msi/assets/project_32x32.ico
94
- omnibus-name/resources/msi/localization-en-us.wxl.erb
95
- omnibus-name/resources/msi/parameters.wxi.erb
96
- omnibus-name/resources/msi/source.wxs.erb
88
+ omnibus-name/resources/name/msi/assets/LICENSE.rtf
89
+ omnibus-name/resources/name/msi/assets/banner_background.bmp
90
+ omnibus-name/resources/name/msi/assets/dialog_background.bmp
91
+ omnibus-name/resources/name/msi/assets/project.ico
92
+ omnibus-name/resources/name/msi/assets/project_16x16.ico
93
+ omnibus-name/resources/name/msi/assets/project_32x32.ico
94
+ omnibus-name/resources/name/msi/localization-en-us.wxl.erb
95
+ omnibus-name/resources/name/msi/parameters.wxi.erb
96
+ omnibus-name/resources/name/msi/source.wxs.erb
97
97
  ))
98
98
  end
99
99
  end
@@ -103,9 +103,10 @@ module Omnibus
103
103
  Generator.new(['name'], path: tmp_path, pkg_assets: true).invoke_all
104
104
 
105
105
  expect(structure).to include(*%w(
106
- omnibus-name/resources/pkg/background.png
107
- omnibus-name/resources/pkg/license.html.erb
108
- omnibus-name/resources/pkg/welcome.html.erb
106
+ omnibus-name/resources/name/pkg/background.png
107
+ omnibus-name/resources/name/pkg/license.html.erb
108
+ omnibus-name/resources/name/pkg/welcome.html.erb
109
+ omnibus-name/resources/name/pkg/distribution.xml.erb
109
110
  ))
110
111
  end
111
112
  end
@@ -115,9 +116,9 @@ module Omnibus
115
116
  Generator.new(['name'], path: tmp_path, rpm_assets: true).invoke_all
116
117
 
117
118
  expect(structure).to include(*%w(
118
- omnibus-name/resources/rpm/rpmmacros.erb
119
- omnibus-name/resources/rpm/signing.erb
120
- omnibus-name/resources/rpm/spec.erb
119
+ omnibus-name/resources/name/rpm/rpmmacros.erb
120
+ omnibus-name/resources/name/rpm/signing.erb
121
+ omnibus-name/resources/name/rpm/spec.erb
121
122
  ))
122
123
  end
123
124
  end
@@ -0,0 +1,60 @@
1
+ require 'spec_helper'
2
+
3
+ module Omnibus
4
+ describe GitRepository do
5
+ let(:git_repo) do
6
+ path = local_git_repo("foobar", annotated_tags: ["1.0", "2.0", "3.0"])
7
+ Omnibus::GitRepository.new(path)
8
+ end
9
+
10
+ describe "#authors" do
11
+ it "returns an array of authors between two tags" do
12
+ expect(git_repo.authors("1.0", "2.0")).to eq(["omnibus"])
13
+ end
14
+
15
+ it "returns an empty array if start_ref == end_ref" do
16
+ expect(git_repo.authors("3.0", "3.0")).to eq([])
17
+ end
18
+
19
+ it "doesn't return duplicates" do
20
+ expect(git_repo.authors("1.0", "3.0")).to eq(["omnibus"])
21
+ end
22
+
23
+ it "returns an error if the tags don't exist" do
24
+ expect{git_repo.authors("1.0", "WUT")}.to raise_error(RuntimeError)
25
+ end
26
+ end
27
+
28
+ describe "#latest_tag" do
29
+ it "returns the latest annotated tag" do
30
+ expect(git_repo.latest_tag).to eq("3.0")
31
+ end
32
+ end
33
+
34
+ describe "#revision" do
35
+ it "returns the current revision at HEAD" do
36
+ expect(git_repo.revision).to eq("632501dde2c41f3bdd988b818b4c008e2ff398dc")
37
+ end
38
+ end
39
+
40
+ describe "#file_at_revision" do
41
+ it "returns the text of the specified file in a repository at a given revision" do
42
+ expect(git_repo.file_at_revision("configure", "1.0")).to eq("echo \"Done!\"")
43
+ end
44
+ end
45
+
46
+ describe "#commit_messages" do
47
+ it "returns the raw text from commits between two tags as an array of lines" do
48
+ expect(git_repo.commit_messages("1.0", "3.0")).to eq(["Create tag 3.0\n", "\n", "Create tag 2.0\n"])
49
+ end
50
+
51
+ it "returns lines with the newline attached" do
52
+ expect(git_repo.commit_messages("1.0", "3.0").first[-1]).to eq("\n")
53
+ end
54
+
55
+ it "returns an empty array if start_ref == end_ref" do
56
+ expect(git_repo.commit_messages("3.0", "3.0")).to eq([])
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,75 @@
1
+ require 'spec_helper'
2
+
3
+ module Omnibus
4
+ describe ManifestDiff do
5
+ def manifest_entry_for(name, dv, lv)
6
+ Omnibus::ManifestEntry.new(name, {:described_version => dv,
7
+ :locked_version => lv,
8
+ :locked_source => {
9
+ :git => "git://#{name}@example.com"},
10
+ :source_type => :git
11
+ })
12
+ end
13
+
14
+
15
+ let(:manifest_one) do
16
+ m = Omnibus::Manifest.new()
17
+ m.add("foo", manifest_entry_for("foo", "1.2.4", "deadbeef"))
18
+ m.add("bar", manifest_entry_for("bar", "1.2.4", "deadbeef"))
19
+ m.add("baz", manifest_entry_for("baz", "1.2.4", "deadbeef"))
20
+ m
21
+ end
22
+
23
+ let(:manifest_two) do
24
+ m = Omnibus::Manifest.new()
25
+ m.add("foo", manifest_entry_for("foo", "1.2.5", "deadbea0"))
26
+ m.add("baz", manifest_entry_for("baz", "1.2.4", "deadbeef"))
27
+ m.add("quux", manifest_entry_for("quux", "1.2.4", "deadbeef"))
28
+ m
29
+ end
30
+
31
+ subject { described_class.new(manifest_one, manifest_two)}
32
+
33
+ describe "#updated" do
34
+ it "returns items that existed in the first manifest but have been changed" do
35
+ expect(subject.updated).to eq([{ :name => "foo",
36
+ :old_version => "deadbeef",
37
+ :new_version => "deadbea0",
38
+ :source_type => :git,
39
+ :source => {:git => "git://foo@example.com"}
40
+ }])
41
+ end
42
+
43
+ describe "#removed" do
44
+ it "returns items that existed in the first manfiest but don't exist in the second" do
45
+ expect(subject.removed).to eq([{ :name => "bar",
46
+ :old_version => "deadbeef",
47
+ :source_type => :git,
48
+ :source => {:git => "git://bar@example.com"}
49
+ }])
50
+ end
51
+ end
52
+
53
+ describe "#added" do
54
+ it "returns items that did not exist in the first manifest but do exist in the second" do
55
+ expect(subject.added).to eq([{ :name => "quux",
56
+ :new_version => "deadbeef",
57
+ :source_type => :git,
58
+ :source => {:git => "git://quux@example.com"}
59
+ }])
60
+ end
61
+ end
62
+
63
+ describe "#empty?" do
64
+ it "returns false if there have been changes" do
65
+ expect(subject.empty?).to eq(false)
66
+ end
67
+
68
+ it "returns true if nothing changed" do
69
+ diff = Omnibus::ManifestDiff.new(manifest_one, manifest_one)
70
+ expect(diff.empty?).to eq(true)
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,116 @@
1
+ require 'spec_helper'
2
+ require 'omnibus/manifest'
3
+ require 'omnibus/manifest_entry'
4
+
5
+ module Omnibus
6
+ describe Manifest do
7
+ subject { described_class.new }
8
+
9
+ describe "#add" do
10
+ it "stores manifest entries" do
11
+ me = ManifestEntry.new("womabt", {})
12
+ expect {subject.add("wombat", me)}.to_not raise_error
13
+ end
14
+
15
+ it "raises an error if it isn't given a ManifestEntry" do
16
+ expect {subject.add("foobar", {})}.to raise_error Manifest::NotAManifestEntry
17
+ end
18
+ end
19
+
20
+ describe "#entry_for" do
21
+ it "returns a ManifestEntry for the requested software" do
22
+ me = ManifestEntry.new("foobar", {})
23
+ subject.add("foobar", me)
24
+ expect(subject.entry_for("foobar")).to eq(me)
25
+ end
26
+
27
+ it "raises an error if no such manifest entry exists" do
28
+ expect {subject.entry_for("non-existant-entry")}.to raise_error Manifest::MissingManifestEntry
29
+ end
30
+ end
31
+
32
+ describe "#each" do
33
+ it "yields each item to the block" do
34
+ first = ManifestEntry.new("foobar", {})
35
+ second = ManifestEntry.new("wombat", {})
36
+ subject.add("foobar", first)
37
+ subject.add("wombat", second)
38
+ expect{ |b| subject.each &b }.to yield_successive_args(first, second)
39
+ end
40
+ end
41
+
42
+ describe "#entry_names" do
43
+ it "returns an array of software names present in the manifest" do
44
+ first = ManifestEntry.new("foobar", {})
45
+ second = ManifestEntry.new("wombat", {})
46
+ subject.add("foobar", first)
47
+ subject.add("wombat", second)
48
+ expect(subject.entry_names).to eq(["foobar", "wombat"])
49
+ end
50
+ end
51
+
52
+ describe "#to_hash" do
53
+ it "returns a Hash containg the current manifest format" do
54
+ expect(subject.to_hash['manifest_format']).to eq(Manifest::LATEST_MANIFEST_FORMAT)
55
+ end
56
+
57
+ it "includes entries for software in the manifest" do
58
+ subject.add("foobar", ManifestEntry.new("foobar", {}))
59
+ expect(subject.to_hash['software']).to have_key("foobar")
60
+ end
61
+
62
+ it "converts the manifest entries to hashes" do
63
+ subject.add("foobar", ManifestEntry.new("foobar", {}))
64
+ expect(subject.to_hash['software']['foobar']).to be_a(Hash)
65
+ end
66
+
67
+ it "returns a build_version if one was passed in" do
68
+ expect(Omnibus::Manifest.new("1.2.3").to_hash["build_version"]).to eq("1.2.3")
69
+ end
70
+
71
+ it "returns a build_git_revision if one was passed in" do
72
+ expect(Omnibus::Manifest.new("1.2.3", "e8e8e8").to_hash["build_git_revision"]).to eq("e8e8e8")
73
+ end
74
+ end
75
+
76
+ describe "#from_hash" do
77
+ let(:manifest) {
78
+ { "manifest_format" => 1,
79
+ "build_version" => "12.4.0+20150629082811",
80
+ "build_git_revision" => "2e763ac957b308ba95cef256c2491a5a55a163cc",
81
+ "software" => {
82
+ "zlib" => {
83
+ "locked_source" => {
84
+ "url" => "an_url"
85
+ },
86
+ "locked_version" => "new.newer",
87
+ "source_type" => "url",
88
+ "described_version" => "new.newer"}}}
89
+ }
90
+
91
+ let(:v2_manifest) {
92
+ {"manifest_format" => 2}
93
+ }
94
+
95
+ it "has a build_version" do
96
+ expect(Manifest.from_hash(manifest).build_version).to eq('12.4.0+20150629082811')
97
+ end
98
+
99
+ it "has a build_git_revision" do
100
+ expect(Manifest.from_hash(manifest).build_git_revision).to eq('2e763ac957b308ba95cef256c2491a5a55a163cc')
101
+ end
102
+
103
+ it "returns a manifest from a hash" do
104
+ expect(Manifest.from_hash(manifest)).to be_a(Manifest)
105
+ end
106
+
107
+ it "normalizes the source to use symbols" do
108
+ expect(Manifest.from_hash(manifest).entry_for("zlib").locked_source).to eq({:url => "an_url"})
109
+ end
110
+
111
+ it "raises an error if it doesn't recognize the manifest version" do
112
+ expect{Manifest.from_hash(v2_manifest)}.to raise_error Manifest::InvalidManifestFormat
113
+ end
114
+ end
115
+ end
116
+ end
@@ -28,6 +28,16 @@ module Omnibus
28
28
  end
29
29
  expect(described_class.arch).to eq('x86_64')
30
30
  end
31
+
32
+ context 'on windows' do
33
+ it 'returns a 32-bit value based on Config.windows_arch being set to x86' do
34
+ stub_ohai(platform: 'windows', version: '2012R2') do |data|
35
+ data['kernel']['machine'] = 'x86_64'
36
+ end
37
+ expect(Config).to receive(:windows_arch).and_return(:x86)
38
+ expect(described_class.arch).to eq('i386')
39
+ end
40
+ end
31
41
  end
32
42
 
33
43
  describe '.platform_shortname' do
@@ -93,6 +103,7 @@ module Omnibus
93
103
  it_behaves_like 'a version manipulator', 'windows', '6.2.9200', '8'
94
104
  it_behaves_like 'a version manipulator', 'windows', '6.3.9200', '8.1'
95
105
  it_behaves_like 'a version manipulator', 'windows', '6.3.9600', '8.1'
106
+ it_behaves_like 'a version manipulator', 'windows', '10.0.10240', '10'
96
107
 
97
108
  context 'given an unknown platform' do
98
109
  before do
@@ -7,14 +7,14 @@ describe Omnibus do
7
7
 
8
8
  allow(Gem::Specification).to receive(:find_all_by_name)
9
9
  .with('omnibus-software')
10
- .and_return([double(gem_dir: '/gem/omnibus-software')])
10
+ .and_return([double(gem_dir: File.join(tmp_path, '/gem/omnibus-software'))])
11
11
 
12
12
  allow(Gem::Specification).to receive(:find_all_by_name)
13
13
  .with('custom-omnibus-software')
14
- .and_return([double(gem_dir: '/gem/custom-omnibus-software')])
14
+ .and_return([double(gem_dir: File.join(tmp_path, '/gem/custom-omnibus-software'))])
15
15
 
16
- Omnibus::Config.project_root('/foo/bar')
17
- Omnibus::Config.local_software_dirs(['/local', '/other'])
16
+ Omnibus::Config.project_root(File.join(tmp_path, '/foo/bar'))
17
+ Omnibus::Config.local_software_dirs([File.join(tmp_path, '/local'), File.join(tmp_path, '/other')])
18
18
  Omnibus::Config.software_gems(['omnibus-software', 'custom-omnibus-software'])
19
19
  end
20
20
 
@@ -25,8 +25,11 @@ describe Omnibus do
25
25
  end
26
26
 
27
27
  it 'returns the path when the file exists' do
28
- ruby = Bundler.which('ruby')
28
+
29
+ ruby_cmd = windows? ? 'ruby.exe' : 'ruby'
30
+ ruby = Bundler.which(ruby_cmd)
29
31
  expect(subject.which(ruby)).to eq(ruby)
32
+ expect(subject.which(ruby_cmd)).to eq(ruby)
30
33
  end
31
34
  end
32
35
 
@@ -76,7 +79,7 @@ describe Omnibus do
76
79
  /other/file
77
80
  /gem/omnibus-software/file
78
81
  /gem/custom-omnibus-software/file
79
- ))
82
+ ).map { |path| File.join(tmp_path, path) })
80
83
  end
81
84
  end
82
85
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  module Omnibus
4
4
  describe Package do
5
- let(:path) { '/path/to/files/thing.deb' }
5
+ let(:path) { windows? ? 'C:/path/to/files/thing.deb' : '/path/to/files/thing.deb' }
6
6
 
7
7
  subject { described_class.new(path) }
8
8
 
@@ -5,7 +5,7 @@ module Omnibus
5
5
  let(:project) do
6
6
  Project.new.tap do |project|
7
7
  project.name('project')
8
- project.install_dir('/opt/project')
8
+ project.install_dir(File.join(tmp_path, 'opt/project'))
9
9
  project.homepage('https://example.com')
10
10
  project.build_version('1.2.3')
11
11
  project.build_iteration('2')
@@ -15,7 +15,7 @@ module Omnibus
15
15
 
16
16
  before do
17
17
  # Force the Dir.mktmpdir call on staging_dir
18
- allow(Dir).to receive(:mktmpdir).and_return('/tmp/dir')
18
+ allow(Dir).to receive(:mktmpdir).and_return(File.join(tmp_path, 'tmp/dir'))
19
19
 
20
20
  Config.package_dir(tmp_path)
21
21
  end
@@ -77,7 +77,7 @@ module Omnibus
77
77
  end
78
78
 
79
79
  it 'returns the project instances install_dir' do
80
- expect(subject.install_dir).to eq('/opt/project')
80
+ expect(subject.install_dir).to eq(project.install_dir)
81
81
  end
82
82
  end
83
83
 
@@ -117,7 +117,7 @@ module Omnibus
117
117
  before { allow(subject).to receive(:id).and_return(id) }
118
118
 
119
119
  context 'when a local resource exists' do
120
- let(:resources_path) { '/resources/path' }
120
+ let(:resources_path) { File.join(tmp_path, '/resources/path') }
121
121
 
122
122
  before do
123
123
  project.resources_path(resources_path)
@@ -130,6 +130,10 @@ module Omnibus
130
130
  it 'returns the local path' do
131
131
  expect(subject.resource_path('foo/bar.erb')).to eq("#{resources_path}/#{id}/foo/bar.erb")
132
132
  end
133
+
134
+ it 'returns the path with the id' do
135
+ expect(subject.resources_path).to eq("#{resources_path}/#{id}")
136
+ end
133
137
  end
134
138
 
135
139
  context 'when a local resource does not exist' do
@@ -138,19 +142,5 @@ module Omnibus
138
142
  end
139
143
  end
140
144
  end
141
-
142
- describe '#resoures_path' do
143
- let(:id) { :base }
144
- let(:resources_path) { '/resources/path' }
145
-
146
- before do
147
- project.resources_path(resources_path)
148
- allow(subject).to receive(:id).and_return(id)
149
- end
150
-
151
- it 'returns the path with the id' do
152
- expect(subject.resources_path).to eq("#{resources_path}/#{id}")
153
- end
154
- end
155
145
  end
156
146
  end