Permalink
Browse files

Always write BOSH_VERSION building gems

  • Loading branch information...
1 parent ac52bfa commit 5ef4c839399ed572c2e81afb7a3b2c576b7e7692 @hiremaga hiremaga committed Oct 9, 2013
@@ -1,11 +1,18 @@
require 'rake'
require 'bosh/dev/gem_component'
+require 'bosh/dev/version_file'
module Bosh::Dev
class GemComponents
include Enumerable
+ def initialize(build_number)
+ @version_file = VersionFile.new(build_number)
+ end
+
def build_release_gems
+ @version_file.write
+
stage_with_dependencies
each do |component|
@@ -6,12 +6,10 @@ module Bosh::Dev
class GemsGenerator
def initialize(build)
@build = build
- @components = GemComponents.new
+ @components = GemComponents.new(build.number)
end
def generate_and_upload
- VersionFile.new(@build.number).write
-
@components.build_release_gems
Dir.chdir('pkg') do
@@ -14,6 +14,7 @@ def self.for_candidate_build(infrastructure_name, operating_system_name)
end
def initialize(env, build, infrastructure_name, operating_system_name)
+ @build_number = build.number
@stemcell_builder_command = Bosh::Stemcell::BuilderCommand.new(
env,
infrastructure_name: infrastructure_name,
@@ -24,7 +25,7 @@ def initialize(env, build, infrastructure_name, operating_system_name)
end
def build_stemcell
- gem_components = GemComponents.new
+ gem_components = GemComponents.new(@build_number)
gem_components.build_release_gems
@stemcell_path = stemcell_builder_command.build
@@ -1,9 +1,11 @@
namespace :release do
desc 'Create BOSH dev release'
task :create_dev_release do
+ require 'bosh/dev/build'
require 'bosh/dev/gem_components'
- gem_components = Bosh::Dev::GemComponents.new
+ build = Bosh::Dev::Build.candidate
+ gem_components = Bosh::Dev::GemComponents.new(build.number)
gem_components.build_release_gems
create_release
end
@@ -4,8 +4,26 @@
module Bosh::Dev
describe GemComponents do
+ let(:version_file) do
+ instance_double('Bosh::Dev::VersionFile', write: nil)
+ end
+
subject(:gem_components) do
- GemComponents.new
+ GemComponents.new('123')
+ end
+
+ before do
+ VersionFile.stub(:new).with(456).and_return(version_file)
+ Bosh::Dev::VersionFile.stub(:new).with('123').and_return(version_file)
+
+ Rake::FileUtilsExt.stub(:sh)
+ end
+
+ describe '#build_release_gems' do
+ it 'updates BOSH_VERSION' do
+ version_file.should_receive(:write)
+ gem_components.build_release_gems
+ end
end
describe '#dot_gems' do
@@ -11,19 +11,11 @@ module Bosh::Dev
before { GemComponents.stub(new: gem_components) }
let(:gem_components) { instance_double('Bosh::Dev::GemComponents', build_release_gems: nil) }
- before { VersionFile.stub(:new).with(456).and_return(version_file) }
- let(:version_file) { instance_double('Bosh::Dev::VersionFile', write: nil) }
-
before do
Rake::FileUtilsExt.stub(:sh)
Dir.stub(:chdir).and_yield
end
- it 'updates BOSH_VERSION' do
- version_file.should_receive(:write)
- subject.generate_and_upload
- end
-
it 'builds all bosh gems' do
gem_components.should_receive(:build_release_gems)
subject.generate_and_upload

0 comments on commit 5ef4c83

Please sign in to comment.