-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a Rakefile and fix the unit tests
- Loading branch information
Showing
684 changed files
with
70,633 additions
and
69,289 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Gemfile.lock | ||
deployment/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require 'rake' | ||
require 'rake/testtask' | ||
require 'rspec/core/rake_task' | ||
require 'rubygems' | ||
|
||
# Check Ruby syntax in bin/ and lib/ | ||
|
||
# Run all units tests in test/ | ||
desc "Run unit tests in test/" | ||
Rake::TestTask.new(:test) do |t| | ||
t.libs << ['test', 'lib', 'test/helpers'] | ||
|
||
test_files = FileList.new("test/**/*_test.rb") | ||
t.test_files = test_files | ||
t.verbose = true | ||
end | ||
task :default => :test | ||
|
||
# Run units tests in test/instance_agent/ | ||
Rake::TestTask.new(:test_instance_agent) do |t| | ||
t.libs << ['test', 'lib', 'test/helpers'] | ||
t.pattern = "test/instance_agent/**/*_test.rb" | ||
t.verbose = true | ||
end | ||
|
||
# Clean up | ||
task :clean do | ||
rm_rf 'deployment' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Revision history for Ruby library Archive::Tar::Minitar. Unless explicitly | ||
noted otherwise, all changes are produced by Austin Ziegler | ||
<[email protected]>. | ||
|
||
== 0.5.2 | ||
* Fixed a Ruby 1.9 compatibility error. | ||
|
||
== 0.5.1 | ||
* Fixed a variable name error. | ||
|
||
== Archive::Tar::Minitar 0.5.0 | ||
* Initial release. Does files and directories. Command does create, extract, | ||
* and list. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Installing this package is as simple as: | ||
|
||
% ruby install.rb | ||
|
||
Alternatively, you can use the RubyGem version of Archive::Tar::Minitar | ||
available as archive-tar-minitar-0.5.2.gem from the usual sources. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
Archive::Tar::Minitar README | ||
============================ | ||
Archive::Tar::Minitar is a pure-Ruby library and command-line utility that | ||
provides the ability to deal with POSIX tar(1) archive files. The | ||
implementation is based heavily on Mauricio Ferna'ndez's implementation in | ||
rpa-base, but has been reorganised to promote reuse in other projects. | ||
|
||
This release is version 0.5.2, offering a Ruby 1.9 compatibility bugfix over | ||
version 0.5.1. The library can only handle files and directories at this | ||
point. A future version will be expanded to handle symbolic links and hard | ||
links in a portable manner. The command line utility, minitar, can only create | ||
archives, extract from archives, and list archive contents. | ||
|
||
Using this library is easy. The simplest case is: | ||
|
||
require 'zlib' | ||
require 'archive/tar/minitar' | ||
include Archive::Tar | ||
|
||
# Packs everything that matches Find.find('tests') | ||
File.open('test.tar', 'wb') { |tar| Minitar.pack('tests', tar) } | ||
# Unpacks 'test.tar' to 'x', creating 'x' if necessary. | ||
Minitar.unpack('test.tar', 'x') | ||
|
||
A gzipped tar can be written with: | ||
|
||
tgz = Zlib::GzipWriter.new(File.open('test.tgz', 'wb')) | ||
# Warning: tgz will be closed! | ||
Minitar.pack('tests', tgz) | ||
|
||
tgz = Zlib::GzipReader.new(File.open('test.tgz', 'rb')) | ||
# Warning: tgz will be closed! | ||
Minitar.unpack(tgz, 'x') | ||
|
||
As the case above shows, one need not write to a file. However, it will | ||
sometimes require that one dive a little deeper into the API, as in the case | ||
of StringIO objects. Note that I'm not providing a block with Minitar::Output, | ||
as Minitar::Output#close automatically closes both the Output object and the | ||
wrapped data stream object. | ||
|
||
begin | ||
sgz = Zlib::GzipWriter.new(StringIO.new("")) | ||
tar = Output.new(sgz) | ||
Find.find('tests') do |entry| | ||
Minitar.pack_file(entry, tar) | ||
end | ||
ensure | ||
# Closes both tar and sgz. | ||
tar.close | ||
end | ||
|
||
Copyright | ||
========= | ||
# Copyright 2004 Mauricio Julio Ferna'ndez Pradier and Austin Ziegler | ||
# | ||
# This program is based on and incorporates parts of RPA::Package from | ||
# rpa-base (lib/rpa/package.rb and lib/rpa/util.rb) by Mauricio and has been | ||
# adapted to be more generic by Austin. | ||
# | ||
# 'minitar' contains an adaptation of Ruby/ProgressBar by Satoru | ||
# Takabayashi <[email protected]>, copyright 2001 - 2004. | ||
# | ||
# This program is free software. It may be redistributed and/or modified | ||
# under the terms of the GPL version 2 (or later) or Ruby's licence. | ||
# | ||
# $Id: README 213 2008-02-26 22:32:11Z austin $ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
#! /usr/bin/env rake | ||
$LOAD_PATH.unshift('lib') | ||
|
||
require 'rubygems' | ||
require 'rake/gempackagetask' | ||
require 'rake/contrib/rubyforgepublisher' | ||
require 'archive/tar/minitar' | ||
require 'zlib' | ||
|
||
DISTDIR = "archive-tar-minitar-#{Archive::Tar::Minitar::VERSION}" | ||
TARDIST = "../#{DISTDIR}.tar.gz" | ||
|
||
DATE_RE = %r<(\d{4})[./-]?(\d{2})[./-]?(\d{2})(?:[\sT]?(\d{2})[:.]?(\d{2})[:.]?(\d{2})?)?> | ||
|
||
if ENV['RELEASE_DATE'] | ||
year, month, day, hour, minute, second = DATE_RE.match(ENV['RELEASE_DATE']).captures | ||
year ||= 0 | ||
month ||= 0 | ||
day ||= 0 | ||
hour ||= 0 | ||
minute ||= 0 | ||
second ||= 0 | ||
ReleaseDate = Time.mktime(year, month, day, hour, minute, second) | ||
else | ||
ReleaseDate = nil | ||
end | ||
|
||
task :test do |t| | ||
require 'test/unit/testsuite' | ||
require 'test/unit/ui/console/testrunner' | ||
|
||
runner = Test::Unit::UI::Console::TestRunner | ||
|
||
$LOAD_PATH.unshift('tests') | ||
Dir['tests/tc_*.rb'].each do |testcase| | ||
load testcase | ||
end | ||
|
||
suite = Test::Unit::TestSuite.new | ||
|
||
ObjectSpace.each_object(Class) do |testcase| | ||
suite << testcase.suite if testcase < Test::Unit::TestCase | ||
end | ||
|
||
runner.run(suite) | ||
end | ||
|
||
spec = eval(File.read("archive-tar-minitar.gemspec")) | ||
desc "Build the RubyGem for Archive::Tar::Minitar." | ||
task :gem => [ :test ] | ||
Rake::GemPackageTask.new(spec) do |g| | ||
g.need_tar = false | ||
g.need_zip = false | ||
g.package_dir = ".." | ||
end | ||
|
||
desc "Build an Archive::Tar::Minitar .tar.gz distribution." | ||
task :tar => [ TARDIST ] | ||
file TARDIST do |t| | ||
current = File.basename(Dir.pwd) | ||
Dir.chdir("..") do | ||
begin | ||
files = Dir["#{current}/**/*"].select { |dd| dd !~ %r{(?:/CVS/?|~$)} } | ||
files.map! do |dd| | ||
ddnew = dd.gsub(/^#{current}/, DISTDIR) | ||
mtime = ReleaseDate || File.stat(dd).mtime | ||
if File.directory?(dd) | ||
{ :name => ddnew, :mode => 0755, :dir => true, :mtime => mtime } | ||
else | ||
if dd =~ %r{bin/} | ||
mode = 0755 | ||
else | ||
mode = 0644 | ||
end | ||
data = File.read(dd) | ||
{ :name => ddnew, :mode => mode, :data => data, :size => data.size, | ||
:mtime => mtime } | ||
end | ||
end | ||
|
||
ff = File.open(t.name.gsub(%r{^\.\./}o, ''), "wb") | ||
gz = Zlib::GzipWriter.new(ff) | ||
tw = Archive::Tar::Minitar::Writer.new(gz) | ||
|
||
files.each do |entry| | ||
if entry[:dir] | ||
tw.mkdir(entry[:name], entry) | ||
else | ||
tw.add_file_simple(entry[:name], entry) { |os| os.write(entry[:data]) } | ||
end | ||
end | ||
ensure | ||
tw.close if tw | ||
gz.close if gz | ||
end | ||
end | ||
end | ||
task TARDIST => [ :test ] | ||
|
||
def sign(file) | ||
sh %(gpg -ba #{file}) | ||
end | ||
|
||
task :signtar => [ :tar ] do | ||
sign TARDIST | ||
end | ||
task :signgem => [ :gem ] do | ||
sign "../#{DISTDIR}.gem" | ||
end | ||
|
||
desc "Build everything." | ||
task :default => [ :signtar, :signgem ] do | ||
end |
Oops, something went wrong.