Sha256: 50b46ee499626d5d8468a43d6a177ea5d058bc27c6c84ffb5fd2c108f19814cd

Contents?: true

Size: 1.31 KB

Versions: 18

Compression:

Stored size: 1.31 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.version_requirements.to_s
            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.version_requirements}"}
          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

18 entries across 18 versions & 5 rubygems

Version Path
dima-jeweler-1.2.0 lib/jeweler/commands/check_dependencies.rb
mcornick-jeweler-1.2.0 lib/jeweler/commands/check_dependencies.rb
technicalpickles-jeweler-1.2.1 lib/jeweler/commands/check_dependencies.rb
gemrage-1.0.0 vendor/ruby/1.8/gems/jeweler-1.4.0/lib/jeweler/commands/check_dependencies.rb
gemrage-0.4.1 vendor/ruby/1.8/gems/jeweler-1.4.0/lib/jeweler/commands/check_dependencies.rb
gemrage-0.4.0 vendor/ruby/1.8/gems/jeweler-1.4.0/lib/jeweler/commands/check_dependencies.rb
gemrage-0.3.2 vendor/ruby/1.8/gems/jeweler-1.4.0/lib/jeweler/commands/check_dependencies.rb
gemrage-0.3.1 vendor/ruby/1.8/gems/jeweler-1.4.0/lib/jeweler/commands/check_dependencies.rb
gemrage-0.3.0 vendor/ruby/1.8/gems/jeweler-1.4.0/lib/jeweler/commands/check_dependencies.rb
gemrage-0.2.0 vendor/ruby/1.8/gems/jeweler-1.4.0/lib/jeweler/commands/check_dependencies.rb
gemrage-0.1.2 vendor/ruby/1.8/gems/jeweler-1.4.0/lib/jeweler/commands/check_dependencies.rb
gemrage-0.1.1 vendor/ruby/1.8/gems/jeweler-1.4.0/lib/jeweler/commands/check_dependencies.rb
gemrage-0.1.0 vendor/ruby/1.8/gems/jeweler-1.4.0/lib/jeweler/commands/check_dependencies.rb
gemrage-0.0.0 vendor/ruby/1.8/gems/jeweler-1.4.0/lib/jeweler/commands/check_dependencies.rb
jeweler-1.4.0 lib/jeweler/commands/check_dependencies.rb
jeweler-1.3.0 lib/jeweler/commands/check_dependencies.rb
jeweler-1.2.1 lib/jeweler/commands/check_dependencies.rb
jeweler-1.2.0 lib/jeweler/commands/check_dependencies.rb