Skip to content

Commit

Permalink
restructured and gemified
Browse files Browse the repository at this point in the history
This can now be used more easily and installed via gem.
  • Loading branch information
davetron5000 committed Dec 20, 2009
1 parent 1f69a50 commit 7595dd2
Show file tree
Hide file tree
Showing 30 changed files with 90 additions and 3,121 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.sw?
pkg
coverage
html
api.yaml
6 changes: 0 additions & 6 deletions README.markdown

This file was deleted.

30 changes: 30 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
trac4r: Ruby wrapper for the Trac XML-RPC API
=============================================

Author:: Niklas Cathor
License:: See LICENSE in source distribution

For more information on the Trac XML-RPC see the {plugin's page on trac-hacks.com}[http://trac-hacks.org/wiki/XmlRpcPlugin#UsingfromRuby]

Thanks to the original author, Niklas Cathor, who has done most of the work.

== Install

# Only if you haven't set up gemcutter yet
sudo gem install gemcutter
sudo gem tumble

# Once Gemcutter is setup
sudo gem install trac4r

== Overview

This wraps the Trac XML-RPC plugin.

require 'rubygems'
require 'trac4r'

# Note that you need to point to the XMLRPC root and not the root of the trac web interface
trac = Trac.new("http://www.example.com/trac/project/xmlrpc","username","password")
trac.tickets.list # get all tickets
trac.tickets.get 2334 # Get ticket #2334
65 changes: 27 additions & 38 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,42 +1,31 @@
require 'rake'
require 'rake/rdoctask'
require 'ftools'
require 'rake/clean'
require 'hanna/rdoctask'
require 'rubygems'
require 'rake/gempackagetask'

Rake::RDocTask.new("doc") { |rdoc|
rdoc.rdoc_dir = 'doc'
rdoc.template = ENV['template'] if ENV['template']
rdoc.title = "Trac for Ruby"
rdoc.options << '--line-number' << '--inline-source'
rdoc.options << '--charset' << 'utf-8'
['lib/*.rb','*.rb'].each do |file|
rdoc.rdoc_files.include(file)
$: << '../grancher/lib'
begin
require 'grancher/task'
Grancher::Task.new do |g|
g.branch = 'gh-pages'
g.push_to = 'origin'
g.directory 'html'
end
}
rescue LoadError
#puts "you may install the optional gem 'grancher'"
end

desc "Install trac4r on your system."
task :install do
default_dir = $:.first
print "Type installation directory [#{default_dir}]: "
dir = $stdin.gets
dir = default_dir if dir.strip.empty?
File.stat(dir.strip)
install_dir = "#{dir}/trac4r"
begin
Dir.mkdir(install_dir)
rescue => e
$stderr.puts "Error creating directory #{install_dir}. Reason: #{e}"
exit!
end
Dir.mkdir(install_dir+'/lib')
File.syscopy("#{File.dirname(__FILE__)}/trac.rb",install_dir)
puts "trac.rb => #{install_dir}/trac.rb"
File.syscopy("#{File.dirname(__FILE__)}/Rakefile",install_dir)
puts "Rakefile => #{install_dir}/Rakefile"
Dir.entries("#{File.dirname(__FILE__)}/lib").each do |file|
if file =~ /.*\.rb$/
File.syscopy("#{File.dirname(__FILE__)}/lib/#{file}",install_dir+'/lib')
puts "#{file} => #{install_dir}/lib/#{file}"
end
end
puts "Successfully installed trac4r!"
Rake::RDocTask.new do |rd|
rd.main = "README.rdoc"
rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
rd.title = 'Ruby interface to Trac'
end

spec = eval(File.read('trac4r.gemspec'))

Rake::GemPackageTask.new(spec) do |pkg|
end

task :default => :test

task :publish_rdoc => [:rdoc,:publish]
215 changes: 0 additions & 215 deletions doc/classes/Trac.html

This file was deleted.

Loading

0 comments on commit 7595dd2

Please sign in to comment.