Sha256: 3621331df68e6e7f76fd6ebe1300eebadfdcbb6329f2861223fc3abb1eae9de2
Contents?: true
Size: 1.37 KB
Versions: 2
Compression:
Stored size: 1.37 KB
Contents
#!/usr/bin/env ruby require File.join(File.dirname(__FILE__), *%w".. lib sprockets") require "optparse" load_path = (ENV["SPROCKETS_PATH"] || "").split(":") filenames = [] OptionParser.new do |opts| opts.summary_width = 28 opts.banner = "Usage: sprocketize [options] filename [filename ...]" def opts.show_usage puts self exit end opts.on("-C DIRECTORY", "--directory=DIRECTORY", "Change to DIRECTORY before doing anything") do |directory| Dir.chdir(directory) end opts.on("-I DIRECTORY", "--include-dir=DIRECTORY", "Adds the directory to the Sprockets load path") do |directory| load_path << directory 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::STRING exit end opts.show_usage if ARGV.empty? begin opts.order(ARGV) do |filename| filenames << filename end rescue OptionParser::ParseError => e opts.warn e.message opts.show_usage end end environment = Sprockets::Environment.new(".", load_path) preprocessor = Sprockets::Preprocessor.new(environment) filenames.each do |filename| if pathname = environment.find(filename) preprocessor.require(pathname.source_file) else raise Sprockets::LoadError, "no such file `#{filename}'" end end print preprocessor.output_file
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sstephenson-sprockets-0.1.1 | bin/sprocketize |
sstephenson-sprockets-0.3.0 | bin/sprocketize |