Last active
August 29, 2015 14:22
-
-
Save leandro/6a0db07565607db27ee8 to your computer and use it in GitHub Desktop.
Making a compass executable that runs specific versions of compass
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby_executable_hooks | |
# | |
# This file was generated by RubyGems. | |
# | |
# The application 'compass' is installed as part of a gem, and | |
# this file is here to facilitate running it. | |
# | |
require 'rubygems' | |
version_arg = ARGV.shift if ARGV.first =~ /^(?:\d+.)+\d+$/ | |
version = version_arg || ">= 0" | |
if ARGV.first | |
str = ARGV.first | |
str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding | |
if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then | |
version = $1 | |
ARGV.shift | |
end | |
end | |
gem 'compass', version | |
load Gem.bin_path('compass', 'compass', version) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create the custom executable | |
$ vim ~/.rvm/gems/ruby-2.1.2/bin/compass-custom | |
# In the editor, enter the code in the snippet file above and save the file | |
# Then make the file executable | |
$ chmod +ux ~/.rvm/gems/ruby-2.1.2/bin/compass-custom | |
# Then run it, passing as FIRST argument the version you want to use | |
$ compass-custom 1.0.3 [...] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment