Skip to content

Instantly share code, notes, and snippets.

@dgsuarez
Last active December 16, 2015 22:09
Show Gist options
  • Save dgsuarez/5504512 to your computer and use it in GitHub Desktop.
Save dgsuarez/5504512 to your computer and use it in GitHub Desktop.
Use mercurial instead of git in a gem generated by bundle gem
#! /bin/sh
set -e
bundle gem $1
cd $1
rm -rf .git
mv .gitignore .hgignore
sed -i -e "1s/^/syntax: glob\n/" .hgignore
sed -i 's|git ls-files -z.*|hg manifest -q\`.split("\\n")|' $1.gemspec
sed -i "s/end$/ spec.add_development_dependency 'rspec', '~> 1.3'\nend/" $1.gemspec
sed -i -e "/MIT/d" $1.gemspec
sed -i -e "/description/d" $1.gemspec
sed -i "s/TODO:.*\}/$1}/" $1.gemspec
mkdir -p "spec/$1"
cat > spec/spec_helper.rb <<EOF
require '$1'
EOF
hg init
hg addremove
@sergioalvz
Copy link

It is not possible to make a Pull Request for a Gist, so here is mine, where the files inside the test|spec|features folders are automatically removed from the *.gemspec file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment