Skip to content

Commit

Permalink
Merge remote branch 'danlucraft/master'
Browse files Browse the repository at this point in the history
Conflicts (trivial):
	spec/spec_helpers.rb
  • Loading branch information
taw committed Jul 27, 2010
2 parents ca2c2f9 + 6390626 commit 225540d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bin/rak
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Rak
VERSION_INFO=<<END
rak #{VERSION}
Copyright 2008 Daniel Lucraft, all rights reserved.
Copyright 2008-#{Time.now.year} Daniel Lucraft, all rights reserved.
Based on the perl tool 'ack' by Andy Lester.
This program is free software; you can redistribute it and/or modify it
Expand Down
16 changes: 8 additions & 8 deletions spec/help_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
end

it "--version prints version information" do
strip_ansi(%x{rak --version}).should == t=<<END
rak 0.9
strip_ansi(rak "--version").should == t=<<END
rak #{Rak::VERSION}
Copyright 2008 Daniel Lucraft, all rights reserved.
Copyright 2008-#{Time.now.year} Daniel Lucraft, all rights reserved.
Based on the perl tool 'ack' by Andy Lester.
This program is free software; you can redistribute it and/or modify it
Expand All @@ -23,28 +23,28 @@
end

it "prints unknown type errors" do
%x{rak Virg --type=pyth}.should == t=<<END
rak("Virg --type=pyth").should == t=<<END
rak: Unknown --type "pyth"
rak: See rak --help types
END
end

it "--help prints help information" do
%x{rak Virg --help}.split("\n")[0].should == "Usage: rak [OPTION]... PATTERN [FILES]"
rak("Virg --help").split("\n")[0].should == "Usage: rak [OPTION]... PATTERN [FILES]"
end

it "--help types prints type information" do
%x{rak --help types}.split("\n")[2].should == "The following is the list of filetypes supported by rak. You can"
rak("--help types").split("\n")[2].should == "The following is the list of filetypes supported by rak. You can"
end

it "no options or patterns prints the usage info" do
%x{rak}.split("\n")[0].should == "Usage: rak [OPTION]... PATTERN [FILES]"
rak.split("\n")[0].should == "Usage: rak [OPTION]... PATTERN [FILES]"
end

it "prints a nice message for unknown options" do
t=<<END
rak: see rak --help for usage.
END
%x{rak foo --asfdasfd 2>/dev/null}.include?(t).should be_true
rak("foo --asfdasfd 2>/dev/null").include?(t).should be_true
end
end
3 changes: 2 additions & 1 deletion spec/spec_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def shell_escape
end

HERE = Pathname(__FILE__).parent.expand_path
require(HERE.join("../lib/rak"))

def ruby_bin
File.join(
Expand All @@ -34,7 +35,7 @@ def asterize_ansi(str)
replace_ansi(str, '*')
end

def rak(args, opts={})
def rak(args="", opts={})
begin
unless args.is_a?(String)
args = args.map{|str| str.shell_escape}.join(" ")
Expand Down

0 comments on commit 225540d

Please sign in to comment.