[rspec-users] rspec for the svn-less (ruby version)

barsalou barjunk at attglobal.net
Sun Jul 1 18:05:21 EDT 2007


A couple of things:

- it is defaulted to 1.0.5, but if there was a "current" I could 
probably use that instead.

- it seems like everyone might not use the rspec_on_rails piece...what 
do other think?

- there are some other checks I could put in here, suggestions are welcome.

- general code suggestions are welcome as well.

Mike B.


Here is my ruby version:

#!/usr/bin/ruby -w

require 'ftools'

def usage
  puts
  puts "Usage: makespec.rb <path> [<dotted-version>]"
  puts
  puts "Version defaults to 1.0.5"
  puts
  puts "Example: "
  puts "   makespec.rb /var/www/rails/railsapp 1.0.5"
  puts
end

if ARGV[0].nil? then
  usage
  puts
  puts "You must include a pathname"
  puts
  exit 1
end

version = ARGV[1]

if ARGV[1].nil? then
  puts
  puts "Defaulting to version: 1.0.5"
  puts
  version = "1.0.5"
end

rspec="rspec-" + version + ".tgz"
rspecrails="rspec_on_rails-" + version + ".tgz"
app = ARGV[0]

if ! File.exist?(rspec) then
  puts
  puts "Rspec tarball (" + rspec + ") does not exist in the current directory"
  puts
  exit 1
end

if ! File.exist?(rspecrails) then
  puts
  puts "Rspec-rails tarball (" + rspecrails + ") does not exist in the 
current d
irectory"
  puts
  exit 1
end

if FileTest.directory? app + "/vendor/plugins" then
   system("tar","zxvf", rspec)
   system("tar","zxvf", rspecrails)
   cwd = Dir.pwd
   Dir.chdir(app + "/vendor/plugins")
   File.move(cwd + "/" + File.basename(rspec,".tgz"),app + 
"/vendor/plugins/rspec")
   File.move(cwd + "/" + File.basename(rspecrails,".tgz"),app + 
"/vendor/plugins/rspec_on_rails")
else
   puts app + "/vendor/plugins doesn't exist"
   exit 1
end


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



More information about the rspec-users mailing list