lib/ana/command.rb in ana-0.9.4 vs lib/ana/command.rb in ana-0.9.5
- old
+ new
@@ -1,9 +1,10 @@
require 'thor'
require 'net/http'
require 'json'
require 'launchy'
+require 'active_support/core_ext/object/blank'
module Ana
class Command < Thor
include Ana::Scalars
include Thor::Actions
@@ -123,23 +124,24 @@
def fuzzy_search(gem)
return if gem_does_not_exist?(gem)
system("gem search -r #{Shellwords.escape gem}")
end
- # Open the URIs of a given Gem.
+ # FIXME: Only print the uri type if it is not null
+ # Open the URIs of a given Gem. Default open the home page.
# Available URI types could be found in Ana::Scalars::URI_TYPE.
- desc 'open (o)', 'Open gem doc directly via open command.'
- def open(gem, open_type='doc')
+ desc 'open (o)', 'Open gem's uris directly via open command.'
+ def open(gem, open_type='home')
return if gem_does_not_exist?(gem)
gem_hash = get_gem_json!(gem, type: 'gems')
url = if URI_TYPE.keys.include? open_type
skip = false
gem_hash[URI_TYPE[open_type]]
else
say "#{open_type} is not a valid type :( \n"
print_valid_uri_open_types!
skip = true
- gem_hash[URI_TYPE['doc']]
+ gem_hash[URI_TYPE[type]]
end
Launchy.open(url) if url.present? && skip == false
end
# Download a given Gem.
\ No newline at end of file