Skip to content

Commit

Permalink
add info command to CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
NARKOZ committed May 21, 2014
1 parent 24306b9 commit 16834bb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/gitlab/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ def self.run(cmd, args=[])
case cmd
when 'help'
puts actions_table
when 'info'
endpoint = Gitlab.endpoint ? Gitlab.endpoint : 'not set'
private_token = Gitlab.private_token ? Gitlab.private_token : 'not set'
puts "Gitlab endpoint is #{endpoint}"
puts "Gitlab private token is #{private_token}"
puts "Ruby Version is #{RUBY_VERSION}"
puts "Gitlab Ruby Gem #{Gitlab::VERSION}"
when '-v', '--version'
puts "Gitlab Ruby Gem #{Gitlab::VERSION}"
else
Expand Down
10 changes: 10 additions & 0 deletions spec/gitlab/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@
end
end

context "when command is info" do
it "should show environment info" do
output = capture_output { Gitlab::CLI.run('info') }
expect(output).to include("Gitlab endpoint is")
expect(output).to include("Gitlab private token is")
expect(output).to include("Ruby Version is")
expect(output).to include("Gitlab Ruby Gem")
end
end

context "when command is help" do
it "should show available actions" do
output = capture_output { Gitlab::CLI.run('help') }
Expand Down

0 comments on commit 16834bb

Please sign in to comment.