Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/jrebel_agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@
---
version: 7.+
repository_root: https://dl.zeroturnaround.com/jrebel
enabled: true
1 change: 1 addition & 0 deletions docs/framework-jrebel_agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ The framework can be configured by modifying the [`config/jrebel_agent.yml`][] f
| ---- | -----------
| `repository_root` | The URL of the JRebel repository index ([details][repositories]).
| `version` | The version of JRebel to use. Candidate versions can be found in [this listing][].
| `enabled` | Whether to activate JRebel (upon the presence of `rebel-remote.xml`) or not.

[Configuration and Extension]: ../README.md#configuration-and-extension
[`config/jrebel_agent.yml`]: ../config/jrebel_agent.yml
Expand Down
10 changes: 8 additions & 2 deletions lib/java_buildpack/framework/jrebel_agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ def release

# (see JavaBuildpack::Component::VersionedDependencyComponent#supports?)
def supports?
jrebel_configured?(@application.root) || jrebel_configured?(@application.root + 'WEB-INF/classes') ||
jars_with_jrebel_configured?(@application.root)
enabled? && (
jrebel_configured?(@application.root) ||
jrebel_configured?(@application.root + 'WEB-INF/classes') ||
jars_with_jrebel_configured?(@application.root))
end

private
Expand All @@ -68,6 +70,10 @@ def architecture
`uname -m`.strip
end

def enabled?
@configuration['enabled'].nil? || @configuration['enabled']
end

end

end
Expand Down
9 changes: 9 additions & 0 deletions spec/java_buildpack/framework/jrebel_agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@
app_fixture: 'framework_jrebel_app_war_with_jar' do
expect(component.detect).to eq("jrebel-agent=#{version}")
end

context do
let(:configuration) { { 'enabled' => false } }

it 'does not detect when not enabled',
app_fixture: 'framework_jrebel_app_simple' do
expect(component.detect).to be_nil
end
end

it 'downloads the JRebel JAR and the native agent',
app_fixture: 'framework_jrebel_app_simple',
Expand Down