Rakefile in jekyll-2.0.0.alpha.1 vs Rakefile in jekyll-2.0.0.alpha.2
- old
+ new
@@ -3,10 +3,11 @@
require 'rdoc'
require 'date'
require 'yaml'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), *%w[lib]))
+require 'jekyll/version'
#############################################################################
#
# Helper functions
#
@@ -15,26 +16,13 @@
def name
@name ||= Dir['*.gemspec'].first.split('.').first
end
def version
- line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
- line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
+ Jekyll::VERSION
end
-def date
- Date.today.to_s
-end
-
-def file_date
- Date.today.strftime("%F")
-end
-
-def rubyforge_project
- name
-end
-
def gemspec_file
"#{name}.gemspec"
end
def gem_file
@@ -261,38 +249,10 @@
sh "git push origin master"
sh "git push origin v#{version}"
sh "gem push pkg/#{name}-#{version}.gem"
end
-task :build => :gemspec do
- sh "mkdir -p pkg"
+task :build do
+ 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