Sha256: f3b626def0daa0398d6538ff00096aa1c4f7bcf88c1c5deb535a9988fb8f1c2e
Contents?: true
Size: 1.7 KB
Versions: 12
Compression:
Stored size: 1.7 KB
Contents
# # This will unpack the solidus gem into its components without calling `bundle install`. # # # Nothing to do if the `solidus` gem is not there. solidus = Bundler.locked_gems.dependencies['solidus'] or return # Write and remove into and from a Gemfile # # This custom injector fixes support for path, git and custom sources, # which is missing in bundler's upstream injector for a dependency fetched # with `Bundler.locked_gems.dependencies`. bundler_injector = Class.new(Bundler::Injector) do def build_gem_lines(conservative_versioning) @deps.map do |d| name = d.name.dump is_local = d.source.instance_of?(Bundler::Source::Path) is_git = d.source.instance_of?(Bundler::Source::Git) requirement = if is_local ", path: \"#{d.source.path}\"" elsif is_git ", git: \"#{d.git}\"".then { |g| d.ref ? g + ", ref: \"#{d.ref}\"" : g } elsif conservative_versioning ", \"#{conservative_version(@definition.specs[d.name][0])}\"" else ", #{d.requirement.as_list.map(&:dump).join(", ")}" end source = ", source: \"#{d.source.remotes.join(",")}\"" unless is_local || is_git || d.source.nil? %(gem #{name}#{requirement}#{source}) end.join("\n") end end to_dependency = ->(component) do Bundler::Dependency.new( component, solidus.requirement, "source" => solidus.source, "git" => solidus.source.try(:uri), "ref" => solidus.source.try(:ref), ) end bundler_injector.inject(%w[ solidus_core solidus_backend solidus_api solidus_sample ].map(&to_dependency)) bundler_injector.remove(%w[ solidus ])
Version data entries
12 entries across 12 versions & 1 rubygems