File tree Expand file tree Collapse file tree
fixtures/container_spring_boot_cli_beans_configuration Expand file tree Collapse file tree Original file line number Diff line number Diff line change 270270 <orderEntry type =" sourceFolder" forTests =" false" />
271271 <orderEntry type =" library" scope =" PROVIDED" name =" addressable (v2.3.5, rbenv: 1.9.3-p484) [gem]" level =" application" />
272272 <orderEntry type =" library" scope =" PROVIDED" name =" ast (v1.1.0, rbenv: 1.9.3-p484) [gem]" level =" application" />
273- <orderEntry type =" library" scope =" PROVIDED" name =" bundler (v1.5.1 , rbenv: 1.9.3-p484) [gem]" level =" application" />
273+ <orderEntry type =" library" scope =" PROVIDED" name =" bundler (v1.5.3 , rbenv: 1.9.3-p484) [gem]" level =" application" />
274274 <orderEntry type =" library" scope =" PROVIDED" name =" codeclimate-test-reporter (v0.2.0, rbenv: 1.9.3-p484) [gem]" level =" application" />
275275 <orderEntry type =" library" scope =" PROVIDED" name =" crack (v0.4.1, rbenv: 1.9.3-p484) [gem]" level =" application" />
276276 <orderEntry type =" library" scope =" PROVIDED" name =" debugger-ruby_core_source (v1.2.4, rbenv: 1.9.3-p484) [gem]" level =" application" />
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ def release
5151 # @macro versioned_dependency_component_supports
5252 def supports?
5353 gf = JavaBuildpack ::Util ::GroovyUtils . groovy_files ( @application )
54- gf . length > 0 && all_pogo ( gf ) && no_main_method ( gf ) && no_shebang ( gf ) && !has_web_inf
54+ gf . length > 0 && all_pogo_or_configuration ( gf ) && no_main_method ( gf ) && no_shebang ( gf ) && !has_web_inf
5555 end
5656
5757 private
@@ -76,8 +76,10 @@ def has_web_inf
7676 ( @application . root + 'WEB-INF' ) . exist?
7777 end
7878
79- def all_pogo ( groovy_files )
80- all? ( groovy_files ) { |file | JavaBuildpack ::Util ::GroovyUtils . pogo? file } # note that this will scan comments
79+ def all_pogo_or_configuration ( groovy_files )
80+ all? ( groovy_files ) do |file |
81+ JavaBuildpack ::Util ::GroovyUtils . pogo? ( file ) || JavaBuildpack ::Util ::GroovyUtils . beans? ( file )
82+ end # note that this will scan comments
8183 end
8284
8385 def all? ( groovy_files , &block )
Original file line number Diff line number Diff line change @@ -26,28 +26,36 @@ class GroovyUtils
2626
2727 class << self
2828
29+ # Indicates whether a file is a +beans+style configuration
30+ #
31+ # @param [File] file the file to scan
32+ # @return [Boolean] +true+ if the file is a +beans+style configuration, +false+ otherwise.
33+ def beans? ( file )
34+ Pathname . new ( file ) . read =~ /beans[\s ]*\{ /
35+ end
36+
2937 # Indicates whether a file has a +main()+ method in it
3038 #
3139 # @param [File] file the file to scan
3240 # @return [Boolean] +true+ if the file contains a +main()+ method, +false+ otherwise.
3341 def main_method? ( file )
34- file . read =~ /static void main\( /
42+ Pathname . new ( file ) . read =~ /static void main\( /
3543 end
3644
3745 # Indicates whether a file is a POGO
3846 #
3947 # @param [File] file the file to scan
4048 # @return [Boolean] +true+ if the file is a POGO, +false+ otherwise.
4149 def pogo? ( file )
42- file . read =~ /class [\w ]+ [\s \w ]*{/
50+ Pathname . new ( file ) . read =~ /class [\w ]+ [\s \w ]*\ { /
4351 end
4452
4553 # Indicates whether a file has a shebang
4654 #
4755 # @param [File] file the file to scan
4856 # @return [Boolean] +true+ if the file has a shebang, +false+ otherwise.
4957 def shebang? ( file )
50- file . read =~ /#!/
58+ Pathname . new ( file ) . read =~ /#!/
5159 end
5260
5361 # Returns all the Ruby files in the given directory
Original file line number Diff line number Diff line change 1+ beans {
2+
3+ }
Original file line number Diff line number Diff line change 1+ class X {
Original file line number Diff line number Diff line change 6363 expect ( component . detect ) . to be_nil
6464 end
6565
66+ it 'should detect if there are Groovy files and they are all POGOs plus a beans-style configuration' ,
67+ app_fixture : 'container_spring_boot_cli_beans_configuration' do
68+
69+ expect ( component . detect ) . to eq ( "spring-boot-cli=#{ version } " )
70+ end
71+
6672 it 'should detect if there are Groovy files and they are all POGOs with no main method and there is no WEB-INF directory' ,
6773 app_fixture : 'container_spring_boot_cli_valid_app' do
6874
You can’t perform that action at this time.
0 commit comments