Skip to content

Commit

Permalink
* Updated rake tasks.
Browse files Browse the repository at this point in the history
* Moved doc from rdoc to yard.
* Updated http_router dependency.
  • Loading branch information
DAddYE committed Aug 24, 2011
1 parent 5d631d4 commit 7c5c604
Show file tree
Hide file tree
Showing 27 changed files with 102 additions and 176 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.bundle
Gemfile.lock
.rvmrc
*.rbc
.yardoc
*.rbc
27 changes: 14 additions & 13 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require File.expand_path("../padrino-core/lib/padrino-core/version.rb", __FILE__)

base_path = File.expand_path(File.dirname(__FILE__), __FILE__)

source :rubygems

group :db do
Expand All @@ -18,9 +16,9 @@ group :development do
gem "sinatra", :git => "git://github.com/sinatra/sinatra.git"
end
gem "nokogiri", "1.4.4"
gem "rack", "~> 1.3.0"
gem "rake", ">= 0.8.7"
gem "rdoc"
gem "rack", "~> 1.3.0"
gem "rake", ">= 0.8.7"
gem "yard", ">= 0.7.2"
gem "mocha", ">= 0.9.8"
gem "rack-test", ">= 0.5.0"
gem "fakeweb", ">=1.2.8"
Expand All @@ -31,7 +29,6 @@ group :development do
gem "shoulda", ">= 2.10.3"
gem "uuid", ">= 2.3.1"
gem "bcrypt-ruby", :require => "bcrypt"
gem "phocus"
gem "builder", ">= 2.1.2"
platforms :mri_18 do
gem "rcov", "~> 0.9.8"
Expand Down Expand Up @@ -63,10 +60,14 @@ group :cache do
end
end

gem "padrino", :path => "/#{base_path}/padrino"
gem "padrino-admin", :path => "/#{base_path}/padrino-admin"
gem "padrino-cache", :path => "/#{base_path}/padrino-cache"
gem "padrino-core", :path => "/#{base_path}/padrino-core"
gem "padrino-gen", :path => "/#{base_path}/padrino-gen"
gem "padrino-helpers", :path => "/#{base_path}/padrino-helpers"
gem "padrino-mailer", :path => "/#{base_path}/padrino-mailer"
%w[
padrino
padrino-admin
padrino-cache
padrino-core
padrino-gen
padrino-helpers
padrino-mailer
].each do |dep|
gem dep, :path => File.join(File.expand_path(File.dirname(__FILE__)), dep)
end
103 changes: 37 additions & 66 deletions Rakefile
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 }
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
70 changes: 12 additions & 58 deletions gem_rake_helper.rb
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
8 changes: 4 additions & 4 deletions padrino-admin/lib/padrino-admin/access_control.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Padrino
module Admin
class AccessControlError < StandardError #:nodoc:
class AccessControlError < StandardError ## @private
end
##
# This module give to a padrino application an access control functionality
Expand All @@ -22,7 +22,7 @@ def registered(app)
end

class Base
def initialize #:nodoc:
def initialize ## @private
@roles, @authorizations, @project_modules = [], [], []
end

Expand Down Expand Up @@ -80,7 +80,7 @@ def allowed?(account=nil, path=nil)
class Authorization
attr_reader :allowed, :denied, :project_modules, :roles

def initialize(*roles, &block) #:nodoc:
def initialize(*roles, &block) ## @private
@roles = roles
@allowed = []
@denied = []
Expand Down Expand Up @@ -117,7 +117,7 @@ def project_module(name, path)
class ProjectModule
attr_reader :name

def initialize(name, path) #:nodoc:
def initialize(name, path) ## @private
@name, @path = name, path
end

Expand Down
2 changes: 1 addition & 1 deletion padrino-admin/lib/padrino-admin/utils/crypt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def encrypt(password)
end

private
def build_cipher(type, password) #:nodoc:
def build_cipher(type, password) ## @private
cipher = OpenSSL::Cipher::Cipher.new("DES-EDE3-CBC").send(type)
cipher.pkcs5_keyivgen(password)
cipher
Expand Down
2 changes: 1 addition & 1 deletion padrino-cache/lib/padrino-cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def registered(app)
end
alias :included :registered

def padrino_route_added(route, verb, path, args, options, block) #:nodoc
def padrino_route_added(route, verb, path, args, options, block) ## @private
Padrino::Cache::Helpers::Page.padrino_route_added(route, verb, path, args, options, block)
end
end
Expand Down
2 changes: 1 addition & 1 deletion padrino-cache/lib/padrino-cache/helpers/cache_store.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Padrino
module Cache
module Helpers
module CacheStore #:nodoc:
module CacheStore ## @private
def expire(*key)
if key.size == 1 and key.first.is_a?(String)
settings.cache.delete(key)
Expand Down
2 changes: 1 addition & 1 deletion padrino-cache/lib/padrino-cache/helpers/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def cache_key(name)
@_cache_key = name
end

def self.padrino_route_added(route, verb, path, args, options, block) #:nodoc:
def self.padrino_route_added(route, verb, path, args, options, block) ## @private
if route.cache and %w(GET HEAD).include?(verb)
route.add_before_filter(Proc.new {
if settings.caching?
Expand Down
2 changes: 1 addition & 1 deletion padrino-core/lib/padrino-core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
PADRINO_ROOT = ENV["PADRINO_ROOT"] ||= File.dirname(Padrino.first_caller) unless defined?(PADRINO_ROOT)

module Padrino
class ApplicationLoadError < RuntimeError #:nodoc:
class ApplicationLoadError < RuntimeError ## @private
end

class << self
Expand Down
4 changes: 2 additions & 2 deletions padrino-core/lib/padrino-core/application.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Padrino
class ApplicationSetupError < RuntimeError #:nodoc:
class ApplicationSetupError < RuntimeError ## @private
end

##
Expand All @@ -11,7 +11,7 @@ class Application < Sinatra::Base

class << self

def inherited(base) #:nodoc:
def inherited(base) ## @private
logger.devel "Setup #{base}"
CALLERS_TO_IGNORE.concat(PADRINO_IGNORE_CALLERS)
base.default_configuration!
Expand Down
Loading

0 comments on commit 7c5c604

Please sign in to comment.