public

  • Download Gist
TextMate gemspec snippet.png
gemspec_snippet.rb
Ruby
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
#!/usr/bin/env ruby
def git_config(key)
value = `git config #{key}`.chomp
value.empty?? nil : value
end
 
name = File.basename(ENV['TM_FILENAME'] || 'name').split('.').first
user = git_config('github.user') || ENV['USER'] || ENV['USERNAME'] || 'user'
email = git_config('user.email') || 'you@example.com'
full_name = git_config('user.name') || 'Your Full Name'
 
puts <<-GEMSPEC
Gem::Specification.new do |gem|
gem.name = '${1:#{name}}'
gem.version = '${2:0.0.1}'
gem.date = Date.today.to_s
 
# gem.add_dependency 'hpricot', '~> 0.8.2'
# gem.add_development_dependency 'rspec', '~> 1.2.9'
 
gem.summary = "${3:summary}"
gem.description = "${4:Longer description.}"
 
gem.authors = ['${5:#{full_name}}']
gem.email = '${6:#{email}}'
gem.homepage = 'http://github.com/#{user}/$1'
 
gem.rubyforge_project = nil
gem.has_rdoc = true
gem.rdoc_options = ['--main', 'README.rdoc', '--charset=UTF-8']
gem.extra_rdoc_files = ['README.rdoc', 'LICENSE', 'CHANGELOG.rdoc']
 
gem.files = Dir['Rakefile', '{bin,lib,man,test,spec}/**/*', 'README*', 'LICENSE*'] & \\`git ls-files -z\\`.split("\\0")
end
GEMSPEC
instructions.md
Markdown

How to install:

  1. Create a new command
  2. Paste the ruby code into it
  3. Output: "Insert as Snippet"
  4. Tab trigger: gemspec
  5. Scope: source.ruby

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.