Skip to content

Commit

Permalink
convert to use rakegem
Browse files Browse the repository at this point in the history
mojombo committed Apr 21, 2010
1 parent 3efe008 commit 03cb12a
Showing 7 changed files with 264 additions and 211 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
(The MIT License)

Copyright (c) 2008 Tom Preston-Werner

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the 'Software'), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
10 changes: 1 addition & 9 deletions README.textile
Original file line number Diff line number Diff line change
@@ -38,12 +38,4 @@ h2. Developer Dependencies

h2. License

(The MIT License)

Copyright (c) 2008 Tom Preston-Werner

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
See LICENSE.
170 changes: 119 additions & 51 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,85 +1,101 @@
require 'rubygems'
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'date'

begin
gem 'jeweler', '>= 0.11.0'
require 'jeweler'
Jeweler::Tasks.new do |s|
s.name = "jekyll"
s.summary = %Q{Jekyll is a simple, blog aware, static site generator.}
s.email = "[email protected]"
s.homepage = "http://github.com/mojombo/jekyll"
s.description = "Jekyll is a simple, blog aware, static site generator."
s.authors = ["Tom Preston-Werner"]
s.rubyforge_project = "jekyll"
s.files.exclude 'test/dest'
s.test_files.exclude 'test/dest'
s.add_dependency('RedCloth', '>= 4.2.1')
s.add_dependency('liquid', '>= 1.9.0')
s.add_dependency('classifier', '>= 1.3.1')
s.add_dependency('maruku', '>= 0.5.9')
s.add_dependency('directory_watcher', '>= 1.1.1')
s.add_dependency('open4', '>= 0.9.6')
end
rescue LoadError
puts "Jeweler not available. Install it with: sudo gem install jeweler --version '>= 0.11.0'"
exit(1)
#############################################################################
#
# Helper functions
#
#############################################################################

def name
@name ||= Dir['*.gemspec'].first.split('.').first
end

Rake::TestTask.new do |t|
t.libs << 'lib'
t.pattern = 'test/**/test_*.rb'
t.verbose = false
def version
line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
end

Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'jekyll'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
def date
Date.today.to_s
end

begin
require 'rcov/rcovtask'
Rcov::RcovTask.new do |t|
t.libs << 'test'
t.test_files = FileList['test/**/test_*.rb']
t.verbose = true
end
rescue LoadError
def rubyforge_project
name
end

def gemspec_file
"#{name}.gemspec"
end

def gem_file
"#{name}-#{version}.gem"
end

def replace_header(head, header_name)
head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
end

#############################################################################
#
# Standard tasks
#
#############################################################################

task :default => [:test, :features]

# console
require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test'
test.pattern = 'test/**/test_*.rb'
test.verbose = true
end

desc "Generate RCov test coverage and open in your browser"
task :coverage do
require 'rcov'
sh "rm -fr coverage"
sh "rcov test/test_*.rb"
sh "open coverage/index.html"
end

require 'rake/rdoctask'
Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = "#{name} #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end

desc "Open an irb session preloaded with this library"
task :console do
sh "irb -rubygems -I lib -r jekyll.rb"
sh "irb -rubygems -r ./lib/#{name}.rb"
end

# converters
#############################################################################
#
# Custom tasks (add your own tasks here)
#
#############################################################################

namespace :convert do
namespace :migrate do
desc "Migrate from mephisto in the current directory"
task :mephisto do
sh %q(ruby -r './lib/jekyll/converters/mephisto' -e 'Jekyll::Mephisto.postgres(:database => "#{ENV["DB"]}")')
sh %q(ruby -r './lib/jekyll/migrators/mephisto' -e 'Jekyll::Mephisto.postgres(:database => "#{ENV["DB"]}")')
end
desc "Migrate from Movable Type in the current directory"
task :mt do
sh %q(ruby -r './lib/jekyll/converters/mt' -e 'Jekyll::MT.process("#{ENV["DB"]}", "#{ENV["USER"]}", "#{ENV["PASS"]}")')
sh %q(ruby -r './lib/jekyll/migrators/mt' -e 'Jekyll::MT.process("#{ENV["DB"]}", "#{ENV["USER"]}", "#{ENV["PASS"]}")')
end
desc "Migrate from Typo in the current directory"
task :typo do
sh %q(ruby -r './lib/jekyll/converters/typo' -e 'Jekyll::Typo.process("#{ENV["DB"]}", "#{ENV["USER"]}", "#{ENV["PASS"]}")')
sh %q(ruby -r './lib/jekyll/migrators/typo' -e 'Jekyll::Typo.process("#{ENV["DB"]}", "#{ENV["USER"]}", "#{ENV["PASS"]}")')
end
end

begin
require 'cucumber/rake/task'

Cucumber::Rake::Task.new(:features) do |t|
t.cucumber_opts = "--format progress"
end
@@ -89,3 +105,55 @@ rescue LoadError
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
end
end

#############################################################################
#
# Packaging tasks
#
#############################################################################

task :release => :build do
unless `git branch` =~ /^\* master$/
puts "You must be on the master branch to release!"
exit!
end
sh "git commit --allow-empty -a -m 'Release #{version}'"
sh "git tag v#{version}"
sh "git push origin master"
sh "git push v#{version}"
sh "gem push pkg/#{name}-#{version}.gem"
end

task :build => :gemspec 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
5 changes: 0 additions & 5 deletions VERSION.yml

This file was deleted.

2 changes: 1 addition & 1 deletion bin/jekyll
Original file line number Diff line number Diff line change
@@ -75,7 +75,7 @@ opts = OptionParser.new do |opts|
end

opts.on("--version", "Display current version") do
puts "Jekyll " + Jekyll.version
puts "Jekyll " + Jekyll::VERSION
exit 0
end
end
260 changes: 120 additions & 140 deletions jekyll.gemspec
Original file line number Diff line number Diff line change
@@ -1,147 +1,127 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in rakefile, and run the gemspec command
# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
s.name = %q{jekyll}
s.version = "0.5.7"

s.specification_version = 2 if s.respond_to? :specification_version=
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Tom Preston-Werner"]
s.date = %q{2010-01-12}
s.default_executable = %q{jekyll}
s.description = %q{Jekyll is a simple, blog aware, static site generator.}
s.email = %q{tom@mojombo.com}
s.rubygems_version = '1.3.5'

s.name = 'jekyll'
s.version = '0.5.7'
s.date = '2010-04-21'
s.rubyforge_project = 'jekyll'

s.summary = "A simple, blog aware, static site generator."
s.description = "Jekyll is a simple, blog aware, static site generator."

s.authors = ["Tom Preston-Werner"]
s.email = 'tom@mojombo.com'
s.homepage = 'http://github.com/mojombo/jekyll'

s.require_paths = %w[lib]

s.executables = ["jekyll"]
s.extra_rdoc_files = [
"README.textile"
]
s.files = [
".gitignore",
"History.txt",
"README.textile",
"Rakefile",
"VERSION.yml",
"bin/jekyll",
"features/create_sites.feature",
"features/embed_filters.feature",
"features/markdown.feature",
"features/pagination.feature",
"features/permalinks.feature",
"features/post_data.feature",
"features/site_configuration.feature",
"features/site_data.feature",
"features/step_definitions/jekyll_steps.rb",
"features/support/env.rb",
"jekyll.gemspec",
"lib/jekyll.rb",
"lib/jekyll/albino.rb",
"lib/jekyll/converters/csv.rb",
"lib/jekyll/converters/mephisto.rb",
"lib/jekyll/converters/mt.rb",
"lib/jekyll/converters/textpattern.rb",
"lib/jekyll/converters/typo.rb",
"lib/jekyll/converters/wordpress.rb",
"lib/jekyll/convertible.rb",
"lib/jekyll/core_ext.rb",
"lib/jekyll/filters.rb",
"lib/jekyll/layout.rb",
"lib/jekyll/page.rb",
"lib/jekyll/pager.rb",
"lib/jekyll/post.rb",
"lib/jekyll/site.rb",
"lib/jekyll/static_file.rb",
"lib/jekyll/tags/highlight.rb",
"lib/jekyll/tags/include.rb",
"test/helper.rb",
"test/source/_includes/sig.markdown",
"test/source/_layouts/default.html",
"test/source/_layouts/simple.html",
"test/source/_posts/2008-02-02-not-published.textile",
"test/source/_posts/2008-02-02-published.textile",
"test/source/_posts/2008-10-18-foo-bar.textile",
"test/source/_posts/2008-11-21-complex.textile",
"test/source/_posts/2008-12-03-permalinked-post.textile",
"test/source/_posts/2008-12-13-include.markdown",
"test/source/_posts/2009-01-27-array-categories.textile",
"test/source/_posts/2009-01-27-categories.textile",
"test/source/_posts/2009-01-27-category.textile",
"test/source/_posts/2009-01-27-empty-categories.textile",
"test/source/_posts/2009-01-27-empty-category.textile",
"test/source/_posts/2009-03-12-hash-#1.markdown",
"test/source/_posts/2009-05-18-empty-tag.textile",
"test/source/_posts/2009-05-18-empty-tags.textile",
"test/source/_posts/2009-05-18-tag.textile",
"test/source/_posts/2009-05-18-tags.textile",
"test/source/_posts/2009-06-22-empty-yaml.textile",
"test/source/_posts/2009-06-22-no-yaml.textile",
"test/source/_posts/2010-01-08-triple-dash.markdown",
"test/source/_posts/2010-01-09-date-override.textile",
"test/source/_posts/2010-01-09-time-override.textile",
"test/source/about.html",
"test/source/category/_posts/2008-9-23-categories.textile",
"test/source/contacts.html",
"test/source/css/screen.css",
"test/source/foo/_posts/bar/2008-12-12-topical-post.textile",
"test/source/index.html",
"test/source/sitemap.xml",
"test/source/win/_posts/2009-05-24-yaml-linebreak.markdown",
"test/source/z_category/_posts/2008-9-23-categories.textile",
"test/suite.rb",
"test/test_configuration.rb",
"test/test_core_ext.rb",
"test/test_filters.rb",
"test/test_generated_site.rb",
"test/test_page.rb",
"test/test_pager.rb",
"test/test_post.rb",
"test/test_site.rb",
"test/test_tags.rb"
]
s.homepage = %q{http://github.com/mojombo/jekyll}
s.default_executable = 'jekyll'

s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubyforge_project = %q{jekyll}
s.rubygems_version = %q{1.3.5}
s.summary = %q{Jekyll is a simple, blog aware, static site generator.}
s.test_files = [
"test/helper.rb",
"test/suite.rb",
"test/test_configuration.rb",
"test/test_core_ext.rb",
"test/test_filters.rb",
"test/test_generated_site.rb",
"test/test_page.rb",
"test/test_pager.rb",
"test/test_post.rb",
"test/test_site.rb",
"test/test_tags.rb"
]
s.extra_rdoc_files = %w[README.textile LICENSE]

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3
s.add_runtime_dependency('RedCloth', [">= 4.2.1"])
s.add_runtime_dependency('liquid', [">= 1.9.0"])
s.add_runtime_dependency('classifier', [">= 1.3.1"])
s.add_runtime_dependency('maruku', [">= 0.5.9"])
s.add_runtime_dependency('directory_watcher', [">= 1.1.1"])

if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<RedCloth>, [">= 4.2.1"])
s.add_runtime_dependency(%q<liquid>, [">= 1.9.0"])
s.add_runtime_dependency(%q<classifier>, [">= 1.3.1"])
s.add_runtime_dependency(%q<maruku>, [">= 0.5.9"])
s.add_runtime_dependency(%q<directory_watcher>, [">= 1.1.1"])
else
s.add_dependency(%q<RedCloth>, [">= 4.2.1"])
s.add_dependency(%q<liquid>, [">= 1.9.0"])
s.add_dependency(%q<classifier>, [">= 1.3.1"])
s.add_dependency(%q<maruku>, [">= 0.5.9"])
s.add_dependency(%q<directory_watcher>, [">= 1.1.1"])
end
else
s.add_dependency(%q<RedCloth>, [">= 4.2.1"])
s.add_dependency(%q<liquid>, [">= 1.9.0"])
s.add_dependency(%q<classifier>, [">= 1.3.1"])
s.add_dependency(%q<maruku>, [">= 0.5.9"])
s.add_dependency(%q<directory_watcher>, [">= 1.1.1"])
end
end
s.add_development_dependency('DEVDEPNAME', [">= 1.1.0", "< 2.0.0"])

# = MANIFEST =
s.files = %w[
History.txt
README.textile
Rakefile
bin/jekyll
cucumber.yml
features/create_sites.feature
features/embed_filters.feature
features/markdown.feature
features/pagination.feature
features/permalinks.feature
features/post_data.feature
features/site_configuration.feature
features/site_data.feature
features/step_definitions/jekyll_steps.rb
features/support/env.rb
jekyll.gemspec
lib/jekyll.rb
lib/jekyll/albino.rb
lib/jekyll/converter.rb
lib/jekyll/converters/identity.rb
lib/jekyll/converters/markdown.rb
lib/jekyll/converters/textile.rb
lib/jekyll/convertible.rb
lib/jekyll/core_ext.rb
lib/jekyll/extension.rb
lib/jekyll/filters.rb
lib/jekyll/generator.rb
lib/jekyll/generators/pagination.rb
lib/jekyll/layout.rb
lib/jekyll/migrators/csv.rb
lib/jekyll/migrators/mephisto.rb
lib/jekyll/migrators/mt.rb
lib/jekyll/migrators/textpattern.rb
lib/jekyll/migrators/typo.rb
lib/jekyll/migrators/wordpress.rb
lib/jekyll/page.rb
lib/jekyll/post.rb
lib/jekyll/site.rb
lib/jekyll/static_file.rb
lib/jekyll/tags/highlight.rb
lib/jekyll/tags/include.rb
test/helper.rb
test/source/_includes/sig.markdown
test/source/_layouts/default.html
test/source/_layouts/simple.html
test/source/_posts/2008-02-02-not-published.textile
test/source/_posts/2008-02-02-published.textile
test/source/_posts/2008-10-18-foo-bar.textile
test/source/_posts/2008-11-21-complex.textile
test/source/_posts/2008-12-03-permalinked-post.textile
test/source/_posts/2008-12-13-include.markdown
test/source/_posts/2009-01-27-array-categories.textile
test/source/_posts/2009-01-27-categories.textile
test/source/_posts/2009-01-27-category.textile
test/source/_posts/2009-01-27-empty-categories.textile
test/source/_posts/2009-01-27-empty-category.textile
test/source/_posts/2009-03-12-hash-#1.markdown
test/source/_posts/2009-05-18-empty-tag.textile
test/source/_posts/2009-05-18-empty-tags.textile
test/source/_posts/2009-05-18-tag.textile
test/source/_posts/2009-05-18-tags.textile
test/source/_posts/2009-06-22-empty-yaml.textile
test/source/_posts/2009-06-22-no-yaml.textile
test/source/_posts/2010-01-08-triple-dash.markdown
test/source/_posts/2010-01-09-date-override.textile
test/source/_posts/2010-01-09-time-override.textile
test/source/_posts/2010-01-09-timezone-override.textile
test/source/_posts/2010-01-16-override-data.textile
test/source/about.html
test/source/category/_posts/2008-9-23-categories.textile
test/source/contacts.html
test/source/css/screen.css
test/source/foo/_posts/bar/2008-12-12-topical-post.textile
test/source/index.html
test/source/sitemap.xml
test/source/win/_posts/2009-05-24-yaml-linebreak.markdown
test/source/z_category/_posts/2008-9-23-categories.textile
test/suite.rb
test/test_configuration.rb
test/test_core_ext.rb
test/test_filters.rb
test/test_generated_site.rb
test/test_page.rb
test/test_pager.rb
test/test_post.rb
test/test_site.rb
test/test_tags.rb
]
# = MANIFEST =

s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
end
7 changes: 2 additions & 5 deletions lib/jekyll.rb
Original file line number Diff line number Diff line change
@@ -44,6 +44,8 @@ def require_all(path)
require_all 'jekyll/tags'

module Jekyll
VERSION = '0.5.7'

# Default options. Overriden by values in _config.yml or command-line opts.
# (Strings rather symbols used for compatability with YAML).
DEFAULTS = {
@@ -98,9 +100,4 @@ def self.configuration(override)
# Merge DEFAULTS < _config.yml < override
Jekyll::DEFAULTS.deep_merge(config).deep_merge(override)
end

def self.version
yml = YAML.load(File.read(File.join(File.dirname(__FILE__), *%w[.. VERSION.yml])))
"#{yml[:major]}.#{yml[:minor]}.#{yml[:patch]}"
end
end

0 comments on commit 03cb12a

Please sign in to comment.