Sha256: d9765b552c44c5cdbc02df05fb997ebb34b6e5ec245fce254b58bd8edc7ea0af

Contents?: true

Size: 1.27 KB

Versions: 65

Compression:

Stored size: 1.27 KB

Contents

class Jeweler
  module Commands
    class CheckDependencies
      class MissingDependenciesError < RuntimeError
        attr_accessor :dependencies, :type
      end

      attr_accessor :gemspec, :type

      def run
        missing_dependencies = dependencies.select do |dependency|
          begin
            Gem.activate dependency.name, *dependency.requirement.as_list
            false
          rescue LoadError => e
            true
          end
        end

        if missing_dependencies.empty?
          puts "#{type || 'All'} dependencies seem to be installed."
        else
          puts "Missing some dependencies. Install them with the following commands:"
          missing_dependencies.each do |dependency|
            puts %Q{\tgem install #{dependency.name} --version "#{dependency.requirement.to_s}"}
          end

          abort "Run the specified gem commands before trying to run this again: #{$0} #{ARGV.join(' ')}"
        end
      end

      def dependencies
        case type
        when :runtime, :development
          gemspec.send("#{type}_dependencies")
        else
          gemspec.dependencies
        end
      end

      def self.build_for(jeweler)
        command = new

        command.gemspec = jeweler.gemspec

        command
      end
    end
  end
end

Version data entries

65 entries across 38 versions & 3 rubygems

Version Path
dirty_history-0.7.3 dirty_history/ruby/1.9.1/gems/jeweler-1.5.2/lib/jeweler/commands/check_dependencies.rb
dirty_history-0.7.2 dirty_history/ruby/1.9.1/gems/jeweler-1.5.2/lib/jeweler/commands/check_dependencies.rb
dirty_history-0.7.1 dirty_history/ruby/1.9.1/gems/jeweler-1.5.2/lib/jeweler/commands/check_dependencies.rb
dirty_history-0.7.0 dirty_history/ruby/1.9.1/gems/jeweler-1.5.2/lib/jeweler/commands/check_dependencies.rb
dirty_history-0.6.7 dirty_history/ruby/1.9.1/gems/jeweler-1.5.2/lib/jeweler/commands/check_dependencies.rb
dirty_history-0.6.6 dirty_history/ruby/1.9.1/gems/jeweler-1.5.2/lib/jeweler/commands/check_dependencies.rb
dirty_history-0.6.5 dirty_history/ruby/1.9.1/gems/jeweler-1.5.2/lib/jeweler/commands/check_dependencies.rb
dirty_history-0.6.4 dirty_history/ruby/1.9.1/gems/jeweler-1.5.2/lib/jeweler/commands/check_dependencies.rb
dirty_history-0.6.3 dirty_history/ruby/1.9.1/gems/jeweler-1.5.2/lib/jeweler/commands/check_dependencies.rb
dirty_history-0.6.2 dirty_history/ruby/1.9.1/gems/jeweler-1.5.2/lib/jeweler/commands/check_dependencies.rb
dirty_history-0.6.1 dirty_history/ruby/1.9.1/gems/jeweler-1.5.2/lib/jeweler/commands/check_dependencies.rb
dirty_history-0.6.0 dirty_history/ruby/1.9.1/gems/jeweler-1.5.2/lib/jeweler/commands/check_dependencies.rb
dirty_history-0.5.4 dirty_history/ruby/1.9.1/gems/jeweler-1.5.2/lib/jeweler/commands/check_dependencies.rb
dirty_history-0.5.3 dirty_history/ruby/1.9.1/gems/jeweler-1.5.2/lib/jeweler/commands/check_dependencies.rb
dirty_history-0.5.2 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/jeweler-1.5.2/lib/jeweler/commands/check_dependencies.rb
dirty_history-0.5.2 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/jeweler-1.5.2/lib/jeweler/commands/check_dependencies.rb
dirty_history-0.5.2 dirty_history/ruby/1.9.1/gems/jeweler-1.5.2/lib/jeweler/commands/check_dependencies.rb
dirty_history-0.5.1 dirty_history/ruby/1.9.1/gems/jeweler-1.5.2/lib/jeweler/commands/check_dependencies.rb
dirty_history-0.5.1 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/jeweler-1.5.2/lib/jeweler/commands/check_dependencies.rb
dirty_history-0.5.1 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/jeweler-1.5.2/lib/jeweler/commands/check_dependencies.rb