From edca52ef9a0720caa10c3a4793ccf6f1aeae84ae Mon Sep 17 00:00:00 2001 From: Jef Mathiot Date: Fri, 16 Jan 2015 17:31:58 +0100 Subject: [PATCH] Add the version command to CLI --- lib/electric_sheep/cli.rb | 5 +++++ spec/electric_sheep/cli_spec.rb | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/lib/electric_sheep/cli.rb b/lib/electric_sheep/cli.rb index 8485807..01bd0a3 100644 --- a/lib/electric_sheep/cli.rb +++ b/lib/electric_sheep/cli.rb @@ -78,6 +78,11 @@ def restart launch_master(:restart!) end + desc "version", "Show version and git revision" + def version + puts ElectricSheep.revision + end + default_task :work protected diff --git a/spec/electric_sheep/cli_spec.rb b/spec/electric_sheep/cli_spec.rb index edb094c..a5e798a 100644 --- a/spec/electric_sheep/cli_spec.rb +++ b/spec/electric_sheep/cli_spec.rb @@ -240,4 +240,11 @@ def self.ensure_startup(action) end + it 'outputs revision' do + ElectricSheep.expects(:revision).returns('0.0.0 0000000') + cli = subject.new([]) + cli.expects(:puts).with('0.0.0 0000000') + cli.send(:version) + end + end