Created
April 30, 2010 01:36
-
-
Save tomas-stefano/384581 to your computer and use it in GitHub Desktop.
Just a Fake DSL Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rake Syntax for RDoc | |
# | |
Rake::RDocTask.new do |rdoc| | |
rdoc.rdoc_dir = "doc" | |
rdoc.title = "My Gem" | |
rdoc.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object' | |
rdoc.options << '--charset' << 'utf-8' | |
rdoc.template = ENV['template'] ? "#{ENV['template']}.rb" : '../doc/template/horo' | |
rdoc.rdoc_files.include("README", "CHANGELOG") | |
rdoc.rdoc_files.include("lib/**/*.rb") | |
end | |
# Run | |
# $ rake rdoc | |
# FAKE DSL CODE (Just for thinking more) | |
# | |
# The default rdoc directory option is 'doc' | |
# The default charset is 'utf-8' | |
# | |
rdoc do | |
title 'My gem' | |
line_numbers | |
inline_source | |
other_options '-A cattr_accessor=object' | |
template ENV['template'] ? "#{ENV['template']}.rb" : '../doc/template/horo' | |
rdoc_include :files => %w(README CHANGELOG lib/**/*.rb) | |
end | |
# Run | |
# $ morpheus rdoc | |
# Rake Syntax for Rspec | |
# | |
Spec::Rake::SpecTask.new(:spec) do |t| | |
t.libs << 'lib' | |
t.spec_opts = ['--options', "spec/spec.opts"] | |
t.spec_files = FileList['spec/**/*_spec.rb'] | |
end | |
# Run | |
# $ rake spec | |
# Fake DSL code | |
# | |
# The default spec_options is locate in the spec/spec.opts | |
# | |
rspec do | |
files 'spec/**/*_spec.rb' | |
end | |
# Run | |
# $ morpheus spec | |
# Rake Syntax for RCov with Rspec | |
# | |
Spec::Rake::SpecTask.new(:rcov) do |spec| | |
spec.libs << 'lib' << 'spec' | |
spec.pattern = 'spec/**/*_spec.rb' | |
spec.rcov = true | |
end | |
# Run | |
# $ rake rcov | |
# Fake Code Syntax | |
# | |
# The default libs is 'lib' and 'spec' | |
# The default pattern is 'spec/**/*_spec.rb' | |
# | |
rspec :task => :rcov do | |
rcov | |
end | |
# Run | |
# $ morpheus rcov | |
# Rake Syntax for Test::Unit | |
# | |
Rake::TestTask.new(:test) do |test| | |
test.libs << 'test' | |
test.pattern = 'test/**/test_*.rb' | |
test.verbose = true | |
end | |
# Run | |
# $ rake test | |
# Fake DSL Code | |
# | |
# The default libs option is 'test' | |
# The default pattern option for Test::Unit is 'test/**/test_*.rb' | |
# | |
test_unit do | |
verbose true | |
end | |
# Run | |
# $ morpheus test | |
# Rake Syntax for Test::Unit with RCov | |
# | |
begin | |
require 'rcov/rcovtask' | |
Rcov::RcovTask.new do |rcov| | |
rcov.libs << 'test' | |
rcov.pattern = 'test/**/test_*.rb' | |
rcov.verbose = true | |
rcov.rcov_opts << ['--exclude /Gems/1.8/gems/,padrino-core,padrino-cache,padrino-gen,padrino-helpers,padrino-mailer'] | |
end | |
rescue LoadError | |
task :rcov do | |
abort "RCov is not available. In order to run rcov, you must: sudo gem install relevance-rcov" | |
end | |
end | |
# Run | |
# $ rake rcov | |
# Fake DSL Code | |
# | |
# The default pattern is 'test/**/test_*.rb' | |
# | |
test_unit :task => :rcov do | |
verbose true | |
rcov | |
rcov_exclude '/Gems/1.8/gems/,padrino-core,padrino-cache,padrino-gen,padrino-helpers,padrino-mailer' | |
end | |
# Run | |
# $ morpheus rcov | |
# Rake Syntax for Jeweler | |
# | |
begin | |
require 'jeweler' | |
Jeweler::Tasks.new do |gem| | |
gem.name = "my-gem" | |
gem.summary = "My gem Summary" | |
gem.description = "My gem description" | |
gem.email = "[email protected]" | |
gem.homepage = "http://github.com/my-github-user/my-gem/tree/master/" | |
gem.authors = ["The Authors", "Other Authors"] | |
gem.rubyforge_project = 'my-gem' | |
gem.version = MyGem.version | |
gem.add_runtime_dependency "mygem-core", "= #{MyGem.version}" | |
gem.add_runtime_dependency "mygem-admin", "= #{MyGem.version}" | |
gem.add_runtime_dependency "mygem-helpers", "= #{MyGem.version}" | |
gem.add_development_dependency "shoulda", ">= 0" | |
gem.add_development_dependency "mocha", ">= 0.9.7" | |
end | |
Jeweler::GemcutterTasks.new | |
Jeweler::RubyforgeTasks.new { |r| r.doc_task = :none } | |
rescue LoadError | |
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler" | |
end | |
# Run | |
# $ rake -T | |
# and you'll see some tasks that Jeweler gives to you | |
# FAKE DSL CODE | |
# | |
jeweler do | |
gem_name 'my-gem' | |
summary 'My gem Summary' | |
description 'My gem Description' | |
email '[email protected]' | |
homepage 'http://github.com/my-github-user/my-gem/tree/master/' | |
authors ["The Authors", "Other Authors"] | |
rubyforge_project 'my-gem' | |
rubyforge_tasks :doc_task => :none | |
version MyGem.version | |
runtime_dependencies { 'mygem-core' => MyGem.version, 'mygem-admin' => MyGem.version, 'mygem-helpers' => MyGem.version} | |
development_dependencies { :shoulda => '> 0', :mocha => '> = 0.9.7'} | |
end | |
# Run | |
# $ morpheus -T | |
# and you'll see some tasks that Jeweler gives to you |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment