forked from padrino/padrino-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Moved doc from rdoc to yard. * Updated http_router dependency.
- Loading branch information
Showing
27 changed files
with
102 additions
and
176 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.bundle | ||
Gemfile.lock | ||
.rvmrc | ||
*.rbc | ||
.yardoc | ||
*.rbc |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,40 @@ | ||
# rake bump[X.X.X] && rake publish | ||
require 'rubygems' unless defined?(Gem) | ||
require 'rake/clean' | ||
require 'rake/contrib/sshpublisher' | ||
require 'fileutils' unless defined?(FileUtils) | ||
require 'rdoc/task' | ||
|
||
# Commented out temporarily | ||
# require 'rake/dsl_definition' | ||
# include Rake::DSL | ||
|
||
require 'rubygems' unless defined?(Gem) | ||
require 'fileutils' unless defined?(FileUtils) | ||
require 'rake' | ||
require 'yard' | ||
require File.expand_path("../padrino-core/lib/padrino-core/version.rb", __FILE__) | ||
begin | ||
require 'sdoc' | ||
rescue LoadError | ||
puts "You need to install sdoc: gem install sdoc to correctly generate our api docs." | ||
end | ||
|
||
include FileUtils | ||
|
||
ROOT = File.expand_path(File.dirname(__FILE__)) | ||
GEM_NAME = 'padrino-framework' | ||
|
||
padrino_gems = [ | ||
"padrino-core", | ||
"padrino-gen", | ||
"padrino-helpers", | ||
"padrino-mailer", | ||
"padrino-admin", | ||
"padrino-cache", | ||
"padrino" | ||
ROOT = File.expand_path(File.dirname(__FILE__)) | ||
GEM_NAME = 'padrino-framework' | ||
|
||
padrino_gems = %w[ | ||
padrino-core | ||
padrino-gen | ||
padrino-helpers | ||
padrino-mailer | ||
padrino-admin | ||
padrino-cache | ||
padrino | ||
] | ||
|
||
GEM_PATHS = padrino_gems.freeze | ||
|
||
def rake_command(command) | ||
def sh_rake(command) | ||
sh "#{Gem.ruby} -S rake #{command}", :verbose => true | ||
end | ||
|
||
%w(install gemspec package).each do |name| | ||
desc "Run #{name} for all projects" | ||
task name do | ||
GEM_PATHS.each do |dir| | ||
Dir.chdir(dir) { rake_command(name) } | ||
end | ||
desc "Run 'install' for all projects" | ||
task :install do | ||
GEM_PATHS.each do |dir| | ||
Dir.chdir(dir) { sh_rake(name) } | ||
end | ||
end | ||
|
||
desc "Clean pkg and other stuff" | ||
task :clean do | ||
GEM_PATHS.each do |dir| | ||
Dir.chdir(dir) do | ||
%w(tmp pkg coverage).each { |dir| FileUtils.rm_rf dir } | ||
%w[tmp pkg coverage].each { |dir| FileUtils.rm_rf dir } | ||
end | ||
end | ||
Dir["**/*.gem"].each { |gem| FileUtils.rm_rf gem } | ||
|
@@ -66,11 +50,6 @@ task :version do | |
puts "Current version: #{Padrino.version}" | ||
end | ||
|
||
desc "Commits all staged files" | ||
task :commit, [:message] do |t, args| | ||
sh "git commit -a -m \"#{args.message}\"" | ||
end | ||
|
||
desc "Bumps the version number based on given version" | ||
task :bump, [:version] do |t, args| | ||
raise "Please specify version=x.x.x !" unless args.version | ||
|
@@ -98,7 +77,7 @@ desc "Release all padrino gems" | |
task :publish => :push do | ||
puts "Pushing to rubygems..." | ||
GEM_PATHS.each do |dir| | ||
Dir.chdir(dir) { rake_command("release") } | ||
Dir.chdir(dir) { sh_rake("release") } | ||
end | ||
Rake::Task["clean"].invoke | ||
end | ||
|
@@ -108,39 +87,31 @@ task :test do | |
# Omit the padrino metagem since no tests there | ||
GEM_PATHS[0..-2].each do |g| | ||
# Hardcode the 'cd' into the command and do not use Dir.chdir because this causes random tests to fail | ||
sh "cd #{File.join(ROOT, g)} && #{Gem.ruby} -S rake test", :verbose => true | ||
sh "cd #{File.join(ROOT, g)} && #{Gem.ruby} -S rake test"#, :verbose => true | ||
end | ||
end | ||
|
||
desc "Run tests for all padrino stack gems" | ||
task :default => :test | ||
|
||
desc "Generate documentation for the Padrino framework" | ||
Rake::RDocTask.new do |rdoc| | ||
rdoc.rdoc_dir = 'doc' | ||
rdoc.options << '--fmt' << 'shtml' # explictly set shtml generator | ||
rdoc.title = "Padrino Framework Documentation - v. #{Padrino.version}" | ||
rdoc.main = 'padrino-core/README.rdoc' | ||
rdoc.rdoc_files.include('padrino-core/lib/{*.rb,padrino-core}/*.rb') | ||
rdoc.rdoc_files.include('padrino-core/lib/padrino-core/application/**/*.rb') | ||
rdoc.rdoc_files.exclude('padrino-core/lib/padrino-core/cli.rb') | ||
rdoc.rdoc_files.exclude('padrino-core/lib/padrino-core/support_lite.rb') | ||
rdoc.rdoc_files.exclude('padrino-core/lib/padrino-core/server.rb') | ||
rdoc.rdoc_files.include('padrino-core/README.rdoc') | ||
rdoc.rdoc_files.include('padrino-admin/lib/**/*.rb') | ||
rdoc.rdoc_files.exclude('padrino-admin/lib/padrino-admin/generators') | ||
rdoc.rdoc_files.include('padrino-admin/README.rdoc') | ||
rdoc.rdoc_files.include('padrino-helpers/lib/**/*.rb') | ||
rdoc.rdoc_files.include('padrino-helpers/README.rdoc') | ||
rdoc.rdoc_files.include('padrino-mailer/lib/**/*.rb') | ||
rdoc.rdoc_files.include('padrino-mailer/README.rdoc') | ||
rdoc.rdoc_files.include('padrino-cache/lib/**/*.rb') | ||
rdoc.rdoc_files.include('padrino-cache/README.rdoc') | ||
task :doc do | ||
yard = YARD::CLI::Yardoc.new | ||
yard.parse_arguments *%w[ | ||
--exclude /support_lite|padrino-tasks|padrino-core\/cli/ | ||
--hide-void-return | ||
--output-dir doc/ | ||
--readme README.rdoc | ||
--no-private | ||
--title Padrino Framework | ||
padrino-*/lib/**/*.rb | ||
] | ||
yard.run | ||
end | ||
|
||
desc "Publish doc on padrinorb.com/api" | ||
task :pdoc => :rdoc do | ||
task :pdoc => :doc do | ||
puts "Publishing doc on padrinorb.com ..." | ||
Rake::SshDirPublisher.new("[email protected]", "/mnt/www/apps/padrino/public/api", "doc").upload | ||
sh "scp -r doc/* [email protected]:/mnt/www/apps/padrino/public/api/" | ||
FileUtils.rm_rf "doc" | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,22 @@ | ||
require 'rubygems/specification' | ||
require 'rubygems' unless defined?(Gem) | ||
require 'rake' | ||
require 'rubygems/package_task' | ||
|
||
# Runs the sh command with sudo if the rake command is run with sudo | ||
def sudo_sh(command) | ||
command = `whoami`.strip! != "root" ? "sudo #{command}" : command | ||
sh command | ||
end | ||
|
||
# Returns the gem specification object for a gem | ||
def gemspec | ||
@gemspec ||= begin | ||
gem_name = File.basename(File.dirname(RAKE_ROOT)) | ||
file = File.expand_path("../#{gem_name}.gemspec", RAKE_ROOT) | ||
::Gem::Specification.load(file) | ||
require 'rake/testtask' | ||
require 'bundler/gem_tasks' | ||
|
||
# Skip the releasing tag | ||
class Bundler::GemHelper | ||
def release_gem | ||
guard_clean | ||
guard_already_tagged | ||
built_gem_path = build_gem | ||
rubygem_push(built_gem_path) | ||
end | ||
end | ||
|
||
# These are the uniform tasks used to build the individual padrino gems | ||
# | ||
# Use these by requiring them into the Rakefile in a gem | ||
# RAKE_ROOT = __FILE__ | ||
# require 'rubygems' | ||
# require File.expand_path(File.dirname(__FILE__) + '/../gem_rake_helper') | ||
# | ||
# Most notable functions are: | ||
# $ rake test # runs all tests | ||
# $ rake package # packages the gem into the pkg folder | ||
# $ rake install # installs the gem into system | ||
# $ rake release # publishes gem to rubygems | ||
|
||
desc "Validates the gemspec" | ||
task :gemspec do | ||
gemspec.validate | ||
end | ||
|
||
desc "Displays the current version" | ||
task :version do | ||
puts "Current version: #{gemspec.version}" | ||
end | ||
|
||
desc "Installs the gem locally" | ||
task :install => :package do | ||
sh "gem install pkg/#{gemspec.name}-#{gemspec.version}" | ||
end | ||
|
||
desc "Release the gem" | ||
task :release => :package do | ||
sh "gem push pkg/#{gemspec.name}-#{gemspec.version}.gem" | ||
end | ||
|
||
# rake test | ||
require 'rake/testtask' | ||
Rake::TestTask.new(:test) do |test| | ||
test.libs << 'test' | ||
test.test_files = Dir['test/**/test_*.rb'] | ||
test.verbose = true | ||
end | ||
|
||
# rake package | ||
Gem::PackageTask.new(gemspec) do |pkg| | ||
pkg.gem_spec = gemspec | ||
end | ||
task :gem => :gemspec | ||
task :package => :gemspec | ||
|
||
task :default => :test | ||
task :default => :test |
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
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
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
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
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
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
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
Oops, something went wrong.