From 99dc5fa2ee0c7417f8e65edc5466120b17a7dff6 Mon Sep 17 00:00:00 2001 From: Simone Carletti Date: Wed, 18 Feb 2009 00:29:39 +0100 Subject: [PATCH] Packaged library as a GEM. --- .gitignore | 5 +++ CHANGELOG.rdoc | 2 ++ Rakefile | 67 ++++++++++++++++++++++++++++------------ lib/helperful.rb | 6 ++++ lib/helperful/version.rb | 32 +++++++++++++++++++ 5 files changed, 93 insertions(+), 19 deletions(-) create mode 100644 lib/helperful/version.rb diff --git a/.gitignore b/.gitignore index 9679b83..5a5c23e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,7 @@ +.DS_Store nbproject .idea +pkg +doc +coverage +Manifest \ No newline at end of file diff --git a/CHANGELOG.rdoc b/CHANGELOG.rdoc index 6510d43..df1d617 100644 --- a/CHANGELOG.rdoc +++ b/CHANGELOG.rdoc @@ -10,6 +10,8 @@ * ADDED: Added #helperful method as shortcut for including helper modules from the Helperful namespace. +* ADDED: Packaged library as a GEM. + * CHANGED: Renamed TitleHelper to HelperfulTitleHelper to prevent conflicts with other common helpers (subsequently renamed to Helperful::TitleHelper). * CHANGED: Renamed all helper modules from HelperfulHelperName to Helperful::HelperName. diff --git a/Rakefile b/Rakefile index 3520b69..31ae0cd 100644 --- a/Rakefile +++ b/Rakefile @@ -1,23 +1,52 @@ +require 'rubygems' require 'rake' -require 'rake/testtask' -require 'rake/rdoctask' - -desc 'Default: run unit tests.' -task :default => :test - -desc 'Test the helperful plugin.' -Rake::TestTask.new(:test) do |t| - t.libs << 'lib' - t.libs << 'test' - t.pattern = 'test/**/*_test.rb' - t.verbose = true +require 'echoe' + +$:.unshift(File.dirname(__FILE__) + "/lib") +require 'helperful' + + +PKG_NAME = ENV['PKG_NAME'] || Helperful::GEM +PKG_VERSION = ENV['PKG_VERSION'] || Helperful::VERSION +PKG_SUMMARY = "A collection of useful Rails helpers." +PKG_FILES = FileList.new("{lib,rails,tasks,test}/**/*") do |files| + files.include %w(*.{rdoc,rb}) + files.include %w(Rakefile) +end +RUBYFORGE_PROJECT = nil + +if ENV['SNAPSHOT'].to_i == 1 + PKG_VERSION << "." << Time.now.utc.strftime("%Y%m%d%H%M%S") end + + +Echoe.new(PKG_NAME, PKG_VERSION) do |p| + p.author = "Simone Carletti" + p.email = "weppos@weppos.net" + p.summary = PKG_SUMMARY + p.description = <<-EOD + Helperful aims to be a collection of useful and reusable Rails helpers. + EOD + p.url = "http://code.simonecarletti.com/helperful" + p.project = RUBYFORGE_PROJECT + + p.need_zip = true + p.rcov_options = ["--main << README.rdoc -x Rakefile -x mocha -x rcov"] + p.rdoc_pattern = /^(lib|CHANGELOG.rdoc|README.rdoc|LICENSE.rdoc)/ + + p.development_dependencies += ["rake >=0.8", + "echoe >=3.1", + "mocha >=0.9"] +end + -desc 'Generate documentation for the helperful plugin.' -Rake::RDocTask.new(:rdoc) do |rdoc| - rdoc.rdoc_dir = 'rdoc' - rdoc.title = 'Helperful' - rdoc.options << '--line-numbers' << '--inline-source' - rdoc.rdoc_files.include('README') - rdoc.rdoc_files.include('lib/**/*.rb') +begin + require 'code_statistics' + desc "Show library's code statistics" + task :stats do + CodeStatistics.new(["Helperful", "lib"], + ["Tests", "test"]).to_s + end +rescue LoadError + puts "CodeStatistics (Rails) is not available" end diff --git a/lib/helperful.rb b/lib/helperful.rb index d197dc3..f0e1e82 100644 --- a/lib/helperful.rb +++ b/lib/helperful.rb @@ -17,9 +17,15 @@ Dir.glob(File.dirname(__FILE__) + '/helperful/*_helper.rb').each { |helper| require helper } require 'helperful/deprecations' +require 'helperful/version' module Helperful + + NAME = 'Helperful' + GEM = 'helperful' + AUTHOR = 'Simone Carletti ' + module ControllerMixin diff --git a/lib/helperful/version.rb b/lib/helperful/version.rb new file mode 100644 index 0000000..0f664aa --- /dev/null +++ b/lib/helperful/version.rb @@ -0,0 +1,32 @@ +# +# = Helperful +# +# A collection of useful Rails helpers. +# +# +# Category:: Rails +# Package:: Helperful +# Author:: Simone Carletti +# Copyright:: 2007-2008 The Authors +# License:: MIT License +# +#-- +# +#++ + + +module Helperful + + module Version + MAJOR = 0 + MINOR = 2 + TINY = 0 + + STRING = [MAJOR, MINOR, TINY].join('.') + end + + VERSION = Version::STRING + STATUS = 'alpha' + BUILD = ''.match(/(\d+)/).to_a.first + +end