Rakefile in camping-2.1 vs Rakefile in camping-2.1.467
- old
+ new
@@ -1,99 +1,40 @@
$:.unshift 'extras'
require 'rake'
require 'rake/clean'
-require 'rake/gempackagetask'
require 'rake/testtask'
require 'tempfile'
require 'open3'
-task :default => :check
+require File.expand_path('../constants', __FILE__)
-## Constants
-NAME = "camping"
-BRANCH = "2.1"
-GIT = ENV['GIT'] || "git"
-REV = `#{GIT} rev-list HEAD`.strip.split.length
-VERS = ENV['VERSION'] || (REV.zero? ? BRANCH : [BRANCH, REV] * '.')
-
CLEAN.include ['**/.*.sw?', '*.gem', '.config', 'test/test.log', '.*.pt']
-RDOC_OPTS = ["--line-numbers", "--quiet", "--main", "README"]
-
-## Packaging
-spec =
- Gem::Specification.new do |s|
- s.name = NAME
- s.version = VERS
- s.platform = Gem::Platform::RUBY
- s.has_rdoc = true
- s.extra_rdoc_files = FileList["README", "CHANGELOG", "COPYING", "book/*"].to_a
- s.rdoc_options += RDOC_OPTS + ['--exclude', '^(examples|extras)\/', '--exclude', 'lib/camping.rb']
- s.summary = "minature rails for stay-at-home moms"
- s.author = "why the lucky stiff"
- s.email = 'why@ruby-lang.org'
- s.homepage = 'http://camping.rubyforge.org/'
- s.rubyforge_project = 'camping'
- s.executables = ['camping']
- s.add_dependency('rack', '>=1.0')
- s.required_ruby_version = '>= 1.8.2'
+task :default => :check
- s.files = %w(COPYING README Rakefile) +
- Dir.glob("{bin,doc,test,lib,extras,book}/**/*") +
- Dir.glob("ext/**/*.{h,c,rb}") +
- Dir.glob("examples/**/*.rb") +
- Dir.glob("tools/*.rb")
-
- s.require_path = "lib"
- s.bindir = "bin"
- end
-
-omni =
- Gem::Specification.new do |s|
- s.name = "camping-omnibus"
- s.version = VERS
- s.platform = Gem::Platform::RUBY
- s.summary = "the camping meta-package for updating ActiveRecord, Mongrel and SQLite3 bindings"
- %w[author email homepage rubyforge_project].each { |x| s.__send__("#{x}=", spec.__send__(x)) }
-
- s.add_dependency('camping', "=#{VERS}")
- s.add_dependency('activerecord')
- s.add_dependency('sqlite3-ruby', '>=1.1.0.1')
- s.add_dependency('mongrel')
- s.add_dependency('RedCloth')
- s.add_dependency('markaby')
- end
-
## RDoc
begin
- gem 'rdoc', '~> 2.4.0'
+ gem 'rdoc', '~>3.9.0'
rescue LoadError
- # Don't complain yet.
-end
-
-require 'rdoc/rdoc'
-require 'rake/rdoctask'
-
-Rake::RDocTask.new(:docs) do |rdoc|
- if defined?(RDoc::VERSION) && RDoc::VERSION[0,3] == "2.4"
+ task :docs do
+ puts "** Camping needs RDoc 3.9 in order to use the Flipbook template."
+ end
+else
+ require 'rdoc/task'
+ RDoc::Task.new(:docs) do |rdoc|
# We have a recent version of RDoc, so let's use flipbook.
require 'rdoc/generator/singledarkfish'
rdoc.options += ['-f', 'singledarkfish', *RDOC_OPTS]
rdoc.template = "flipbook"
- else
- # Use whatever template is available, and give a little warning.
- task :docs do
- puts "** Camping needs RDoc 2.4 in order to use the Flipbook template."
- end
+
+ rdoc.rdoc_dir = 'doc'
+ rdoc.title = "Camping, a Microframework"
+ rdoc.rdoc_files.add ['README', 'lib/camping-unabridged.rb', 'lib/camping/**/*.rb', 'book/*']
end
-
- rdoc.inline_source = false # --inline-source is deprecated
- rdoc.rdoc_dir = 'doc'
- rdoc.title = "Camping, a Microframework"
- rdoc.rdoc_files.add ['README', 'lib/camping-unabridged.rb', 'lib/camping/**/*.rb', 'book/*']
end
+
task :rubygems_docs do
require 'rubygems/doc_manager'
def spec.installation_path; '.' end
@@ -103,33 +44,14 @@
end
desc "Packages Camping."
task :package => :clean
-Rake::GemPackageTask.new(spec) do |p|
- p.need_tar = true
- p.gem_spec = spec
-end
-
-Rake::GemPackageTask.new(omni) do |p|
- p.gem_spec = omni
-end
-
-task :install => :package do
- sh %{sudo gem install pkg/#{NAME}-#{VERS}}
-end
-
-task :uninstall => [:clean] do
- sh %{sudo gem uninstall #{NAME}}
-end
-
## Tests
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.test_files = FileList['test/app_*.rb']
-# t.warning = true
-# t.verbose = true
end
## Diff
desc "Compare camping and camping-unabridged"
task :diff do
@@ -151,14 +73,19 @@
end
error = false
## Check
-task :check => ["test", "check:valid", "check:size", "check:lines", "check:exit"]
+task :check => ["test", "check:valid", "check:equal", "check:size", "check:lines", "check:exit"]
namespace :check do
desc "Check source code validity"
task :valid do
+ sh "ruby -c lib/camping.rb"
+ end
+
+ desc "Check equality between mural and unabridged"
+ task :equal do
require 'ruby_parser'
u = RubyParser.new.parse(File.read("lib/camping-unabridged.rb"))
m = RubyParser.new.parse(File.read("lib/camping.rb"))
u.reject! do |sexp|