Skip to content

Commit

Permalink
Add 'list' subcommand to CLI
Browse files Browse the repository at this point in the history
Closes #74
  • Loading branch information
Juan González authored and sikachu committed Jun 25, 2014
1 parent 385246e commit f3c7201
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/appraisal/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ def update(*gems)
end
end

desc 'list', 'List the names of the defined appraisals'
def list
File.new.appraisals.each { |appraisal| puts appraisal.name }
end

private

def method_missing(name, *args, &block)
Expand Down
28 changes: 28 additions & 0 deletions spec/acceptance/cli/list_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
require 'spec_helper'

describe 'CLI', 'appraisal list' do
it 'prints list of appraisals' do
build_appraisal_file <<-Appraisal
appraise '1.0.0' do
gem 'dummy', '1.0.0'
end
appraise '2.0.0' do
gem 'dummy', '1.0.0'
end
appraise '1.1.0' do
gem 'dummy', '1.0.0'
end
Appraisal

output = run 'appraisal list'

expect(output).to eq("1.0.0\n2.0.0\n1.1.0\n")
end

it 'prints nothing if there are no appraisals in the file' do
build_appraisal_file ''
output = run 'appraisal list'

expect(output.length).to eq(0)
end
end

0 comments on commit f3c7201

Please sign in to comment.