summaryrefslogtreecommitdiff
path: root/lib/ohai/plugins/groovy.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ohai/plugins/groovy.rb')
-rw-r--r--lib/ohai/plugins/groovy.rb25
1 files changed, 14 insertions, 11 deletions
diff --git a/lib/ohai/plugins/groovy.rb b/lib/ohai/plugins/groovy.rb
index 8979a563..0873d726 100644
--- a/lib/ohai/plugins/groovy.rb
+++ b/lib/ohai/plugins/groovy.rb
@@ -16,20 +16,23 @@
# limitations under the License.
#
-provides "languages/groovy"
+Ohai.plugin(:Groovy) do
+ provides "languages/groovy"
-require_plugin "languages"
+ depends "languages"
-output = nil
+ collect_data do
+ output = nil
-groovy = Mash.new
+ groovy = Mash.new
-status, stdout, stderr = run_command(:no_status_check => true, :command => "groovy -v")
-if status == 0
- output = stdout.split
- if output.length >= 2
- groovy[:version] = output[2]
+ status, stdout, stderr = run_command(:no_status_check => true, :command => "groovy -v")
+ if status == 0
+ output = stdout.split
+ if output.length >= 2
+ groovy[:version] = output[2]
+ end
+ languages[:groovy] = groovy if groovy[:version]
+ end
end
- languages[:groovy] = groovy if groovy[:version]
end
-