This file contains hidden or 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
desc 'generate a class in lib/ and a spec in spec/lib/ for name=underscored_class_name' | |
task :genclass do | |
require 'erb' | |
filename = ENV['name'] | |
raise 'must specify name=underscored_class_name' unless filename | |
classname = filename.camelize | |
class_file_template = ERB.new <<-EOF | |
class <%= classname %> |
This file contains hidden or 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
#include <sys/types.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
int fdin, fdout, retval; | |
char buf[2048]; | |
ssize_t nread, nwrote; | |
fdin = open("readfile", O_RDONLY); | |
fdout = open("writefile", O_CREAT | O_WRONLY, 0644); | |
nread = read(fdin, buf, 2048); | |
nwrote = write(fdout, buf, (size_t)nread); |
OlderNewer