Rip out now-obsolete pieces of gemspec.

This commit is contained in:
Parker Moore 2014-02-24 16:17:41 -05:00
parent 8a0d036b87
commit 89328ff03f
1 changed files with 3 additions and 43 deletions

View File

@ -5,6 +5,7 @@ require 'date'
require 'yaml'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), *%w[lib]))
require 'jekyll/version'
#############################################################################
#
@ -17,20 +18,7 @@ def name
end
def version
line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
end
def date
Date.today.to_s
end
def file_date
Date.today.strftime("%F")
end
def rubyforge_project
name
Jekyll::VERSION
end
def gemspec_file
@ -263,36 +251,8 @@ task :release => :build do
sh "gem push pkg/#{name}-#{version}.gem"
end
task :build => :gemspec do
task :build do
sh "mkdir -p pkg"
sh "gem build #{gemspec_file}"
sh "mv #{gem_file} pkg"
end
task :gemspec do
# read spec file and split out manifest section
spec = File.read(gemspec_file)
head, manifest, tail = spec.split(" # = MANIFEST =\n")
# replace name version and date
replace_header(head, :name)
replace_header(head, :version)
replace_header(head, :date)
#comment this out if your rubyforge_project has a different name
replace_header(head, :rubyforge_project)
# determine file list from git ls-files
files = `git ls-files`.
split("\n").
sort.
reject { |file| file =~ /^\./ }.
reject { |file| file =~ /^(rdoc|pkg|coverage)/ }.
map { |file| " #{file}" }.
join("\n")
# piece file back together and write
manifest = " s.files = %w[\n#{files}\n ]\n"
spec = [head, manifest, tail].join(" # = MANIFEST =\n")
File.open(gemspec_file, 'w') { |io| io.write(spec) }
puts "Updated #{gemspec_file}"
end