From 6495312244ad6c0da124404ee7087d835d883ca1 Mon Sep 17 00:00:00 2001 From: Danilo Sousa Date: Tue, 16 Feb 2016 20:53:52 -0200 Subject: update version in `Gemfile.lock` for some reason this was causing my build in travis to fail :( --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 8d19651..6be5978 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - oxidized (0.11.0) + oxidized (0.12.2) asetus (~> 0.1) net-ssh (~> 3.0, >= 3.0.2) rugged (~> 0.21, >= 0.21.4) -- cgit v1.2.1 From f4f97914195129c7c75d034ac22ca132e2a3ad17 Mon Sep 17 00:00:00 2001 From: Danilo Sousa Date: Wed, 17 Feb 2016 15:09:30 -0200 Subject: some more travis configurations --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 3734051..8f97b30 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,5 @@ language: ruby +sudo: false +cache: bundler rvm: - 2.1.6 -- cgit v1.2.1 From e732e7cc29a035b34657316530f94627ba24f816 Mon Sep 17 00:00:00 2001 From: Danilo Sousa Date: Wed, 17 Feb 2016 14:45:54 -0200 Subject: create `-v` and `--version` options --- lib/oxidized.rb | 1 + lib/oxidized/cli.rb | 4 ++++ spec/cli_spec.rb | 24 ++++++++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 spec/cli_spec.rb diff --git a/lib/oxidized.rb b/lib/oxidized.rb index e92224a..dfd9679 100644 --- a/lib/oxidized.rb +++ b/lib/oxidized.rb @@ -3,6 +3,7 @@ module Oxidized Directory = File.expand_path(File.join(File.dirname(__FILE__), '../')) + require 'oxidized/version' require 'oxidized/string' require 'oxidized/config' require 'oxidized/config/vars' diff --git a/lib/oxidized/cli.rb b/lib/oxidized/cli.rb index d35eab3..0594dcb 100644 --- a/lib/oxidized/cli.rb +++ b/lib/oxidized/cli.rb @@ -43,6 +43,10 @@ module Oxidized opts = Slop.new(:help=>true) do on 'd', 'debug', 'turn on debugging' on 'daemonize', 'Daemonize/fork the process' + on 'v', 'version', 'show version' do + puts Oxidized::VERSION + Kernel.exit + end end [opts.parse!, opts] end diff --git a/spec/cli_spec.rb b/spec/cli_spec.rb new file mode 100644 index 0000000..783d9c8 --- /dev/null +++ b/spec/cli_spec.rb @@ -0,0 +1,24 @@ +require 'spec_helper' +require 'oxidized/cli' + +describe Oxidized::CLI do + let(:asetus) { mock() } + + after { ARGV.replace @original } + before { @original = ARGV } + + %w[-v --version].each do |option| + describe option do + before { ARGV.replace [option] } + + it 'prints the version and exits' do + Oxidized::Config.expects(:load).returns(asetus) + Kernel.expects(:exit) + + proc { + Oxidized::CLI.new + }.must_output "#{Oxidized::VERSION}\n" + end + end + end +end -- cgit v1.2.1