Permalink
Browse files

Making gemspec safe.

  • Loading branch information...
JEG2 committed Jun 19, 2008
1 parent 2cbfc46 commit 29ad20858c28c214b2e90c9fbb9ead05ff9c7029
Showing with 44 additions and 0 deletions.
  1. +23 −0 Rakefile
  2. +21 −0 rrdb.gemspec
View
@@ -3,6 +3,8 @@
require "rake/testtask"
require "rake/rdoctask"
+require "fileutils"
+
task :default => [:test]
Rake::TestTask.new do |test|
@@ -19,3 +21,24 @@ Rake::RDocTask.new do |rdoc|
AUTHORS COPYING LICENSE
lib/ ] )
end
+
+desc "Updates the .gemspec file so GitHub will rebuild it"
+task :update_gem do
+ version = File.read(
+ File.join(File.dirname(__FILE__), *%w[lib rrdb.rb])
+ )[/^\s*VERSION\s*=\s*(['"])(\d\.\d\.\d)\1/, 2]
+ open("rrdb.gemspec") do |old_spec|
+ open("new_rrdb.gemspec", "w") do |new_spec|
+ old_spec.each do |line|
+ if line =~ /\A(\s*s\.version\s*=\s*)(["'])\d\.\d\.\d\2\s*\z/
+ new_spec.puts %Q{#{$1}"#{version}"}
+ elsif line =~ /\A(\s*s\.files\s*=\s*)/
+ new_spec.puts %Q{#{$1}%w[#{Dir["{lib,test}/**/*.rb"].join(" ")}] + %w[Rakefile setup.rb]}
+ else
+ new_spec.puts line
+ end
+ end
+ end
+ end
+ FileUtils.mv("new_rrdb.gemspec", "rrdb.gemspec")
+end
View
@@ -0,0 +1,21 @@
+Gem::Specification.new do |s|
+ s.name = "rrdb"
+ s.summary = "A simple wrapper for RRDtool."
+ s.description = "RRDB is a wrapper for RRDtool that provides methods " +
+ "for creating databases, updating them with new " +
+ "entries, and fetching consolidation functions from " +
+ "them."
+ s.homepage = "http://github.com/JEG2/rrdb"
+ s.date = "2008-06-19"
+ s.version = "0.0.1"
+ s.platform = Gem::Platform::RUBY
+ s.authors = ["James Edward Gray II"]
+ s.email = "james@graysoftinc.com"
+ s.files = %w[lib/rrdb.rb test/rrd_manager.rb test/tc_config.rb test/tc_create_database.rb test/tc_fetch.rb test/tc_run_command.rb test/tc_update.rb test/tc_version.rb test/ts_all.rb] + %w[Rakefile setup.rb]
+ s.require_path = "lib"
+ s.test_suite_file = "test/ts_all.rb"
+ s.has_rdoc = true
+ s.rdoc_options = %w[--title RRDB\ Documentation --main README]
+ s.extra_rdoc_files = %w[ README INSTALL CHANGELOG AUTHORS COPYING LICENSE
+ lib/ ]
+end

0 comments on commit 29ad208

Please sign in to comment.