lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 18.03-beta 48 lines 1.2 kB view raw
1require 'rbconfig' 2require 'rubygems' 3require 'rubygems/specification' 4require 'fileutils' 5 6# args/settings 7out = ENV["out"] 8ruby = ARGV[0] 9gemfile = ARGV[1] 10bundle_path = ARGV[2] 11bundler_gem_path = ARGV[3] 12paths = ARGV[4].split 13groups = ARGV[5].split 14 15# generate binstubs 16FileUtils.mkdir_p("#{out}/bin") 17paths.each do |path| 18 next unless File.directory?("#{path}/nix-support/gem-meta") 19 20 name = File.read("#{path}/nix-support/gem-meta/name") 21 executables = File.read("#{path}/nix-support/gem-meta/executables") 22 .force_encoding('UTF-8').split 23 executables.each do |exe| 24 File.open("#{out}/bin/#{exe}", "w") do |f| 25 f.write(<<-EOF) 26#!#{ruby} 27# 28# This file was generated by Nix. 29# 30# The application '#{exe}' is installed as part of a gem, and 31# this file is here to facilitate running it. 32# 33 34ENV["BUNDLE_GEMFILE"] = #{gemfile.dump} 35ENV["BUNDLE_PATH"] = #{bundle_path.dump} 36ENV['BUNDLE_FROZEN'] = '1' 37 38Gem.use_paths(#{bundler_gem_path.dump}, ENV["GEM_PATH"]) 39 40require 'bundler' 41Bundler.setup(#{groups.map(&:dump).join(', ')}) 42 43load Gem.bin_path(#{name.dump}, #{exe.dump}) 44EOF 45 FileUtils.chmod("+x", "#{out}/bin/#{exe}") 46 end 47 end 48end