Class: Gem::Commands::Isit19Command
- Inherits:
-
Gem::Command
- Object
- Gem::Command
- Gem::Commands::Isit19Command
- Includes:
- Text, VersionOption
- Defined in:
- lib/rubygems/commands/isit19_command.rb
Direct Known Subclasses
Constant Summary collapse
- COMMAND =
'isit19'
- DESCRIPTION =
'Check isitruby19.com for ruby 1.9 compatibility'
Instance Method Summary collapse
-
#arguments ⇒ Object
:nodoc:.
-
#defaults_str ⇒ Object
:nodoc:.
- #execute ⇒ Object
-
#initialize(command = COMMAND, description = DESCRIPTION) ⇒ Isit19Command
constructor
A new instance of Isit19Command.
-
#usage ⇒ Object
:nodoc:.
Constructor Details
#initialize(command = COMMAND, description = DESCRIPTION) ⇒ Isit19Command
Returns a new instance of Isit19Command.
14 15 16 17 18 |
# File 'lib/rubygems/commands/isit19_command.rb', line 14 def initialize(command=COMMAND, description=DESCRIPTION) super command, description, :version => Gem::Requirement.default add_version_option end |
Instance Method Details
#arguments ⇒ Object
:nodoc:
20 21 22 |
# File 'lib/rubygems/commands/isit19_command.rb', line 20 def arguments # :nodoc: 'GEMNAME name of an installed gem to check for 1.9 compatibility' end |
#defaults_str ⇒ Object
:nodoc:
24 25 26 |
# File 'lib/rubygems/commands/isit19_command.rb', line 24 def defaults_str # :nodoc: "--version='>= 0'" end |
#execute ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/rubygems/commands/isit19_command.rb', line 32 def execute name = get_one_gem_name dep = Gem::Dependency.new name, [:version] specs = Gem.source_index.search dep if specs.empty? then alert_error "No installed gem #{dep}" terminate_interaction 1 end spec = specs.last isit19 = new_instance_isit(spec) isit19.fetch! comments = isit19.comments say "#{spec.name} #{spec.version}: #{isit19.url}" say ' No reports!' if comments.empty? last_seen_version = nil comments.each_with_index do |comment, i| break if i > 0 and comment['version'] != last_seen_version works = comment['works_for_me'] ? 'works' : 'fails' platform = comment['platform'].values.join ' ' if comment['platform'] msg = "#{comment['name']} says #{comment['version']} #{works}" msg << " on #{platform}" if platform say " #{msg}" say format_text(comment['body'], 68, 8) unless comment['body'].empty? say last_seen_version = comment['version'] end end |
#usage ⇒ Object
:nodoc:
28 29 30 |
# File 'lib/rubygems/commands/isit19_command.rb', line 28 def usage # :nodoc: "#{program_name} GEMNAME [options]" end |