/usr/bin/sprockets is in ruby-sprockets 2.12.3-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | #!/usr/bin/ruby
require 'sprockets'
require 'optparse'
require 'shellwords'
unless ARGV.delete("--noenv")
if File.exist?(path = "./.sprocketsrc")
rcflags = Shellwords.split(File.read(path))
ARGV.unshift(*rcflags)
end
end
filenames = []
environment = Sprockets::Environment.new(Dir.pwd)
manifest = nil
(ENV['SPROCKETS_PATH'] || "").split(File::PATH_SEPARATOR).each do |path|
environment.append_path path
end
OptionParser.new do |opts|
opts.summary_width = 28
opts.banner = "Usage: sprockets [options] filename [filename ...]"
def opts.show_usage
puts self
exit 1
end
opts.on("-r", "--require LIBRARY", "Require the LIBRARY before doing anything") do |lib|
require lib
end
opts.on("-I DIRECTORY", "--include=DIRECTORY", "Adds the directory to the Sprockets load path") do |directory|
environment.append_path directory
end
opts.on("-o DIRECTORY", "--output=DIRECTORY", "Copy provided assets into DIRECTORY") do |directory|
manifest = Sprockets::Manifest.new(environment, directory)
end
opts.on("--css-compressor=COMPRESSOR", "Use CSS compressor") do |compressor|
environment.css_compressor = compressor.to_sym
end
opts.on("--js-compressor=COMPRESSOR", "Use JavaScript compressor") do |compressor|
environment.js_compressor = compressor.to_sym
end
opts.on("--noenv", "Disables .sprocketsrc file") do
end
opts.on_tail("-h", "--help", "Shows this help message") do
opts.show_usage
end
opts.on_tail("-v", "--version", "Shows version") do
puts Sprockets::VERSION
exit
end
opts.show_usage if ARGV.empty?
begin
opts.order(ARGV) do |filename|
filenames << File.expand_path(filename)
end
rescue OptionParser::ParseError => e
opts.warn e.message
opts.show_usage
end
end
if environment.paths.empty?
warn "No load paths given"
warn "Usage: sprockets -Ijavascripts/ filename"
exit 1
end
if manifest
manifest.compile(filenames)
elsif filenames.length == 1
puts environment.find_asset(filenames.first).to_s
else
warn "Only one file can be compiled to stdout at a time"
exit 1
end
|