Permalink
Browse files

initial commit of the plugin files

  • Loading branch information...
TwP committed Oct 17, 2010
1 parent 8a1ac73 commit 3cb803308f04dc19acde744007a65f7967e3503d
Showing with 189 additions and 118 deletions.
  1. +6 −17 README.txt
  2. +9 −7 Rakefile
  3. +0 −7 bin/bones-yard
  4. +0 −65 lib/bones-yard.rb
  5. +87 −0 lib/bones/plugins/rubyforge.rb
  6. +86 −0 lib/bones/plugins/yard.rb
  7. +0 −6 spec/bones-yard_spec.rb
  8. +0 −15 spec/spec_helper.rb
  9. 0 test/test_bones-yard.rb
  10. +1 −1 version.txt
View
@@ -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
View
@@ -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
}
View
@@ -1,7 +0,0 @@
-#!/usr/bin/env ruby
-
-require File.expand_path(
- File.join(File.dirname(__FILE__), %w[.. lib bones-yard]))
-
-# Put your code here
-
View
@@ -1,65 +0,0 @@
-
-module BonesYard
-
- # :stopdoc:
- LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
- PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
- # :startdoc:
-
- # Returns the version string for the library.
- #
- def self.version
- @version ||= File.read(path('version.txt')).strip
- end
-
- # Returns the library path for the module. If any arguments are given,
- # they will be joined to the end of the libray path using
- # <tt>File.join</tt>.
- #
- def self.libpath( *args, &block )
- rv = args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
- if block
- begin
- $LOAD_PATH.unshift LIBPATH
- rv = block.call
- ensure
- $LOAD_PATH.shift
- end
- end
- return rv
- end
-
- # Returns the lpath for the module. If any arguments are given,
- # they will be joined to the end of the path using
- # <tt>File.join</tt>.
- #
- def self.path( *args, &block )
- rv = args.empty? ? PATH : ::File.join(PATH, args.flatten)
- if block
- begin
- $LOAD_PATH.unshift PATH
- rv = block.call
- ensure
- $LOAD_PATH.shift
- end
- end
- return rv
- end
-
- # Utility method used to require all files ending in .rb that lie in the
- # directory below this file that has the same name as the filename passed
- # in. Optionally, a specific _directory_ name can be passed in such that
- # the _filename_ does not have to be equivalent to the directory.
- #
- def self.require_all_libs_relative_to( fname, dir = nil )
- dir ||= ::File.basename(fname, '.*')
- search_me = ::File.expand_path(
- ::File.join(::File.dirname(fname), dir, '**', '*.rb'))
-
- Dir.glob(search_me).sort.each {|rb| require rb}
- end
-
-end # module BonesYard
-
-BonesYard.require_all_libs_relative_to(__FILE__)
-
@@ -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
View
@@ -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
View
@@ -1,6 +0,0 @@
-
-require File.join(File.dirname(__FILE__), %w[spec_helper])
-
-describe BonesYard do
-end
-
View
@@ -1,15 +0,0 @@
-
-require File.expand_path(
- File.join(File.dirname(__FILE__), %w[.. lib bones-yard]))
-
-Spec::Runner.configure do |config|
- # == Mock Framework
- #
- # RSpec uses it's own mocking framework by default. If you prefer to
- # use mocha, flexmock or RR, uncomment the appropriate line:
- #
- # config.mock_with :mocha
- # config.mock_with :flexmock
- # config.mock_with :rr
-end
-
View
No changes.
View
@@ -1 +1 @@
-0.0.0
+1.0.0

0 comments on commit 3cb8033

Please sign in to comment.