summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-01-04 01:34:39 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-01-04 01:34:39 +0000
commit584652c6b84fdbc910f7bde96639b772dde8fa23 (patch)
treea242937c48de48b93709dbab534e7eab5fa35490
parent0e0fdac1a743416191dd202cf8606d7a2ef042eb (diff)
downloadpuppet-584652c6b84fdbc910f7bde96639b772dde8fa23.tar.gz
puppet-584652c6b84fdbc910f7bde96639b772dde8fa23.tar.xz
puppet-584652c6b84fdbc910f7bde96639b772dde8fa23.zip
Disabling most documentation generation except for the API docs, and wrapping the StatusServer in the xmlrpc check
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@766 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r--Rakefile94
-rw-r--r--install.rb90
-rw-r--r--lib/puppet/server.rb81
3 files changed, 170 insertions, 95 deletions
diff --git a/Rakefile b/Rakefile
index 03681bf95..cb4a23069 100644
--- a/Rakefile
+++ b/Rakefile
@@ -7,18 +7,18 @@ rescue Exception
nil
end
+require 'rdoc/rdoc'
require 'rake/clean'
require 'rake/testtask'
-#require 'rake/rdoctask'
-#CLEAN.include('**/*.o')
-#CLOBBER.include('doc/*')
+require 'rake/rdoctask'
+CLEAN.include('**/*.o')
+CLOBBER.include('doc/*')
def announce(msg='')
STDERR.puts msg
end
-
# Determine the current version
if `ruby -Ilib ./bin/puppet --version` =~ /\S+$/
@@ -33,6 +33,7 @@ else
PKG_VERSION = CURRENT_VERSION
end
+DOWNDIR = "/export/docroots/reductivelabs.com/htdocs/downloads"
# The default task is run if rake is given no explicit arguments.
@@ -45,16 +46,16 @@ task :u => :unittests
task :a => :alltests
Rake::TestTask.new(:alltests) do |t|
- t.test_files = FileList['test/tc*.rb']
+ t.test_files = FileList['test/*/*.rb']
t.warning = true
t.verbose = false
end
-Rake::TestTask.new(:unittests) do |t|
- t.test_files = FileList['test/test']
- t.warning = true
- t.verbose = false
-end
+#Rake::TestTask.new(:unittests) do |t|
+# t.test_files = FileList['test/test']
+# t.warning = true
+# t.verbose = false
+#end
# SVN Tasks ----------------------------------------------------------
# ... none.
@@ -68,15 +69,40 @@ end
# Create a task to build the RDOC documentation tree.
-#rd = Rake::RDocTask.new("rdoc") { |rdoc|
-# rdoc.rdoc_dir = 'html'
-# rdoc.template = 'css2'
-# rdoc.title = "Puppet"
-# rdoc.options << '--line-numbers' << '--inline-source' << '--main' << 'README'
-# rdoc.rdoc_files.include('README', 'LICENSE', 'TODO', 'CHANGELOG')
-# rdoc.rdoc_files.include('lib/**/*.rb', 'doc/**/*.rdoc')
+#Rake::RDocTask.new("ri") { |rdoc|
+# #rdoc.rdoc_dir = 'html'
+# #rdoc.template = 'html'
+# rdoc.title = "Puppet"
+# rdoc.options << '--ri' << '--line-numbers' << '--inline-source' << '--main' << 'README'
+# rdoc.rdoc_files.include('README', 'LICENSE', 'TODO', 'CHANGELOG')
+# rdoc.rdoc_files.include('lib/**/*.rb', 'doc/**/*.rdoc')
#}
+Rake::RDocTask.new(:html) { |rdoc|
+ rdoc.rdoc_dir = 'html'
+ rdoc.template = 'html'
+ rdoc.title = "Puppet"
+ rdoc.options << '--line-numbers' << '--inline-source' << '--main' << 'README'
+ rdoc.rdoc_files.include('README', 'LICENSE', 'TODO', 'CHANGELOG')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+ CLEAN.include("html")
+}
+
+task :ri do |ri|
+ files = ['README', 'LICENSE', 'TODO', 'CHANGELOG'] + Dir.glob('lib/**/*.rb')
+ puts "files are \n%s" % files.join("\n")
+ begin
+ ri = RDoc::RDoc.new
+ ri.document(["--ri-site"] + files)
+ rescue RDoc::RDocError => detail
+ puts "Failed to build docs: %s" % detail
+ return nil
+ rescue LoadError
+ puts "Missing rdoc; cannot build documentation"
+ return nil
+ end
+end
+
# ====================================================================
# Create a task that will package the Rake software into distributable
# tar, zip and gem files.
@@ -111,7 +137,10 @@ the configuration.
#### Dependencies and requirements.
- s.add_dependency('facter', '>= 1.0.0')
+ # I'd love to explicitly list all of the libraries that I need,
+ # but gems seem to only be able to handle dependencies on other
+ # gems, which is, um, stupid.
+ s.add_dependency('facter', '>= 1.0.1')
#s.requirements << ""
s.files = PKG_FILES.to_a
@@ -128,12 +157,12 @@ the configuration.
#### Documentation and testing.
- s.has_rdoc = false
+ s.has_rdoc = true
#s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$/ }.to_a
- #s.rdoc_options <<
- # '--title' << 'Puppet - Configuration Management' <<
- # '--main' << 'README' <<
- # '--line-numbers'
+ s.rdoc_options <<
+ '--title' << 'Puppet - Configuration Management' <<
+ '--main' << 'README' <<
+ '--line-numbers'
s.test_file = "test/test"
#### Signing key and cert chain
@@ -145,13 +174,14 @@ the configuration.
s.author = "Luke Kanies"
s.email = "dev@reductivelabs.com"
s.homepage = "http://reductivelabs.com/projects/puppet"
- #s.rubyforge_project = "puppet"
+ s.rubyforge_project = "puppet"
}
Rake::GemPackageTask.new(spec) { |pkg|
#pkg.need_zip = true
pkg.need_tar = true
}
+ CLEAN.include("pkg")
end
# Misc tasks =========================================================
@@ -207,6 +237,7 @@ task :release => [
:prerelease,
:clobber,
:alltests,
+ :rdoc,
:update_version,
:package,
:copy,
@@ -262,7 +293,7 @@ task :update_version => [:prerelease] do
open("lib/puppet.rb") do |rakein|
open("lib/puppet.rb.new", "w") do |rakeout|
rakein.each do |line|
- if line =~ /^PUPPETVERSION\s*=\s*/
+ if line =~ /^\s+PUPPETVERSION\s*=\s*/
rakeout.puts "PUPPETVERSION = '#{PKG_VERSION}'"
else
rakeout.puts line
@@ -280,6 +311,15 @@ task :update_version => [:prerelease] do
end
end
+desc "Copy the newly created package into the downloads directory"
+task :copy => [:package, :html] do
+ sh %{cp pkg/puppet-#{PKG_VERSION}.gem #{DOWNDIR}/gems}
+ sh %{generate_yaml_index.rb -d #{DOWNDIR}}
+ sh %{cp pkg/puppet-#{PKG_VERSION}.tgz #{DOWNDIR}/puppet}
+ sh %{ln -sf puppet-#{PKG_VERSION}.tgz #{DOWNDIR}/puppet/puppet-latest.tgz}
+ sh %{cp -r html #{DOWNDIR}/puppet/apidocs}
+end
+
desc "Tag all the SVN files with the latest release number (REL=x.y.z)"
task :tag => [:prerelease] do
reltag = "REL_#{PKG_VERSION.gsub(/\./, '_')}"
@@ -288,7 +328,9 @@ task :tag => [:prerelease] do
if ENV['RELTEST']
announce "Release Task Testing, skipping SVN tagging"
else
- #sh %{svn copy ../trunk/ ../tags/#{reltag}}
+ sh %{svn copy ../trunk/ ../tags/#{reltag}}
+ sh %{cd ../tags; svn ci -m "Adding release tag #{reltag}}
end
end
+# $Id$
diff --git a/install.rb b/install.rb
index d36857fbd..a9422c697 100644
--- a/install.rb
+++ b/install.rb
@@ -36,21 +36,30 @@
require 'rbconfig'
require 'find'
require 'fileutils'
-require 'rdoc/rdoc'
require 'optparse'
require 'ostruct'
+begin
+ require 'rdoc/rdoc'
+ $haverdoc = true
+rescue LoadError
+ puts "Missing rdoc; skipping documentation"
+ $haverdoc = false
+end
+
+PREREQS = %w{openssl facter xmlrpc/client xmlrpc/server cgi}
+
InstallOptions = OpenStruct.new
def glob(list)
- g = list.map { |i| Dir.glob(i) }
- g.flatten!
- g.compact!
- g.reject! { |e| e =~ /\.svn/ }
- g
+ g = list.map { |i| Dir.glob(i) }
+ g.flatten!
+ g.compact!
+ g.reject! { |e| e =~ /\.svn/ }
+ g
end
- # Set these values to what you want installed.
+# Set these values to what you want installed.
bins = glob(%w{bin/**/*})
rdoc = glob(%w{bin/**/* lib/**/*.rb README README-library CHANGELOG TODO Install}).reject { |e| e=~ /\.(bat|cmd)$/ }
ri = glob(%w(bin/**/*.rb lib/**/*.rb)).reject { |e| e=~ /\.(bat|cmd)$/ }
@@ -74,15 +83,32 @@ def do_libs(libs, strip = 'lib/')
end
end
+# Verify that all of the prereqs are installed
+def check_prereqs
+ PREREQS.each { |pre|
+ begin
+ require pre
+ rescue LoadError
+ puts "Could not load %s; cannot install" % pre
+ end
+ }
+end
+
##
# Prepare the file installation.
#
def prepare_installation
- InstallOptions.rdoc = true
- if RUBY_PLATFORM == "i386-mswin32"
- InstallOptions.ri = false
+ # Only try to do docs if we're sure they have rdoc
+ if $haverdoc
+ InstallOptions.rdoc = true
+ if RUBY_PLATFORM == "i386-mswin32"
+ InstallOptions.ri = false
+ else
+ InstallOptions.ri = true
+ end
else
- InstallOptions.ri = true
+ InstallOptions.rdoc = false
+ InstallOptions.ri = false
end
InstallOptions.tests = true
@@ -153,25 +179,30 @@ end
# Build the rdoc documentation. Also, try to build the RI documentation.
#
def build_rdoc(files)
- r = RDoc::RDoc.new
- r.document(["--main", "README", "--title", "Puppet -- Site Configuration Management",
- "--line-numbers"] + files)
-
-rescue RDoc::RDocError => e
- $stderr.puts e.message
-rescue Exception => e
- $stderr.puts "Couldn't build RDoc documentation\n#{e.message}"
+ return unless $haverdoc
+ begin
+ r = RDoc::RDoc.new
+ r.document(["--main", "README", "--title",
+ "Puppet -- Site Configuration Management", "--line-numbers"] + files)
+ rescue RDoc::RDocError => e
+ $stderr.puts e.message
+ rescue Exception => e
+ $stderr.puts "Couldn't build RDoc documentation\n#{e.message}"
+ end
end
def build_ri(files)
- ri = RDoc::RDoc.new
- #ri.document (["--ri-site", "--merge"] + files)
- ri.document(["--ri-site"] + files)
-rescue RDoc::RDocError => e
- $stderr.puts e.message
-rescue Exception => e
- $stderr.puts "Couldn't build Ri documentation\n#{e.message}"
- $stderr.puts "Continuing with install..."
+ return unless $haverdoc
+ begin
+ ri = RDoc::RDoc.new
+ #ri.document(["--ri-site", "--merge"] + files)
+ ri.document(["--ri-site"] + files)
+ rescue RDoc::RDocError => e
+ $stderr.puts e.message
+ rescue Exception => e
+ $stderr.puts "Couldn't build Ri documentation\n#{e.message}"
+ $stderr.puts "Continuing with install..."
+ end
end
def run_tests(test_list)
@@ -261,10 +292,11 @@ goto done
:done
EOS
+check_prereqs
prepare_installation
run_tests(tests) if InstallOptions.tests
-build_rdoc(rdoc) if InstallOptions.rdoc
-build_ri(ri) if InstallOptions.ri
+#build_rdoc(rdoc) if InstallOptions.rdoc
+#build_ri(ri) if InstallOptions.ri
do_bins(bins, Config::CONFIG['bindir'])
do_libs(libs)
diff --git a/lib/puppet/server.rb b/lib/puppet/server.rb
index 4b40e2bc9..35a16a7f3 100644
--- a/lib/puppet/server.rb
+++ b/lib/puppet/server.rb
@@ -97,62 +97,63 @@ module Puppet
self.mount("/RPC2", Puppet::Server::Servlet, @handlers)
end
end
- end
-
- class Server
- # the base class for the different handlers
- class Handler
- attr_accessor :server
- @subclasses = []
- def self.each
- @subclasses.each { |c| yield c }
- end
+ class Server
+ # the base class for the different handlers
+ class Handler
+ attr_accessor :server
+ @subclasses = []
- def self.handler(name)
- @subclasses.find { |h|
- h.name == name
- }
- end
+ def self.each
+ @subclasses.each { |c| yield c }
+ end
- def self.inherited(sub)
- @subclasses << sub
- end
+ def self.handler(name)
+ @subclasses.find { |h|
+ h.name == name
+ }
+ end
- def self.interface
- if defined? @interface
- return @interface
- else
- raise Puppet::DevError, "Handler %s has no defined interface" %
- self
+ def self.inherited(sub)
+ @subclasses << sub
end
- end
- def self.name
- unless defined? @name
- @name = self.to_s.sub(/.+::/, '').intern
+ def self.interface
+ if defined? @interface
+ return @interface
+ else
+ raise Puppet::DevError, "Handler %s has no defined interface" %
+ self
+ end
end
- return @name
- end
+ def self.name
+ unless defined? @name
+ @name = self.to_s.sub(/.+::/, '').intern
+ end
- def initialize(hash = {})
+ return @name
+ end
+
+ def initialize(hash = {})
+ end
end
- end
- class ServerStatus < Handler
+
+ class ServerStatus < Handler
- @interface = XMLRPC::Service::Interface.new("status") { |iface|
- iface.add_method("int status()")
- }
+ @interface = XMLRPC::Service::Interface.new("status") { |iface|
+ iface.add_method("int status()")
+ }
- @name = :Status
+ @name = :Status
- def status(status = nil, client = nil, clientip = nil)
- return 1
+ def status(status = nil, client = nil, clientip = nil)
+ return 1
+ end
end
- end
+ end
end
#---------------------------------------------------------------