Sha256: 390622c5dff85f0560b8294db21ba8ea62b141cedabb866c70685a6533c72fec
Contents?: true
Size: 942 Bytes
Versions: 6
Compression:
Stored size: 942 Bytes
Contents
desc 'Render licenses into LICENSES/' task 'licenses' => 'LICENSES/.info' desc 'View licenses' task 'view-licenses' => 'licenses' do sh "less", *Dir["LICENSES/*"] end #############################################3 directory "LICENSES" gemspec = Gem::Specification.load(Dir["*.gemspec"][0]) def render_erb(s, src, dest) File.write(dest, ERB.new(File.read(src), nil, '-').result(binding) ) end file "LICENSES/.info" => "gemspec.gemspec" do |t| mkdir_p "LICENSES" licenses_dir = File.expand_path('../../share/gemspec/licenses/', `gem which gemspec`.chomp) $? == 0 or licenses_dir = File.expand_path('licenses/') gemspec.licenses.each do |license| render_erb(gemspec, File.join(licenses_dir, license + '.erb'), "LICENSES/#{Shellwords.escape license}" ) end File.write(t.name, "This directory contains the licenses you can use with this gem\n") end
Version data entries
6 entries across 6 versions & 4 rubygems