Class: Jeweler::Commands::CheckDependencies
- Inherits:
-
Object
- Object
- Jeweler::Commands::CheckDependencies
- Defined in:
- lib/jeweler/commands/check_dependencies.rb
Defined Under Namespace
Classes: MissingDependenciesError
Instance Attribute Summary collapse
-
#gemspec ⇒ Object
Returns the value of attribute gemspec.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#gemspec ⇒ Object
Returns the value of attribute gemspec.
8 9 10 |
# File 'lib/jeweler/commands/check_dependencies.rb', line 8 def gemspec @gemspec end |
#type ⇒ Object
Returns the value of attribute type.
8 9 10 |
# File 'lib/jeweler/commands/check_dependencies.rb', line 8 def type @type end |
Class Method Details
.build_for(jeweler) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/jeweler/commands/check_dependencies.rb', line 43 def self.build_for(jeweler) command = new command.gemspec = jeweler.gemspec command end |
Instance Method Details
#dependencies ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/jeweler/commands/check_dependencies.rb', line 33 def dependencies case type when :runtime, :development gemspec.send("#{type}_dependencies") else gemspec.dependencies end end |
#run ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/jeweler/commands/check_dependencies.rb', line 10 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 |