Skip to content

Commit

Permalink
initial commit of the plugin files
Browse files Browse the repository at this point in the history
  • Loading branch information
TwP committed Oct 17, 2010
1 parent 8a1ac73 commit 3cb8033
Show file tree
Hide file tree
Showing 10 changed files with 189 additions and 118 deletions.
23 changes: 6 additions & 17 deletions README.txt
@@ -1,32 +1,21 @@
bones-yard
by FIXME (your name)
FIXME (url)
by Tim Pease
http://rubygems.org/gems/bones-yard

== DESCRIPTION:

FIXME (describe your package)

== FEATURES/PROBLEMS:

* FIXME (list of features or problems)

== SYNOPSIS:

FIXME (code sample of usage)

== REQUIREMENTS:

* FIXME (list of requirements)
The yard package for Mr Bones provides tasks to incorporate Yard based
documentation into bones based projects.

== INSTALL:

* FIXME (sudo gem install, anything else)
gem install bones-yard

== LICENSE:

(The MIT License)

Copyright (c) 2009 FIXME (different license?)
Copyright (c) 2010

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
16 changes: 9 additions & 7 deletions Rakefile
Expand Up @@ -5,14 +5,16 @@ rescue LoadError
abort '### Please install the "bones" gem ###'
end

task :default => 'test:run'
task 'gem:release' => 'test:run'

Bones {
name 'bones-yard'
authors 'Tim Pease'
email 'tim.pease@gmail.com'
url 'http://github.com/TwP/bones-yard'
name 'bones-yard'
authors 'Tim Pease'
email 'tim.pease@gmail.com'
url 'http://github.com/TwP/bones-yard'
ignore_file '.gitignore'

depend_on 'bones'
depend_on 'yard', '>= 0.5.8'

use_gmail
}

7 changes: 0 additions & 7 deletions bin/bones-yard

This file was deleted.

65 changes: 0 additions & 65 deletions lib/bones-yard.rb

This file was deleted.

87 changes: 87 additions & 0 deletions lib/bones/plugins/rubyforge.rb
@@ -0,0 +1,87 @@

module Bones::Plugins::Rubyforge
include ::Bones::Helpers
extend self

def initialize_rubyforge
require 'rubyforge'
require 'rake/contrib/sshpublisher'
have?(:rubyforge) { true }

::Bones.config {
desc 'Configuration settings for RubyForge publishing.'
rubyforge {
name nil, :desc => <<-__
The RubyForge project name where your code will be published. If not
supplied, the RubyForge name will default to the base 'name' of your
gem. The RubyForge name is used when your gem name differs from the
registered project name; for example if you release multiple gems
under the same project.
__
}

rdoc {
remote_dir nil, :desc => <<-__
This is the remote directory to use when publishing RDoc HTML
documentation to your RubyForge project page. If not specified, this
defaults to the root of the project page.
__
}
}
rescue LoadError
have?(:rubyforge) { false }
end

def post_load
return unless have? :rubyforge
config = ::Bones.config
config.rubyforge.name ||= config.name
end

def define_tasks
return unless have? :rubyforge
config = ::Bones.config

namespace :rubyforge do
desc 'Package gem and upload to RubyForge'
task :release => ['gem:clobber_package', 'gem:package'] do |t|
v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
abort "Versions don't match #{v} vs #{config.version}" if v != config.version
pkg = "pkg/#{config.gem._spec.full_name}"

rf = RubyForge.new
rf.configure rescue nil
puts 'Logging in'
rf.login

c = rf.userconfig
c['release_notes'] = config.description if config.description
c['release_changes'] = config.changes if config.changes
c['preformatted'] = true

files = Dir.glob("#{pkg}*.*")

puts "Releasing #{config.name} v. #{config.version}"
rf.add_release config.rubyforge.name, config.name, config.version, *files
end

desc 'Publish RDoc to RubyForge'
task :doc_release => %w(doc:clobber_rdoc doc:rdoc) do
rubyforge_config = YAML.load(
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
)

host = "#{rubyforge_config['username']}@rubyforge.org"
remote_dir = "/var/www/gforge-projects/#{config.rubyforge.name}/"
remote_dir << config.rdoc.remote_dir if config.rdoc.remote_dir
local_dir = config.rdoc.dir

Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
end
end

end

end # module Bones::Plugins::Rubyforge

# EOF
86 changes: 86 additions & 0 deletions lib/bones/plugins/yard.rb
@@ -0,0 +1,86 @@

module Bones::Plugins::Yard
include ::Bones::Helpers
extend self

def initialize_yard
require 'yard'
require 'yard/rake/yardoc_task'
have?(:yard) { true }

::Bones.config {
desc 'Configuration settings for yard'
yard {
opts [], :desc => 'Array of yard options to use when generating documentation.'

include %w(^lib/ ^bin/ ^ext/ \.txt$ \.rdoc$), :desc => <<-__
An array of patterns that will be used to find the files for which
documentation should be generated. This is an array of strings that
will be converted in regular expressions.
__

exclude %w(extconf\.rb$), :desc => <<-__
An array of patterns that will be used to exclude files from yard
processing. This is an array of strings that will be converted in
regular expressions.
__

main nil, :desc => <<-__
The main yard file for the project. This defaults to the project's
README file.
__

dir 'doc', :desc => 'Output directory for generated documentation.'
}
}
rescue LoadError
have?(:yard) { false }
end

def post_load
return unless have? :yard
config = ::Bones.config

config.exclude << "^#{Regexp.escape(config.yard.dir)}/"
config.yard.main ||= config.readme_file
end

def define_tasks
return unless have?(:yard)
config = ::Bones.config

namespace :doc do
desc 'Generate Yard documentation'
YARD::Rake::YardocTask.new(:yard) do |yd|
yard = config.yard

incl = Regexp.new(yard.include.join('|'))
excl = Regexp.new(yard.exclude.join('|'))
yd.files = config.gem.files.find_all do |fn|
case fn
when excl; false
when incl; true
else false end
end

yd.options << '--main' << yard.main
yd.options << '--output-dir' << yard.dir
yd.options << '--title' << "#{config.name}-#{config.version} Documentation"

yd.options.concat(yard.opts)
end

task :clobber_yard do
rm_r config.yard.dir rescue nil
end
end # namespace :doc

desc 'Alias to doc:yard'
task :doc => 'doc:yard'

task :clobber => %w(doc:clobber_yard)
end

end

# EOF
6 changes: 0 additions & 6 deletions spec/bones-yard_spec.rb

This file was deleted.

15 changes: 0 additions & 15 deletions spec/spec_helper.rb

This file was deleted.

Empty file removed test/test_bones-yard.rb
Empty file.
2 changes: 1 addition & 1 deletion version.txt
@@ -1 +1 @@
0.0.0
1.0.0

0 comments on commit 3cb8033

Please sign in to comment.