lib/sprout/ruby_feature.rb in sprout-1.0.29.pre vs lib/sprout/ruby_feature.rb in sprout-1.0.31.pre

- old
+ new

@@ -74,19 +74,32 @@ end message << "\n\nYou may need to update your Gemfile and run 'bundle install' " message << "to update your local gems.\n\n" raise Sprout::Errors::LoadError.new message end + + resolve_file_target entity entity end def clear_entities! @registered_entities = [] end protected + def resolve_file_target entity + if(entity.respond_to? :resolve) + entity.resolve + elsif(entity.respond_to? :file_target) + file_target = entity.file_target + if(file_target.respond_to? :resolve) + file_target.resolve + end + end + end + def validate_registration entity if(!entity.respond_to?(:name) || entity.name.nil?) raise Sprout::Errors::UsageError.new "Cannot register a RubyFeature without a 'name' getter" end end @@ -101,11 +114,11 @@ # These commented blocks help immensely when debugging # loading and registration issues, please leave them here: #puts "+++++++++++++++++++++++++++" #puts ">> entity_for #{name_or_names} pkg_name: #{pkg_name} version: #{version_requirement}" #registered_entities.each do |entity| - #puts ">> entity: #{entity.name} pkg_name: #{entity.pkg_name} version: #{entity.pkg_version}" + #puts ">> entity: #{entity.name} platform: #{entity.platform} pkg_name: #{entity.pkg_name} version: #{entity.pkg_version}" #end registered_entities.reverse.select do |entity| satisfies_name?(entity, name_or_names) && satisfies_platform?(entity) && satisfies_pkg_name?(entity, pkg_name) && @@ -132,9 +145,10 @@ return expected.to_s == entity.name.to_s end def satisfies_platform? entity #puts">> satisfies platform?" + # If not platform is defined, it's assumed to work on all platforms: return true if !entity.respond_to?(:platform) || entity.platform.nil? #puts ">> platform: #{entity.platform}" Sprout.current_system.can_execute?(entity.platform) end