Skip to content

Commit 41a50e5

Browse files
committed
Release script
Previously, the buildpack did not meet the contractual obligations for the release phase of the buildpack lifecycle. This change adds a bin/release shell script which delegates to a ruby class internally. This class currently does nothing, but will need to delegate to buildpack components in the future. [#49321333]
1 parent e55750f commit 41a50e5

File tree

6 files changed

+108
-3
lines changed

6 files changed

+108
-3
lines changed

bin/release

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env ruby
2+
# Cloud Foundry Java Buildpack
3+
# Copyright (c) 2013 the original author or authors.
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+
$:.unshift File.expand_path("../../lib", __FILE__)
18+
require 'java_buildpack'
19+
20+
build_dir = ARGV[0]
21+
22+
begin
23+
puts JavaBuildpack::Release.new(build_dir).run
24+
rescue => e
25+
abort e.message
26+
end
27+

lib/java-buildpack/release.rb

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Cloud Foundry Java Buildpack
2+
# Copyright (c) 2013 the original author or authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Encapsulates the release functionality in the Java buildpack
17+
class JavaBuildpack::Release
18+
19+
# Creates a new instance, passing in the application directory used during release
20+
#
21+
# @param [String] app_dir The application directory used during release
22+
def initialize(app_dir)
23+
24+
end
25+
26+
# The execution entry point for release. This method is responsible for generating a payload describing the execution
27+
# command used to start the application.
28+
#
29+
# @return [String] the YAML formatted payload describing the execution command used to start the application
30+
def run
31+
{
32+
addons: [],
33+
config_vars: {},
34+
default_process_types: {
35+
web: ''
36+
}
37+
}.to_yaml
38+
end
39+
40+
end

lib/java_buildpack.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ module JavaBuildpack
1919

2020
require 'java-buildpack/compile'
2121
require 'java-buildpack/detect'
22-
#require 'java-buildpack/release'
22+
require 'java-buildpack/release'

spec/bin/compile_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Git Pivotal Tracker Integration
1+
# Cloud Foundry Java Buildpack
22
# Copyright (c) 2013 the original author or authors.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");

spec/bin/detect_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Git Pivotal Tracker Integration
1+
# Cloud Foundry Java Buildpack
22
# Copyright (c) 2013 the original author or authors.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");

spec/bin/release_spec.rb

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Cloud Foundry Java Buildpack
2+
# Copyright (c) 2013 the original author or authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
require 'spec_helper'
17+
require 'open3'
18+
19+
describe 'release' do
20+
21+
it 'should return zero if the release is successful' do
22+
# TODO Implement test as things are filled out
23+
end
24+
25+
it 'should return non-zero if an error occurs' do
26+
# TODO Implement test as things are filled out
27+
end
28+
29+
it 'should print the error message if an error occurs' do
30+
# TODO Implement test as things are filled out
31+
end
32+
33+
private
34+
35+
COMPILE = File.expand_path('../../../bin/release', __FILE__)
36+
FIXTURES_DIR = File.expand_path('../../fixtures', __FILE__)
37+
38+
end

0 commit comments

Comments
 (0)