Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3b8f13c
Showing
24 changed files
with
705 additions
and
0 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,4 @@ | ||
= Changelog | ||
== Version 0.0.1 | ||
|
||
* Initial public release |
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,19 @@ | ||
Copyright (c) 2008 Jeremy Hinegardner | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
of the Software, and to permit persons to whom the Software is furnished to do | ||
so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,21 @@ | ||
== hightimes | ||
|
||
* Homepage | ||
* rubyforge project | ||
|
||
== DESCRIPTION | ||
|
||
== FEATURES | ||
|
||
== SYNOPSIS | ||
|
||
== CREDITS | ||
|
||
== LICENSE | ||
|
||
Copyright (c) Jeremy Hinegardner | ||
|
||
All rights reserved. | ||
|
||
See LICENSE and/or COPYING for details. |
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,60 @@ | ||
#-- | ||
# Copyright (c) 2008 Jeremy Hinegardner | ||
# All rights reserved. See LICENSE and/or COPYING for details. | ||
#++ | ||
|
||
#------------------------------------------------------------------------------- | ||
# make sure our project's top level directory and the lib directory are added to | ||
# the ruby search path. | ||
#------------------------------------------------------------------------------- | ||
$: << File.expand_path(File.join(File.dirname(__FILE__),"lib")) | ||
$: << File.expand_path(File.dirname(__FILE__)) | ||
|
||
|
||
#------------------------------------------------------------------------------- | ||
# load the global project configuration and add in the top level clean and | ||
# clobber tasks so that other tasks can utilize those constants if necessary | ||
# This loads up the defaults for the whole project configuration | ||
#------------------------------------------------------------------------------- | ||
require 'rubygems' | ||
require 'tasks/config.rb' | ||
require 'rake/clean' | ||
|
||
#------------------------------------------------------------------------------- | ||
# Main configuration for the project, these overwrite the items that are in | ||
# tasks/config.rb | ||
#------------------------------------------------------------------------------- | ||
require 'hightimes' | ||
Configuration.for("project") { | ||
name "hightimes" | ||
version Hightimes::VERSION | ||
author "Jeremy Hinegardner" | ||
email "jeremy@hinegardner.org" | ||
homepage "http://hightimes.rubyforge.org/" | ||
} | ||
|
||
#------------------------------------------------------------------------------- | ||
# load up all the project tasks and setup the default task to be the | ||
# test:default task. | ||
#------------------------------------------------------------------------------- | ||
Configuration.for("packaging").files.tasks.each do |tasklib| | ||
import tasklib | ||
end | ||
task :default => 'test:default' | ||
|
||
#------------------------------------------------------------------------------- | ||
# Finalize the loading of all pending imports and update the top level clobber | ||
# task to depend on all possible sub-level tasks that have a name like | ||
# ':clobber' in other namespaces. This allows us to say: | ||
# | ||
# rake clobber | ||
# | ||
# and it will get everything. | ||
#------------------------------------------------------------------------------- | ||
Rake.application.load_imports | ||
Rake.application.tasks.each do |t| | ||
if t.name =~ /:clobber/ then | ||
task :clobber => [t.name] | ||
end | ||
end | ||
|
Binary file not shown.
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,35 @@ | ||
#include <unistd.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <CoreServices/CoreServices.h> | ||
|
||
int main( int argc, char** argv ) | ||
{ | ||
|
||
AbsoluteTime start; | ||
AbsoluteTime end; | ||
Duration duration; | ||
Nanoseconds elapsedNano; | ||
uint64_t *nano; | ||
|
||
int count = atoi(argv[1]); | ||
int i; | ||
float secs; | ||
|
||
start = UpTime(); | ||
|
||
for( i = 0 ; i < count ; i++) { (void) getpid(); } | ||
|
||
end = UpTime(); | ||
|
||
elapsedNano = AbsoluteDeltaToNanoseconds( end, start ); | ||
|
||
nano = (uint64_t *)&elapsedNano; | ||
|
||
secs = (double)((*nano) * (1e-9)); | ||
|
||
printf("elapsed time : %lld\n", *nano); | ||
|
||
exit( 0 ); | ||
} | ||
|
Empty file.
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,17 @@ | ||
/* | ||
* | ||
*/ | ||
struct hires_unit | ||
{ | ||
char* name; | ||
float factor; | ||
}; | ||
typedef struct hires_unit hires_unit_t; | ||
|
||
struct hires_time | ||
{ | ||
hires_value_t value; | ||
hires_unit_t units; | ||
}; | ||
|
||
typedef struct hires_time hires_time_t; |
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,18 @@ | ||
#include <hires.h> | ||
|
||
#ifndef __HIRES_OSX__ | ||
#define __HIRES_OSX__ | ||
|
||
#include <CoreServices/CoreServices.h> | ||
extern hires_units = { "nanosecond", 1e-9 } | ||
|
||
hires_time_t hires_uptime() | ||
{ | ||
AbsoluteTime now_raw = UpTime(); | ||
hires_time_t now; | ||
|
||
now.value = AbsoluteToNanoseconds( now_raw ); | ||
now.units = hirest_units; | ||
|
||
return now; | ||
} |
Empty file.
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 @@ | ||
#include <stdio.h> | ||
|
||
int main(void) | ||
{ | ||
printf("size of unsigned long : %d\n", sizeof( unsigned long ) ); | ||
} |
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,44 @@ | ||
require 'rubygems' | ||
require 'hightimes/version' | ||
require 'tasks/config' | ||
|
||
Hightimes::GEM_SPEC = Gem::Specification.new do |spec| | ||
proj = Configuration.for('project') | ||
spec.name = proj.name | ||
spec.version = Hightimes::VERSION | ||
|
||
spec.author = proj.author | ||
spec.email = proj.email | ||
spec.homepage = proj.homepage | ||
spec.summary = proj.summary | ||
spec.description = proj.description | ||
spec.platform = Gem::Platform::RUBY | ||
|
||
|
||
pkg = Configuration.for('packaging') | ||
spec.files = pkg.files.all | ||
spec.executables = pkg.files.bin.collect { |b| File.basename(b) } | ||
|
||
# add dependencies here | ||
# spec.add_dependency("rake", ">= 0.8.1") | ||
spec.add_dependency("configuration", ">= 0.0.5") | ||
|
||
|
||
|
||
if rdoc = Configuration.for_if_exist?('rdoc') then | ||
spec.has_rdoc = true | ||
spec.extra_rdoc_files = pkg.files.rdoc | ||
spec.rdoc_options = rdoc.options + [ "--main" , rdoc.main_page ] | ||
else | ||
spec.has_rdoc = false | ||
end | ||
|
||
if test = Configuration.for_if_exist?('testing') then | ||
spec.test_files = test.files | ||
end | ||
|
||
if rf = Configuration.for_if_exist?('rubyforge') then | ||
spec.rubyforge_project = rf.project | ||
end | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#-- | ||
# Copyright (c) 2008 Jeremy Hinegardner | ||
# All rights reserved. See LICENSE and/or COPYING for details. | ||
#++ | ||
|
||
module Hightimes | ||
|
||
# The root directory of the project is considered to be the parent directory | ||
# of the 'lib' directory. | ||
# | ||
# returns:: [String] The full expanded path of the parent directory of 'lib' | ||
# going up the path from the current file. Trailing | ||
# File::SEPARATOR is guaranteed. | ||
# | ||
def self.root_dir | ||
unless @root_dir | ||
path_parts = ::File.expand_path(__FILE__).split(::File::SEPARATOR) | ||
lib_index = path_parts.rindex("lib") | ||
@root_dir = path_parts[0...lib_index].join(::File::SEPARATOR) + ::File::SEPARATOR | ||
end | ||
return @root_dir | ||
end | ||
|
||
# returns:: [String] The full expanded path of the +config+ directory | ||
# below _root_dir_. All parameters passed in are joined onto the | ||
# result. Trailing File::SEPARATOR is guaranteed if _args_ are | ||
# *not* present. | ||
# | ||
def self.config_path(*args) | ||
self.sub_path("config", *args) | ||
end | ||
|
||
# returns:: [String] The full expanded path of the +data+ directory below | ||
# _root_dir_. All parameters passed in are joined onto the | ||
# result. Trailing File::SEPARATOR is guaranteed if | ||
# _*args_ are *not* present. | ||
# | ||
def self.data_path(*args) | ||
self.sub_path("data", *args) | ||
end | ||
|
||
# returns:: [String] The full expanded path of the +lib+ directory below | ||
# _root_dir_. All parameters passed in are joined onto the | ||
# result. Trailing File::SEPARATOR is guaranteed if | ||
# _*args_ are *not* present. | ||
# | ||
def self.lib_path(*args) | ||
self.sub_path("lib", *args) | ||
end | ||
|
||
def self.sub_path(sub,*args) | ||
sp = ::File.join(root_dir, sub) + File::SEPARATOR | ||
sp = ::File.join(sp, *args) if args | ||
end | ||
|
||
end | ||
require 'hightimes/version' |
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,26 @@ | ||
#-- | ||
# Copyright (c) 2008 Jeremy Hinegardner | ||
# All rights reserved. See LICENSE and/or COPYING for details | ||
#++ | ||
|
||
module Hightimes | ||
module Version | ||
MAJOR = 0 | ||
MINOR = 0 | ||
BUILD = 1 | ||
|
||
def to_a | ||
[MAJOR, MINOR, BUILD] | ||
end | ||
|
||
def to_s | ||
to_a.join(".") | ||
end | ||
|
||
module_function :to_a | ||
module_function :to_s | ||
|
||
STRING = Version.to_s | ||
end | ||
VERSION = Version.to_s | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require File.expand_path(File.join(File.dirname(__FILE__),"spec_helper.rb")) | ||
|
||
describe Hightimes do | ||
before(:each) do | ||
# some setup | ||
end | ||
|
||
after(:each) do | ||
# some cleanup | ||
end | ||
|
||
it "should have some tests" do | ||
violated("I just want to be tested... is that so wrong?") | ||
end | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require 'rubygems' | ||
require 'spec' | ||
|
||
$: << File.expand_path(File.join(File.dirname(__FILE__),"..","lib")) | ||
require 'hightimes' |
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,38 @@ | ||
require 'tasks/config' | ||
#------------------------------------------------------------------------------- | ||
# announcement methods | ||
#------------------------------------------------------------------------------- | ||
|
||
proj_config = Configuration.for('project') | ||
namespace :announce do | ||
desc "create email for ruby-talk" | ||
task :email do | ||
info = Utils.announcement | ||
|
||
File.open("email.txt", "w") do |mail| | ||
mail.puts "From: #{proj_config.author} <#{proj_config.email}>" | ||
mail.puts "To: ruby-talk@ruby-lang.org" | ||
mail.puts "Date: #{Time.now.rfc2822}" | ||
mail.puts "Subject: [ANN] #{info[:subject]}" | ||
mail.puts | ||
mail.puts info[:title] | ||
mail.puts | ||
mail.puts info[:urls] | ||
mail.puts | ||
mail.puts info[:description] | ||
mail.puts | ||
mail.puts "{{ Release notes for Version #{Hightimes::VERSION} }}" | ||
mail.puts | ||
mail.puts info[:release_notes] | ||
mail.puts | ||
mail.puts info[:urls] | ||
end | ||
puts "Created the following as email.txt:" | ||
puts "-" * 72 | ||
puts File.read("email.txt") | ||
puts "-" * 72 | ||
end | ||
|
||
CLOBBER << "email.txt" | ||
end | ||
|
Oops, something went wrong.