Sha256: 7ce938381a9ec847db04d71bf26ebda7d4c2dac78b4f51601b7eb91038b6f895

Contents?: true

Size: 917 Bytes

Versions: 34

Compression:

Stored size: 917 Bytes

Contents

module PowerStencil
  module Utils

    module GemUtils

      def plugin_definition_to_name_and_req(plugin_definition)
        md = plugin_definition.match /^\s*([^\s]+)\s*,?\s*(.+)?\s*$/
        if md.nil?
          raise PowerStencil::Error, "Invalid plugin_definition '#{plugin_definition}'"
        end
        gem_name = md[1]
        gem_req = if md[2].nil? or md[2].empty?
                    ::Gem::Requirement.default
                  else
                    ::Gem::Requirement.create md[2]
                  end
        [gem_name, gem_req]
      end

      def find_gemspec_manually(gem_name)
        gem_spec_files = []
        ::Gem::Specification.dirs.each do |dir|
          Dir.glob(File.join(dir,  "#{gem_name}-*.*.*.gemspec")) do |file|
            gem_spec_files << file
          end
        end
        gem_spec_files.map { |file| ::Gem::Specification.load file }
      end

    end

  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
power_stencil-0.10.0 lib/power_stencil/utils/gem_utils.rb
power_stencil-0.9.8 lib/power_stencil/utils/gem_utils.rb
power_stencil-0.9.7 lib/power_stencil/utils/gem_utils.rb
power_stencil-0.9.6 lib/power_stencil/utils/gem_utils.rb
power_stencil-0.9.5 lib/power_stencil/utils/gem_utils.rb
power_stencil-0.9.4 lib/power_stencil/utils/gem_utils.rb
power_stencil-0.9.3 lib/power_stencil/utils/gem_utils.rb
power_stencil-0.9.2 lib/power_stencil/utils/gem_utils.rb
power_stencil-0.9.1 lib/power_stencil/utils/gem_utils.rb
power_stencil-0.9.0 lib/power_stencil/utils/gem_utils.rb
power_stencil-0.8.14 lib/power_stencil/utils/gem_utils.rb
power_stencil-0.8.13 lib/power_stencil/utils/gem_utils.rb
power_stencil-0.8.12 lib/power_stencil/utils/gem_utils.rb
power_stencil-0.8.11 lib/power_stencil/utils/gem_utils.rb
power_stencil-0.8.10 lib/power_stencil/utils/gem_utils.rb
power_stencil-0.8.9 lib/power_stencil/utils/gem_utils.rb
power_stencil-0.8.8 lib/power_stencil/utils/gem_utils.rb
power_stencil-0.8.7 lib/power_stencil/utils/gem_utils.rb
power_stencil-0.8.6 lib/power_stencil/utils/gem_utils.rb
power_stencil-0.8.5 lib/power_stencil/utils/gem_utils.rb