Skip to content

Instantly share code, notes, and snippets.

@billturner billturner/gemspec forked from defunkt/gemspec
Created May 13, 2010

What would you like to do?
#!/usr/bin/env ruby
# Usage: gemspec [-s] GEMNAME
# Prints a basic gemspec for GEMNAME based on your git-config info.
# If -s is passed, saves it as a GEMNAME.gemspec in the current
# directory. Otherwise prints to standard output.
# Once you check this gemspec into your project, releasing a new gem
# is dead simple:
# $ gem build GEMNAME.gemspec
# $ gem push GEMNAME-VERSION.gem
# Wants you to have a "lib/GEMNAME/version.rb" file in your project
# which sets the GEMNAME::VERSION constant.
fullname = `git config --get`.chomp
email = `git config --get`.chomp
login = `git config --get github.user`.chomp
save = ARGV.delete('-s')
abort "* Pass a gem name." unless name = ARGV[0]
gemspec = <<spec
$LOAD_PATH.unshift 'lib'
require "#{name}/version" do |s| = "#{name}"
s.version = "#{name.capitalize}::Version" ='%Y-%m-%d')
s.summary = "Feed me."
s.homepage = "{login}/#{name}" = "#{email}"
s.authors = [ "#{fullname}" ]
s.has_rdoc = false
s.files = %w( Rakefile LICENSE )
s.files += Dir.glob("lib/**/*")
s.files += Dir.glob("bin/**/*")
s.files += Dir.glob("man/**/*")
s.files += Dir.glob("test/**/*")
# s.executables = %w( #{name} )
s.description = <<desc
Feed me.
if save
if File.exist? file = "#{name}.gemspec"
abort "* #{file} exists!"
else, 'w') { |f| f.puts gemspec }
puts gemspec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.