buildpack-support 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +202 -0
- data/NOTICE +2 -0
- data/docs/cache.md +77 -0
- data/docs/component.md +1 -0
- data/docs/configuration.md +27 -0
- data/docs/logging.md +54 -0
- data/docs/other.md +1 -0
- data/docs/rake.md +1 -0
- data/docs/repository.md +116 -0
- data/docs/test.md +1 -0
- data/lib/buildpack_support.rb +18 -0
- data/lib/buildpack_support/base_buildpack.rb +166 -0
- data/lib/buildpack_support/buildpack_version.rb +124 -0
- data/lib/buildpack_support/cache.rb +24 -0
- data/lib/buildpack_support/cache/application_cache.rb +41 -0
- data/lib/buildpack_support/cache/cached_file.rb +103 -0
- data/lib/buildpack_support/cache/download_cache.rb +280 -0
- data/lib/buildpack_support/cache/inferred_network_failure.rb +26 -0
- data/lib/buildpack_support/cache/internet_availability.rb +64 -0
- data/lib/buildpack_support/component.rb +24 -0
- data/lib/buildpack_support/component/application.rb +76 -0
- data/lib/buildpack_support/component/base_component.rb +78 -0
- data/lib/buildpack_support/component/base_droplet.rb +96 -0
- data/lib/buildpack_support/component/downloads.rb +88 -0
- data/lib/buildpack_support/component/services.rb +84 -0
- data/lib/buildpack_support/component/versioned_dependency_component.rb +71 -0
- data/lib/buildpack_support/component/versioned_downloads.rb +57 -0
- data/lib/buildpack_support/component/with_timing.rb +40 -0
- data/lib/buildpack_support/configuration_utils.rb +58 -0
- data/lib/buildpack_support/constantize.rb +46 -0
- data/lib/buildpack_support/dash_case.rb +29 -0
- data/lib/buildpack_support/directory_finder.rb +45 -0
- data/lib/buildpack_support/filtering_pathname.rb +227 -0
- data/lib/buildpack_support/format_duration.rb +57 -0
- data/lib/buildpack_support/logging.rb +22 -0
- data/lib/buildpack_support/logging/delegating_logger.rb +48 -0
- data/lib/buildpack_support/logging/logger_factory.rb +148 -0
- data/lib/buildpack_support/qualify_path.rb +36 -0
- data/lib/buildpack_support/rake.rb +22 -0
- data/lib/buildpack_support/rake/buildpack_stage_task.rb +86 -0
- data/lib/buildpack_support/rake/cached_artifact_finder.rb +99 -0
- data/lib/buildpack_support/rake/check_api_doc_task.rb +70 -0
- data/lib/buildpack_support/rake/dependency_cache_task.rb +87 -0
- data/lib/buildpack_support/rake/disable_remote_downloads_task.rb +80 -0
- data/lib/buildpack_support/rake/package_task.rb +133 -0
- data/lib/buildpack_support/rake/package_zip_task.rb +80 -0
- data/lib/buildpack_support/rake/repository_configuration_finder.rb +66 -0
- data/lib/buildpack_support/rake/write_version_file_task.rb +82 -0
- data/lib/buildpack_support/repository.rb +24 -0
- data/lib/buildpack_support/repository/configured_item.rb +81 -0
- data/lib/buildpack_support/repository/repository_index.rb +98 -0
- data/lib/buildpack_support/repository/wildcard_version_resolver.rb +75 -0
- data/lib/buildpack_support/shell.rb +41 -0
- data/lib/buildpack_support/snake_case.rb +30 -0
- data/lib/buildpack_support/space_case.rb +29 -0
- data/lib/buildpack_support/test/application_helper.rb +41 -0
- data/lib/buildpack_support/test/base_component_helper.rb +59 -0
- data/lib/buildpack_support/test/base_droplet_helper.rb +36 -0
- data/lib/buildpack_support/test/console_helper.rb +57 -0
- data/lib/buildpack_support/test/environment_helper.rb +32 -0
- data/lib/buildpack_support/test/internet_availability_helper.rb +29 -0
- data/lib/buildpack_support/test/logging_helper.rb +50 -0
- data/lib/buildpack_support/test/scratch_helper.rb +32 -0
- data/lib/buildpack_support/test/versioned_dependency_component_helper.rb +32 -0
- data/lib/buildpack_support/test/with_load_path_helper.rb +27 -0
- data/lib/buildpack_support/to_b.rb +38 -0
- data/lib/buildpack_support/tokenized_version.rb +157 -0
- data/lib/buildpack_support/version.rb +23 -0
- data/spec/buildpack_support/base_buildpack_spec.rb +112 -0
- data/spec/buildpack_support/buildpack_version_spec.rb +122 -0
- data/spec/buildpack_support/cache/application_cache_spec.rb +56 -0
- data/spec/buildpack_support/cache/cached_file_spec.rb +94 -0
- data/spec/buildpack_support/cache/download_cache_spec.rb +293 -0
- data/spec/buildpack_support/cache/internet_availability_spec.rb +57 -0
- data/spec/buildpack_support/cache/yield_file_with_content.rb +30 -0
- data/spec/buildpack_support/component/application_spec.rb +81 -0
- data/spec/buildpack_support/component/base_component_spec.rb +81 -0
- data/spec/buildpack_support/component/base_droplet_spec.rb +72 -0
- data/spec/buildpack_support/component/downloads_spec.rb +63 -0
- data/spec/buildpack_support/component/services_spec.rb +80 -0
- data/spec/buildpack_support/component/versioned_dependency_component_spec.rb +58 -0
- data/spec/buildpack_support/component/versioned_downloads_spec.rb +58 -0
- data/spec/buildpack_support/component/with_timing_spec.rb +30 -0
- data/spec/buildpack_support/configuration_utils_spec.rb +39 -0
- data/spec/buildpack_support/constantize_spec.rb +34 -0
- data/spec/buildpack_support/dash_case_spec.rb +41 -0
- data/spec/buildpack_support/directory_finder_spec.rb +41 -0
- data/spec/buildpack_support/filtering_pathname_spec.rb +443 -0
- data/spec/buildpack_support/format_duration_spec.rb +60 -0
- data/spec/buildpack_support/logging/delegating_logger_spec.rb +62 -0
- data/spec/buildpack_support/logging/logger_factory_spec.rb +262 -0
- data/spec/buildpack_support/qualify_path_spec.rb +42 -0
- data/spec/buildpack_support/rake/buildpack_stage_task_spec.rb +88 -0
- data/spec/buildpack_support/rake/cached_artifact_finder_spec.rb +73 -0
- data/spec/buildpack_support/rake/check_api_doc_task_spec.rb +69 -0
- data/spec/buildpack_support/rake/dependency_cache_task_spec.rb +133 -0
- data/spec/buildpack_support/rake/disable_remote_downloads_task_spec.rb +91 -0
- data/spec/buildpack_support/rake/package_task_spec.rb +335 -0
- data/spec/buildpack_support/rake/package_zip_task_spec.rb +91 -0
- data/spec/buildpack_support/rake/repository_configuration_finder_spec.rb +61 -0
- data/spec/buildpack_support/rake/write_version_file_task_spec.rb +96 -0
- data/spec/buildpack_support/repository/configured_item_spec.rb +78 -0
- data/spec/buildpack_support/repository/repository_index_spec.rb +118 -0
- data/spec/buildpack_support/repository/wildcard_version_resolver_spec.rb +73 -0
- data/spec/buildpack_support/shell_spec.rb +32 -0
- data/spec/buildpack_support/snake_case_spec.rb +45 -0
- data/spec/buildpack_support/space_case_spec.rb +41 -0
- data/spec/buildpack_support/to_b_spec.rb +41 -0
- data/spec/buildpack_support/tokenized_version_spec.rb +132 -0
- data/spec/fixtures/application/test-file +0 -0
- data/spec/fixtures/config/found-config.yml +2 -0
- data/spec/fixtures/droplet-resources/droplet-resource +0 -0
- data/spec/fixtures/stub-download-with-top-level.zip +0 -0
- data/spec/fixtures/stub-download.tar.gz +0 -0
- data/spec/fixtures/stub-download.zip +0 -0
- data/spec/fixtures/test-cache.yml +18 -0
- data/spec/fixtures/test-index.yml +2 -0
- data/spec/fixtures/test_component.rb +0 -0
- data/spec/fixtures/zip-contents/test-directory/test-deep-file +0 -0
- data/spec/fixtures/zip-contents/test-file +0 -0
- data/spec/spec_helper.rb +30 -0
- metadata +416 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Encoding: utf-8
|
|
2
|
+
# Copyright 2013-2014 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.anguage governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
require 'spec_helper'
|
|
18
|
+
require 'buildpack_support/repository/wildcard_version_resolver'
|
|
19
|
+
require 'buildpack_support/tokenized_version'
|
|
20
|
+
|
|
21
|
+
describe BuildpackSupport::Repository::WildcardVersionResolver do
|
|
22
|
+
|
|
23
|
+
let(:resolver) { described_class.new }
|
|
24
|
+
|
|
25
|
+
let(:versions) { %w(1.6.0_26 1.6.0_27 1.6.1_14 1.7.0_19 1.7.0_21 1.8.0_M-7 1.8.0_05 2.0.0) }
|
|
26
|
+
|
|
27
|
+
it 'resolves the default version if no candidate is supplied' do
|
|
28
|
+
expect(resolver.resolve(nil, versions)).to eq(tokenized_version('2.0.0'))
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'resolves a wildcard major version' do
|
|
32
|
+
expect(resolver.resolve(tokenized_version('+'), versions)).to eq(tokenized_version('2.0.0'))
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'resolves a wildcard minor version' do
|
|
36
|
+
expect(resolver.resolve(tokenized_version('1.+'), versions)).to eq(tokenized_version('1.8.0_05'))
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'resolves a wildcard micro version' do
|
|
40
|
+
expect(resolver.resolve(tokenized_version('1.6.+'), versions)).to eq(tokenized_version('1.6.1_14'))
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it 'resolves a wildcard qualifier' do
|
|
44
|
+
expect(resolver.resolve(tokenized_version('1.6.0_+'), versions)).to eq(tokenized_version('1.6.0_27'))
|
|
45
|
+
expect(resolver.resolve(tokenized_version('1.8.0_+'), versions)).to eq(tokenized_version('1.8.0_05'))
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it 'resolves a non-wildcard version' do
|
|
49
|
+
expect(resolver.resolve(tokenized_version('1.6.0_26'), versions)).to eq(tokenized_version('1.6.0_26'))
|
|
50
|
+
expect(resolver.resolve(tokenized_version('2.0.0'), versions)).to eq(tokenized_version('2.0.0'))
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
it 'resolves a non-digit qualifier' do
|
|
54
|
+
expect(resolver.resolve(tokenized_version('1.8.0_M-7'), versions)).to eq(tokenized_version('1.8.0_M-7'))
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it 'should raise an exception if no version can be resolved' do
|
|
58
|
+
expect { resolver.resolve(tokenized_version('2.1.0'), versions) }.to raise_error
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
it 'should raise an exception when a wildcard is specified in the [] collection' do
|
|
62
|
+
expect { resolver.resolve(tokenized_version('1.6.0_25'), %w(+)) }.to raise_error(/Invalid/)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
it 'should fail if candidate is not a tokenized version' do
|
|
66
|
+
expect { resolver.resolve('+', versions) }.to raise_error(/Invalid TokenizedVersion '\+'/)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def tokenized_version(s)
|
|
70
|
+
BuildpackSupport::TokenizedVersion.new(s)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Encoding: utf-8
|
|
2
|
+
# Copyright 2013-2014 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 'buildpack_support/shell'
|
|
18
|
+
require 'buildpack_support/test/console_helper'
|
|
19
|
+
|
|
20
|
+
describe BuildpackSupport::Shell do
|
|
21
|
+
include BuildpackSupport::Shell
|
|
22
|
+
include_context 'console_helper'
|
|
23
|
+
|
|
24
|
+
it 'should return if command returns a zero exit code' do
|
|
25
|
+
shell 'true'
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it 'should raise an error if command returns a non-zero exit code' do
|
|
29
|
+
expect { shell 'false' }.to raise_error
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Encoding: utf-8
|
|
2
|
+
# Copyright 2013-2014 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 'buildpack_support/snake_case'
|
|
18
|
+
|
|
19
|
+
describe 'snake_case' do
|
|
20
|
+
|
|
21
|
+
it 'should return only lowercase strings' do
|
|
22
|
+
expect('Test'.snake_case).to eq('test')
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'should separate module names with forward slash characters' do
|
|
26
|
+
expect('Foo::Bar::Bang'.snake_case).to eq('foo/bar/bang')
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it 'should split on penultimate uppercase characters' do
|
|
30
|
+
expect('FOOBar'.snake_case).to eq('foo_bar')
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it 'should split on lowercase characters followed an uppercase characters' do
|
|
34
|
+
expect('FooBar'.snake_case).to eq('foo_bar')
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'should split on digit characters followed an uppercase characters' do
|
|
38
|
+
expect('123Bar'.snake_case).to eq('123_bar')
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it 'should replace dashes with underscores' do
|
|
42
|
+
expect('Foo-Bar'.snake_case).to eq('foo_bar')
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Encoding: utf-8
|
|
2
|
+
# Copyright 2013-2014 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 'buildpack_support/space_case'
|
|
18
|
+
|
|
19
|
+
describe 'space_case' do
|
|
20
|
+
|
|
21
|
+
it 'should replace dashes with spaces' do
|
|
22
|
+
expect('Test-Test'.space_case).to eq('Test Test')
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'should return only the last module name' do
|
|
26
|
+
expect('Foo::Bar::Bang'.space_case).to eq('Bang')
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it 'should split on penultimate uppercase characters' do
|
|
30
|
+
expect('FOOBar'.space_case).to eq('FOO Bar')
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it 'should split on lowercase characters followed an uppercase characters' do
|
|
34
|
+
expect('FooBar'.space_case).to eq('Foo Bar')
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'should split on digit characters followed an uppercase characters' do
|
|
38
|
+
expect('123Bar'.space_case).to eq('123 Bar')
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Encoding: utf-8
|
|
2
|
+
# Copyright 2013-2014 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 'buildpack_support/to_b'
|
|
18
|
+
|
|
19
|
+
describe 'to_b' do
|
|
20
|
+
|
|
21
|
+
it 'should return true for any the string "true" in mixed case' do
|
|
22
|
+
expect('TrUe'.to_b).to eq(true)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'should return true for the string "true" in any lower case' do
|
|
26
|
+
expect('true'.to_b).to eq(true)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it 'should return false for any string other than "true" in any case' do
|
|
30
|
+
expect('1true'.to_b).to eq(false)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it 'should return false for the string "false" in any case' do
|
|
34
|
+
expect('FALSE'.to_b).to eq(false)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'should return false for a nil Class' do
|
|
38
|
+
expect(nil.to_b).to eq(false)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
end
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Encoding: utf-8
|
|
2
|
+
# Copyright 2013-2014 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 'buildpack_support/tokenized_version'
|
|
18
|
+
|
|
19
|
+
describe BuildpackSupport::TokenizedVersion do
|
|
20
|
+
|
|
21
|
+
it 'defaults to a wildcard if no version is supplied' do
|
|
22
|
+
expect(described_class.new(nil)).to eq(described_class.new('+'))
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'should order major versions correctly' do
|
|
26
|
+
expect(described_class.new('3.0.0')).to be > described_class.new('2.0.0')
|
|
27
|
+
expect(described_class.new('10.0.0')).to be > described_class.new('2.0.0')
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'should order minor versions correctly' do
|
|
31
|
+
expect(described_class.new('0.3.0')).to be > described_class.new('0.2.0')
|
|
32
|
+
expect(described_class.new('0.10.0')).to be > described_class.new('0.2.0')
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'should order micro versions correctly' do
|
|
36
|
+
expect(described_class.new('0.0.3')).to be > described_class.new('0.0.2')
|
|
37
|
+
expect(described_class.new('0.0.10')).to be > described_class.new('0.0.2')
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it 'should order qualifiers correctly' do
|
|
41
|
+
expect(described_class.new('1.7.0_28a')).to be > described_class.new('1.7.0_28')
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it 'should accept a qualifier with embedded periods and hyphens' do
|
|
45
|
+
described_class.new('0.5.0_BUILD-20120731.141622-16')
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it 'should raise an exception when the major version is not numeric' do
|
|
49
|
+
expect { described_class.new('A') }.to raise_error(/Invalid/)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it 'should raise an exception when the minor version is not numeric' do
|
|
53
|
+
expect { described_class.new('1.A') }.to raise_error(/Invalid/)
|
|
54
|
+
expect { described_class.new('1..0') }.to raise_error(/Invalid/)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it 'should raise an exception when the micro version is not numeric' do
|
|
58
|
+
expect { described_class.new('1.6.A') }.to raise_error(/Invalid/)
|
|
59
|
+
expect { described_class.new('1.6..') }.to raise_error(/Invalid/)
|
|
60
|
+
expect { described_class.new('1.6._0') }.to raise_error(/Invalid/)
|
|
61
|
+
expect { described_class.new('1.6_26') }.to raise_error(/Invalid/)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it 'should raise an exception when micro version is missing' do
|
|
65
|
+
expect { described_class.new('1.6') }.to raise_error(/Invalid/)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
it 'should raise an exception when major version is not legal' do
|
|
69
|
+
expect { described_class.new('1+') }.to raise_error(/Invalid/)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
it 'should raise an exception when minor version is not legal' do
|
|
73
|
+
expect { described_class.new('1.6+') }.to raise_error(/Invalid/)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
it 'should raise an exception when micro version is not legal' do
|
|
77
|
+
expect { described_class.new('1.6.0+') }.to raise_error(/Invalid/)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
it 'should raise an exception when qualifier version is not legal' do
|
|
81
|
+
expect { described_class.new('1.6.0_05+') }.to raise_error(/Invalid/)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
it 'should raise an exception when the qualifier is not letter, number, or hyphen' do
|
|
85
|
+
expect { described_class.new('1.6.0_?') }.to raise_error(/Invalid/)
|
|
86
|
+
expect { described_class.new('1.6.0__5') }.to raise_error(/Invalid/)
|
|
87
|
+
expect { described_class.new('1.6.0_A.') }.to raise_error(/Invalid/)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
it 'should raise an exception when a major version wildcard is followed by anything' do
|
|
91
|
+
expect { described_class.new('+.6.0_26') }.to raise_error(/Invalid/)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
it 'should raise an exception when a minor version wildcard is followed by anything' do
|
|
95
|
+
expect { described_class.new('1.+.0_26') }.to raise_error(/Invalid/)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
it 'should raise an exception when a micro version wildcard is followed by anything' do
|
|
99
|
+
expect { described_class.new('1.6.+_26') }.to raise_error(/Invalid/)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
it 'should raise an exception when too many components are specified' do
|
|
103
|
+
expect { described_class.new('1.6.0.25') }.to raise_error(/Invalid/)
|
|
104
|
+
expect { described_class.new('1.6.0.25_27') }.to raise_error(/Invalid/)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
it 'should raise an exception when not enough components are specified' do
|
|
108
|
+
expect { described_class.new('_25') }.to raise_error(/Invalid/)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
it 'should raise an exception when a wildcard is specified but should not be' do
|
|
112
|
+
expect { described_class.new('+', false) }.to raise_error(/Invalid/)
|
|
113
|
+
expect { described_class.new('1.+', false) }.to raise_error(/Invalid/)
|
|
114
|
+
expect { described_class.new('1.1.+', false) }.to raise_error(/Invalid/)
|
|
115
|
+
expect { described_class.new('1.1.1_+', false) }.to raise_error(/Invalid/)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
it 'should raise an exception when a version ends with a component separator' do
|
|
119
|
+
expect { described_class.new('1.') }.to raise_error(/Invalid/)
|
|
120
|
+
expect { described_class.new('1.7.') }.to raise_error(/Invalid/)
|
|
121
|
+
expect { described_class.new('1.7.0_') }.to raise_error(/Invalid/)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
it 'should accept a version has a number of components acceptable to check_size' do
|
|
125
|
+
described_class.new('1.2.3_4').check_size(4)
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
it 'should raise an exception when a version has too many components for check_size' do
|
|
129
|
+
expect { described_class.new('1.2.3_4').check_size(3) }.to raise_error(/too many version components/)
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
end
|
|
File without changes
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
# Download cache configuration
|
|
17
|
+
---
|
|
18
|
+
remote_downloads: enabled
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Encoding: utf-8
|
|
2
|
+
# Copyright 2013-2014 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 'simplecov'
|
|
17
|
+
SimpleCov.start do
|
|
18
|
+
add_filter 'spec'
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
require 'codeclimate-test-reporter'
|
|
22
|
+
CodeClimate::TestReporter.start
|
|
23
|
+
|
|
24
|
+
require 'webmock/rspec'
|
|
25
|
+
WebMock.disable_net_connect!(allow: 'codeclimate.com')
|
|
26
|
+
|
|
27
|
+
RSpec.configure do |config|
|
|
28
|
+
config.run_all_when_everything_filtered = true
|
|
29
|
+
config.filter_run :focus
|
|
30
|
+
end
|